diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec4c5c7840..d948fa89ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,8 +42,8 @@ jobs: strategy: matrix: include: - - testnet: nairobinet - testnet_uppercase: NAIROBINET + - testnet: oxfordnet + testnet_uppercase: OXFORDNET steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -62,69 +62,69 @@ jobs: # Ternary operator workaround TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && format('https://{0}.ecadinfra.com', matrix.testnet) || null }} - integration-tests-flextesa: - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - include: - - protocol: Nairobi - testnet: nairobinet - testnet_uppercase: NAIROBINET - flextesa_docker_image: oxheadalpha/flextesa:20230607 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/hydrogen + # integration-tests-flextesa: + # runs-on: ubuntu-latest + # continue-on-error: true + # strategy: + # matrix: + # include: + # - protocol: Oxford + # testnet: oxfordnet + # testnet_uppercase: OXFORDNET + # flextesa_docker_image: oxheadalpha/flextesa:latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-node@v3 + # with: + # node-version: lts/hydrogen - ## The 4 Bootstrap Accounts (alias, pk, pkh, sk) - # alice,edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn,tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb,unencrypted:edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq - # bob,edpkurPsQ8eUApnLUJ9ZPDvu98E8VNj4KtJa1aZr16Cr5ow5VHKnz4,tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6,unencrypted:edsk3RFfvaFaxbHx8BMtEW1rKQcPtDML3LXjNqMNLCzC3wLC1bWbAt - # charlie,edpkuvMuRuZ6ZbAquJH1XxBFfUmuBFz1zp9ENEqjCVgLp3NcY3Ww9M,tz1RDVcKmFcqzvTpJirvg4JaUVgZbjtnRT26,unencrypted:edsk3RgWvbKKA1atEUcaGwivge7QtckHkTL9nQJUXQKY5r8WKp4pF4 - # donald,edpkvXGp1BMZxHkwg3mKnWfJYS6HTJ5JtufD8YXxLtH8UKqLZkZVun,tz1eSWp4B9s1qhtNMMNXAkaf2oqCnDHd2iAm,unencrypted:edsk3S8mG2sSBmSRbikAcZVLCz4SrCq4DjmsQRic6MGktqNFijfrS2 - - name: Generate Flextesa bootstrap accounts - run: |- - echo "alice=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key alice)" >> $GITHUB_ENV - echo "bob=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key bob)" >> $GITHUB_ENV - echo "charlie=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key charlie)" >> $GITHUB_ENV - echo "donald=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key donald)" >> $GITHUB_ENV - - name: Provision Flextesa ${{ matrix.protocol }} container - run: |- - docker run \ - --rm \ - --name my-sandbox \ - --detach \ - -p 20000:20000 \ - ${{ matrix.flextesa_docker_image }} \ - flextesa mini-net \ - --root /tmp/mini-box --size 1 \ - --set-history-mode N000:archive \ - --number-of-b 1 \ - --balance-of-bootstrap-accounts tez:100_000_000 \ - --time-b 1 \ - --add-bootstrap-account="${alice}@2_000_000_000_000" \ - --add-bootstrap-account="${bob}@2_000_000_000_000" \ - --add-bootstrap-account="${charlie}@2_000_000_000_000" \ - --add-bootstrap-account="${donald}@2_000_000_000_000" \ - --no-daemons-for=donald \ - --until-level 200_000_000 \ - --protocol-kind ${{ matrix.protocol }} - - run: npm ci - - run: npm run build - - run: npm -w integration-tests run test:originate-known-contracts && npm -w integration-tests run test:${{ matrix.testnet }}-secret-key -- --testPathIgnorePatterns ledger-signer-failing-tests.spec.ts ledger-signer.spec.ts contract-estimation-tests.spec.ts rpc-get-protocol-constants.spec.ts sandbox-ballot-operation.spec.ts contract-batch-high-number-of-operations.spec.ts contract-pair-as-key.spec.ts --detectOpenHandles --runInBand - env: - RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true - SECRET_KEY: edsk3S8mG2sSBmSRbikAcZVLCz4SrCq4DjmsQRic6MGktqNFijfrS2 - TEZOS_RPC_${{ matrix.testnet_uppercase }}: http://localhost:20000 - POLLING_INTERVAL_MILLISECONDS: 100 - RPC_CACHE_MILLISECONDS: 0 - TEZOS_BAKER: tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb - - run: npm -w integration-tests run test:${{ matrix.testnet }}-secret-key sandbox-ballot-operation.spec.ts - env: - RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true - SECRET_KEY: edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq - TEZOS_RPC_${{ matrix.testnet_uppercase }}: http://localhost:20000 - POLLING_INTERVAL_MILLISECONDS: 100 - RPC_CACHE_MILLISECONDS: 0 - TEZOS_BAKER: tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb + # ## The 4 Bootstrap Accounts (alias, pk, pkh, sk) + # # alice,edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn,tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb,unencrypted:edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq + # # bob,edpkurPsQ8eUApnLUJ9ZPDvu98E8VNj4KtJa1aZr16Cr5ow5VHKnz4,tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6,unencrypted:edsk3RFfvaFaxbHx8BMtEW1rKQcPtDML3LXjNqMNLCzC3wLC1bWbAt + # # charlie,edpkuvMuRuZ6ZbAquJH1XxBFfUmuBFz1zp9ENEqjCVgLp3NcY3Ww9M,tz1RDVcKmFcqzvTpJirvg4JaUVgZbjtnRT26,unencrypted:edsk3RgWvbKKA1atEUcaGwivge7QtckHkTL9nQJUXQKY5r8WKp4pF4 + # # donald,edpkvXGp1BMZxHkwg3mKnWfJYS6HTJ5JtufD8YXxLtH8UKqLZkZVun,tz1eSWp4B9s1qhtNMMNXAkaf2oqCnDHd2iAm,unencrypted:edsk3S8mG2sSBmSRbikAcZVLCz4SrCq4DjmsQRic6MGktqNFijfrS2 + # - name: Generate Flextesa bootstrap accounts + # run: |- + # echo "alice=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key alice)" >> $GITHUB_ENV + # echo "bob=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key bob)" >> $GITHUB_ENV + # echo "charlie=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key charlie)" >> $GITHUB_ENV + # echo "donald=$(docker run --rm ${{ matrix.flextesa_docker_image }} flextesa key donald)" >> $GITHUB_ENV + # - name: Provision Flextesa ${{ matrix.protocol }} container + # run: |- + # docker run \ + # --rm \ + # --name my-sandbox \ + # --detach \ + # -p 20000:20000 \ + # ${{ matrix.flextesa_docker_image }} \ + # flextesa mini-net \ + # --root /tmp/mini-box --size 1 \ + # --set-history-mode N000:archive \ + # --number-of-b 1 \ + # --balance-of-bootstrap-accounts tez:100_000_000 \ + # --time-b 1 \ + # --add-bootstrap-account="${alice}@2_000_000_000_000" \ + # --add-bootstrap-account="${bob}@2_000_000_000_000" \ + # --add-bootstrap-account="${charlie}@2_000_000_000_000" \ + # --add-bootstrap-account="${donald}@2_000_000_000_000" \ + # --no-daemons-for=donald \ + # --until-level 200_000_000 \ + # --protocol-kind ${{ matrix.protocol }} + # - run: npm ci + # - run: npm run build + # - run: npm -w integration-tests run originate-known-contracts && npm -w integration-tests run test:${{ matrix.testnet }}-secret-key -- --testPathIgnorePatterns ledger-signer-failing-tests.spec.ts ledger-signer.spec.ts contract-estimation-tests.spec.ts rpc-get-protocol-constants.spec.ts sandbox-ballot-operation.spec.ts contract-batch-high-number-of-operations.spec.ts contract-pair-as-key.spec.ts --detectOpenHandles --runInBand + # env: + # RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true + # SECRET_KEY: edsk3S8mG2sSBmSRbikAcZVLCz4SrCq4DjmsQRic6MGktqNFijfrS2 + # TEZOS_RPC_${{ matrix.testnet_uppercase }}: http://localhost:20000 + # POLLING_INTERVAL_MILLISECONDS: 100 + # RPC_CACHE_MILLISECONDS: 0 + # TEZOS_BAKER: tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb + # - run: npm -w integration-tests run test:${{ matrix.testnet }}-secret-key sandbox-ballot-operation.spec.ts + # env: + # RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true + # SECRET_KEY: edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq + # TEZOS_RPC_${{ matrix.testnet_uppercase }}: http://localhost:20000 + # POLLING_INTERVAL_MILLISECONDS: 100 + # RPC_CACHE_MILLISECONDS: 0 + # TEZOS_BAKER: tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb diff --git a/apps/taquito-test-dapp/package.json b/apps/taquito-test-dapp/package.json index 022e1e900c..6967283f6a 100644 --- a/apps/taquito-test-dapp/package.json +++ b/apps/taquito-test-dapp/package.json @@ -1,7 +1,7 @@ { "name": "taquito-test-dapp-vite", "private": true, - "version": "17.5.2", + "version": "19.0.0", "type": "module", "scripts": { "dev": "vite", @@ -25,10 +25,10 @@ }, "dependencies": { "@airgap/beacon-sdk": "4.1.0", - "@taquito/beacon-wallet": "^17.5.2", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/beacon-wallet": "^19.0.0", + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "buffer": "^6.0.3", "svelte-select": "^5.7.0", "vite-compatible-readable-stream": "^3.6.1" diff --git a/apps/taquito-test-dapp/src/App.svelte b/apps/taquito-test-dapp/src/App.svelte index 0d8ff2808d..37e3009f9d 100644 --- a/apps/taquito-test-dapp/src/App.svelte +++ b/apps/taquito-test-dapp/src/App.svelte @@ -10,21 +10,13 @@ let layout: Layout; - // https://ide.ligolang.org/p/RL93C86hftTTCNGU0ykLMw | https://ide.ligolang.org/p/61ENTorA4PSfQg-jhpu0jA - // https://better-call.dev/florencenet/KT1PzUGbdKaN332Smfd1ExpdKQ7BSzzJRqJ4/operations - // https://better-call.dev/granadanet/KT1T836HqhBu9waqmknStVDCXu2WogZtzsNz/operations - // https://better-call.dev/hangzhounet/KT1T2gL26SwYMxpkR5SZT1pHRBF84knfw8Cg/operations - // https://better-call.dev/ithacanet/KT1QKmcNBcfzVTXG2kBcE6XqXtEuYYUzMcT5/operations - // https://better-call.dev/mumbainet/KT1Tkm7U3NS9JWgeCGywrRTSQdLZJvDSgD5Z/operations - let browser = ""; let availableNetworks = [ { value: "ghostnet", label: "Ghostnet", group: "current testnets" }, - { value: "mumbainet", label: "Mumbainet", group: "current testnets" }, - { value: "nairobinet", label: "Nairobinet", group: "current testnets" }, + { value: "oxfordnet", label: "Oxfordnet", group: "current testnets" }, { value: "mainnet", label: "Mainnet", group: "mainnet" }, { value: "dailynet", label: "Dailynet", group: "other testnets" }, - { value: "mondaynet", label: "Mondaynet", group: "other testnets" }, + { value: "weeklynet", label: "Weeklynet", group: "other testnets" }, { value: "custom", label: "Custom", group: "custom network" }, ]; let availableMatrixNodes = [ @@ -47,8 +39,8 @@ case "ghostnet": store.updateNetworkType(NetworkType.GHOSTNET); break; - case "nairobinet": - store.updateNetworkType(NetworkType.NAIROBINET); + case "oxfordnet": + store.updateNetworkType(NetworkType.OXFORDNET); break; case "custom": //TODO: input custom RPC URL diff --git a/apps/taquito-test-dapp/src/config.ts b/apps/taquito-test-dapp/src/config.ts index 2f03b66dbb..d16262d370 100644 --- a/apps/taquito-test-dapp/src/config.ts +++ b/apps/taquito-test-dapp/src/config.ts @@ -1,12 +1,12 @@ import { NetworkType } from "@airgap/beacon-sdk"; -export type SupportedNetworks = NetworkType.NAIROBINET | NetworkType.GHOSTNET | NetworkType.MAINNET | NetworkType.CUSTOM; +export type SupportedNetworks = NetworkType.OXFORDNET | NetworkType.GHOSTNET | NetworkType.MAINNET | NetworkType.CUSTOM; const rpcUrls: Record = { [NetworkType.MAINNET]: "https://mainnet.ecadinfra.com", [NetworkType.GHOSTNET]: "https://ghostnet.ecadinfra.com/", - [NetworkType.NAIROBINET]: "https://nairobinet.ecadinfra.com/", - // [NetworkType.CUSTOM]: "https://ghostnet.ecadinfra.com/", + [NetworkType.OXFORDNET]: "https://oxfordnet.ecadinfra.com/", + [NetworkType.CUSTOM]: "https://ghostnet.ecadinfra.com/", }; export const getRpcUrl = (networkType: SupportedNetworks): string => { @@ -19,8 +19,8 @@ export const getTzKtUrl = (networkType: SupportedNetworks): string | undefined = return "https://tzkt.io"; case NetworkType.GHOSTNET: return "https://ghostnet.tzkt.io"; - case NetworkType.NAIROBINET: - return "https://nairobinet.tzkt.io"; + case NetworkType.OXFORDNET: + return "https://oxfordnet.tzkt.io"; case NetworkType.CUSTOM: return undefined; } @@ -34,5 +34,5 @@ export const defaultNetworkType = NetworkType.GHOSTNET; export const contractAddress = { mainnet: "KT1ShtH2zCrKMuWGRejEd6RAcnePwxBQeMAN", ghostnet: "KT1QKmcNBcfzVTXG2kBcE6XqXtEuYYUzMcT5", - nairobinet: "KT1WoyF3wpUGRm6fbmmm1qKmpfneq1iijMT8" + oxfordnet: "KT1GYx1KDhMQt2GJEztRh8EyYxJUPM6fnAMM", }; diff --git a/cspell.json b/cspell.json index acb37e860c..eed4d8abf3 100644 --- a/cspell.json +++ b/cspell.json @@ -67,15 +67,22 @@ "octez", "opkind", "originations", + "oxfordbox", + "oxfordnet", "oxheadalpha", "Pkhfrom", + "preattestation", "precommit", + "preendorsement", + "preendorsements", "prevalidated", "prevalidation", "println", "Protofire", + "ProxfordY", "PtNairobi", "refetched", + "riscv", "rollups", "Roxane", "SAPLINGCONTRACT", @@ -94,6 +101,7 @@ "taquito", "tcli", "testbox", + "testchain", "tezbridge", "tezos", "Thanos", @@ -109,6 +117,7 @@ "Unparsing", "vals", "walletbeacon", + "weeklynet", "ZARITH" ], "files": [ diff --git a/docs/complex_parameters.md b/docs/complex_parameters.md index a85f187f87..b303d04a4f 100644 --- a/docs/complex_parameters.md +++ b/docs/complex_parameters.md @@ -43,7 +43,7 @@ storage (pair (map %validators nat address)); ``` -In this example, we originate the contract with initial values in the storage. We use the `MichelsonMap` class' of Taquito to initialize [the maps and the bigMap](https://tezostaquito.io/docs/maps_bigmaps). +In this example, we originate the contract with initial values in the storage. We use the `MichelsonMap` class' of Taquito to initialize [the maps and the bigMap](https://tezostaquito.io/docs/maps_bigmaps). As described above, the `map %data` uses a value that we chose between different types. When using Taquito, we need to surround the chosen argument with curly braces. In the current example, we initialize the value in the `map %data` to the boolean true: `{ bool: true }`. @@ -59,7 +59,7 @@ const dataMap = new MichelsonMap(); //key is a string, we choose a boolean for the value dataMap.set('Hello', { bool : true }) -//%records +//%records const recordsBigMap = new MichelsonMap(); recordsBigMap.set( 'FFFF', //key of the bigMap %records is in bytes @@ -89,7 +89,7 @@ importKey(Tezos, secretKey) code : contractJson, storage : { owner : 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address - records: recordsBigMap, + records: recordsBigMap, validators : validatorsMap }}) }).then((contractOriginated) => { @@ -102,7 +102,7 @@ importKey(Tezos, secretKey) ## Calling the function of a contract having a complex object as a parameter -The contract contains a function named `set_child_record`. The parameter of the function is composed of nested pairs regrouping different datatypes (address, `map`, `bytes` and `nat`). Two of its arguments, the `address %address` and the `nat %ttl`, are optional. The `map %data` uses a `string` as its key. The user needs to choose the value of the `map` between different proposed types. +The contract contains a function named `set_child_record`. The parameter of the function is composed of nested pairs regrouping different datatypes (address, `map`, `bytes` and `nat`). Two of its arguments, the `address %address` and the `nat %ttl`, are optional. The `map %data` uses a `string` as its key. The user needs to choose the value of the `map` between different proposed types. Here is the parameter of the function defined in Michelson : @@ -138,7 +138,7 @@ importKey(Tezos, secretKey) }).then(myContract => { const dataMap = new MichelsonMap(); dataMap.set("Hello World", { bool : true }) - let inspect = myContract.methods.set_child_record('tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', dataMap, 'EEEE', 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', 'FFFF', '10').toTransferParams(); + let inspect = myContract.methods.set_child_record('tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', dataMap, 'EEEE', 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', 'FFFF', '10').toTransferParams(); println(JSON.stringify(inspect, null, 2)) }).catch(error => println(`Error: ${JSON.stringify(error, null, 2)}`)); ``` @@ -156,7 +156,7 @@ importKey(Tezos, secretKey) }).then(myContract => { const dataMap = new MichelsonMap(); dataMap.set("Hello World", { bool : true }) - + return myContract.methods.set_child_record( 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address(optional) dataMap, //data @@ -164,7 +164,7 @@ importKey(Tezos, secretKey) 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //owner 'FFFF', //parent '10' //ttl(optional) - ).send(); + ).send(); }).then(op => { println(`Waiting for ${op.hash} to be confirmed...`); return op.confirmation(1).then(() => op.hash); @@ -178,7 +178,7 @@ The `address %address` and the `nat %ttl` of the `set_child_record` function are ```js live noInline // import { TezosToolkit, MichelsonMap } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com') +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com') // import { importKey } from '@taquito/signer'; importKey(Tezos, secretKey) @@ -187,7 +187,7 @@ importKey(Tezos, secretKey) }).then(myContract => { const dataMap = new MichelsonMap(); dataMap.set("Hello World", { nat : '3' }) - + return myContract.methods.set_child_record( null, //address(optional) dataMap, //data @@ -195,7 +195,7 @@ importKey(Tezos, secretKey) 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //owner 'FFFF', //parent undefined //ttl(optional) - ).send(); + ).send(); }).then(op => { println(`Waiting for ${op.hash} to be confirmed...`); return op.confirmation(1).then(() => op.hash); diff --git a/docs/consensus_key.md b/docs/consensus_key.md index 7b9b84b478..bda600b95d 100644 --- a/docs/consensus_key.md +++ b/docs/consensus_key.md @@ -3,7 +3,7 @@ title: Consensus Keys author: Davis Sawali & Hui-An Yang --- -The "consensus key" feature allows bakers to use a different key, called the consensus key. It will allow for baking and signing consensus operations (i.e. pre-endorsements and endorsements). For more detailed information on consensus keys, refer to [this documentation](https://tezos.gitlab.io/protocols/015_lima.html?highlight=update%20consensus%20key#consensus-key) +The "consensus key" feature allows bakers to use a different key, called the consensus key. It will allow for baking and signing consensus operations (i.e. preattestation/preendorsements and attestation/endorsements). For more detailed information on consensus keys, refer to [this documentation](https://tezos.gitlab.io/protocols/015_lima.html?highlight=update%20consensus%20key#consensus-key) Starting from Lima protocol, these 2 new operations will be available: diff --git a/docs/drain_account.md b/docs/drain_account.md index 92000886cb..e56c015f39 100644 --- a/docs/drain_account.md +++ b/docs/drain_account.md @@ -22,7 +22,7 @@ In the following example, we have not revealed the account that we want to empty ::: ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // import { DEFAULT_FEE } from "@taquito/taquito"; Tezos.signer @@ -87,7 +87,7 @@ The contract we originate is a `manager contract.` It has a `do` method taking a In the example, we estimate the transfer operation before doing it. The associated fees are deducted from the manager's address when draining the account. Thus, for the operation to be successful, the manager's address for that account must contain funds to cover the gas. ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); function transferImplicit(key, mutez) { return [ diff --git a/docs/events.md b/docs/events.md index 40938fb861..517e1a3275 100644 --- a/docs/events.md +++ b/docs/events.md @@ -7,9 +7,9 @@ author: Davis Sawali # Contract Events ## Introduction -Contract events is a way for contracts to deliver event-like information to third-party (off-chain) applications. It can be emitted by using the EMIT instruction in Michelson. +Contract events is a way for contracts to deliver event-like information to third-party (off-chain) applications. It can be emitted by using the EMIT instruction in Michelson. -For more details and examples of how the EMIT instruction works, refer to [this article](https://tezos.gitlab.io/kathmandu/event.html). +For more details and examples of how the EMIT instruction works, refer to [this article](https://tezos.gitlab.io/active/event.html). ## Getting contract events in Taquito You can get the events in a contract through the `eventSchema` field of the `ContractAbstraction`. @@ -58,8 +58,8 @@ const Tezos = new TezosToolkit(RPC_URL); Tezos.setStreamProvider( Tezos.getFactory(PollingSubscribeProvider)({ - shouldObservableSubscriptionRetry: true, - pollingIntervalMilliseconds: 1500 + shouldObservableSubscriptionRetry: true, + pollingIntervalMilliseconds: 1500 }) ); @@ -69,9 +69,9 @@ try { address: 'KT1_CONTRACT_ADDRESS', excludeFailedOperations: true }); - + sub.on('data', console.log); - + } catch (e) { console.log(e); } @@ -79,7 +79,7 @@ try { - `tag` is the tag string that was defined in the smart contract with the EMIT instruction -- `address` is the address of the smart contract that was called +- `address` is the address of the smart contract that was called - `excludeFailedOperations`: In rare cases, events from failed operations can be received by the subscriber. You can use this field to filter out these events (if you pass `true` to this field, only events from successful operations will be received) :::info diff --git a/docs/inmemory_signer.md b/docs/inmemory_signer.md index bb720c37e8..503b949641 100644 --- a/docs/inmemory_signer.md +++ b/docs/inmemory_signer.md @@ -41,7 +41,7 @@ The `fromSecretKey` method takes a secret that is base58 encoded as a parameter. ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey('edsk2rKA8YEExg9Zo2qNPiQnnYheF1DhqjLVmfKdxiFfu5GyGRZRnb') .then((theSigner) => { @@ -58,7 +58,7 @@ InMemorySigner.fromSecretKey('edsk2rKA8YEExg9Zo2qNPiQnnYheF1DhqjLVmfKdxiFfu5GyGR ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey('spsk2Fiz7sGP5fNMJrokp6ynTa4bcFbsRhw58FHXbNf5ProDNFJ5Xq') .then((theSigner) => { @@ -78,7 +78,7 @@ When required, Taquito offers the `b58cencode` function allowing to encode the s // import { b58cencode, prefix, Prefix } from '@taquito/utils'; // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); const b58encodedSecret = b58cencode( '7c842c15c8b0c8fd228e6cb5302a50201f41642dd36b699003fb3c857920bc9d', @@ -119,7 +119,7 @@ Here are three examples with encrypted private keys where the passphrase used is ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey( 'edesk1GXwWmGjXiLHBKxGBxwmNvG21vKBh6FBxc4CyJ8adQQE2avP5vBB57ZUZ93Anm7i4k8RmsHaPzVAvpnHkFF', @@ -139,7 +139,7 @@ InMemorySigner.fromSecretKey( ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey( 'spesk24UQkAiJk8X6AufNtRv1WWPp2BAssEgmijCTQPMgUXweSKPmLdbyAjPmCG1pR2dC9P5UZZVeZcb7zVodUHZ', @@ -159,7 +159,7 @@ InMemorySigner.fromSecretKey( ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey( 'p2esk28hoUE2J88QNFj2aDX2pjzL7wcVh2g8tkEwtWWguby9M3FHUgSbzvF2Sd7wQ4Kd8crFwvto6gF3otcBuo4T', @@ -188,7 +188,7 @@ With ed25519 default derivation path (Reminder Must be hardened with either h or ```js live noInline // import { TezosToolkit } from '@taquito/taquito // import { InMemorySigner } from '@taquito/signer' - // const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); + // const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // ed25519 must have all hardened paths @@ -212,7 +212,7 @@ With a non-default derivation path non-hardened with a tz2 address ```js live noInline // import { TezosToolkit } from '@taquito/taquito // import { InMemorySigner } from '@taquito/signer' - // const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); + // const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); const params = { mnemonic: 'author crumble medal dose ribbon permit ankle sport final hood shadow vessel horn hawk enter zebra prefer devote captain during fly found despair business', @@ -253,7 +253,7 @@ const signerFactory = async (rpcUrl: string, pk: string) => { }; const bob = await signerFactory('bobs_secret_key'); -const alice = await signerFactory('alices_secret_key'); +const alice = await signerFactory('alice_secret_key'); ``` [0]: https://signatory.io diff --git a/docs/ledger_signer.md b/docs/ledger_signer.md index c5d0f6c4de..9a5dff3274 100644 --- a/docs/ledger_signer.md +++ b/docs/ledger_signer.md @@ -57,12 +57,12 @@ const ledgerSigner = new LedgerSigner(transport); The constructor of the `LedgerSigner` class can take three other parameters. If none are specified, the default values are used. -- path: **default value is "44'/1729'/0'/0'"** - You can use as a parameter the `HDPathTemplate` which refers to `44'/1729'/${account}'/0'`. You have to specify what is the index of the account you want to use. Or you can also use a complete path as a parameter. +- path: **default value is "44'/1729'/0'/0'"** + You can use as a parameter the `HDPathTemplate` which refers to `44'/1729'/${account}'/0'`. You have to specify what is the index of the account you want to use. Or you can also use a complete path as a parameter. _More details about paths below_ -- prompt: **default is true** +- prompt: **default is true** If true, you will be asked on your Ledger device to send your public key for validation. -- derivationType: **default is DerivationType.ED25519** +- derivationType: **default is DerivationType.ED25519** It can be DerivationType.ED25519 | DerivationType.BIP32_ED25519 (tz1), DerivationType.SECP256K1 (tz2) or DerivationType.P256 (tz3). ```js @@ -116,7 +116,7 @@ Tezos.contract console.log(`Waiting for ${op.hash} to be confirmed...`); return op.confirmation(1).then(() => op.hash); }) - .then((hash) => console.log(`Operation injected: https://jakarta.tzstats.com/${hash}`)) + .then((hash) => console.log(`Operation injected: https://ghost.tzstats.com/${hash}`)) .catch((error) => console.log(`Error: ${error} ${JSON.stringify(error, null, 2)}`)); ``` @@ -135,7 +135,7 @@ Tezos.wallet console.log(`Waiting for ${op.opHash} to be confirmed...`); return op.confirmation(1).then(() => op.opHash); }) - .then((hash) => console.log(`Operation injected: https://jakarta.tzstats.com/${hash}`)) + .then((hash) => console.log(`Operation injected: https://ghost.tzstats.com/${hash}`)) .catch((error) => console.log(`Error: ${error} ${JSON.stringify(error, null, 2)}`)); ``` @@ -162,7 +162,7 @@ Where `purpose` is a constant set to `44'` and `coin_type` is set to `1729'` for The path always begins with `44'/1729'` and we see some difference for the three other indexes across the Tezos ecosystem. We can notice that changing any number for the three last indexes of the path (`account' / change / address_index`) will lead to different accounts. **But, to ensure consistency, it is important trying to follow the same convention regarding the structure of the path and which index to increase to access the next address.** In Tezos, we generally see a slight difference in the path compared to the BIP44 specification. It is common to see path made of 4 indexes instead of 5 (default path being `44'/1729'/0'/0'` instead of `44'/1729'/0'/0'/0'`). For example, the default path used by tezos-client is `44'/1729'/0'/0'`. -Based on what is done by the Tezos-client, the default path used by Taquito in the `LedgerSigner` is also `44'/1729'/0'/0'`. Taquito offers a template for the path called `HDPathTemplate`. This template uses four indexes and suggests doing the iteration on the `account` index. +Based on what is done by the Tezos-client, the default path used by Taquito in the `LedgerSigner` is also `44'/1729'/0'/0'`. Taquito offers a template for the path called `HDPathTemplate`. This template uses four indexes and suggests doing the iteration on the `account` index. For example, you can use HDPathTemplate(0) (equivalent to `44'/1729'/0'/0'`) to access the first address, HDPathTemplate(1) equivalent to `44'/1729'/1'/0'`) to access the second address, HDPathTemplate(2) (equivalent to `44'/1729'/2'/0'`) to access the third address... _In order to meet the needs of each user, this template is not imposed by Taquito_. We can see other implementations that use `44'/1729'/0'/0'/0'`, where the next address is accessed by incrementing `account` or `address_index`. @@ -192,14 +192,14 @@ https://medium.com/mycrypto/wtf-is-a-derivation-path-c3493ca2eb52 ## Live example that iterates from the path `44'/1729'/0'/0'` to `44'/1729'/9'/0'` -Having your Ledger device connected to your computer and the `Tezos Wallet App` opened, you can run the following code example. It will scan your Ledger from path `44'/1729'/0'/0'` to `44'/1729'/9'/0'` to get public key hashes and the balance for revealed accounts. Confirmations will be asked on your Ledger to send the public keys. +Having your Ledger device connected to your computer and the `Tezos Wallet App` opened, you can run the following code example. It will scan your Ledger from path `44'/1729'/0'/0'` to `44'/1729'/9'/0'` to get public key hashes and the balance for revealed accounts. Confirmations will be asked on your Ledger to send the public keys. _Note that this example is not intended to be a complete example of paths scanning but only a rough outline of what it is possible to do._ ```js live noInline //import { LedgerSigner, DerivationType, HDPathTemplate } from '@taquito/ledger-signer'; //import { TezosToolkit } from '@taquito/taquito'; // import TransportWebHID from "@ledgerhq/hw-transport-webhid"; -//const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +//const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); TransportWebHID.create().then((transport) => { for (let index = 0, p = Promise.resolve(); index < 10; index++) { diff --git a/docs/originate.md b/docs/originate.md index f13a942b41..eebab219a3 100644 --- a/docs/originate.md +++ b/docs/originate.md @@ -35,7 +35,7 @@ This requires a signer to be configured, ie: ``` import { importKey } from '@taquito/signer'; import { TezosToolkit } from '@taquito/taquito'; -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); importKey(Tezos, "p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1") ``` @@ -45,8 +45,8 @@ importKey(Tezos, "p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1") ``` import { BeaconWallet } from '@taquito/beacon-wallet'; import { TezosToolkit } from '@taquito/taquito'; -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); -const option = { name: "nameOfWallet", network: { type: 'jakartanet' }} +const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); +const option = { name: "nameOfWallet", network: { type: 'ghostnet' }} const wallet = new BeaconWallet(option) await wallet.requestPermissions() Tezos.setWalletProvider(wallet) @@ -67,7 +67,7 @@ This JavaScript object : keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'] } ``` -Is equivilent to this Michelson expression : +Is equivalent to this Michelson expression : ``` (Pair 0 (Pair 1 { "edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t" })) @@ -85,7 +85,7 @@ values={[ ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -114,7 +114,7 @@ Tezos.contract ```js live noInline wallet // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -156,7 +156,7 @@ values={[ ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -181,7 +181,7 @@ Tezos.contract ```js live noInline wallet // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -217,7 +217,7 @@ values={[ ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -254,7 +254,7 @@ Tezos.contract ```js live noInline wallet // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation diff --git a/docs/rpc_nodes.md b/docs/rpc_nodes.md index 764fca96ce..6ce4048300 100644 --- a/docs/rpc_nodes.md +++ b/docs/rpc_nodes.md @@ -25,21 +25,19 @@ values={[ |------------------|--------------|------------------------------------------|---------------------------------------------------------------------------------| | ECAD Labs | Mainnet | https://mainnet.ecadinfra.com | [Check](https://mainnet.ecadinfra.com/chains/main/blocks/head/header) | | ECAD Labs | Ghostnet | https://ghostnet.ecadinfra.com | [Check](https://ghostnet.ecadinfra.com/chains/main/blocks/head/header) | -| ECAD Labs | Nairobinet | https://nairobinet.ecadinfra.com | [Check](https://nairobinet.ecadinfra.com/chains/main/blocks/head/header) | -| ECAD Labs | Mumbainet | https://mumbainet.ecadinfra.com | [Check](https://mumbainet.ecadinfra.com/chains/main/blocks/head/header) | +| ECAD Labs | Oxfordnet | https://oxfordnet.ecadinfra.com | [Check](https://oxfordnet.ecadinfra.com/chains/main/blocks/head/header) | | 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) | | 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 | Nairobinet | https://nairobinet.tezos.marigold.dev/ | [Check](https://nairobinet.tezos.marigold.dev/chains/main/blocks/head/header) | -| Marigold | Mumbainet | https://mumbainet.tezos.marigold.dev/ | [Check](https://mumbainet.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) | *If you are aware of a public node missing from our list or our information is inaccurate, please help us by submitting an issue or pull request on our GitHub page.* -| Provider | Details | +| Provider | Details | |------------------|---------------------------------------------| | TzPro | https://tzpro.io/ | | MIDL.dev | https://midl.dev/tezos-rpc/ | diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index d9bf64803d..97e1c8d17b 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -5,77 +5,109 @@ author: Roxane Letourneau ## Steps to run the tests -1. The RPC nodes' integration tests are disabled by default. +1. The RPC nodes' integration tests are disabled by default. Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json. - **nairobinet**: `npm run test:nairobinet rpc-nodes.spec.ts` + **oxfordnet**: `npm run test:oxfordnet rpc-nodes.spec.ts` **When all endpoints are accessible for a node, you will obtain:** ``` Test calling all methods from RPC node: https://a-node - ✓ Get the head block hash (1376 ms) - ✓ List the ancestors of the head block (1010 ms) - ✓ Access the balance of an address (1024 ms) - ✓ Access the data of a contract (1022 ms) - ✓ Access the code and data of a contract (1096 ms) - ✓ Access the complete status of a contract (1057 ms) - ✓ Access the manager key of a contract (1023 ms) - ✓ Access the delegate of a contract (1023 ms) - ✓ Access the value associated with a key in a big map (3927 ms) - ✓ Fetches information about a delegate from RPC (1590 ms) - ✓ Get all constants from RPC (938 ms) - ✓ Get all the information about a block (1021 ms) - ✓ Get the whole block header (1125 ms) - ✓ Get all the metadata associated to the block (918 ms) - ✓ Retrieves the list of delegates allowed to bake a block (912 ms) - ✓ Retrieves the list of delegates allowed to endorse a block (971 ms) - ✓ Get ballots casted so far during a voting period (1059 ms) - ✓ Get sum of ballots casted so far during a voting period (904 ms) - ✓ Get current period kind (907 ms) - ✓ Get current proposal under evaluation (986 ms) - ✓ Get current expected quorum (920 ms) - ✓ List of delegates with their voting weight, in number of rolls (923 ms) - ✓ List of proposals with number of supporters (1023 ms) - ✓ Forge an operation returning the unsigned bytes (1026 ms) - ✓ Inject an operation in node and broadcast it (1127 ms) - ✓ Simulate the validation of an operation (1022 ms) - ✓ Get the list of entrypoints of the contract (1023 ms) - ✓ Get chain ID (896 ms) - ✓ Run an operation without signature checks (948 ms) + ✓ Verify that rpcClient.getBlockHash returns the head block hash (19 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (21 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (14 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (12 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (17 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (15 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (15 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (11 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (21 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (1090 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (16 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (1020 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (18 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (24 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (15 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (17 ms) + ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (14 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (25 ms) + ✓ Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block (19 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (10 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (39 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (11 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (11 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (13 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (10 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (11 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (2019 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (11 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (75 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (13 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (10 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (15 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (12 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (29 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (25 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (12 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (25 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (10 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (11 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (12 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (12 ms) + ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (10 ms) + ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (12 ms) + ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (250 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (683 ms) ``` -**Otherwise, you will see which endpoints do not work for a specific node:** +**Otherwise, you will see which endpoints do not work for a specific node:** ``` Test calling all methods from RPC node: https://another-node - ✓ Get the head block hash (888 ms) - ✓ List the ancestors of the head block (782 ms) - ✓ Access the balance of an address (779 ms) - ✓ Access the data of a contract (636 ms) - ✓ Access the code and data of a contract (801 ms) - ✓ Access the complete status of a contract (638 ms) - ✓ Access the manager key of a contract (771 ms) - ✓ Access the delegate of a contract (682 ms) - ✓ Access the value associated with a key in a big map (4200 ms) - ✓ Fetches information about a delegate from RPC (739 ms) - ✓ Get all constants from RPC (633 ms) - ✓ Get all the information about a block (673 ms) - ✓ Get the whole block header (648 ms) - ✓ Get all the metadata associated to the block (646 ms) - ✓ Retrieves the list of delegates allowed to bake a block (814 ms) - ✓ Retrieves the list of delegates allowed to endorse a block (649 ms) - ✕ Get ballots casted so far during a voting period (634 ms) - ✕ Get sum of ballots casted so far during a voting period (707 ms) - ✕ Get current period kind (766 ms) - ✕ Get current proposal under evaluation (654 ms) - ✕ Get current expected quorum (639 ms) - ✕ List of delegates with their voting weight, in number of rolls (630 ms) - ✕ List of proposals with number of supporters (699 ms) - ✓ Forge an operation returning the unsigned bytes (641 ms) - ✓ Inject an operation in node and broadcast it (655 ms) - ✓ Simulate the validation of an operation (653 ms) - ✓ Get the list of entrypoints of the contract (625 ms) - ✓ Get chain ID (636 ms) - ✓ Run an operation without signature checks (626 ms) + ✓ Verify that rpcClient.getBlockHash returns the head block hash (486 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (650 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (616 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (534 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (591 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (680 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (605 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (553 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (613 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (3074 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (674 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (612 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (513 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (549 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (516 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (1472 ms) + ✕ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (479 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (1487 ms) + ✕ Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block (539 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (615 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (1670 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (487 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (471 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (462 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (590 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (631 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (600 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (654 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (1585 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (771 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (671 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (614 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (1330 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (1149 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (1111 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (478 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (995 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (665 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (511 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (616 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (488 ms) + ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (486 ms) + ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (561 ms) + ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (1298 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (1060 ms) ``` \ No newline at end of file diff --git a/docs/rpc_package.md b/docs/rpc_package.md index ef7fca632d..3b7ee3109b 100644 --- a/docs/rpc_package.md +++ b/docs/rpc_package.md @@ -18,7 +18,7 @@ Methods in the RPC package map one-to-one to the corresponding Tezos RPC API end import { RpcClient } from '@taquito/rpc'; -const client = new RpcClient(' https://jakartanet.ecadinfra.com/', 'NetXLH1uAxK7CCh'); +const client = new RpcClient(' https://ghostnet.ecadinfra.com/', 'NetXLH1uAxK7CCh'); ``` The `RpcClient` constructor takes the URL of the node you want to use and the chain ID. @@ -96,7 +96,7 @@ const packedData = await client.packData({ data: { string: 'test' }, type: { pri console.log('-- Packed data:', packedData); ``` -You can simulate the `PACK` instruction from Michelson with the `packData` method. +You can simulate the `PACK` instruction from Michelson with the `packData` method. This function will execute Tzip4 views normally referred to as 'Lambda Views'. You can learn more about Tzip4 [here](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints) ```js @@ -111,17 +111,6 @@ const view = await client.runView({ }); ``` -You can obtain the `Origination Proof` for the `smart_rollup_originate` batch operation (not needed for the `smart_rollup_originate` alone) - -This function will obtain the proof needed for the `smart_rollup_originate` batch method -```js -const originationProof = await client.getOriginationProof({ - kernel: 'your kernel', - kind: 'PVM kind' -}) -``` - - ## Full documentation You can find the full documentation at the following address: [https://tezostaquito.io/typedoc/classes/\_taquito_rpc.rpcclient.html](https://tezostaquito.io/typedoc/classes/_taquito_rpc.rpcclient.html) diff --git a/docs/smart_rollups.md b/docs/smart_rollups.md index efb75fd3dd..1a8e990556 100644 --- a/docs/smart_rollups.md +++ b/docs/smart_rollups.md @@ -1,13 +1,13 @@ --- title: Smart Rollups -author: Davis Sawali +author: Davis Sawali --- # Smart Optimistic Rollups Rollups are a permissionless scaling implementation for the Tezos blockchain. The idea is that anyone can originate and operate one or more rollups, increasing the overall throughput of the Tezos blockchain. -In Taquito, we have implemented some of the operations included in Mumbai protocol update in regards to smart rollups. In this document, we will go through the operations we support. We also won't go too detailed on how rollups work behind the scenes, if you'd like to understand the feature a bit deeper, you can refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html). +In Taquito, we have implemented some of the operations included in Mumbai protocol update in regards to smart rollups. In this document, we will go through the operations we support. We also won't go too detailed on how rollups work behind the scenes, if you'd like to understand the feature a bit deeper, you can refer to [this document](https://tezos.gitlab.io/active/smart_rollups.html). ## `smart_rollup_originate` @@ -27,11 +27,10 @@ await op.confirmation(); ##### please note - `pvmKind` at this time the only PVM supported is `wasm_2_0_0` -- `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) -- `parametersType` is a MichelsonV1Expression to define the type. -- **Please note** `originationProof` is needed origination in `batch` which can be obtained with the `rpc.getOriginationProof({kernel, kind: PVMKind})` +- `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/active/smart_rollups.html) +- `parametersType` is a MichelsonV1Expression to define the type. -For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) +For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/active/smart_rollups.html#origination) ## `smart_rollup_add_messages` @@ -43,15 +42,15 @@ The main use case of sending messages, is usually to denote contract calls. Thes MESSAGE='[{\ "destination" : "${CONTRACT}", \ "parameters" : "\"Hello world\"", \ - "entrypoint" : "default" + "entrypoint" : "default" }]' -``` +``` If you read closely, the message includes a `destination`, a `parameter`, and an `entrypoint` property. All components needed to **call an entrypoint** of a contract. These messages can then be claimed back into L1 as a legitimate contract call using the `smart_rollup_execute_outbox_message` operation which we will go over in another section of this doc. -for more information, refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html#sending-an-external-inbox-message) +for more information, refer to [this document](https://tezos.gitlab.io/active/smart_rollups.html#external-messages) ### Example ```typescript @@ -64,4 +63,4 @@ const op = await Tezos.contract.smartRollupAddMessages({ await op.confirmation(); ``` -- `message` property receives an array of encoded outbox messages. For more information on how to encode or what message gets encoded, refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html#sending-an-external-inbox-message) +- `message` property receives an array of encoded outbox messages. For more information on how to encode or what message gets encoded \ No newline at end of file diff --git a/docs/storage_annotations.md b/docs/storage_annotations.md index 6763d67634..998103c9ac 100644 --- a/docs/storage_annotations.md +++ b/docs/storage_annotations.md @@ -36,7 +36,7 @@ values={[ ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.contract .originate({ @@ -62,7 +62,7 @@ Tezos.contract ```js live noInline wallet -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.wallet .originate({ @@ -84,7 +84,7 @@ Tezos.wallet println(`Origination completed.`); }) .catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); -``` +``` @@ -111,7 +111,7 @@ values={[ ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.contract .originate({ @@ -137,7 +137,7 @@ Tezos.contract ```js live noInline wallet -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.wallet .originate({ @@ -159,7 +159,7 @@ Tezos.wallet println(`Origination completed.`); }) .catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); -``` +``` @@ -188,7 +188,7 @@ values={[ ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.contract .originate({ @@ -215,7 +215,7 @@ Tezos.contract ```js live noInline wallet -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.wallet .originate({ @@ -237,6 +237,6 @@ Tezos.wallet println(`Origination completed.`); }) .catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); -``` +``` \ No newline at end of file diff --git a/docs/testing_strategies.md b/docs/testing_strategies.md index a4d1ac6249..c9149b19a0 100644 --- a/docs/testing_strategies.md +++ b/docs/testing_strategies.md @@ -3,24 +3,24 @@ title: Taquito Testing Strategies id: testing_strategies author: Michael Kernaghan --- - + ### How Taquito is Tested - + #### General Philosophy - + We write and maintain tests so that we may check that the software we create will do what we think it should do and alert us when it doesn’t. This link offers more detail on software testing philosophy in general: https://www.codesimplicity.com/post/the-philosophy-of-testing/. - + #### Assumptions - + Taquito is a library. It offers tools. To test that Taquito is suitable for use, we must ensure that each tool the library provides does what it is supposed to. We also need to check that changes to support new features have not broken old features. - + We use the following Test Heuristics to achieve these assurance goals. Taquito uses several of these in the CI/CD pipeline. - + ### Unit Tests - + Unit Tests are detailed tests of simple software components at the atomic level. Taquito includes unit tests in each of its packages. Here is an example: - + ```javascript it('Public key returned by ledger device should be compressed adequately for tz1 before b58 encoding', () => { const buff = Buffer.from( @@ -34,15 +34,15 @@ Unit Tests are detailed tests of simple software components at the atomic level. ); }); ``` - + Sometimes a Unit Test will use a Mock to simulate interactions between the software and some external component. We measure how comprehensive our unit test coverage is by running "test code coverage tools" that report on the lines of code that are not touched when running unit tests. We can verify that unit tests are effecctive with "mutation testing" described below. - + ### Integration Tests Integration Tests look to ensure that multiple software components are working together. These components might be created by different teams or run on separate machines. The integration of various components can make these tests susceptible to random failures, but they will be rerun until they pass. Taquito testing routinely runs hundreds of integration tests daily. - + Here is a simple example of an integration test. The test sends Taquito instructions to a live test node with the transactions processed on the blockchain. This test originates a contract on the chain with transfers and verifies that confirmation is received. - + ```javascript it('Simple transfers with origination', async () => { const batch = await Tezos.batch() @@ -54,31 +54,31 @@ Here is a simple example of an integration test. The test sends Taquito instruct code: ligoSample, storage: 0, }) - + const op = await batch.send(); await op.confirmation(); expect(op.status).toEqual('applied') }) ``` - + ### Code Reviews - + We do Code Reviews whenever a developer seeks to merge code. Other team members review it for correctness, accuracy, conformance with Taquito design overall, and suitability. This process will rapidly find problems that testing would either miss or take wasteful cycles to resolve. We will not merge code changes or new features unless they have been code reviewed and all requested changes are determined. - + ### Static Code Analysis - + Static Code Analysis is run during the CICD cycle to do syntactic checks for errors in the code. Often a line marking a merge conflict or a violation of a coding format will cause a static analyzer to complain. During a CICD run, a Pull Request will be examined by [CodeQL](https://codeql.github.com/) and [Snyk](https://snyk.io/). - + ### End-to-End Tests - + Taquito uses the Taquito Test Dapp and the Live Code examples in the documentation as end-to-end tests. The tests exercise the entire software stack between the blockchain node and the user-facing interface. These tests show that all the components are working together. At each Taquito release, these tests are checked, and the results are included in the release. - + ### Mutation Tests - + Mutation testing is a way to verify the effectiveness of unit tests. In addition to the code coverage of unit tests, we can check that the tests are resilient against all sorts of code changes. We all understand the intuition that if you change some code and no test fails, then the tests are missing something. Mutation testing tools allow us to implement this intuition and find missed test cases, confusing tests, missing assertions, etc. Taquito has been using Stryker to identify test mutations and systematically remove them from the code base. For details on how mutation testing works, please see: https://stryker-mutator.io/docs/. - + ### Manual Tests - + When a user raises an issue, Testers will verify the problem using manual methods. For Taquito, such testing could be: a quick Taquito script, checking a result with tezos-client, @@ -87,23 +87,23 @@ rerunning scripts with variations each time, or other exploratory activities around the code base that are not fully scripted tests in the CICD. Ledger Devices require manual testing as they have buttons that an operator must press to authorize signatures and transactions. There are emulators for Ledger Devices, but Taquito testing of ledger devices combines manual and scripted exploratory testing. - + ### Security Tests - + Taquito has implemented some security tests in its integration test suite. These tests check for regressions in the Tezos code that could open known attack techniques. The tests verify that a particular attack is impossible and that appropriate error messaging and exceptions occur when the tests try some well-known attacks. - + ### Performance - + Ecad DevOps maintains an extensive performance tracking monitoring setup using Loki and Grafana, which generates alerts when specific performance parameters are out of band. - + ## Managing Tezos Protocol Migrations with Test Nets - + Each time Tezos changes protocol, there is a new test net, and old ones are deprecated. Contracts originated in a more senior test net must be originated again on the new testnet. We have to update RPC content values and recreate Live Code Example contracts. So each protocol change requires an overhaul of some of the test assets to suit the new protocol. - -The Taquito test suite will run tests in CICD against the current and next test net. There is also testing of “Mondaynet,” which represents the bleeding edge of the available Tezos test code. - + +The Taquito test suite will run tests in CICD against the current and next test net. There is also testing of “Weeklynet,” which represents the bleeding edge of the available Tezos test code. + ECAD Devops maintains a suite of Tezos public nodes that the Tezos community can use. By supporting and monitoring these nodes, ECAD engineers have an overview and insights into the behaviour of these systems and can contribute to problem isolation, bug fixes and general troubleshooting; or specific test scenarios that require DevOps level node access. - -### Mondaynet and Daily net - -To keep up with the current changes proposed for the following Tezos protocol, we can run our integration test suite against the node called "Mondaynet." This node captures the head of the Tezos development branch each Monday. By regression testing this node, we can ascertain changes Taquito may need to make early in the protocol development process. There is also "Daily net," which offers the current Tezos branch head each day. \ No newline at end of file + +### Weeklynet and Daily net + +To keep up with the current changes proposed for the following Tezos protocol, we can run our integration test suite against the node called "Weeklynet." This node captures the head of the Tezos development branch each Monday. By regression testing this node, we can ascertain changes Taquito may need to make early in the protocol development process. There is also "Daily net," which offers the current Tezos branch head each day. \ No newline at end of file diff --git a/docs/tx_rollups.md b/docs/tx_rollups.md deleted file mode 100644 index 82c737ce9c..0000000000 --- a/docs/tx_rollups.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: Transaction Optimistic Rollups -id: tx_rollups -author: Davis Sawali ---- - -A Transaction Optimistic Rollup (TORU) is an experimental temporary scaling solution to help Tezos developers and users get acquainted with the idea of working with rollups. - -This is a trimmed, more concise documentation of how to do TORU operations in Taquito. If you aren't yet familiar with rollup node interactions, please refer to this [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#transaction-rollups) by Nomadic Labs. - -TORU currently supports the transferring of funds in the form of [tickets](https://tezostaquito.io/docs/tickets). Fund (or ticket) transfers can be done from: -- Layer-1 to layer 2 (deposit) -- Layer-2 to layer 2 (transfer) -- Layer-2 to layer-1 (withdrawal) - -Taquito currently supports **layer-1** operations that facilitate deposits and withdrawals to and from the rollup node. - -## Deposits -To be able to interact or transfer funds on layer-2, you will first need to deposit an amount to an existing layer-2 (tz4) address. - -Depositing tickets from layer-1 to layer-2 can be done via a smart contract that facilitates the transfer to a tz4 address in a specified rollup node. - -An example of such contract can be found [here](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#depositing-assets-on-a-rollup) - -Assuming the contract has been originated, interacting with the contract in Taquito would look something like this: -```javascript -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); - -const deposit = Tezos.contract.at(SMART_CONTRACT_ADDRESS); - -const op = await deposit.methods.default( - 'foobar', - '15', - 'tz4Jxn8MpRndqWUzkuZbQKmE3aNWJzYsSEso', - 'txr1c9XcfmiLSWeqDPamPytns2ZXvwgYA7EpA' -); - -const confirmation = await op.confirmation(); - -console.log(op.hash); -console.log(op.operationResults); -``` -The `default` entrypoint takes in 4 arguments: -- `foobar` is the ticket string -- `15` is the quantity of a ticket string -- `tz4Jxn8MpRndqWUzkuZbQKmE3aNWJzYsSEso` is the layer-2 address that will be the deposit recipient -- `txr1c9XcfmiLSWeqDPamPytns2ZXvwgYA7EpA` is the rollup node id - -If the deposit is successful, you will be returned an operation hash that can be accessed via `op.hash` - -You also might want to look at `op.operationResults` to retrieve the `ticket_hash`. A ticket hash should look something like this: `exprtz9FgfdzufUADVsvP8Gj8d8PZr9RsBEjZ5GQKM8Kp5cKWww7di` - -## Transfer -The exchange of assets in the form of tickets can be done from a layer-2 (`tz4`) address to another layer-2 address. Not to be confused with the `transfer_ticket` operation, this layer-2 operation will not be supported in Taquito. This may change in the future with SCORU (Smart Contract Optimistic Rollups). - -For instructions on how to conduct a transfer in layer-2 using the rollup client, refer to this [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#exchanging-assets-inside-a-rollup) by Nomadic Labs. - -## Withdrawal -A withdrawal of assets from layer-2 back to layer-1 can be done in several steps. - -The first step is to perform a `withdraw` in layer-2 to a layer-1 address in the rollup client. -``` -tezos-tx-rollup-client-alpha withdraw ${qty} of ${ticket_hash} from ${l2_src} to ${l1_dst} -``` - -- `${qty}` is the quantity of a ticket string that you would like to withdraw -- `${ticket_hash}` is the ticket hash that was returned by a deposit -- `${l2_src}` is the BLS pair of keys generated with `tezos-client bls gen key`; or in other words, the tz4 address that holds the tickets -- `${l1_dst}` is the layer-1 address you would like to withdraw the tickets to - -After a successful withdrawal, your assets will exist back in layer-1 in the form of tickets after the [finality period](#Glossary) ends. - -:::warning -Please note that this first step is a layer-2 operation which Taquito does not currently support. -::: - - - -The second step is to use a Tezos operation that will transfer these tickets to a smart contract. You can use your own contracts to process the tickets as you'd like (e.g. allow access to XTZ existing in the tickets, etc). - -This second step is called a `Transfer Ticket` operation, which Taquito supports. - -``` -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); - -const op = await Tezos.contract.transferTicket({ - ticketContents: { "string": "foobar" }, - ticketTy: { "prim": "string" } , - ticketTicketer: 'KT1AL8we1Bfajn2M7i3gQM5PJEuyD36sXaYb', - ticketAmount: 5, - destination: KT1SUT2TBFPCknkBxLqM5eJZKoYVY6mB26Fg, - entrypoint: 'default', -}); -``` -- `ticket_amount` is the amount that you would like to transfer to the smart contract -- `destination` is the address of the smart contract you would like to transfer the tickets to -- `entrypoint` is the entrypoint of the destination smart contract -- `ticket_contents`, `ticket_ty`, and `ticket_ticketer` can be retrieved from running this command using the rollup client (see [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#exchanging-assets-inside-a-rollup)) -``` -tezos-tx-rollup-client-alpha rpc get "/context/head/tickets/${ticket_hash}" -``` - -## Glossary -- `Layer-1` refers to our main protocol networks related to on-chain transactions -- `Layer-2` refers to rollup nodes deployed by any individual/group to receive transactions off-chain -- `TORU` is short for Transactional Optimistic Rollup; the experimental, temporary introduction for rollup nodes -- `SCORU` is short for Smart Contract Optimistic Rollup; the more 'permanent' solution that has yet to be be released -- `Finality Period` refers to the number of blocks needed for the chain to finalize transactions on a rollup node (40,000 blocks on mainnet and testnets, 10 blocks on Mondaynet and Dailynet for ease of testing and demo purposes). See [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#commitments-and-rejections). diff --git a/docs/version.md b/docs/version.md index 0956126b8d..a26ee8750c 100644 --- a/docs/version.md +++ b/docs/version.md @@ -2,6 +2,37 @@ title: Versions author: Jev Bjorsell --- +# Taquito v19.0.0 + +:::info +You might have noticed that we jumped versions from v17.5.0 to v19.0.0 (no v18). We do this as an effort to be in parallel with the current Octez version. +- Oxford - v18 +- Oxford2 - v19 + +Taquito v19 supports Oxford2, and not the previously named Oxford protocol. +::: + +**Potential Breaking Changes**: +Oxford2 comes with quite a few breaking changes, please make sure to update your projects accordingly. + +Oxford2 changes: +- Removed transactional rollups (tx rollup) references in Taquito #2650 +- Removed origination proof from smart rollups #2597 +- Updated all references of `endorsement` into `attestation` for Oxford2 #2599 +- `@taquito/rpc` - Updated RPC types for Oxford2 compatibility #2596 + + +## Summary + +### New Features +- `@taquito/local-forging` - Added new property `whitelist` in smart rollup origination operation #2776 + + +### Documentation + +### Internals + + # Taquito 17.5.0 **Important Note:** diff --git a/docs/wallet_API.md b/docs/wallet_API.md index 8ee9ab6412..5fb8a1c1b3 100644 --- a/docs/wallet_API.md +++ b/docs/wallet_API.md @@ -92,7 +92,7 @@ Please check out the section [Subscribing to events](#subscribing-to-events) to In previous versions of Beacon, you were able to set the `network` property when doing `requestPermissions()`. This behavior was removed from Beacon, and you must now set the network when instantiating the wallet. -You can choose among `mainnet`, `jakartanet` `ghostnet` and `custom` to set up the network. Once the permissions have been configured, you can get the user's address by calling the `getPKH` method on the wallet: +You can choose among `mainnet`, `oxfordnet`, `ghostnet` and `custom` to set up the network. Once the permissions have been configured, you can get the user's address by calling the `getPKH` method on the wallet: ```js const userAddress = await wallet.getPKH(); @@ -179,7 +179,7 @@ const wallet = new TempleWallet('MyAwesomeDapp'); The class constructor takes one parameter, the name of your dapp (this will be used later in the transaction confirmation pop-up). After the instantiation, we can connect the wallet by calling the `connect` method: ```js -await wallet.connect('mainnet' | 'mumbainet' | 'nairobinet' | 'ghostnet' | 'mondaynet' | 'sandbox'); +await wallet.connect('mainnet' | 'oxfordnet' | 'nairobinet' | 'ghostnet' | 'mondaynet' | 'sandbox'); ``` (Temple used to be called Thanos and some Taquito code still uses the name Thanos.) diff --git a/example/example-streamer-custom-retry-logic.ts b/example/example-streamer-custom-retry-logic.ts index 7009bcd7a5..4a5194bb0b 100644 --- a/example/example-streamer-custom-retry-logic.ts +++ b/example/example-streamer-custom-retry-logic.ts @@ -20,6 +20,10 @@ async function example() { ) as any })); + const bakerAttestationFilter = { + and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'attestation' }] + } + const bakerEndorsementFilter = { and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'endorsement' }] } @@ -29,7 +33,7 @@ async function example() { } tezos.stream.subscribeOperation({ - or: [bakerEndorsementFilter, bakerDelegation] + or: [bakerAttestationFilter, bakerEndorsementFilter, bakerDelegation] }) } diff --git a/example/example-streamer.ts b/example/example-streamer.ts index 9653adad81..91d61bee55 100644 --- a/example/example-streamer.ts +++ b/example/example-streamer.ts @@ -6,6 +6,10 @@ async function example() { tezos.setStreamProvider(tezos.getFactory(PollingSubscribeProvider)({ shouldObservableSubscriptionRetry: true, pollingIntervalMilliseconds: 15000 })); try { + const bakerAttestationFilter = { + and: [{ source: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'attestation' }] + } + const bakerEndorsementFilter = { and: [{ source: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'endorsement' }] } @@ -15,7 +19,7 @@ async function example() { } const sub = tezos.stream.subscribeOperation({ - or: [bakerEndorsementFilter, bakerDelegation] + or: [bakerAttestationFilter, bakerEndorsementFilter, bakerDelegation] }) sub.on('data', console.log) diff --git a/example/package.json b/example/package.json index 1146b2e87d..25d1050b5d 100644 --- a/example/package.json +++ b/example/package.json @@ -1,7 +1,7 @@ { "name": "@taquito/example", "private": true, - "version": "17.5.2", + "version": "19.0.0", "scripts": { "example": "node -r ts-node/register --preserve-symlinks example-node.ts", "example:activation": "node -r ts-node/register --preserve-symlinks example-activate.ts", @@ -42,16 +42,16 @@ }, "dependencies": { "@ledgerhq/hw-transport-node-hid": "^6.27.21", - "@taquito/ledger-signer": "^17.5.2", - "@taquito/local-forging": "^17.5.2", - "@taquito/michel-codec": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/sapling": "^17.5.2", - "@taquito/signer": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/tzip16": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/ledger-signer": "^19.0.0", + "@taquito/local-forging": "^19.0.0", + "@taquito/michel-codec": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/sapling": "^19.0.0", + "@taquito/signer": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/tzip16": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/integration-tests/README.md b/integration-tests/README.md index e6667b784f..0ad0eaf4d3 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -1,12 +1,12 @@ # Taquito Integration Tests -The `taquito/integration-tests` directory contains the integration test suite for Taquito. These tests are executed against live Tezos testnets, ensuring a comprehensive evaluation of various Taquito use cases. +The `taquito/integration-tests` directory contains the integration test suite for Taquito. These tests are executed against live Tezos testnets, ensuring a comprehensive evaluation of various Taquito use cases. The tests may also be run using Flextesa. This is useful for testing new features not in current test nets and for testing features around governance that benefit from shortened block processing times. As well Flextesa tests offer a secondary confirmation of the test net results. -Internally Taquito is tested with tests running in parallel. This is achieved using an application that generates new keys and funds them as needed per test. -The application is not publicly available. External users, therefore, must run the Taquito Integration Tests in sequence, one test at a time. +Internally Taquito is tested with tests running in parallel. This is achieved using an application that generates new keys and funds them as needed per test. +The application is not publicly available. External users, therefore, must run the Taquito Integration Tests in sequence, one test at a time. ## Running Integration Tests Against a Tezos Testnet @@ -37,7 +37,7 @@ Depending on the current Tezos upgrade cycle, multiple testnet networks may be c ``` -NAIROBINET=true npm run test +OXFORDNET=true npm run test ``` ## Configuration @@ -52,7 +52,7 @@ If different testnets are configured in the `config.ts` file, you can run tests ``` -npm run test:nairobinet contract-with-bigmap-init.spec.ts +npm run test:oxfordnet contract-with-bigmap-init.spec.ts ``` @@ -60,7 +60,7 @@ Or for a specific test within a test file: ``` -npm run test:nairobinet -- -t "Verify contract.originate for a contract and call deposit method with unit param" +npm run test:oxfordnet -- -t "Verify contract.originate for a contract and call deposit method with unit param" ``` @@ -70,7 +70,7 @@ npm run test:nairobinet -- -t "Verify contract.originate for a contract and call To run tests against a node that is not pre-configured in Taquito, use: -`export TEZOS_RPC_NAIROBINET='http://localhost:8732'`. +`export TEZOS_RPC_OXFORDNET='http://localhost:8732'`. ## Using a Secret Key Instead of the Keygen API @@ -79,7 +79,7 @@ By default, the integration tests use an ephemeral key managed by the Keygen API ``` -npm run test:nairobinet-secret-key contract-with-bigmap-init.spec.ts +npm run test:oxfordnet-secret-key contract-with-bigmap-init.spec.ts ``` @@ -126,31 +126,31 @@ from the top level. This will export the following environment variables: ```sh -RUN_NAIROBINET_WITH_SECRET_KEY=true +RUN_OXFORDNET_WITH_SECRET_KEY=true SECRET_KEY=edsk3RFgDiCt7tWB2oe96w1eRw72iYiiqZPLu9nnEY23MYRp2d8Kkx -TEZOS_RPC_NAIROBINET=http://localhost:20000 +TEZOS_RPC_OXFORDNET=http://localhost:20000 POLLING_INTERVAL_MILLISECONDS=100 RPC_CACHE_MILLISECONDS=0 TEZOS_BAKER=tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb ``` -### 2. Start a Flextesa sandbox to run a local Nairobi testnet +### 2. Start a Flextesa sandbox to run a local Oxford testnet Start the docker container, which encapsulates the flextesa_sandbox: ```sh -docker run --rm --name flextesa_sandbox --detach -p 20000:20000 oxheadalpha/flextesa:latest nairobibox start +docker run --rm --name flextesa_sandbox --detach -p 20000:20000 oxheadalpha/flextesa:latest oxfordbox start ``` -The default block time is 5 seconds. If we want to simulate Nairobi block times, we could use +The default block time is 5 seconds. If we want to simulate Oxford block times, we could use ```sh -docker run --rm --name flextesa_sandbox --detach -e block_time=8 -p 20000:20000 oxheadalpha/flextesa:latest nairobibox start +docker run --rm --name flextesa_sandbox --detach -e block_time=8 -p 20000:20000 oxheadalpha/flextesa:latest oxfordbox start ``` @@ -164,21 +164,21 @@ Flextesa is the "Flexible Tezos Sandbox" and effectively enables you to run a lo *Note: It is no longer necessary to `cd` into the `integration-tests/` directory* -To run the integration tests, use the command `npm run integration-tests`. The integration test suite will execute all tests against the current Tezos protocol (Nairobi) sandbox and typically also against the previous and next protocol testnets. You can find specific test targets in the `scripts` property in the `integration-tests/package.json` file. +To run the integration tests, use the command `npm run integration-tests`. The integration test suite will execute all tests against the current Tezos protocol (Oxford) sandbox and typically also against the previous and next protocol testnets. You can find specific test targets in the `scripts` property in the `integration-tests/package.json` file. -Remember that the first time you run the integration tests, `docker` will download the required image, which might take some time. +Remember that the first time you run the integration tests, `docker` will download the required image, which might take some time. -Before running the tests, make sure the file `~/taquito/integration-tests/known-contracts-PtNairobi.ts` includes the following: +Before running the tests, make sure the file `~/taquito/integration-tests/known-contracts-ProxfordY.ts` includes the following: ```bash -export const knownContractPtNairobi = "KT1GrzF7DSNc7LrLmS7RNaLrBQqyYHyoMzwR"; -export const knownBigMapContractPtNairobi = "KT1Twd6GBBqHEFhzvBDEn4JiUopttq2WjdnF"; -export const knownTzip12BigMapOffChainContractPtNairobi = "KT1WZUqEKZ4TMW75FKpqod4HwB4ts7wbnsFh"; -export const knownSaplingContractPtNairobi = "KT1VNnD8NWx9ep2gxsHbzrmahrWsKpZb3xGY"; -export const knownOnChainViewContractAddressPtNairobi = "KT19eNryXTuVgH6s6cUc1a5LyjSamdBw4JXo"; +export const knownContractProxfordY = "KT1GrzF7DSNc7LrLmS7RNaLrBQqyYHyoMzwR"; +export const knownBigMapContractProxfordY = "KT1Twd6GBBqHEFhzvBDEn4JiUopttq2WjdnF"; +export const knownTzip12BigMapOffChainContractProxfordY = "KT1WZUqEKZ4TMW75FKpqod4HwB4ts7wbnsFh"; +export const knownSaplingContractProxfordY = "KT1VNnD8NWx9ep2gxsHbzrmahrWsKpZb3xGY"; +export const knownOnChainViewContractAddressProxfordY = "KT19eNryXTuVgH6s6cUc1a5LyjSamdBw4JXo"; ``` @@ -197,7 +197,7 @@ When running Flextesa tests, you must pass the Jest config `--runInBand`, as the ```bash -npm -w integration-tests run test:originate-known-contracts && npm -w integration-tests run test:nairobinet-secret-key --runInBand +npm -w integration-tests run test:originate-known-contracts && npm -w integration-tests run test:oxfordnet-secret-key --runInBand ``` @@ -205,7 +205,7 @@ If you're running the tests for a second time in the same session, you don't nee ```bash -npm -w --runInBand integration-tests run test:nairobinet-secret-key +npm -w --runInBand integration-tests run test:oxfordnet-secret-key ``` @@ -213,7 +213,7 @@ Some tests might fail due to test data discrepancies, such as changes in RPC end ```bash -npm -w integration-tests run test:nairobinet-secret-key -- --runInBand --testPathIgnorePatterns='ledger-signer-failing-tests.spec.ts|ledger-signer.spec.ts|contract-estimation-tests.spec.ts|rpc-get-protocol-constants.spec.ts|' +npm -w integration-tests run test:oxfordnet-secret-key -- --runInBand --testPathIgnorePatterns='ledger-signer-failing-tests.spec.ts|ledger-signer.spec.ts|contract-estimation-tests.spec.ts|rpc-get-protocol-constants.spec.ts|' ``` @@ -221,7 +221,7 @@ You can also avoid slow-running tests. For example, if you want not to run the ` ```bash -npm -w integration-tests run test:nairobinet-secret-key -- --runInBand --testPathIgnorePatterns='ledger-signer-failing-tests.spec.ts|ledger-signer.spec.ts|contract-estimation-tests.spec.ts|rpc-get-protocol-constants.spec.ts|sapling-batched-transactions.spec.ts| sapling-transactions-contract-with-multiple-sapling-states.spec.ts|sapling-transactions-contract-with-single-state.spec.ts|sapling-transactions-proof-using-proving-key.spec.ts' +npm -w integration-tests run test:oxfordnet-secret-key -- --runInBand --testPathIgnorePatterns='ledger-signer-failing-tests.spec.ts|ledger-signer.spec.ts|contract-estimation-tests.spec.ts|rpc-get-protocol-constants.spec.ts|sapling-batched-transactions.spec.ts| sapling-transactions-contract-with-multiple-sapling-states.spec.ts|sapling-transactions-contract-with-single-state.spec.ts|sapling-transactions-proof-using-proving-key.spec.ts' ``` @@ -231,7 +231,7 @@ Upon successfully starting the tests with contract origination, you should see t ```bash integration-tests@16.1.2 test:originate-known-contracts node -r ts-node/register originate-known-contracts.ts -PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf +ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH knownContract address: KT1CX4Qbkfy4N9fgRD5L7RPZW9ByydfKxh5t ::set-output name=knownContractAddress::KT1CX4Qbkfy4N9fgRD5L7RPZW9Byv2ycodEBUxHWoRkWHFBht knownBigMapContract address: KT1NN9wjEDzrpcXynvA1L97Y5JCT7ebyjPNj @@ -248,8 +248,8 @@ Initial Balance : 90856887.13687 XTZ Final Balance : 90856909.589235 XTZ Total XTZ Spent : -22.452365 XTZ -> integration-tests@16.1.2 test:nairobinet-secret-key -> RUN_NAIROBINET_WITH_SECRET_KEY=true jest --runInBand +> integration-tests@16.1.2 test:oxfordnet-secret-key +> RUN_OXFORDNET_WITH_SECRET_KEY=true jest --runInBand RUNS ./contract-manager-scenario.spec.ts PASS ./contract-manager-scenario.spec.ts (6.167 s) ``` @@ -258,12 +258,12 @@ PASS ./contract-manager-scenario.spec.ts (6.167 s) We provide a shell script `integration-tests/sandbox-bakers.sh` for setting up and running a mini net of bakers with Flextesa. The default values for the sandbox include - - blocks_per_voting_period=12 - - extra_dummy_proposals_batch_size=2 - - extra_dummy_proposals_batch_level=2,4 + - blocks_per_voting_period=12 + - extra_dummy_proposals_batch_size=2 + - extra_dummy_proposals_batch_level=2,4 - number_of_bootstrap_accounts=2 -Before running the script, make sure the file `~/taquito/integration-tests/known-contracts-PtNairobi.ts` is populated. Stop the `baking-sandbox` docker process before running the script again. +Before running the script, make sure the file `~/taquito/integration-tests/known-contracts-ProxfordY.ts` is populated. Stop the `baking-sandbox` docker process before running the script again. To run this script, save it as `integration-tests/sandbox-bakers.sh` and execute it with the required arguments: @@ -273,7 +273,7 @@ chmod +x sandbox-bakers.sh ``` for example, ```bash -./sandbox-bakers.sh oxheadalpha/flextesa:20230313 Nairobi nairobinet NAIROBINET +./sandbox-bakers.sh oxheadalpha/flextesa:20230313 Oxford oxfordnet OXFORDNET ``` Create an alias to make interacting with the flextesa node easier @@ -291,18 +291,18 @@ For baking, check for baking rights ```bash! tcli show address alice # get the pkh tcli rpc get /chains/main/blocks/head/metadata | jq .level_info,.protocol # get the cycle -tcli rpc get /chains/main/blocks/head/helpers/baking_rights\?cycle=\&delegate=\&max_round=7 +tcli rpc get /chains/main/blocks/head/helpers/baking_rights\?cycle=\&delegate=\&max_round=7 ``` Since the cycles fly by in this setup, check for rights a few cycles ahead .. -Then +Then ```bash! tcli bake for alice ``` You should see something like: ```bash! -May 11 20:14:39.014 - 017-PtNairobi.baker.transitions: received new head BLr6cAaj2oM2ibakFp8zZMNEbpcSAZ94WhzeV57njD7NrnaYrZU at -May 11 20:14:39.014 - 017-PtNairobi.baker.transitions: level 1152, round 0 +May 11 20:14:39.014 - 017-ProxfordY.baker.transitions: received new head BLr6cAaj2oM2ibakFp8zZMNEbpcSAZ94WhzeV57njD7NrnaYrZU at +May 11 20:14:39.014 - 017-ProxfordY.baker.transitions: level 1152, round 0 Block BLCjrRGMJxZEBoZaxafUHcTCNBnmGzRfX2Qf5qru2XtAhiNEsun (1153) injected ``` @@ -326,7 +326,7 @@ Keygen->>+Redis: Create lease entry in Redis (with expiry date) Keygen-->>+User: Return Ephemeral Key Lease ID User->>+User: Create a remote signer with Lease ID -loop +loop User->>+Keygen: Sign Operation Keygen->>+Redis: Retrieve private key to sign based on Lease ID Keygen->>+Keygen: Sign user data diff --git a/integration-tests/config.ts b/integration-tests/config.ts index 3c57a0cde1..69e70e361f 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -7,7 +7,7 @@ import { RpcClient, RpcClientCache } from '@taquito/rpc'; import { KnownContracts } from './known-contracts'; import { knownContractsProtoALph } from './known-contracts-ProtoALph'; import { knownContractsPtGhostnet } from './known-contracts-PtGhostnet'; -import { knownContractsPtNairobi } from './known-contracts-PtNairobi'; +import { knownContractsProxfordY } from './known-contracts-ProxfordY'; const nodeCrypto = require('crypto'); @@ -23,21 +23,16 @@ enum ForgerType { COMPOSITE = 'composite', } -export const isSandbox = (config: {rpc: string}) => { +export const isSandbox = (config: { rpc: string }) => { return config.rpc.includes('localhost') || config.rpc.includes('0.0.0.0') || config.rpc.includes('127.0.0.1'); } const forgers: ForgerType[] = [ForgerType.COMPOSITE]; -// A network type. TESTNETs corresponds to a pre-existing set of test -// networks, such as Jakartanet, Kathmanet, Mondaynet etc. Some -// integration test cases are hardcoded against such networks. A -// SANDBOX is a local, ephemeral sandboxed network. When the -// integration test suite runs against such network, the test -// network-specific test cases are disabled. +// user running integration test can pass environment variable TEZOS_NETWORK_TYPE=sandbox to specify which network to run against export enum NetworkType { - TESTNET, - SANDBOX, + TESTNET, // corresponds ghostnet, oxfordnet and weeklynet etc. + SANDBOX, // corresponds to flextesa local chain } interface Config { @@ -121,7 +116,7 @@ const defaultConfig = ({ rpc: process.env[`TEZOS_RPC_${networkName}`] || defaultRpc, pollingIntervalMilliseconds: process.env[`POLLING_INTERVAL_MILLISECONDS`] || undefined, rpcCacheMilliseconds: process.env[`RPC_CACHE_MILLISECONDS`] || '1000', - knownBaker: process.env[`TEZOS_BAKER`] || (networkName === 'MONDAYNET' ? 'tz1ck3EJwzFpbLVmXVuEn5Ptwzc6Aj14mHSH' : 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'), + knownBaker: process.env[`TEZOS_BAKER`] || (networkName === 'WEEKLYNET' ? 'tz1ck3EJwzFpbLVmXVuEn5Ptwzc6Aj14mHSH' : 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'), knownContract: process.env[`TEZOS_${networkName}_CONTRACT_ADDRESS`] || knownContracts.contract, knownBigMapContract: process.env[`TEZOS_${networkName}_BIGMAPCONTRACT_ADDRESS`] || knownContracts.bigMapContract, knownTzip1216Contract: process.env[`TEZOS_${networkName}_TZIP1216CONTRACT_ADDRESS`] || knownContracts.tzip12BigMapOffChainContract, @@ -133,22 +128,22 @@ const defaultConfig = ({ } } -const nairobinetEphemeral: Config = +const oxfordnetEphemeral: Config = defaultConfig({ - networkName: 'NAIROBINET', - protocol: Protocols.PtNairobi, - defaultRpc: 'http://ecad-nairobinet-full.i.tez.ie:8732', - knownContracts: knownContractsPtNairobi, - signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/nairobinet') + networkName: 'OXFORDNET', + protocol: Protocols.ProxfordY, + defaultRpc: 'http://ecad-oxfordnet-full.i.tez.ie:8732', + knownContracts: knownContractsProxfordY, + signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/oxfordnet') }); -const nairobinetSecretKey: Config = - { ...nairobinetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-nairobinet-full:8732' } }; +const oxfordnetSecretKey: Config = + { ...oxfordnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-oxfordnet-full:8732' } }; const ghostnetEphemeral: Config = defaultConfig({ networkName: 'GHOSTNET', - protocol: Protocols.PtMumbai2, + protocol: Protocols.PtNairobi, defaultRpc: 'http://ecad-ghostnet-rolling:8732', knownContracts: knownContractsPtGhostnet, signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/ghostnet') @@ -157,36 +152,36 @@ const ghostnetEphemeral: Config = const ghostnetSecretKey: Config = { ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-ghostnet-rolling:8732' } }; -const mondaynetEphemeral: Config = +const weeklynetEphemeral: Config = defaultConfig({ - networkName: 'MONDAYNET', + networkName: 'WEEKLYNET', protocol: Protocols.ProtoALpha, defaultRpc: 'http://mondaynet.ecadinfra.com:8732', knownContracts: knownContractsProtoALph, signerConfig: defaultEphemeralConfig('http://key-gen-1.i.tez.ie:3010/mondaynet') }); -const mondaynetSecretKey: Config = - { ...mondaynetEphemeral, ...{ signerConfig: defaultSecretKey } }; +const weeklynetSecretKey: Config = + { ...weeklynetEphemeral, ...{ signerConfig: defaultSecretKey } }; const providers: Config[] = []; if (process.env['RUN_WITH_SECRET_KEY']) { - providers.push(nairobinetSecretKey); -} else if (process.env['RUN_NAIROBINET_WITH_SECRET_KEY']) { - providers.push(nairobinetSecretKey); + providers.push(oxfordnetSecretKey); +} else if (process.env['RUN_OXFORDNET_WITH_SECRET_KEY']) { + providers.push(oxfordnetSecretKey); } else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) { providers.push(ghostnetSecretKey); -} else if (process.env['RUN_MONDAYNET_WITH_SECRET_KEY']) { - providers.push(mondaynetSecretKey); -} else if (process.env['NAIROBINET']) { - providers.push(nairobinetEphemeral); +} else if (process.env['RUN_WEEKLYNET_WITH_SECRET_KEY']) { + providers.push(weeklynetSecretKey); +} else if (process.env['OXFORDNET']) { + providers.push(oxfordnetEphemeral); } else if (process.env['GHOSTNET']) { providers.push(ghostnetEphemeral); -} else if (process.env['MONDAYNET']) { - providers.push(mondaynetEphemeral); +} else if (process.env['WEEKLYNET']) { + providers.push(weeklynetEphemeral); } else { - providers.push(nairobinetEphemeral); + providers.push(oxfordnetEphemeral); } const setupForger = (Tezos: TezosToolkit, forger: ForgerType): void => { @@ -215,7 +210,7 @@ const setupSignerWithFreshKey = async ( headers: requestHeaders, json: false, }); - + const signer = new InMemorySigner(key!); Tezos.setSignerProvider(signer); } catch (e) { @@ -249,13 +244,13 @@ const setupWithSecretKey = async (Tezos: TezosToolkit, signerConfig: SecretKeyCo }; const configurePollingInterval = (Tezos: TezosToolkit, pollingIntervalMilliseconds: string | undefined) => { - if(pollingIntervalMilliseconds) { + if (pollingIntervalMilliseconds) { Tezos.setStreamProvider(Tezos.getFactory(PollingSubscribeProvider)({ pollingIntervalMilliseconds: Number(pollingIntervalMilliseconds) })); } } const configureRpcCache = (rpc: string, rpcCacheMilliseconds: string) => { - if(rpcCacheMilliseconds === '0') { + if (rpcCacheMilliseconds === '0') { return new TezosToolkit(rpc); } else { return new TezosToolkit(new RpcClientCache(new RpcClient(rpc), Number(rpcCacheMilliseconds))); diff --git a/integration-tests/contract-batch-smart-rollup-add-messages.spec.ts b/integration-tests/contract-batch-smart-rollup-add-messages.spec.ts index fef648ef75..c31263c74c 100644 --- a/integration-tests/contract-batch-smart-rollup-add-messages.spec.ts +++ b/integration-tests/contract-batch-smart-rollup-add-messages.spec.ts @@ -26,7 +26,6 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { expect(op.status).toEqual('applied'); expect(op.includedInBlock).toBeDefined(); - }); }); }); diff --git a/integration-tests/contract-batch-smart-rollup-originate.spec.ts b/integration-tests/contract-batch-smart-rollup-originate.spec.ts index d758a31c15..11730ae382 100644 --- a/integration-tests/contract-batch-smart-rollup-originate.spec.ts +++ b/integration-tests/contract-batch-smart-rollup-originate.spec.ts @@ -12,14 +12,12 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { it('should be able to batch smart rollup originate with other operations', async () => { const kernel = '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' - const originationProof = await Tezos.rpc.getOriginationProof({ kernel, kind: PvmKind.WASM2 }) const batch = Tezos.contract .batch() .withSmartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel, - originationProof, parametersType: { prim: 'bytes' }, }) .withOrigination({ diff --git a/integration-tests/contract-estimation-tests.spec.ts b/integration-tests/contract-estimation-tests.spec.ts index 125bd0513d..748243ddae 100644 --- a/integration-tests/contract-estimation-tests.spec.ts +++ b/integration-tests/contract-estimation-tests.spec.ts @@ -73,7 +73,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(613); expect(estimate.totalCost).toEqual(143363); expect(estimate.usingBaseFeeMutez).toEqual(613); - expect(estimate.consumedMilligas).toEqual(576347); + expect(estimate.consumedMilligas).toEqual(576402); }); it('Verify .estimate.setDelegate result', async () => { @@ -101,7 +101,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(472); expect(estimate.totalCost).toEqual(472); expect(estimate.usingBaseFeeMutez).toEqual(472); - expect(estimate.consumedMilligas).toEqual(1356735); + expect(estimate.consumedMilligas).toEqual(1356228); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -111,40 +111,40 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { 50) ).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(1572); + expect(estimate.gasLimit).toEqual(1571); expect(estimate.storageLimit).toEqual(514); expect(estimate.suggestedFeeMutez).toEqual(643); expect(estimate.burnFeeMutez).toEqual(128500); expect(estimate.minimalFeeMutez).toEqual(543); expect(estimate.totalCost).toEqual(129043); expect(estimate.usingBaseFeeMutez).toEqual(543); - expect(estimate.consumedMilligas).toEqual(1471270); + expect(estimate.consumedMilligas).toEqual(1470757); }); it('Verify .estimate.transfer for internal origination', async () => { const tx = contract.methods.do(originate()).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(1868); + expect(estimate.gasLimit).toEqual(1867); expect(estimate.storageLimit).toEqual(317); expect(estimate.suggestedFeeMutez).toEqual(619); expect(estimate.burnFeeMutez).toEqual(79250); expect(estimate.minimalFeeMutez).toEqual(519); expect(estimate.totalCost).toEqual(79769); expect(estimate.usingBaseFeeMutez).toEqual(519); - expect(estimate.consumedMilligas).toEqual(1767848); + expect(estimate.consumedMilligas).toEqual(1766852); }); it('Verify .estimate.transfer for multiple internal originations', async () => { const tx = contract.methods.do(originate2()).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(2394); + expect(estimate.gasLimit).toEqual(2393); expect(estimate.storageLimit).toEqual(634); expect(estimate.suggestedFeeMutez).toEqual(737); expect(estimate.burnFeeMutez).toEqual(158500); expect(estimate.minimalFeeMutez).toEqual(637); expect(estimate.totalCost).toEqual(159137); expect(estimate.usingBaseFeeMutez).toEqual(637); - expect(estimate.consumedMilligas).toEqual(2293496); + expect(estimate.consumedMilligas).toEqual(2292005); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); diff --git a/integration-tests/contract-failing-noop.spec.ts b/integration-tests/contract-failing-noop.spec.ts index 573f9e2e34..84083333b7 100644 --- a/integration-tests/contract-failing-noop.spec.ts +++ b/integration-tests/contract-failing-noop.spec.ts @@ -1,45 +1,17 @@ +import { CONFIGS } from "./config"; +import { OpKind, TezosToolkit } from "@taquito/taquito"; import { InMemorySigner } from "@taquito/signer"; -import { CONFIGS, defaultSecretKey, isSandbox } from "./config"; -import { OpKind, Protocols, TezosToolkit } from "@taquito/taquito"; import { verifySignature } from "@taquito/utils"; -CONFIGS().forEach(({ rpc, setup, protocol }) => { - - const Tezos = new TezosToolkit(rpc); - Tezos.setSignerProvider(new InMemorySigner(defaultSecretKey.secret_key)); - const nairobinet = !isSandbox({ rpc }) && protocol === Protocols.PtNairobi ? it : it.skip; - - describe(`Test failing_noop through contract api, based on head, and secret_key using: ${rpc}`, () => { - beforeEach(async () => { - await setup(); - }); - - nairobinet('Verify that the contract.failingNoop result is as expected when the block and secret key are kept constant', async () => { - const signed = await Tezos.contract.failingNoop({ - arbitrary: "48656C6C6F20576F726C64", // Hello World - basedOnBlock: 0, - }); - // This test is skipped from flextesa because the genesis block hash is not guaranteed to stay the same - // The signature will change if the hash of the genesis block changes (maybe when switching to a testnet based on a new protocol). - // Also it depends on the signing key. - // So if any of them changes, the expected values need to be adjusted - expect(signed).toEqual({ - bytes: 'df2788eed43ab680c8a2b79969ce4de93b9768cd2786a85ebdfba90ca7612638110000000b48656c6c6f20576f726c64', - signature: 'spsig1QVVCiQ6aN2zmut2wKTg4zWLoP9ia4qUY2hBo21odA7P25gqfieFWJMyntaJWmyrd6v3mgjKF5n4d2wcaB3LxkLmd1MoJQ', - signedContent: { - branch: 'BMQZWtQjSpyJZBVHbABEmVP9VG8yEZPZ3wNftwZdXt6A33ZYatj', - contents: [{ - kind: OpKind.FAILING_NOOP, - arbitrary: '48656C6C6F20576F726C64' - }] - } - }); - }); - }); +CONFIGS().forEach(({ rpc, lib }) => { + const aliceSKey = 'edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq' describe(`Test failing_noop through contract api using: ${rpc}`, () => { - beforeEach(async () => { - await setup(); + let Tezos: TezosToolkit; + + beforeAll(async () => { + Tezos = lib; + Tezos.setSignerProvider(new InMemorySigner(aliceSKey)); }); it('Verify that the contract.failingNoop signs a text on the genesis block', async () => { @@ -60,4 +32,31 @@ CONFIGS().forEach(({ rpc, setup, protocol }) => { expect(verifySignature(signed.bytes, pk!, signed.signature, new Uint8Array([3]))).toBe(true); }); }); + + describe(`Test failing_noop through contract api, based on genesis and secret_key on mainnet`, () => { + let Mainnet: TezosToolkit; + + beforeAll(async () => { + Mainnet = new TezosToolkit('https://rpc.tzkt.io/mainnet'); // this is an archive node public rpc url for mainnet + Mainnet.setSignerProvider(new InMemorySigner(aliceSKey)); + }); + + it('Verify that the contract.failingNoop result is as expected when the block and secret key are kept constant', async () => { + const signed = await Mainnet.contract.failingNoop({ + arbitrary: "48656C6C6F20576F726C64", // Hello World + basedOnBlock: 0, + }); + expect(signed).toEqual({ + bytes: '8fcf233671b6a04fcf679d2a381c2544ea6c1ea29ba6157776ed8424c7ccd00b110000000b48656c6c6f20576f726c64', + signature: 'edsigtYFkwJo6uVY5J1KnjnMFsj3Y1MKD9vqmtX2sF2u6yyg6fLJWn6Cy1CcbwJAkmEq5Zxvh49uYkMtHHGbeBm8LqBJg2uYjqG', + signedContent: { + branch: 'BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2', + contents: [{ + kind: OpKind.FAILING_NOOP, + arbitrary: '48656C6C6F20576F726C64' + }] + } + }); + }); + }); }) diff --git a/integration-tests/contract-originate-contract-with-chest.spec.ts b/integration-tests/contract-originate-contract-with-chest.spec.ts new file mode 100644 index 0000000000..28c043e9e7 --- /dev/null +++ b/integration-tests/contract-originate-contract-with-chest.spec.ts @@ -0,0 +1,51 @@ +import { DefaultContractType, OriginationOperation, Protocols } from "@taquito/taquito"; +import { CONFIGS } from "./config"; +import { ProtoGreaterOrEqual } from "@taquito/michel-codec"; + +CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { + const Tezos = lib; + const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip; + + describe(`Test contract origination with timelock types (chest or chest_key) in storage and retrieve its value through contract api: ${rpc}`, () => { + const chestValue = 'deafa2a781dee4a1cea296d1d5fef8c5cffad5d4a7fecdebc8ecde8afad580e5d9fdaa98cfeb91a3bb8cc8e5fae79ce3ebf9baf3af9b94bdefc9fbf68ac8bcbbc09c99b6e6b8b9fec8bdb5949af5bf85b5d8d5fbe8e8d1c0cdcebee792a1f8d0f1fbabe8bda590f1938a9cdc8fe3a29fbba3c1b3e7bcbc9aedb58dde9388a7dee5a4c9d8cd989fdcd285afcfa780ebc7cdd78099fbf8b4d8f58083b782bf83fcacbc9f86adfedbc983e08b8fcbc0cb89f7a0ccd1a0bfc1dfc0d3b58a98ffb7a5a8f794ad8bc8dfc9bac3f6c9b2e1cd80cfc1e398df898ed6a0ca928f81cadeb3a8c694e29fc79c92ddbed28584dd9bbafb89c9dedabb8fb68c98dda19ac0f681ffa2a7c1da84b0fbe6a0b6ce82a7df908c9add859bbad6b3cec0c0aba0bab8de9480a8a00132511a7cc4b258bf58089548b44d9fbed4b6434ca39fd51100000014464ee1937269169dc3f93983f7bbe25b8a6915d7'; + const chestKeyValue = 'b4bdeae3d2f5b4d0ecf486aaa2c6d2d89ad4ded2848e92ac8dc9a9fbad9daaaa8990e1f0bf96b9e89a8dd9e3a999dddbc0f18bb2e1b3c687bacde7cefcbd8f8fb18092ed9f9bf9b482c989fefba3f5c99193ccc2a8a697b58cd9bbbeeffaad9c84efb085aceef5e9d8cec6b182c8e686deccd088b6d5ecdfa5e8eb90d7a9f2c6ecb0c8b8e3ccc294f4d7f0ec95f6ededbcf8e698a3cfb9a0c0c6e4dfd882f9fe92afea95e2c5df9ecdb0f0b8c2b689f0c4ecfbe3b4d387c0c4d6e6a187c3e980bffbc6a1b090e493a7b0a8d9b5e583b7fbe8a3bff3add6e8ddceb5a2eec8e0bdfbf2ccfe86ff8e93bd9ce2a0b7d2fe91f19cdaa1f4f8f9b4b7e9c387ce83e7f8f4bcac949ef0bbd684a9c1a193d4e1bad3a0f1eecdbbe5f2a1f2edfea6bcf4a99fa4cadc018097ffbede93a98fa68d93eef190dbc5b9a0cab4899cf59690caf3cdd3c3cbd381978985cdd68ef697b29bcce3acd3b7c99aa7ae8dd3cfdff4d6e5ce8eecccf6f7aafbf1c1e5a3f0e1beefd3cfc7d193ba88eaf2cecf8e96a89ca2f2fbd8e5a496d6cac8ca8aa3b6ced7e7eddba8bac7ee85d98bfb8a93849bca8fddd9a1b0bae3c5dafef5c1f5d7e9a388fafaeaf4cdfef3b0e7d4f7a6c2f1bdced7d7b7cd9ed4eec0a1f5c9a2e38de2c09fbda082cf95f8f0fcdddbc784f4bbfde1f994a3deb1f497f8dec0a58c9ffddd8da88af6c3d5a2fcc7839fb6f6aa8cbc81fdb8bba68f8b93f791a88df39c91ded8d199cef8ebbaa8c9dee4c9a1f2b5e3d4e5f9a7d5b395eaef86bf81efc5cde9a5a4fe8ffceef481f4a3b6f0f59381daf58592cebad494b7c709f78183b5effcc4c7c3f3e2b78ff4fedeceb9a7fbf0ede2e2d2afe99e9496f2abf9a190d1bdc786fcf38a80bbaecb94f59aa985fcf5e1c1b68ad9aceddff09a9ac591d8b8e7bfb5a5a1a1f8cea6bdad8682dfa5f8b5e0d4cea7bbe0d9daa2cba5bd91f396cdebbdfb95daadc39ed7faa5e8eda1f5b78db6c886dc9bb8fdc2e7e7d6a294d2a5c2eca8fcce9dd9a8ebe28fa2f4aef8d8aac68a869bccddb7aca8c39fc691fccb868feafae2a8a0f3fcebfbf99cecdd9586ecd2dda9f4d1f8bd89b4fca480e7fdaccaf1eeadc7f3dffe96fab3dbd7a0f4eafd9dc8f9c0f0feca8ec1a1a8f992fbcbe9edfec9b6fc878da0f8a4ef87a4f583ead786fc8da4eeb8ccd0e69a9992fef8c984cd88ae918292c9eae9e6ccc4e9c6acd6edcfaafcf4c28f90a68096d008ddc3d5aea480a8fee2bcaff585fc9cf3f3a103'; + let opChest: OriginationOperation + let opChestKey: OriginationOperation; + + beforeAll(async () => { + await setup(); + + opChest = await Tezos.contract.originate({ + balance: "1", + code: [{ "prim": "parameter", "args": [{ "prim": "chest" }] }, { "prim": "storage", "args": [{ "prim": "chest" }] }, { "prim": "code", "args": [[{ "prim": "CAR" }, { "prim": "NIL", "args": [{ "prim": "operation" }] }, { "prim": "PAIR" }]] }], + storage: chestValue, + }) + await opChest.confirmation() + + opChestKey = await Tezos.contract.originate({ + balance: "1", + code: [{ "prim": "parameter", "args": [{ "prim": "chest_key" }] }, { "prim": "storage", "args": [{ "prim": "chest_key" }] }, { "prim": "code", "args": [[{ "prim": "CAR" }, { "prim": "NIL", "args": [{ "prim": "operation" }] }, { "prim": "PAIR" }]] }], + storage: chestKeyValue, + }) + await opChestKey.confirmation() + }) + + oxfordAndAlpha('Verify contract.originate for a contract with chest in storage', async () => { + expect(opChest.hash).toBeDefined(); + expect(opChest.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY) + const contract = await opChest.contract(); + + const storage: any = await contract.storage(); + expect(storage).toEqual(chestValue); + }); + + oxfordAndAlpha('Verify contract.originate for a contract with chest_key in storage', async () => { + expect(opChestKey.hash).toBeDefined(); + expect(opChestKey.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY) + const contract = await opChestKey.contract(); + + const storage: any = await contract.storage(); + expect(storage).toEqual(chestKeyValue); + }); + }); +}) \ No newline at end of file diff --git a/integration-tests/contract-security-balance-instruction.spec.ts b/integration-tests/contract-security-balance-instruction.spec.ts index bb4405a9e0..ce5abfd2d6 100644 --- a/integration-tests/contract-security-balance-instruction.spec.ts +++ b/integration-tests/contract-security-balance-instruction.spec.ts @@ -6,14 +6,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet("Verify Obtained balance of a smart contract using the BALANCE instruction does not change during the execution of the entrypoint's own code", async () => { + weeklynet("Verify Obtained balance of a smart contract using the BALANCE instruction does not change during the execution of the entrypoint's own code", async () => { const opTezTransferA = await Tezos.contract.originate({ balance: '0.00001', code: ` { parameter (option address) ; diff --git a/integration-tests/contract-security-batch-operation-fail.spec.ts b/integration-tests/contract-security-batch-operation-fail.spec.ts index 16bbd18dc6..bb95151fc0 100644 --- a/integration-tests/contract-security-batch-operation-fail.spec.ts +++ b/integration-tests/contract-security-batch-operation-fail.spec.ts @@ -7,14 +7,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify failed batch', async () => { + weeklynet('Verify failed batch', async () => { const op = await Tezos.contract.originate({ code: ` { parameter (or (nat %add) (nat %sub)) ; storage nat ; diff --git a/integration-tests/contract-security-duplicate-ticket.spec.ts b/integration-tests/contract-security-duplicate-ticket.spec.ts index 04b0ab3c82..91dda953d7 100644 --- a/integration-tests/contract-security-duplicate-ticket.spec.ts +++ b/integration-tests/contract-security-duplicate-ticket.spec.ts @@ -5,14 +5,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify type ticket string cannot be used with "dup" here because it is not duplicable', async () => { + weeklynet('Verify type ticket string cannot be used with "dup" here because it is not duplicable', async () => { try { const opTicketsDup = await Tezos.contract.originate({ code: `{ parameter unit; @@ -41,7 +41,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify type ticket string cannot be used with "dup n" here because it is not duplicable', async () => { + weeklynet('Verify type ticket string cannot be used with "dup n" here because it is not duplicable', async () => { try { const opTicketsDup = await Tezos.contract.originate({ code: `{ parameter unit; @@ -72,7 +72,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify type list (ticket string) cannot be used here because it is not duplicable', async () => { + weeklynet('Verify type list (ticket string) cannot be used here because it is not duplicable', async () => { try { const opTicketsDup = await Tezos.contract.originate({ code: `{ parameter unit; @@ -104,7 +104,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify Packing a ticket is not possible', async () => { + weeklynet('Verify Packing a ticket is not possible', async () => { try { const opTicketsDup = await Tezos.contract.originate({ code: `{ parameter unit; @@ -132,7 +132,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify pack a ticket stored within a pair structure is not possible', async () => { + weeklynet('Verify pack a ticket stored within a pair structure is not possible', async () => { try { const opTicketsDup = await Tezos.contract.originate({ code: `{ parameter unit; @@ -160,7 +160,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify returning a ticket in an on-chain view is not possible', async () => { + weeklynet('Verify returning a ticket in an on-chain view is not possible', async () => { try { const opTicketsDup = await Tezos.contract.originate({ code: `{ parameter unit; diff --git a/integration-tests/contract-security-duplicate-transfer.spec.ts b/integration-tests/contract-security-duplicate-transfer.spec.ts index 57aa5daa2a..1647b08cb0 100644 --- a/integration-tests/contract-security-duplicate-transfer.spec.ts +++ b/integration-tests/contract-security-duplicate-transfer.spec.ts @@ -7,21 +7,21 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet( + weeklynet( 'Verify Type "operation" is not duplicable with error internal_operation_replay.', async () => { try { const publicKeyHash = await Tezos.signer.publicKeyHash(); const op = await Tezos.contract.originate({ balance: '8', - code: `{ + code: `{ parameter unit; storage unit; code diff --git a/integration-tests/contract-security-mutez-overflow.spec.ts b/integration-tests/contract-security-mutez-overflow.spec.ts index 4072be65b5..7a6e45e91c 100644 --- a/integration-tests/contract-security-mutez-overflow.spec.ts +++ b/integration-tests/contract-security-mutez-overflow.spec.ts @@ -8,14 +8,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify mutez overflow example', async () => { + weeklynet('Verify mutez overflow example', async () => { try { const op = await Tezos.contract.originate({ code: ` { parameter unit ; diff --git a/integration-tests/contract-security-mutez-underflow.spec.ts b/integration-tests/contract-security-mutez-underflow.spec.ts index bbfe34b22c..e4ad4a87a2 100644 --- a/integration-tests/contract-security-mutez-underflow.spec.ts +++ b/integration-tests/contract-security-mutez-underflow.spec.ts @@ -9,14 +9,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify mutez underflow example', async () => { + weeklynet('Verify mutez underflow example', async () => { try { const op = await Tezos.contract.originate({ code: ` { parameter unit ; diff --git a/integration-tests/contract-security-non-existent-KT-address.spec.ts b/integration-tests/contract-security-non-existent-KT-address.spec.ts index cf8eb0b208..410a365db6 100644 --- a/integration-tests/contract-security-non-existent-KT-address.spec.ts +++ b/integration-tests/contract-security-non-existent-KT-address.spec.ts @@ -9,7 +9,7 @@ import { Protocols, TezosToolkit } from '@taquito/taquito'; const testContractAddress = 'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn'; CONFIGS().forEach(({ rpc, setup, protocol }) => { - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; const Tezos = new TezosToolkit(new RpcClient(rpc)); describe(`Test contracts using: ${rpc}`, () => { @@ -18,7 +18,7 @@ CONFIGS().forEach(({ rpc, setup, protocol }) => { }); - mondaynet('Verify that you cannot prefund a non existent smart contract', async () => { + weeklynet('Verify that you cannot prefund a non existent smart contract', async () => { try { await Tezos.contract.at(testContractAddress); } catch (error: any) { diff --git a/integration-tests/contract-security-on-chain-views.spec.ts b/integration-tests/contract-security-on-chain-views.spec.ts index b8a75c4fcf..6e75d117b6 100644 --- a/integration-tests/contract-security-on-chain-views.spec.ts +++ b/integration-tests/contract-security-on-chain-views.spec.ts @@ -1,12 +1,12 @@ import { Protocols } from '@taquito/taquito'; import { CONFIGS } from './config'; -/** - * This "naive*" testcase assumes that the on-chain view stack is not correctly separated from the caller's stack. - * Thus, this testcase assumes that there is only one stack, whereas the elements of the on-chain stack are on top. - * Naive - meaning: WE just try it without thinking whether this test makes sense in regards with the used underlying architecture. +/** + * This "naive*" testcase assumes that the on-chain view stack is not correctly separated from the caller's stack. + * Thus, this testcase assumes that there is only one stack, whereas the elements of the on-chain stack are on top. + * Naive - meaning: WE just try it without thinking whether this test makes sense in regards with the used underlying architecture. * We think of the underlying architecture (type system, stack separation, etc.) as a black box. - * + * * TC-V-002: On-chain view - add instruction * TC-V-003: On-chain view - dig instruction * TC-V-004: On-chain view - dup instruction @@ -14,14 +14,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet("Verify we can access the stack of the caller by using the instruction add.", async () => { + weeklynet("Verify we can access the stack of the caller by using the instruction add.", async () => { try { const opGetter = await Tezos.contract.originate({ code: ` { parameter unit; @@ -37,16 +37,16 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { "rogue" unit nat { # We assume that the on-chain view stack is just on top of the caller stack. - + # DROP view input DROP; - + # On the caller stack the top value is a "nat". So, we try to access this by using instruction "add". PUSH nat 3; ADD; # we leave this addition result on stack. - - # Since, add consumes two stack elements, we have to push another nat (the result of the view) to stack in order + + # Since, add consumes two stack elements, we have to push another nat (the result of the view) to stack in order # to restore a correct stack. PUSH nat 1; }; @@ -62,7 +62,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet("Verify we can access the stack of the caller by using the instruction dig n", async () => { + weeklynet("Verify we can access the stack of the caller by using the instruction dig n", async () => { try { const opGetter = await Tezos.contract.originate({ code: ` { parameter unit; @@ -99,7 +99,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet("Verify we can access the stack of the caller by using the instruction dup.", async () => { + weeklynet("Verify we can access the stack of the caller by using the instruction dup.", async () => { try { const opGetter = await Tezos.contract.originate({ code: ` { parameter unit; @@ -138,4 +138,3 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { }); // This test was transcribed to Taquito from bash scripts at https://github.com/InferenceAG/TezosSecurityBaselineChecking - diff --git a/integration-tests/contract-security-reentrance.spec.ts b/integration-tests/contract-security-reentrance.spec.ts index b5a763d98e..3bf2f51299 100644 --- a/integration-tests/contract-security-reentrance.spec.ts +++ b/integration-tests/contract-security-reentrance.spec.ts @@ -11,7 +11,7 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; const address = 'tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys'; describe(`Test contracts using: ${rpc}`, () => { @@ -19,7 +19,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { await setup(true); }); - mondaynet('Reentrance attack test', async () => { + weeklynet('Reentrance attack test', async () => { const vestingContractOp = await Tezos.contract.originate({ balance: '8', code: `{ parameter diff --git a/integration-tests/contract-security-ticket-callback-string.spec.ts b/integration-tests/contract-security-ticket-callback-string.spec.ts index a743896fed..e47158d983 100644 --- a/integration-tests/contract-security-ticket-callback-string.spec.ts +++ b/integration-tests/contract-security-ticket-callback-string.spec.ts @@ -7,19 +7,19 @@ import { CONFIGS } from './config'; // Naively* trying to create an own ticket from scratch. // We assume that the ticket is just a (pair string cty nat) and can "easily" be created via a callback. -// *Naively - meaning: WE just try it without thinking whether this test makes sense in regards with the used underlying architecture. +// *Naively - meaning: WE just try it without thinking whether this test makes sense in regards with the used underlying architecture. // We think of the underlying architecture (type system, stack separation, etc.) as a black box. CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet("Verify ticket is not easily created by a callback - address and option", async () => { + weeklynet("Verify ticket is not easily created by a callback - address and option", async () => { try { const opCaller = await Tezos.contract.originate({ code: ` { parameter (or (address %init) (option %setToken (ticket string))) ; @@ -86,7 +86,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet("Verify ticket is not easily created by a callback - string and option ", async () => { + weeklynet("Verify ticket is not easily created by a callback - string and option ", async () => { try { const opCaller = await Tezos.contract.originate({ code: ` { parameter @@ -157,7 +157,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet("Verify ticket is not easily created by a callback - string", async () => { + weeklynet("Verify ticket is not easily created by a callback - string", async () => { try { const opCaller = await Tezos.contract.originate({ code: ` { parameter @@ -231,4 +231,3 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { }); // This test was transcribed to Taquito from bash scripts at https://github.com/InferenceAG/TezosSecurityBaselineChecking - diff --git a/integration-tests/contract-security-ticket-callback.spec.ts b/integration-tests/contract-security-ticket-callback.spec.ts index 640b66874b..4b51ebbbb6 100644 --- a/integration-tests/contract-security-ticket-callback.spec.ts +++ b/integration-tests/contract-security-ticket-callback.spec.ts @@ -6,14 +6,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify ticket is not easily created by a callback', async () => { + weeklynet('Verify ticket is not easily created by a callback', async () => { try { const opCaller = await Tezos.contract.originate({ code: ` { parameter (or (address %init) (ticket %setToken string)) ; diff --git a/integration-tests/contract-security-tickets-duplication.spec.ts b/integration-tests/contract-security-tickets-duplication.spec.ts index 44182f6734..a01e57c30c 100644 --- a/integration-tests/contract-security-tickets-duplication.spec.ts +++ b/integration-tests/contract-security-tickets-duplication.spec.ts @@ -7,14 +7,14 @@ import { CONFIGS } from './config'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify creating ticket is not possible with duplicate transaction operation - fail with internal_operation_replay', async () => { + weeklynet('Verify creating ticket is not possible with duplicate transaction operation - fail with internal_operation_replay', async () => { try { const opJoin = await Tezos.contract.originate({ code: ` { parameter (ticket string); @@ -84,7 +84,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify contract for ticket is not created with duplicate map containing tickets - fail with unexpected ticket', async () => { + weeklynet('Verify contract for ticket is not created with duplicate map containing tickets - fail with unexpected ticket', async () => { try { const opMapDup = await Tezos.contract.originate({ code: ` { parameter unit; @@ -119,7 +119,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { } }); - mondaynet('Verify contract for ticket is not created with a duplicate big_map containing tickets - fail with unexpected_ticket', async () => { + weeklynet('Verify contract for ticket is not created with a duplicate big_map containing tickets - fail with unexpected_ticket', async () => { try { const opGetter = await Tezos.contract.originate({ code: ` { parameter unit; diff --git a/integration-tests/contract-security-wrong-field-annotations.spec.ts b/integration-tests/contract-security-wrong-field-annotations.spec.ts index 6e6898b2ee..df06876304 100644 --- a/integration-tests/contract-security-wrong-field-annotations.spec.ts +++ b/integration-tests/contract-security-wrong-field-annotations.spec.ts @@ -3,59 +3,59 @@ import { CONFIGS } from './config'; import { securityWrongAnnotations } from './data/security-wrong-annotations-contract'; // TC-009: Check whether wrong field annotations are leading to failed transactions. -/** - * The annotation test TC-009 is a general test to check whether the smart contracts still behave/react the same way. - * It is basically to understand and know that the smart contract primitives are still working as we thought they are working. - * If they may suddenly (e.g. with a protocol upgrade) change, this may open a (security) issue (e.g. external contracts can no longer be +/** + * The annotation test TC-009 is a general test to check whether the smart contracts still behave/react the same way. + * It is basically to understand and know that the smart contract primitives are still working as we thought they are working. + * If they may suddenly (e.g. with a protocol upgrade) change, this may open a (security) issue (e.g. external contracts can no longer be * called, if annotation is done in a wrong way). - * With the current behavior of annotations, we sometimes suggest in our smart contract assessment to not use field annotations, - * when calling other contracts. E.g. if a DEX crafts his calls to external contract and does not use any annotations - * (https://github.com/InferenceAG/TezosSecurityBaselineChecking/blob/master/testcases/TC-009/execute_test.sh#L36), - * the DEX is still able to interact e.g. with smart contracts which are not FA1.2/FA2 compatible, because they are using wrong annotations + * With the current behavior of annotations, we sometimes suggest in our smart contract assessment to not use field annotations, + * when calling other contracts. E.g. if a DEX crafts his calls to external contract and does not use any annotations + * (https://github.com/InferenceAG/TezosSecurityBaselineChecking/blob/master/testcases/TC-009/execute_test.sh#L36), + * the DEX is still able to interact e.g. with smart contracts which are not FA1.2/FA2 compatible, because they are using wrong annotations * (e.g. "to" instead of "to_" for FA2 transfer entrypoints). - * + * * The contract used has six entrypoints: - * + * * entrypoint: parameter: - * + * * add (pair %add (nat %valueA) (nat %valueB)) * addNoAnnot (pair %addNoAnnot nat nat) * addWrongAnnot (pair %addWrongAnnot (nat %a) (nat %b)) - * + * * call (pair %call (string %entrypoint) (pair %param (nat %valueA) (nat %valueB))) * callNoAnnot (pair %callNoAnnot (string %entrypoint) (pair %param nat nat)) * callWrongAnnot (pair %callWrongAnnot (string %entrypoint) (pair %param (nat %a) (nat %b))) - * + * * The test checks 9 cases: For each call entrypoint the tests call each of the three add entrypoints. - * Its not entriely clear what should happen in each case. - * - * For example, - * the first case calls "add" and passes nat %valueA and nat %valueB to CONTRACT %add (pair (nat %valueA) (nat %valueB)), so the annots and params match - * the second case calls "addNoAnnot" and passes nat and nat to CONTRACT %addNoAnnot (pair (nat %valueA) (nat %valueB)), and here the annots and params + * Its not entriely clear what should happen in each case. + * + * For example, + * the first case calls "add" and passes nat %valueA and nat %valueB to CONTRACT %add (pair (nat %valueA) (nat %valueB)), so the annots and params match + * the second case calls "addNoAnnot" and passes nat and nat to CONTRACT %addNoAnnot (pair (nat %valueA) (nat %valueB)), and here the annots and params * do not match because there are no annots. - * the third case calls "addWrongAnnot" and passes nat a and nat b (where a and b are the annots) to CONTRACT %add (pair nat nat) and here the annots + * the third case calls "addWrongAnnot" and passes nat a and nat b (where a and b are the annots) to CONTRACT %add (pair nat nat) and here the annots * and params do not match. - * - * When run the tests get unexpected exceptions such as + * + * When run the tests get unexpected exceptions such as * [a] Value is not a number: undefined * [valueA] Value is not a number: undefined - * - * With Jakarta there is a change regarding Annotations: https://tezos.gitlab.io/protocols/013_jakarta.html#michelson. + * + * With Jakarta there is a change regarding Annotations: https://tezos.gitlab.io/protocols/013_jakarta.html#michelson. * This means the sub testcases 3 & 7 in TC-009 will behave differently in Jakarta. - * + * */ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts to verify wrong field annotations are leading to failed transactions using: ${rpc}`, () => { beforeEach(async () => { await setup(); }); - mondaynet('Verify annotation combinations on mondaynet', async () => { + weeklynet('Verify annotation combinations on weeklynet', async () => { const addition = await Tezos.contract.originate({ code: securityWrongAnnotations, init: `0`, diff --git a/integration-tests/contract-security-zero-transfer.spec.ts b/integration-tests/contract-security-zero-transfer.spec.ts index e47c91c8da..43d11c9115 100644 --- a/integration-tests/contract-security-zero-transfer.spec.ts +++ b/integration-tests/contract-security-zero-transfer.spec.ts @@ -5,7 +5,7 @@ import { Protocols } from '@taquito/taquito'; CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { const Tezos = lib; - const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; + const weeklynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`Test contracts using: ${rpc}`, () => { beforeEach(async () => { @@ -13,7 +13,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { }); - mondaynet('Verify that Transactions of 0ꜩ towards a contract without code are forbidden', async () => { + weeklynet('Verify that Transactions of 0ꜩ towards a contract without code are forbidden', async () => { try { const op = await Tezos.contract.originate({ code: `{ parameter address ; diff --git a/integration-tests/contract-smart-rollup-originate.spec.ts b/integration-tests/contract-smart-rollup-originate.spec.ts index 77ca16ee1b..fb6b5f1c69 100644 --- a/integration-tests/contract-smart-rollup-originate.spec.ts +++ b/integration-tests/contract-smart-rollup-originate.spec.ts @@ -19,7 +19,6 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { await op.confirmation(); expect(op.status).toEqual('applied'); - expect(op.originationProof).toBeDefined(); expect(op.kernel).toEqual('23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a'); }); }); diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index 7fb8213441..bed2448a64 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -22,6 +22,7 @@ import { codeViewsTopLevel, storageViewsTopLevel } from './contract_views_top_le import { MichelsonV1Expression, OpKind, PvmKind } from '@taquito/rpc'; import { emitCode } from './code_with_emit'; import { lambdaRecCode } from './code_with_lambda_rec'; +import { timelockCode, timelockStorage, timelockExpected } from './timelock-flip-contract'; function extractOp( startIndex: number, @@ -48,40 +49,61 @@ interface TestCase { expected?: object; } -export const nairobiCases: TestCase[] = [ +export const oxfordCases: TestCase[] = [ { - name: 'Set deposits limit 1000000', + name: 'Origination of a contract that contains the types chest, chest_key and the instruction OPEN_CHEST', operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', contents: [ { - kind: OpKind.SET_DEPOSITS_LIMIT, + kind: OpKind.ORIGINATION, counter: '1', source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', fee: '10000', gas_limit: '10', storage_limit: '10', - limit: '1000000', + balance: '0', + script: { + code: timelockCode, + storage: timelockStorage, + }, }, ], }, - }, - { - name: 'Unset deposits limit', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + expected: { + branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', contents: [ { - kind: OpKind.SET_DEPOSITS_LIMIT, + kind: OpKind.ORIGINATION, counter: '1', source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', fee: '10000', gas_limit: '10', - storage_limit: '10' + storage_limit: '10', + balance: '0', + script: { + code: timelockExpected, + storage: timelockStorage, + }, }, ], }, }, + { + name: 'Attestation', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.ATTESTATION, + slot: 0, + level: 66299, + round: 5, + block_payload_hash: 'vh3FEkypvxUYLwjGYd2Sme7aWyfX8npDsqxcL6imVpBWnAZeNn2n', + } + ] + } + } ]; export const commonCases: TestCase[] = [ @@ -134,6 +156,40 @@ export const commonCases: TestCase[] = [ ], }, }, + + { + name: 'Set deposits limit 1000000', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.SET_DEPOSITS_LIMIT, + counter: '1', + source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', + fee: '10000', + gas_limit: '10', + storage_limit: '10', + limit: '1000000', + }, + ], + }, + }, + { + name: 'Unset deposits limit', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.SET_DEPOSITS_LIMIT, + counter: '1', + source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', + fee: '10000', + gas_limit: '10', + storage_limit: '10' + }, + ], + }, + }, { name: 'Seed nonce revelation', operation: { @@ -147,6 +203,39 @@ export const commonCases: TestCase[] = [ ], }, }, + { + name: 'Set deposits limit 1000000', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.SET_DEPOSITS_LIMIT, + counter: '1', + source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', + fee: '10000', + gas_limit: '10', + storage_limit: '10', + limit: '1000000', + }, + ], + }, + }, + { + name: 'Unset deposits limit', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.SET_DEPOSITS_LIMIT, + counter: '1', + source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', + fee: '10000', + gas_limit: '10', + storage_limit: '10' + }, + ], + }, + }, { name: 'Proposals', operation: { @@ -1171,21 +1260,6 @@ export const commonCases: TestCase[] = [ ], }, }, - { - name: 'Endorsement', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', - contents: [ - { - kind: OpKind.ENDORSEMENT, - slot: 0, - level: 66299, - round: 5, - block_payload_hash: 'vh3FEkypvxUYLwjGYd2Sme7aWyfX8npDsqxcL6imVpBWnAZeNn2n', - }, - ], - }, - }, { name: `Origination of a contract that contains the instructions SUB_MUTEZ`, operation: { @@ -1363,8 +1437,6 @@ export const commonCases: TestCase[] = [ pvm_kind: PvmKind.WASM2, kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, diff --git a/integration-tests/data/code_with_lambda_rec.ts b/integration-tests/data/code_with_lambda_rec.ts index f187aeb3b1..98aa836372 100644 --- a/integration-tests/data/code_with_lambda_rec.ts +++ b/integration-tests/data/code_with_lambda_rec.ts @@ -1,4 +1,4 @@ -// https://gitlab.com/tezos/tezos/-/blob/master/src/proto_015_PtLimaPt/lib_protocol/test/regression/contracts/rec_id_unit.tz +// https://gitlab.com/tezos/tezos/-/blob/master/src/proto_018_Proxford/lib_protocol/test/regression/contracts/rec_id_unit.tz export const lambdaRecCode = [ { prim: 'parameter', args: [ { prim: 'unit' } ] }, { prim: 'storage', args: [ { prim: 'unit' } ] }, diff --git a/integration-tests/data/code_with_ticket_transfer.ts b/integration-tests/data/code_with_ticket_transfer.ts index 49ed36b2b2..7d399fe7f2 100644 --- a/integration-tests/data/code_with_ticket_transfer.ts +++ b/integration-tests/data/code_with_ticket_transfer.ts @@ -1,4 +1,4 @@ -// https://gitlab.com/tezos/tezos/-/blob/master/tezt/tests/expected/tickets.ml/Mumbai-%20Send%20tickets%20between%20originated%20contracts%20and%20implicit%20accounts.out +// https://gitlab.com/tezos/tezos/-/blob/master/tezt/tests/expected/tickets.ml/Oxford-%20Send%20tickets%20between%20originated%20contracts%20and%20implicit%20accounts.out export const ticketsSendTz = `{ parameter (pair address nat) ;storage unit ;code { CAR ; UNPAIR ; CONTRACT (ticket string) ; IF_NONE { PUSH string "Contract not found" ; FAILWITH } { PUSH mutez 0 ; DIG 2 ; PUSH string "Ticket" ; TICKET ; ASSERT_SOME ; TRANSFER_TOKENS ; PUSH unit Unit ; NIL operation ; DIG 2 ; CONS ; PAIR } } }` export const ticketsBagTz = `{ parameter (or (ticket %save string) (address %send)) ; storage (list (ticket string)) ; code { UNPAIR ; IF_LEFT { CONS ; NIL operation ; PAIR } { SWAP ; IF_CONS { DIG 2 ; CONTRACT %ticket (ticket string) ; ASSERT_SOME ; PUSH mutez 0 ; DIG 2 ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS ; PAIR } { PUSH string "no ticket to send" ; FAILWITH } } } }` diff --git a/integration-tests/data/contract-txr1-address.ts b/integration-tests/data/contract-txr1-address.ts deleted file mode 100644 index b8942c78cf..0000000000 --- a/integration-tests/data/contract-txr1-address.ts +++ /dev/null @@ -1,52 +0,0 @@ -export const contractWithTxr1Address = [{ - "prim": "parameter", - "args": [ - { - "prim": "or", - "args": [ - { - "prim": "map", - "args": [{ "prim": "address" }, { "prim": "int" }], - "annots": ["%setAddressMap"] - }, - { - "prim": "set", "args": [{ "prim": "address" }], - "annots": ["%setAddressSet"] - }] - } - ] -}, -{ - "prim": "storage", - "args": [ - { - "prim": "pair", - "args": - [{ - "prim": "map", - "args": [{ "prim": "address" }, { "prim": "int" }], - "annots": ["%addressMap"] - }, - { - "prim": "set", "args": [{ "prim": "address" }], - "annots": ["%addressSet"] - }] - } - ] -}, -{ - "prim": "code", - "args": [ - [{ "prim": "UNPAIR" }, - { - "prim": "IF_LEFT", - "args": - [[{ "prim": "SWAP" }, { "prim": "CDR" }, { "prim": "SWAP" }, - { "prim": "PAIR" }], - [{ "prim": "SWAP" }, { "prim": "CAR" }, { "prim": "PAIR" }]] - }, - { "prim": "NIL", "args": [{ "prim": "operation" }] }, - { "prim": "PAIR" }] - ] - -}] diff --git a/integration-tests/data/metadataViews.ts b/integration-tests/data/metadataViews.ts index c8a9c23e0c..6f084448a8 100644 --- a/integration-tests/data/metadataViews.ts +++ b/integration-tests/data/metadataViews.ts @@ -42,8 +42,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -66,12 +65,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -83,8 +77,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -108,12 +101,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -125,8 +113,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -150,12 +137,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -167,8 +149,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -192,12 +173,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -209,8 +185,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -234,12 +209,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -276,7 +246,7 @@ export const metadataViewsExample2 = { { michelsonStorageView: { parameter: { prim: 'int', args: [], annots: [ '%the_decisive_argument' ] }, - returnType: { prim: 'int', args: [], annots: [ '%negative_even_number' ] }, + returnType: { prim: 'int', args: [] }, code: [ { prim: 'CAR', args: [], annots: [] }, { prim: 'DUP', args: [], annots: [] }, @@ -303,10 +273,6 @@ export const metadataViewsExample2 = { { name: '%the_decisive_argument', description: 'The integer argument if >0 this will fail.' - }, - { - name: '%negative_even_number', - description: 'The result, if any, is twice the argument (%the_decisive_argument).' } ] } @@ -322,7 +288,7 @@ export const metadataViewsExample2 = { { michelsonStorageView: { parameter: { prim: 'nat', args: [], annots: [] }, - returnType: { prim: 'nat', args: [], annots: [] }, + returnType: { prim: 'nat', args: [] }, code: [ { prim: 'DUP', args: [], annots: [] }, { prim: 'CDR', args: [], annots: [] }, @@ -602,18 +568,13 @@ export const metadataViewsExample2 = { implementations: [ { michelsonStorageView: { - returnType: { prim: 'address', args: [], annots: [ '%ret' ] }, + returnType: { prim: 'address', args: [] }, code: [ { prim: 'DROP', args: [], annots: [] }, { prim: 'SELF', args: [], annots: [] }, { prim: 'ADDRESS', args: [], annots: [] } ], - annotations: [ - { - name: '%ret', - description: 'The address of the (any) contract, re-obtained in Michelson.' - } - ] + annotations: [] } } ] diff --git a/integration-tests/data/timelock-flip-contract.ts b/integration-tests/data/timelock-flip-contract.ts new file mode 100644 index 0000000000..1020f1fffb --- /dev/null +++ b/integration-tests/data/timelock-flip-contract.ts @@ -0,0 +1,854 @@ +// https://gitlab.com/tezos/tezos/-/blob/master/src/proto_018_Proxford/lib_protocol/contracts/timelock_flip.tz + +export const timelockStorage = { + "prim": "Pair", + "args": [ + { + "int": "0" + }, + { + "prim": "Pair", + "args": [ + { + "bytes": "e0d984a0e19fd7e7a4ac90dc9bf7e59288e8d8b0a0ca8bf988cae8fa90dbc584c2ee91a1f5d1a1d8d695f58bd1c7b1e4c0b9f384918a89dfd4eff5c3fbaff7e5d68de19088c5fdc08286f18bc7d1c4f99590f3bfd881c68d97bf91d2d4d2ded688d993e59b8aac84b798eed496a1e2dff9cfc1e3c793a8eea1fbf3a8c6c895bb8d8dedded3ed80b4848cb9ddb0c2f1ea98b8a6c3b6c691f2e787afc9bc8dd386a4b08392bbb7c1b6cdbaa6ec98a1fc96ecb287d5f6e39892aea199f4bf91e89bb8e7b58dc4f5d5bfec88ba99d1efc7c98aabe6bebbeeb4b589a383a6f581e69edbe2a4e7db8cb7e4ab8390b6f7c4c6ba9ee7c1f8d7e0f2aba5bf97cdbb85ca8dd0f7dff8fd95a1a9a68dd3b283a5f9fc93a2e7acafc4cbbeb3b2f8fe8faf97c5d2fae681081fe2a28ce94b55c47fe6a2927dc36c403067a86e36a163000000001a7c31a45bcb9934e3089cbc023a0bebe815ee2f646a0d344469f7" + }, + { + "prim": "Pair", + "args": [ + { + "bytes": "01" + }, + { + "bytes": "01" + } + ] + } + ] + } + ] +} + +export const timelockCode = [ + { + "prim": "storage", + "args": [ + { + "prim": "pair", + "args": [ + { + "prim": "nat", + "annots": [ + "%level" + ] + }, + { + "prim": "chest" + }, + { + "prim": "bytes", + "annots": [ + "%guess" + ] + }, + { + "prim": "bytes", + "annots": [ + "%result" + ] + } + ] + } + ] + }, + { + "prim": "parameter", + "args": [ + { + "prim": "or", + "args": [ + { + "prim": "chest", + "annots": [ + "%initialize_game" + ] + }, + { + "prim": "or", + "args": [ + { + "prim": "bytes", + "annots": [ + "%guess" + ] + }, + { + "prim": "chest_key", + "annots": [ + "%finish_game" + ] + } + ] + } + ] + } + ] + }, + { + "prim": "code", + "args": [ + [ + { + "prim": "UNPAIR", + "args": [ + { + "int": "5" + } + ] + }, + { + "prim": "IF_LEFT", + "args": [ + [ + { + "prim": "DIP", + "args": [ + [ + { + "prim": "DROP", + "args": [ + { + "int": "4" + } + ] + } + ] + ] + }, + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "A0" + } + ] + }, + { + "prim": "DUP" + }, + { + "prim": "PAIR" + }, + { + "prim": "SWAP" + }, + { + "prim": "LEVEL" + }, + { + "prim": "PAIR", + "args": [ + { + "int": "3" + } + ] + } + ], + [ + { + "prim": "IF_LEFT", + "args": [ + [ + { + "prim": "SWAP" + }, + { + "prim": "DUP" + }, + { + "prim": "PUSH", + "args": [ + { + "prim": "nat" + }, + { + "int": "10" + } + ] + }, + { + "prim": "ADD" + }, + { + "prim": "LEVEL" + }, + { + "prim": "COMPARE" + }, + { + "prim": "LE" + }, + { + "prim": "IF", + "args": [ + [ + { + "prim": "DIP", + "args": [ + { + "int": "2" + }, + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "B0" + } + ] + } + ] + ] + }, + { + "prim": "DIP", + "args": [ + [ + { + "prim": "PAIR" + }, + { + "prim": "SWAP" + }, + { + "prim": "PAIR" + } + ] + ] + }, + { + "prim": "PAIR" + }, + { + "prim": "DIP", + "args": [ + [ + { + "prim": "DROP", + "args": [ + { + "int": "2" + } + ] + } + ] + ] + } + ], + [ + { + "prim": "SWAP" + }, + { + "prim": "DROP" + }, + { + "prim": "PAIR", + "args": [ + { + "int": "4" + } + ] + } + ] + ] + } + ], + [ + { + "prim": "DIP", + "args": [ + { + "int": "4" + }, + [ + { + "prim": "DROP" + } + ] + ] + }, + { + "prim": "DUP", + "args": [ + { + "int": "3" + } + ] + }, + { + "prim": "SWAP" + }, + { + "prim": "DIP", + "args": [ + { + "int": "2" + }, + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "nat" + }, + { + "int": "1024" + } + ] + } + ] + ] + }, + { + "prim": "OPEN_CHEST" + }, + [ + { + "prim": "IF_NONE", + "args": [ + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "10" + } + ] + } + ], + [ + { + "prim": "DUP", + "args": [ + { + "int": "4" + } + ] + }, + { + "prim": "COMPARE" + }, + { + "prim": "EQ" + }, + { + "prim": "IF", + "args": [ + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "00" + } + ] + } + ], + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "01" + } + ] + } + ] + ] + } + ] + ] + } + ], + { + "prim": "DIG", + "args": [ + { + "int": "3" + } + ] + }, + { + "prim": "PAIR" + }, + { + "prim": "DIG", + "args": [ + { + "int": "2" + } + ] + }, + { + "prim": "PAIR" + }, + { + "prim": "DIG", + "args": [ + { + "int": "1" + } + ] + }, + { + "prim": "PAIR" + } + ] + ] + } + ] + ] + }, + { + "prim": "NIL", + "args": [ + { + "prim": "operation" + } + ] + }, + { + "prim": "PAIR" + } + ] + ] + } +] + +// parse bytes will be lowercased ref https://github.com/ecadlabs/taquito/pull/1623 +export const timelockExpected = [ + { + "prim": "storage", + "args": [ + { + "prim": "pair", + "args": [ + { + "prim": "nat", + "annots": [ + "%level" + ] + }, + { + "prim": "chest" + }, + { + "prim": "bytes", + "annots": [ + "%guess" + ] + }, + { + "prim": "bytes", + "annots": [ + "%result" + ] + } + ] + } + ] + }, + { + "prim": "parameter", + "args": [ + { + "prim": "or", + "args": [ + { + "prim": "chest", + "annots": [ + "%initialize_game" + ] + }, + { + "prim": "or", + "args": [ + { + "prim": "bytes", + "annots": [ + "%guess" + ] + }, + { + "prim": "chest_key", + "annots": [ + "%finish_game" + ] + } + ] + } + ] + } + ] + }, + { + "prim": "code", + "args": [ + [ + { + "prim": "UNPAIR", + "args": [ + { + "int": "5" + } + ] + }, + { + "prim": "IF_LEFT", + "args": [ + [ + { + "prim": "DIP", + "args": [ + [ + { + "prim": "DROP", + "args": [ + { + "int": "4" + } + ] + } + ] + ] + }, + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "a0" + } + ] + }, + { + "prim": "DUP" + }, + { + "prim": "PAIR" + }, + { + "prim": "SWAP" + }, + { + "prim": "LEVEL" + }, + { + "prim": "PAIR", + "args": [ + { + "int": "3" + } + ] + } + ], + [ + { + "prim": "IF_LEFT", + "args": [ + [ + { + "prim": "SWAP" + }, + { + "prim": "DUP" + }, + { + "prim": "PUSH", + "args": [ + { + "prim": "nat" + }, + { + "int": "10" + } + ] + }, + { + "prim": "ADD" + }, + { + "prim": "LEVEL" + }, + { + "prim": "COMPARE" + }, + { + "prim": "LE" + }, + { + "prim": "IF", + "args": [ + [ + { + "prim": "DIP", + "args": [ + { + "int": "2" + }, + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "b0" + } + ] + } + ] + ] + }, + { + "prim": "DIP", + "args": [ + [ + { + "prim": "PAIR" + }, + { + "prim": "SWAP" + }, + { + "prim": "PAIR" + } + ] + ] + }, + { + "prim": "PAIR" + }, + { + "prim": "DIP", + "args": [ + [ + { + "prim": "DROP", + "args": [ + { + "int": "2" + } + ] + } + ] + ] + } + ], + [ + { + "prim": "SWAP" + }, + { + "prim": "DROP" + }, + { + "prim": "PAIR", + "args": [ + { + "int": "4" + } + ] + } + ] + ] + } + ], + [ + { + "prim": "DIP", + "args": [ + { + "int": "4" + }, + [ + { + "prim": "DROP" + } + ] + ] + }, + { + "prim": "DUP", + "args": [ + { + "int": "3" + } + ] + }, + { + "prim": "SWAP" + }, + { + "prim": "DIP", + "args": [ + { + "int": "2" + }, + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "nat" + }, + { + "int": "1024" + } + ] + } + ] + ] + }, + { + "prim": "OPEN_CHEST" + }, + [ + { + "prim": "IF_NONE", + "args": [ + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "10" + } + ] + } + ], + [ + { + "prim": "DUP", + "args": [ + { + "int": "4" + } + ] + }, + { + "prim": "COMPARE" + }, + { + "prim": "EQ" + }, + { + "prim": "IF", + "args": [ + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "00" + } + ] + } + ], + [ + { + "prim": "PUSH", + "args": [ + { + "prim": "bytes" + }, + { + "bytes": "01" + } + ] + } + ] + ] + } + ] + ] + } + ], + { + "prim": "DIG", + "args": [ + { + "int": "3" + } + ] + }, + { + "prim": "PAIR" + }, + { + "prim": "DIG", + "args": [ + { + "int": "2" + } + ] + }, + { + "prim": "PAIR" + }, + { + "prim": "DIG", + "args": [ + { + "int": "1" + } + ] + }, + { + "prim": "PAIR" + } + ] + ] + } + ] + ] + }, + { + "prim": "NIL", + "args": [ + { + "prim": "operation" + } + ] + }, + { + "prim": "PAIR" + } + ] + ] + } +] \ No newline at end of file diff --git a/integration-tests/known-contracts-ProxfordY.ts b/integration-tests/known-contracts-ProxfordY.ts new file mode 100644 index 0000000000..552641d1ec --- /dev/null +++ b/integration-tests/known-contracts-ProxfordY.ts @@ -0,0 +1,8 @@ +import { KnownContracts } from './known-contracts'; +export const knownContractsProxfordY: KnownContracts = { + contract: "KT1UTWPed6L8pNmWJJhPgwLELxmpua18nvZB", + bigMapContract: "KT1TpJY5K5wg9dYgMhLpcvmPnreE4trxkCdh", + tzip12BigMapOffChainContract: "KT1PxJcsmPm365VGCbopTz7411kwF7u1mFkv", + saplingContract: "KT1PPnjL9TudMnZ23UmnGkCLbZ7TiMjNUVhe", + onChainViewContractAddress: "KT1Mc9DhvGtZPCg5TobjZdgHheCmDERUYCTj", +}; diff --git a/integration-tests/known-contracts-PtMumbai2.ts b/integration-tests/known-contracts-PtMumbai2.ts deleted file mode 100644 index 70b3d80206..0000000000 --- a/integration-tests/known-contracts-PtMumbai2.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { KnownContracts } from './known-contracts'; -export const knownContractsPtMumbai2: KnownContracts = { - contract: "KT1XFiUYC36XSeLTanGJwZxqLzsxz9zquLFB", - bigMapContract: "KT1KbbvszHoWVSS8Nzh9yLgvRBDkzVjKmCtj", - tzip12BigMapOffChainContract: "KT1KKU19PxFbQUT9sBJS8KwYCVaXAzYsTkUK", - saplingContract: "KT1UHkJDY1CWAgYZJR1NkxXv27gsuu7hC77R", - onChainViewContractAddress: "KT1JxWH1vtMiTcvg4AdhTaGmyHt2oBb71tzW" -}; diff --git a/integration-tests/known-contracts-PtNairobi.ts b/integration-tests/known-contracts-PtNairobi.ts deleted file mode 100644 index 2e329bcabd..0000000000 --- a/integration-tests/known-contracts-PtNairobi.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { KnownContracts } from './known-contracts'; -export const knownContractsPtNairobi: KnownContracts = { - contract: "KT1GrzF7DSNc7LrLmS7RNaLrBQqyYHyoMzwR", - bigMapContract: "KT1Twd6GBBqHEFhzvBDEn4JiUopttq2WjdnF", - tzip12BigMapOffChainContract: "KT1WZUqEKZ4TMW75FKpqod4HwB4ts7wbnsFh", - saplingContract: "KT1VNnD8NWx9ep2gxsHbzrmahrWsKpZb3xGY", - onChainViewContractAddress: "KT19eNryXTuVgH6s6cUc1a5LyjSamdBw4JXo" -}; diff --git a/integration-tests/local-forging.spec.ts b/integration-tests/local-forging.spec.ts index 25a9435c4e..636b85e7e6 100644 --- a/integration-tests/local-forging.spec.ts +++ b/integration-tests/local-forging.spec.ts @@ -1,16 +1,17 @@ import { CONFIGS } from "./config"; -import { commonCases, nairobiCases } from './data/allTestsCases'; +import { commonCases, oxfordCases } from './data/allTestsCases'; import { LocalForger, ProtocolsHash } from '@taquito/local-forging' import { Protocols, TezosToolkit } from "@taquito/taquito"; +import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; CONFIGS().forEach(({ rpc, protocol }) => { const Tezos = new TezosToolkit(rpc); - const nairobinet = protocol === Protocols.PtNairobi ? it : it.skip; + const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip describe(`Test local forger: ${rpc}`, () => { // all protocols - nairobiCases.forEach(({ name, operation, expected }) => { - nairobinet(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { + oxfordCases.forEach(({ name, operation, expected }) => { + oxfordAndAlpha(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { const localForger = new LocalForger(protocol as unknown as ProtocolsHash); const result = await localForger.forge(operation); const rpcResult = await Tezos.rpc.forgeOperations(operation); diff --git a/integration-tests/package.json b/integration-tests/package.json index 2b6a71031f..60e6272c42 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -1,35 +1,37 @@ { "name": "integration-tests", "scripts": { + "test": "jest", "test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand", - "test:nairobinet": "NAIROBINET=true jest", - "test:nairobinet-secret-key": "RUN_NAIROBINET_WITH_SECRET_KEY=true jest --runInBand", - "test:originate-known-contracts": "node -r ts-node/register originate-known-contracts.ts", - "originate-known-contracts-and-run-test": "node -r ts-node/register originate-known-contracts.ts && jest", - "test:mondaynet": "MONDAYNET=true jest", - "test:mondaynet-secret-key": "RUN_MONDAYNET_WITH_SECRET_KEY=true jest --runInBand", - "test": "jest" + "test:oxfordnet": "OXFORDNET=true jest", + "test:oxfordnet-secret-key": "RUN_OXFORDNET_WITH_SECRET_KEY=true jest --runInBand", + "test:weeklynet": "WEEKLYNET=true jest", + "test:weeklynet-secret-key": "RUN_WEEKLYNET_WITH_SECRET_KEY=true jest --runInBand", + "test:ghostnet": "GHOSTNET=true jest", + "test:ghostnet-secret-key": "RUN_GHSOTNET_WITH_SECRET_KEY=true jest --runInBand", + "originate-known-contracts": "node -r ts-node/register originate-known-contracts.ts", + "originate-known-contracts-and-run-test": "node -r ts-node/register originate-known-contracts.ts && jest" }, - "version": "17.5.2", + "version": "19.0.0", "dependencies": { "@ledgerhq/devices": "8.0.7", "@ledgerhq/hw-transport": "6.28.8", "@ledgerhq/hw-transport-node-hid": "6.27.21", "@ledgerhq/hw-transport-node-hid-noevents": "6.27.19", - "@taquito/contracts-library": "^17.5.2", - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/local-forging": "^17.5.2", - "@taquito/michel-codec": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/remote-signer": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/sapling": "^17.5.2", - "@taquito/signer": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/tzip12": "^17.5.2", - "@taquito/tzip16": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/contracts-library": "^19.0.0", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/local-forging": "^19.0.0", + "@taquito/michel-codec": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/remote-signer": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/sapling": "^19.0.0", + "@taquito/signer": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/tzip12": "^19.0.0", + "@taquito/tzip16": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1" diff --git a/integration-tests/rpc-get-protocol-constants.spec.ts b/integration-tests/rpc-get-protocol-constants.spec.ts index d7a2eb605f..28591e5eee 100644 --- a/integration-tests/rpc-get-protocol-constants.spec.ts +++ b/integration-tests/rpc-get-protocol-constants.spec.ts @@ -2,13 +2,13 @@ import { Protocols } from "@taquito/taquito"; import { CONFIGS, NetworkType } from "./config"; import BigNumber from 'bignumber.js'; import { - ConstantsResponseProto017, + ConstantsResponseProto017, ConstantsResponseProto018, } from '@taquito/rpc'; CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { const Tezos = lib; - const nairobinet = (networkType == NetworkType.TESTNET && protocol === Protocols.PtNairobi) ? test : test.skip; - const mondaynet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProtoALpha) ? test : test.skip; + const oxfordnet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProxfordY) ? test : test.skip; + const weeklynet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProtoALpha) ? test : test.skip; describe('Test fetching constants for all protocols on Mainnet', () => { const rpcUrl = 'https://mainnet.ecadinfra.com/'; @@ -117,16 +117,41 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { zk_rollup_origination_size: 4000, }); }); - - }); describe(`Fetch constants for testnet`, () => { - nairobinet(`successfully fetches all constants for nairobinet using ${rpc}`, async () => { + oxfordnet(`successfully fetches all constants for oxfordnet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto017 = await Tezos.rpc.getConstants(); + const constants: ConstantsResponseProto018 = await Tezos.rpc.getConstants(); expect(constants).toEqual({ + + adaptive_issuance_activation_vote_enable: false, + adaptive_issuance_launch_ema_threshold: 100000000, + adaptive_rewards_params: { + center_dz: { + denominator: "2", + numerator: "1", + }, + growth_rate: { + denominator: "100", + numerator: "1", + }, + issuance_ratio_max: { + denominator: "20", + numerator: "1", + }, + issuance_ratio_min: { + denominator: "2000", + numerator: "1", + }, + max_bonus: "50000000000000", + radius_dz: { + denominator: "50", + numerator: "1", + }, + }, + autostaking_enable: true, proof_of_work_nonce_size: 8, nonce_length: 32, max_anon_ops_per_block: 132, @@ -138,7 +163,6 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { cache_layout_size: 3, michelson_maximum_type_size: 2001, smart_rollup_max_wrapped_proof_binary_size: 30000, - smart_rollup_message_size_limit: 4096, smart_rollup_max_number_of_messages_per_level: '1000000', preserved_cycles: 3, blocks_per_cycle: 8192, @@ -150,18 +174,25 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { hard_gas_limit_per_block: new BigNumber(2600000), proof_of_work_threshold: new BigNumber(-1), minimal_stake: new BigNumber(6000000000), - vdf_difficulty: new BigNumber(10000000000), - seed_nonce_revelation_tip: new BigNumber(125000), origination_size: 257, - baking_reward_fixed_portion: new BigNumber(2666666), - baking_reward_bonus_per_slot: new BigNumber(1143), - endorsing_reward_per_slot: new BigNumber(761), cost_per_byte: new BigNumber(250), hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, + percentage_of_frozen_deposits_slashed_per_double_baking: 5, + percentage_of_frozen_deposits_slashed_per_double_attestation: 50, + minimal_frozen_stake: '600000000', + limit_of_delegation_over_baking: 9, + issuance_weights: { + attesting_reward_weight: 10240, + baking_reward_bonus_weight: 5120, + baking_reward_fixed_portion_weight: 5120, + base_total_issued_per_minute: "85007812", + liquidity_baking_subsidy_weight: 1280, + seed_nonce_revelation_tip_weight: 1, + vdf_revelation_tip_weight: 1, + }, min_proposal_quorum: 500, - liquidity_baking_subsidy: new BigNumber(666666), + edge_of_staking_over_delegation: 2, + global_limit_of_staking_over_baking: 5, liquidity_baking_toggle_ema_threshold: 1000000000, max_operations_time_to_live: 240, minimal_block_delay: new BigNumber(8), @@ -173,63 +204,55 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { denominator: 3 }, max_slashing_period: 2, - frozen_deposits_percentage: 10, - double_baking_punishment: new BigNumber(640000000), - ratio_of_frozen_deposits_slashed_per_double_endorsement: { - numerator: 1, - denominator: 2 - }, - testnet_dictator: 'tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8', cache_script_size: 100000000, cache_stake_distribution_cycles: 8, cache_sampler_state_cycles: 8, - tx_rollup_enable: false, - tx_rollup_origination_size: 4000, - tx_rollup_hard_size_limit_per_inbox: 500000, - tx_rollup_hard_size_limit_per_message: 5000, - tx_rollup_max_withdrawals_per_batch: 15, - tx_rollup_commitment_bond: new BigNumber(10000000000), - tx_rollup_finality_period: 40000, - tx_rollup_withdraw_period: 40000, - tx_rollup_max_inboxes_count: 40100, - tx_rollup_max_messages_per_inbox: 1010, - tx_rollup_max_commitments_count: 80100, - tx_rollup_cost_per_byte_ema_factor: 120, - tx_rollup_max_ticket_payload_size: 2048, - tx_rollup_rejection_max_proof_size: 30000, - tx_rollup_sunset_level: 10000000, dal_parametric: { feature_enable: false, number_of_slots: 256, - attestation_lag: 1, + attestation_lag: 4, attestation_threshold: 50, - blocks_per_epoch: 32, + blocks_per_epoch: 1, redundancy_factor: 16, page_size: 4096, slot_size: 1048576, number_of_shards: 2048 }, - smart_rollup_enable: true, + quorum_max: 7000, + quorum_min: 2000, smart_rollup_arith_pvm_enable: false, - smart_rollup_origination_size: 6314, smart_rollup_challenge_window_in_blocks: 40, - smart_rollup_stake_amount: '10000000000', smart_rollup_commitment_period_in_blocks: 20, smart_rollup_max_lookahead_in_blocks: 30000, smart_rollup_max_active_outbox_levels: 20160, smart_rollup_max_outbox_messages_per_level: 100, - smart_rollup_number_of_sections_in_dissection: 32, - smart_rollup_timeout_period_in_blocks: 500, smart_rollup_max_number_of_cemented_commitments: 5, smart_rollup_max_number_of_parallel_games: 32, + smart_rollup_message_size_limit: 4096, + smart_rollup_number_of_sections_in_dissection: 32, + smart_rollup_origination_size: 6314, + smart_rollup_private_enable: true, + smart_rollup_reveal_activation_level: { + dal_page: 2147483646, + dal_parameters: 2147483646, + metadata: 0, + raw_data: { + Blake2B: 0, + }, + }, + smart_rollup_riscv_pvm_enable: false, + smart_rollup_stake_amount: '10000000000', + smart_rollup_timeout_period_in_blocks: 500, + testnet_dictator: 'tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8', + vdf_difficulty: new BigNumber(10000000000), zk_rollup_enable: false, + zk_rollup_max_ticket_payload_size: 2048, + zk_rollup_min_pending_to_process: 10, zk_rollup_origination_size: 4000, - zk_rollup_min_pending_to_process: 10 }); - }); - mondaynet(`successfully fetches all constants for mondaynet using ${rpc}`, async () => { + weeklynet(`successfully fetches all constants for weeklynet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); const constants: ConstantsResponseProto017 = await Tezos.rpc.getConstants(); @@ -324,7 +347,6 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { smart_rollup_arith_pvm_enable: true, smart_rollup_challenge_window_in_blocks: 40, smart_rollup_commitment_period_in_blocks: 20, - smart_rollup_enable: true, smart_rollup_max_active_outbox_levels: 20160, smart_rollup_max_lookahead_in_blocks: 30000, smart_rollup_max_number_of_cemented_commitments: 5, diff --git a/integration-tests/rpc-nodes.spec.ts b/integration-tests/rpc-nodes.spec.ts index 5f8a370307..092e12ee3c 100644 --- a/integration-tests/rpc-nodes.spec.ts +++ b/integration-tests/rpc-nodes.spec.ts @@ -1,10 +1,11 @@ import { CONFIGS } from './config'; -import { DefaultContractType } from "@taquito/taquito"; -import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperations, PvmKind } from '@taquito/rpc'; +import { DefaultContractType, Protocols } from "@taquito/taquito"; +import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperationsV1, PendingOperationsV2, PvmKind } from '@taquito/rpc'; import { encodeExpr } from '@taquito/utils'; import { Schema } from '@taquito/michelson-encoder'; import { tokenBigmapCode, tokenBigmapStorage } from './data/token_bigmap'; import { ticketCode, ticketStorage } from './data/code_with_ticket'; +import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; CONFIGS().forEach( ({ @@ -20,6 +21,7 @@ CONFIGS().forEach( }) => { const Tezos = lib; const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test; + const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip; let ticketContract: DefaultContractType; @@ -51,22 +53,22 @@ CONFIGS().forEach( const rpcClient = new RpcClientCache(new RpcClient(rpc)); describe(`Test calling all methods from RPC node: ${rpc}`, () => { - it('Verify rpcClient.getBlockHash returns the head block hash', async () => { + it('Verify that rpcClient.getBlockHash returns the head block hash', async () => { const blockHash = await rpcClient.getBlockHash(); expect(blockHash).toBeDefined(); }); - it('Verify rpcClient.getLiveBlocks returns the ancestors of the head block', async () => { + it('Verify that rpcClient.getLiveBlocks returns the ancestors of the head block', async () => { const liveBlocks = await rpcClient.getLiveBlocks(); expect(liveBlocks).toBeDefined(); }); - it(`Verify rpcClient.getBalance for known baker returns the balance of the address`, async () => { + it(`Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds`, async () => { const balance = await rpcClient.getBalance(knownBaker); expect(balance).toBeDefined(); }); - it(`Verify that rpcClient.getStorage for know contract returns the data of a contract`, async () => { + it(`Verify that rpcClient.getStorage for knownContract returns the data of a contract`, async () => { const storage = await rpcClient.getStorage(knownContract); expect(storage).toBeDefined(); }); @@ -130,7 +132,7 @@ CONFIGS().forEach( expect(delegates).toBeDefined(); }); - it(`Fetches voting information about a delegate from RPC`, async () => { + it(`Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC`, async () => { const votinInfo = await rpcClient.getVotingInfo(knownBaker); expect(votinInfo).toBeDefined(); }); @@ -164,6 +166,19 @@ CONFIGS().forEach( expect(bakingRights[0].priority).toBeUndefined(); }); + unrestrictedRPCNode('Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block', async () => { + const attestationRights = await rpcClient.getAttestationRights(); + expect(attestationRights).toBeDefined(); + expect(attestationRights[0].delegates).toBeDefined(); + expect(attestationRights[0].delegates![0].delegate).toBeDefined(); + expect(typeof attestationRights[0].delegates![0].delegate).toEqual('string'); + expect(attestationRights[0].delegates![0].attestation_power).toBeDefined(); + expect(typeof attestationRights[0].delegates![0].attestation_power).toEqual('number'); + expect(attestationRights[0].delegates![0].first_slot).toBeDefined(); + expect(typeof attestationRights[0].delegates![0].first_slot).toEqual('number'); + expect(attestationRights[0].delegate).toBeUndefined(); + }); + unrestrictedRPCNode('Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block', async () => { const endorsingRights = await rpcClient.getEndorsingRights(); expect(endorsingRights).toBeDefined(); @@ -445,8 +460,8 @@ CONFIGS().forEach( expect(ticketBalances[0].amount).toBeDefined(); }); - it('Verify that rpcClient.getPendingOperations will retrieve the pending operations in mempool', async () => { - const pendingOperations: PendingOperations = await rpcClient.getPendingOperations(); + it('Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied', async () => { + const pendingOperations = await rpcClient.getPendingOperations({ version: '1' }) as PendingOperationsV1; expect(pendingOperations).toBeDefined(); expect(pendingOperations.applied).toBeInstanceOf(Array); expect(pendingOperations.refused).toBeInstanceOf(Array); @@ -455,15 +470,15 @@ CONFIGS().forEach( expect(pendingOperations.branch_refused).toBeInstanceOf(Array); }); - it('Verify that rpcClient.getOriginationProof will retrieve the proof needed for smart rollup originate', async () => { - const proof = await rpcClient.getOriginationProof({ - kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - kind: PvmKind.WASM2 - }) - const hexRegex = RegExp('^[a-fA-F0-9]+$'); - expect(proof).toBeDefined(); - expect(hexRegex.test(proof)).toEqual(true); - }) + oxfordAndAlpha('Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated', async () => { + const pendingOperations = await rpcClient.getPendingOperations({ version: '2' }) as PendingOperationsV2; + expect(pendingOperations).toBeDefined(); + expect(pendingOperations.validated).toBeInstanceOf(Array); + expect(pendingOperations.refused).toBeInstanceOf(Array); + expect(pendingOperations.outdated).toBeInstanceOf(Array); + expect(pendingOperations.branch_delayed).toBeInstanceOf(Array); + expect(pendingOperations.branch_refused).toBeInstanceOf(Array); + }); }); }); } diff --git a/integration-tests/sandbox-env.sh b/integration-tests/sandbox-env.sh index a1c08ca0ea..15687a9c35 100755 --- a/integration-tests/sandbox-env.sh +++ b/integration-tests/sandbox-env.sh @@ -1,7 +1,7 @@ #!/bin/sh -export RUN_NAIROBINET_WITH_SECRET_KEY=true +export RUN_OXFORDNET_WITH_SECRET_KEY=true export SECRET_KEY=edsk3RFgDiCt7tWB2oe96w1eRw72iYiiqZPLu9nnEY23MYRp2d8Kkx -export TEZOS_RPC_NAIROBINET=http://localhost:20000 +export TEZOS_RPC_OXFORDNET=http://localhost:20000 export POLLING_INTERVAL_MILLISECONDS=100 export RPC_CACHE_MILLISECONDS=0 export TEZOS_BAKER=tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb diff --git a/integration-tests/wallet-failing-noop.spec.ts b/integration-tests/wallet-failing-noop.spec.ts index e5a5be32f2..e0746d3c77 100644 --- a/integration-tests/wallet-failing-noop.spec.ts +++ b/integration-tests/wallet-failing-noop.spec.ts @@ -1,63 +1,62 @@ +import { CONFIGS } from "./config"; +import { OpKind, TezosToolkit } from "@taquito/taquito"; import { InMemorySigner } from "@taquito/signer"; -import { CONFIGS, defaultSecretKey, isSandbox } from "./config"; -import { OpKind, Protocols, TezosToolkit } from "@taquito/taquito"; import { verifySignature } from "@taquito/utils"; -CONFIGS().forEach(({ rpc, setup, protocol }) => { +CONFIGS().forEach(({ rpc, lib }) => { + const aliceSKey = 'edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq' - const Tezos = new TezosToolkit(rpc); - Tezos.setSignerProvider(new InMemorySigner(defaultSecretKey.secret_key)); - const nairobinet = !isSandbox({ rpc }) && protocol === Protocols.PtNairobi ? it : it.skip; + describe(`Test failing_noop through wallet api using: ${rpc}`, () => { + let Tezos: TezosToolkit; - describe(`Test failing_noop through wallet api, based on head, and secret_key using: ${rpc}`, () => { - beforeEach(async () => { - await setup(); + beforeAll(async () => { + Tezos = lib; + Tezos.setSignerProvider(new InMemorySigner(aliceSKey)); }); - nairobinet('Verify that the wallet.signFailingNoop result is as expected when the block and private key are kept constant', async () => { + it('Verify that the wallet.failingNoop signs a text on the genesis block', async () => { const signed = await Tezos.wallet.signFailingNoop({ arbitrary: "48656C6C6F20576F726C64", // Hello World basedOnBlock: 0, }); - // This test is skipped from flextesa because the genesis block hash is not guaranteed to stay the same - // The signature will change if the hash of the genesis block changes (maybe when switching to a testnet based on a new protocol). - // Also it depends on the signing key. - // So if any of them changes, the expected values need to be adjusted - expect(signed).toEqual({ - bytes: 'df2788eed43ab680c8a2b79969ce4de93b9768cd2786a85ebdfba90ca7612638110000000b48656c6c6f20576f726c64', - signature: 'spsig1QVVCiQ6aN2zmut2wKTg4zWLoP9ia4qUY2hBo21odA7P25gqfieFWJMyntaJWmyrd6v3mgjKF5n4d2wcaB3LxkLmd1MoJQ', - signedContent: { - branch: 'BMQZWtQjSpyJZBVHbABEmVP9VG8yEZPZ3wNftwZdXt6A33ZYatj', - contents: [{ - kind: OpKind.FAILING_NOOP, - arbitrary: '48656C6C6F20576F726C64' - }] - } - }); - }); - }); - - describe(`Test failing_noop through wallet api using: ${rpc}`, () => { - beforeEach(async () => { - await setup(); + const pk = await Tezos.wallet.pk(); + expect(verifySignature(signed.bytes, pk!, signed.signature, new Uint8Array([3]))).toBe(true); }); - it('Verify that the wallet.signFailingNoop signs a text on the genesis block', async () => { + it('Verify that the wallet.failingNoop signs a text base on head block', async () => { const signed = await Tezos.wallet.signFailingNoop({ arbitrary: "48656C6C6F20576F726C64", // Hello World - basedOnBlock: 0, + basedOnBlock: 'head', }); const pk = await Tezos.wallet.pk(); expect(verifySignature(signed.bytes, pk!, signed.signature, new Uint8Array([3]))).toBe(true); }); + }); - it('Verify that the wallet.signFailingNoop signs a text based on head block', async () => { - const signed = await Tezos.wallet.signFailingNoop({ + describe(`Test failing_noop through wallet api, based on genesis and secret_key on mainnet`, () => { + let Mainnet: TezosToolkit; + + beforeAll(async () => { + Mainnet = new TezosToolkit('https://rpc.tzkt.io/mainnet'); // this is an archive node public rpc url for mainnet + Mainnet.setSignerProvider(new InMemorySigner(aliceSKey)); + }); + + it('Verify that the wallet.failingNoop result is as expected when the block and secret key are kept constant', async () => { + const signed = await Mainnet.wallet.signFailingNoop({ arbitrary: "48656C6C6F20576F726C64", // Hello World - basedOnBlock: 'head', + basedOnBlock: 0, + }); + expect(signed).toEqual({ + bytes: '8fcf233671b6a04fcf679d2a381c2544ea6c1ea29ba6157776ed8424c7ccd00b110000000b48656c6c6f20576f726c64', + signature: 'edsigtYFkwJo6uVY5J1KnjnMFsj3Y1MKD9vqmtX2sF2u6yyg6fLJWn6Cy1CcbwJAkmEq5Zxvh49uYkMtHHGbeBm8LqBJg2uYjqG', + signedContent: { + branch: 'BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2', + contents: [{ + kind: OpKind.FAILING_NOOP, + arbitrary: '48656C6C6F20576F726C64' + }] + } }); - const pk = await Tezos.wallet.pk(); - expect(verifySignature(signed.bytes, pk!, signed.signature, new Uint8Array([3]))).toBe(true); }); }); }) diff --git a/lerna.json b/lerna.json index d9f562317f..dcc1499a6e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "useNx": true, - "version": "17.5.2" + "version": "19.0.0" } diff --git a/package-lock.json b/package-lock.json index e46095c647..cae4af857a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,13 +56,13 @@ }, "apps/taquito-test-dapp": { "name": "taquito-test-dapp-vite", - "version": "17.5.2", + "version": "19.0.0", "dependencies": { "@airgap/beacon-sdk": "4.1.0", - "@taquito/beacon-wallet": "^17.5.2", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/beacon-wallet": "^19.0.0", + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "buffer": "^6.0.3", "svelte-select": "^5.7.0", "vite-compatible-readable-stream": "^3.6.1" @@ -84,19 +84,19 @@ }, "example": { "name": "@taquito/example", - "version": "17.5.2", + "version": "19.0.0", "dependencies": { "@ledgerhq/hw-transport-node-hid": "^6.27.21", - "@taquito/ledger-signer": "^17.5.2", - "@taquito/local-forging": "^17.5.2", - "@taquito/michel-codec": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/sapling": "^17.5.2", - "@taquito/signer": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/tzip16": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/ledger-signer": "^19.0.0", + "@taquito/local-forging": "^19.0.0", + "@taquito/michel-codec": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/sapling": "^19.0.0", + "@taquito/signer": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/tzip16": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -105,26 +105,26 @@ } }, "integration-tests": { - "version": "17.5.2", + "version": "19.0.0", "dependencies": { "@ledgerhq/devices": "8.0.7", "@ledgerhq/hw-transport": "6.28.8", "@ledgerhq/hw-transport-node-hid": "6.27.21", "@ledgerhq/hw-transport-node-hid-noevents": "6.27.19", - "@taquito/contracts-library": "^17.5.2", - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/local-forging": "^17.5.2", - "@taquito/michel-codec": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/remote-signer": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/sapling": "^17.5.2", - "@taquito/signer": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/tzip12": "^17.5.2", - "@taquito/tzip16": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/contracts-library": "^19.0.0", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/local-forging": "^19.0.0", + "@taquito/michel-codec": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/remote-signer": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/sapling": "^19.0.0", + "@taquito/signer": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/tzip12": "^19.0.0", + "@taquito/tzip16": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1" @@ -21938,17 +21938,17 @@ }, "packages/taquito": { "name": "@taquito/taquito", - "version": "17.5.2", + "version": "19.0.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/local-forging": "^17.5.2", - "@taquito/michel-codec": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/local-forging": "^19.0.0", + "@taquito/michel-codec": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -21996,12 +21996,12 @@ }, "packages/taquito-beacon-wallet": { "name": "@taquito/beacon-wallet", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { "@airgap/beacon-dapp": "4.1.0", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2" + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -22038,13 +22038,13 @@ }, "packages/taquito-contracts-library": { "name": "@taquito/contracts-library", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -22081,7 +22081,7 @@ }, "packages/taquito-core": { "name": "@taquito/core", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { "json-stringify-safe": "^5.0.1" @@ -22097,10 +22097,10 @@ }, "packages/taquito-http-utils": { "name": "@taquito/http-utils", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", + "@taquito/core": "^19.0.0", "node-fetch": "^2.7.0" }, "devDependencies": { @@ -22157,14 +22157,14 @@ }, "packages/taquito-ledger-signer": { "name": "@taquito/ledger-signer", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { "@ledgerhq/hw-transport": "^6.28.8", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "buffer": "^6.0.3" }, "devDependencies": { @@ -22201,15 +22201,15 @@ }, "packages/taquito-local-forging": { "name": "@taquito/local-forging", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { - "@taquito/rpc": "^17.5.2", + "@taquito/rpc": "^19.0.0", "@types/bluebird": "^3.5.40", "@types/estree": "^1.0.2", "@types/jest": "^29.5.5", @@ -22247,10 +22247,10 @@ }, "packages/taquito-michel-codec": { "name": "@taquito/michel-codec", - "version": "17.5.2", + "version": "19.0.0", "license": "MIT", "dependencies": { - "@taquito/core": "^17.5.2" + "@taquito/core": "^19.0.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -22279,21 +22279,21 @@ } }, "packages/taquito-michel-codec/pack-test-tool": { - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^17.5.2", + "@taquito/rpc": "^19.0.0", "yargs": "^17.7.2" } }, "packages/taquito-michelson-encoder": { "name": "@taquito/michelson-encoder", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -22330,15 +22330,15 @@ }, "packages/taquito-remote-signer": { "name": "@taquito/remote-signer", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { @@ -22375,12 +22375,12 @@ }, "packages/taquito-rpc": { "name": "@taquito/rpc", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -22416,17 +22416,17 @@ }, "packages/taquito-sapling": { "name": "@taquito/sapling", - "version": "17.5.2", + "version": "19.0.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@airgap/sapling-wasm": "0.0.9", "@stablelib/nacl": "^1.0.4", "@stablelib/random": "^1.0.2", - "@taquito/core": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1", @@ -22486,7 +22486,7 @@ }, "packages/taquito-signer": { "name": "@taquito/signer", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -22495,9 +22495,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -22540,13 +22540,13 @@ }, "packages/taquito-tzip12": { "name": "@taquito/tzip12", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/tzip16": "^17.5.2" + "@taquito/core": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/tzip16": "^19.0.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -22582,15 +22582,15 @@ }, "packages/taquito-tzip16": { "name": "@taquito/tzip16", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, @@ -22629,12 +22629,12 @@ }, "packages/taquito-utils": { "name": "@taquito/utils", - "version": "17.5.2", + "version": "19.0.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^17.5.2", + "@taquito/core": "^19.0.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/package.json b/package.json index 635edfc82d..8c3ab90344 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "example": "cd example && npm run example", "build-docs": "typedoc --tsconfig ./tsconfig.typedoc.json", "gh-pages": "gh-pages", - "integration-tests": "npm -w integration-tests run test:originate-known-contracts && npm -w integration-tests run test:nairobinet-secret-key -- --testPathIgnorePatterns ledger-signer-failing-tests.spec.ts ledger-signer.spec.ts contract-estimation-tests.spec.ts rpc-get-protocol-constants.spec.ts", + "integration-tests": "npm -w integration-tests run test:originate-known-contracts && npm -w integration-tests run test:secret-key -- --testPathIgnorePatterns ledger-signer-failing-tests.spec.ts ledger-signer.spec.ts contract-estimation-tests.spec.ts rpc-get-protocol-constants.spec.ts", "version-stamp": "lerna run version-stamp" }, "jest": { diff --git a/packages/taquito-beacon-wallet/package.json b/packages/taquito-beacon-wallet/package.json index b264ee478d..eec3c989c9 100644 --- a/packages/taquito-beacon-wallet/package.json +++ b/packages/taquito-beacon-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/beacon-wallet", - "version": "17.5.2", + "version": "19.0.0", "description": "Beacon wallet provider", "keywords": [ "tezos", @@ -67,8 +67,8 @@ }, "dependencies": { "@airgap/beacon-dapp": "4.1.0", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2" + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-beacon-wallet/src/version.ts b/packages/taquito-beacon-wallet/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-beacon-wallet/src/version.ts +++ b/packages/taquito-beacon-wallet/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-contracts-library/package.json b/packages/taquito-contracts-library/package.json index 60e4b34b0f..2f11073cca 100644 --- a/packages/taquito-contracts-library/package.json +++ b/packages/taquito-contracts-library/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/contracts-library", - "version": "17.5.2", + "version": "19.0.0", "description": "Can be used as an extension on the TezosToolkit to provide contracts data", "keywords": [ "tezos" @@ -67,10 +67,10 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 7fb5335d13..d7d50d84e4 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -17,6 +17,8 @@ import { DelegateResponse, DelegatesResponse, VotingInfoResponse, + AttestationRightsQueryArguments, + AttestationRightsResponse, EndorsingRightsQueryArguments, EndorsingRightsResponse, EntrypointsResponse, @@ -39,16 +41,14 @@ import { RunViewResult, SaplingDiffResponse, ScriptResponse, - TxRollupInboxResponse, - TxRollupStateResponse, UnparsingMode, VotesListingsResponse, VotingPeriodBlockResult, TicketTokenParams, AllTicketBalances, - PendingOperations, + PendingOperationsV1, + PendingOperationsV2, PendingOperationsQueryArguments, - OriginationProofParams, RPCSimulateOperationParam, } from '@taquito/rpc'; import { ContractsLibrary } from './taquito-contracts-library'; @@ -58,7 +58,10 @@ import { ContractsLibrary } from './taquito-contracts-library'; * */ export class RpcWrapperContractsLibrary implements RpcClientInterface { - constructor(private rpc: RpcClientInterface, private contractslibrary: ContractsLibrary) {} + constructor( + private rpc: RpcClientInterface, + private contractslibrary: ContractsLibrary + ) {} async getContract( address: string, @@ -171,6 +174,12 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getBakingRights(args, { block }); } + async getAttestationRights( + args: AttestationRightsQueryArguments, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getAttestationRights(args, { block }); + } async getEndorsingRights( args: EndorsingRightsQueryArguments, { block }: RPCOptions = defaultRPCOptions @@ -293,19 +302,6 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { async getProtocols({ block }: RPCOptions = defaultRPCOptions): Promise { return this.rpc.getProtocols({ block }); } - async getTxRollupState( - txRollupId: string, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - return this.rpc.getTxRollupState(txRollupId, { block }); - } - async getTxRollupInbox( - txRollupId: string, - blockLevel: string, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - return this.rpc.getTxRollupInbox(txRollupId, blockLevel, { block }); - } async getStorageUsedSpace( contract: string, { block }: RPCOptions = defaultRPCOptions @@ -331,13 +327,9 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getAllTicketBalances(contract, { block }); } - async getPendingOperations(args: PendingOperationsQueryArguments): Promise { + async getPendingOperations( + args: PendingOperationsQueryArguments + ): Promise { return this.rpc.getPendingOperations(args); } - async getOriginationProof( - params: OriginationProofParams, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - return this.rpc.getOriginationProof(params, { block }); - } } diff --git a/packages/taquito-contracts-library/src/version.ts b/packages/taquito-contracts-library/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-contracts-library/src/version.ts +++ b/packages/taquito-contracts-library/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-core/package.json b/packages/taquito-core/package.json index f18f823f79..9980b0de8f 100644 --- a/packages/taquito-core/package.json +++ b/packages/taquito-core/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/core", - "version": "17.5.2", + "version": "19.0.0", "description": "Classes, interfaces, and types shared across Taquito packages", "keywords": [ "tezos", diff --git a/packages/taquito-core/src/version.ts b/packages/taquito-core/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-core/src/version.ts +++ b/packages/taquito-core/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-http-utils/package.json b/packages/taquito-http-utils/package.json index a67b7f0d6e..0b13e13f86 100644 --- a/packages/taquito-http-utils/package.json +++ b/packages/taquito-http-utils/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/http-utils", - "version": "17.5.2", + "version": "19.0.0", "description": "", "keywords": [ "tezos" @@ -58,7 +58,7 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", + "@taquito/core": "^19.0.0", "node-fetch": "^2.7.0" }, "devDependencies": { diff --git a/packages/taquito-http-utils/src/version.ts b/packages/taquito-http-utils/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-http-utils/src/version.ts +++ b/packages/taquito-http-utils/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-ledger-signer/package.json b/packages/taquito-ledger-signer/package.json index 3fc9dfff88..58a98bda47 100644 --- a/packages/taquito-ledger-signer/package.json +++ b/packages/taquito-ledger-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/ledger-signer", - "version": "17.5.2", + "version": "19.0.0", "description": "Ledger signer provider", "keywords": [ "tezos", @@ -59,9 +59,9 @@ "dependencies": { "@ledgerhq/hw-transport": "^6.28.8", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "buffer": "^6.0.3" }, "devDependencies": { diff --git a/packages/taquito-ledger-signer/src/version.ts b/packages/taquito-ledger-signer/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-ledger-signer/src/version.ts +++ b/packages/taquito-ledger-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-local-forging/package.json b/packages/taquito-local-forging/package.json index af32e315ef..0424b4a301 100644 --- a/packages/taquito-local-forging/package.json +++ b/packages/taquito-local-forging/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/local-forging", - "version": "17.5.2", + "version": "19.0.0", "description": "Provide local forging functionality to be with taquito", "keywords": [ "tezos", @@ -67,12 +67,12 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { - "@taquito/rpc": "^17.5.2", + "@taquito/rpc": "^19.0.0", "@types/bluebird": "^3.5.40", "@types/estree": "^1.0.2", "@types/jest": "^29.5.5", diff --git a/packages/taquito-local-forging/src/codec.ts b/packages/taquito-local-forging/src/codec.ts index 175f4d05e6..7fba0d570b 100644 --- a/packages/taquito-local-forging/src/codec.ts +++ b/packages/taquito-local-forging/src/codec.ts @@ -45,7 +45,7 @@ export const prefixDecoder = (pre: Prefix) => (str: Uint8ArrayConsumer) => { export const tz1Decoder = prefixDecoder(Prefix.TZ1); export const branchDecoder = prefixDecoder(Prefix.B); -export const pkhDecoder = (val: Uint8ArrayConsumer) => { +export const publicKeyHashDecoder = (val: Uint8ArrayConsumer) => { const prefix = val.consume(1); if (prefix[0] === 0x00) { @@ -57,6 +57,18 @@ export const pkhDecoder = (val: Uint8ArrayConsumer) => { } }; +export const publicKeyHashesDecoder = (val: Uint8ArrayConsumer) => { + if (!boolDecoder(val)) { + return undefined; + } + const publicKeyHashes = []; + val.consume(4); + while (val.length() > 0) { + publicKeyHashes.push(publicKeyHashDecoder(val)); + } + return publicKeyHashes; +}; + export const branchEncoder = prefixEncoder(Prefix.B); export const tz1Encoder = prefixEncoder(Prefix.TZ1); @@ -116,6 +128,8 @@ export const pvmKindEncoder = (pvm: string): string => { return '00'; case 'wasm_2_0_0': return '01'; + case 'riscv': + return '02'; default: throw new UnsupportedPvmKindError(pvm); } @@ -128,6 +142,8 @@ export const pvmKindDecoder = (pvm: Uint8ArrayConsumer): string => { return 'arith'; case 0x01: return 'wasm_2_0_0'; + case 0x02: + return 'riscv'; default: throw new DecodePvmKindError(value[0].toString()); } @@ -135,7 +151,7 @@ export const pvmKindDecoder = (pvm: Uint8ArrayConsumer): string => { export const delegateEncoder = (val: string) => { if (val) { - return boolEncoder(true) + pkhEncoder(val); + return boolEncoder(true) + publicKeyHashEncoder(val); } else { return boolEncoder(false); } @@ -189,11 +205,11 @@ export const boolDecoder = (val: Uint8ArrayConsumer): boolean => { export const delegateDecoder = (val: Uint8ArrayConsumer) => { const hasDelegate = boolDecoder(val); if (hasDelegate) { - return pkhDecoder(val); + return publicKeyHashDecoder(val); } }; -export const pkhEncoder = (val: string) => { +export const publicKeyHashEncoder = (val: string) => { const pubkeyPrefix = val.substring(0, 3); switch (pubkeyPrefix) { case Prefix.TZ1: @@ -213,6 +229,19 @@ export const pkhEncoder = (val: string) => { } }; +export const publicKeyHashesEncoder = (val?: string[]) => { + if (!val) { + return boolEncoder(false); + } + if (val.length === 0) { + return boolEncoder(true) + pad(0); + } + const publicKeyHashes = val.reduce((prev, curr) => { + return prev + publicKeyHashEncoder(curr); + }, ''); + return boolEncoder(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes; +}; + export const publicKeyEncoder = (val: string) => { const pubkeyPrefix = val.substring(0, 4); switch (pubkeyPrefix) { @@ -238,7 +267,7 @@ export const addressEncoder = (val: string): string => { case Prefix.TZ2: case Prefix.TZ3: case Prefix.TZ4: - return '00' + pkhEncoder(val); + return '00' + publicKeyHashEncoder(val); case Prefix.KT1: return '01' + prefixEncoder(Prefix.KT1)(val) + '00'; default: @@ -304,7 +333,7 @@ export const addressDecoder = (val: Uint8ArrayConsumer) => { const preamble = val.consume(1); switch (preamble[0]) { case 0x00: - return pkhDecoder(val); + return publicKeyHashDecoder(val); case 0x01: { const address = prefixDecoder(Prefix.KT1)(val); val.consume(1); @@ -469,27 +498,6 @@ export const entrypointNameDecoder = (val: Uint8ArrayConsumer) => { return Buffer.from(entry).toString('utf8'); }; -export const txRollupOriginationParamEncoder = (_value: string) => { - return ''; -}; - -export const txRollupOriginationParamDecoder = (_val: Uint8ArrayConsumer) => { - return {}; -}; - -export const txRollupIdEncoder = prefixEncoder(Prefix.TXR1); - -export const txRollupIdDecoder = prefixDecoder(Prefix.TXR1); - -export const txRollupBatchContentEncoder = (value: string) => { - return `${pad(value.length / 2)}${value}`; -}; - -export const txRollupBatchContentDecoder = (val: Uint8ArrayConsumer) => { - const value = extractRequiredLen(val); - return Buffer.from(value).toString('hex'); -}; - export const burnLimitEncoder = (val: string) => { return !val ? '00' : `ff${zarithEncoder(val)}`; }; diff --git a/packages/taquito-local-forging/src/constants.ts b/packages/taquito-local-forging/src/constants.ts index afaaf0a93d..dd5dccb645 100644 --- a/packages/taquito-local-forging/src/constants.ts +++ b/packages/taquito-local-forging/src/constants.ts @@ -16,6 +16,7 @@ export enum CODEC { ZARITH = 'zarith', PUBLIC_KEY = 'public_key', PKH = 'pkh', + PKH_ARR = 'pkhArr', DELEGATE = 'delegate', SCRIPT = 'script', BALLOT_STATEMENT = 'ballotStmt', @@ -41,18 +42,14 @@ export enum CODEC { OP_ORIGINATION = 'origination', OP_BALLOT = 'ballot', OP_FAILING_NOOP = 'failing_noop', + OP_ATTESTATION = 'attestation', OP_ENDORSEMENT = 'endorsement', OP_SEED_NONCE_REVELATION = 'seed_nonce_revelation', OP_REVEAL = 'reveal', OP_PROPOSALS = 'proposals', OP_REGISTER_GLOBAL_CONSTANT = 'register_global_constant', OP_TRANSFER_TICKET = 'transfer_ticket', - OP_TX_ROLLUP_ORIGINATION = 'tx_rollup_origination', - OP_TX_ROLLUP_SUBMIT_BATCH = 'tx_rollup_submit_batch', BURN_LIMIT = 'burn_limit', - TX_ROLLUP_ORIGINATION_PARAM = 'tx_rollup_origination_param', - TX_ROLLUP_ID = 'tx_rollup_id', - TX_ROLLUP_BATCH_CONTENT = 'tx_rollup_batch_content', OP_INCREASE_PAID_STORAGE = 'increase_paid_storage', OP_UPDATE_CONSENSUS_KEY = 'update_consensus_key', OP_DRAIN_DELEGATE = 'drain_delegate', @@ -241,12 +238,10 @@ export const kindMapping: { [key: number]: string } = { 0x6c: 'transaction', 0x6d: 'origination', 0x06: 'ballot', - 0x15: 'endorsement', + 0x15: 'attestation', 0x01: 'seed_nonce_revelation', 0x05: 'proposals', 0x6f: 'register_global_constant', - 0x96: 'tx_rollup_origination', - 0x97: 'tx_rollup_submit_batch', 0x9e: 'transfer_ticket', 0x70: 'set_deposits_limit', 0x71: 'increase_paid_storage', diff --git a/packages/taquito-local-forging/src/decoder.ts b/packages/taquito-local-forging/src/decoder.ts index 8959d0b129..0bcfb7c212 100644 --- a/packages/taquito-local-forging/src/decoder.ts +++ b/packages/taquito-local-forging/src/decoder.ts @@ -10,7 +10,8 @@ import { int32Decoder, paddedBytesDecoder, parametersDecoder, - pkhDecoder, + publicKeyHashDecoder, + publicKeyHashesDecoder, smartRollupMessageDecoder, proposalDecoder, proposalsDecoder, @@ -20,9 +21,6 @@ import { smartContractAddressDecoder, smartRollupAddressDecoder, smartRollupCommitmentHashDecoder, - txRollupBatchContentDecoder, - txRollupIdDecoder, - txRollupOriginationParamDecoder, tz1Decoder, valueParameterDecoder, zarithDecoder, @@ -33,6 +31,7 @@ import { ActivationSchema, BallotSchema, DelegationSchema, + AttestationSchema, EndorsementSchema, IncreasePaidStorageSchema, UpdateConsensusKeySchema, @@ -47,8 +46,6 @@ import { SeedNonceRevelationSchema, TransactionSchema, TransferTicketSchema, - TxRollupOriginationSchema, - TxRollupSubmitBatchSchema, SetDepositsLimitSchema, SmartRollupOriginateSchema, SmartRollupAddMessagesSchema, @@ -67,7 +64,8 @@ export const decoders: { [key: string]: Decoder } = { [CODEC.BRANCH]: branchDecoder, [CODEC.ZARITH]: zarithDecoder, [CODEC.PUBLIC_KEY]: publicKeyDecoder, - [CODEC.PKH]: pkhDecoder, + [CODEC.PKH]: publicKeyHashDecoder, + [CODEC.PKH_ARR]: publicKeyHashesDecoder, [CODEC.DELEGATE]: delegateDecoder, [CODEC.INT32]: int32Decoder, [CODEC.SCRIPT]: scriptDecoder, @@ -83,9 +81,6 @@ export const decoders: { [key: string]: Decoder } = { [CODEC.INT16]: int16Decoder, [CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashDecoder, [CODEC.ENTRYPOINT]: entrypointNameDecoder, - [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamDecoder, - [CODEC.TX_ROLLUP_ID]: txRollupIdDecoder, - [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentDecoder, [CODEC.BURN_LIMIT]: burnLimitDecoder, [CODEC.DEPOSITS_LIMIT]: depositsLimitDecoder, [CODEC.PVM_KIND]: pvmKindDecoder, @@ -105,6 +100,8 @@ decoders[CODEC.OP_TRANSACTION] = (val: Uint8ArrayConsumer) => decoders[CODEC.OP_ORIGINATION] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(OriginationSchema)(val); decoders[CODEC.OP_BALLOT] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(BallotSchema)(val); +decoders[CODEC.OP_ATTESTATION] = (val: Uint8ArrayConsumer) => + schemaDecoder(decoders)(AttestationSchema)(val); decoders[CODEC.OP_ENDORSEMENT] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(EndorsementSchema)(val); decoders[CODEC.OP_SEED_NONCE_REVELATION] = (val: Uint8ArrayConsumer) => @@ -116,10 +113,6 @@ decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(RegisterGlobalConstantSchema)(val); decoders[CODEC.OP_TRANSFER_TICKET] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(TransferTicketSchema)(val); -decoders[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val: Uint8ArrayConsumer) => - schemaDecoder(decoders)(TxRollupOriginationSchema)(val); -decoders[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val: Uint8ArrayConsumer) => - schemaDecoder(decoders)(TxRollupSubmitBatchSchema)(val); decoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(IncreasePaidStorageSchema)(val); decoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val: Uint8ArrayConsumer) => diff --git a/packages/taquito-local-forging/src/encoder.ts b/packages/taquito-local-forging/src/encoder.ts index 3e23e11686..96f7f99133 100644 --- a/packages/taquito-local-forging/src/encoder.ts +++ b/packages/taquito-local-forging/src/encoder.ts @@ -10,7 +10,8 @@ import { int32Encoder, paddedBytesEncoder, parametersEncoder, - pkhEncoder, + publicKeyHashEncoder, + publicKeyHashesEncoder, smartRollupMessageEncoder, proposalEncoder, proposalsEncoder, @@ -20,9 +21,6 @@ import { smartContractAddressEncoder, smartRollupAddressEncoder, smartRollupCommitmentHashEncoder, - txRollupBatchContentEncoder, - txRollupIdEncoder, - txRollupOriginationParamEncoder, tz1Encoder, valueParameterEncoder, zarithEncoder, @@ -33,6 +31,7 @@ import { ActivationSchema, BallotSchema, DelegationSchema, + AttestationSchema, EndorsementSchema, IncreasePaidStorageSchema, UpdateConsensusKeySchema, @@ -47,8 +46,6 @@ import { SeedNonceRevelationSchema, TransactionSchema, TransferTicketSchema, - TxRollupOriginationSchema, - TxRollupSubmitBatchSchema, SetDepositsLimitSchema, SmartRollupOriginateSchema, SmartRollupExecuteOutboxMessageSchema, @@ -65,7 +62,8 @@ export const encoders: { [key: string]: Encoder } = { [CODEC.BRANCH]: branchEncoder, [CODEC.ZARITH]: zarithEncoder, [CODEC.PUBLIC_KEY]: publicKeyEncoder, - [CODEC.PKH]: pkhEncoder, + [CODEC.PKH]: publicKeyHashEncoder, + [CODEC.PKH_ARR]: publicKeyHashesEncoder, [CODEC.DELEGATE]: delegateEncoder, [CODEC.SCRIPT]: scriptEncoder, [CODEC.BALLOT_STATEMENT]: ballotEncoder, @@ -81,9 +79,6 @@ export const encoders: { [key: string]: Encoder } = { [CODEC.INT16]: int16Encoder, [CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder, [CODEC.ENTRYPOINT]: entrypointNameEncoder, - [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamEncoder, - [CODEC.TX_ROLLUP_ID]: txRollupIdEncoder, - [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentEncoder, [CODEC.BURN_LIMIT]: burnLimitEncoder, [CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder, [CODEC.PVM_KIND]: pvmKindEncoder, @@ -97,6 +92,7 @@ encoders[CODEC.OP_DELEGATION] = (val: any) => schemaEncoder(encoders)(Delegation encoders[CODEC.OP_TRANSACTION] = (val: any) => schemaEncoder(encoders)(TransactionSchema)(val); encoders[CODEC.OP_ORIGINATION] = (val: any) => schemaEncoder(encoders)(OriginationSchema)(val); encoders[CODEC.OP_BALLOT] = (val: any) => schemaEncoder(encoders)(BallotSchema)(val); +encoders[CODEC.OP_ATTESTATION] = (val: any) => schemaEncoder(encoders)(AttestationSchema)(val); encoders[CODEC.OP_ENDORSEMENT] = (val: any) => schemaEncoder(encoders)(EndorsementSchema)(val); encoders[CODEC.OP_SEED_NONCE_REVELATION] = (val: any) => schemaEncoder(encoders)(SeedNonceRevelationSchema)(val); @@ -106,10 +102,6 @@ encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val: any) => schemaEncoder(encoders)(RegisterGlobalConstantSchema)(val); encoders[CODEC.OP_TRANSFER_TICKET] = (val: any) => schemaEncoder(encoders)(TransferTicketSchema)(val); -encoders[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val: any) => - schemaEncoder(encoders)(TxRollupOriginationSchema)(val); -encoders[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val: any) => - schemaEncoder(encoders)(TxRollupSubmitBatchSchema)(val); encoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val: any) => schemaEncoder(encoders)(IncreasePaidStorageSchema)(val); encoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val: any) => diff --git a/packages/taquito-local-forging/src/protocols.ts b/packages/taquito-local-forging/src/protocols.ts index 3c5023ce69..4224386a4f 100644 --- a/packages/taquito-local-forging/src/protocols.ts +++ b/packages/taquito-local-forging/src/protocols.ts @@ -15,6 +15,7 @@ export enum ProtocolsHash { PtMumbaii = 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', PtMumbai2 = 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', + ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -35,7 +36,8 @@ const protoLevel: Record = { PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc: 16, PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1: 16, PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17, - ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 18, + ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, + ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 20, }; export function ProtoInferiorTo(a: ProtocolsHash, b: ProtocolsHash): boolean { diff --git a/packages/taquito-local-forging/src/schema/operation.ts b/packages/taquito-local-forging/src/schema/operation.ts index da3ba9688b..3e9640065b 100644 --- a/packages/taquito-local-forging/src/schema/operation.ts +++ b/packages/taquito-local-forging/src/schema/operation.ts @@ -65,6 +65,13 @@ export const BallotSchema = { ballot: CODEC.BALLOT_STATEMENT, }; +export const AttestationSchema = { + slot: CODEC.INT16, + level: CODEC.INT32, + round: CODEC.INT32, + block_payload_hash: CODEC.BLOCK_PAYLOAD_HASH, +}; + export const EndorsementSchema = { slot: CODEC.INT16, level: CODEC.INT32, @@ -106,26 +113,6 @@ export const TransferTicketSchema = { entrypoint: CODEC.ENTRYPOINT, }; -export const TxRollupOriginationSchema = { - source: CODEC.PKH, - fee: CODEC.ZARITH, - counter: CODEC.ZARITH, - gas_limit: CODEC.ZARITH, - storage_limit: CODEC.ZARITH, - tx_rollup_origination: CODEC.TX_ROLLUP_ORIGINATION_PARAM, -}; - -export const TxRollupSubmitBatchSchema = { - source: CODEC.PKH, - fee: CODEC.ZARITH, - counter: CODEC.ZARITH, - gas_limit: CODEC.ZARITH, - storage_limit: CODEC.ZARITH, - rollup: CODEC.TX_ROLLUP_ID, - content: CODEC.TX_ROLLUP_BATCH_CONTENT, - burn_limit: CODEC.BURN_LIMIT, -}; - export const IncreasePaidStorageSchema = { source: CODEC.PKH, fee: CODEC.ZARITH, @@ -168,8 +155,8 @@ export const SmartRollupOriginateSchema = { storage_limit: CODEC.ZARITH, pvm_kind: CODEC.PVM_KIND, kernel: CODEC.PADDED_BYTES, - origination_proof: CODEC.PADDED_BYTES, parameters_ty: CODEC.VALUE, + whitelist: CODEC.PKH_ARR, }; export const SmartRollupAddMessagesSchema = { diff --git a/packages/taquito-local-forging/src/taquito-local-forging.ts b/packages/taquito-local-forging/src/taquito-local-forging.ts index 49b51422b3..b819c7515c 100644 --- a/packages/taquito-local-forging/src/taquito-local-forging.ts +++ b/packages/taquito-local-forging/src/taquito-local-forging.ts @@ -22,7 +22,7 @@ export * from './interface'; export { VERSION } from './version'; export { ProtocolsHash } from './protocols'; -const PROTOCOL_CURRENT = ProtocolsHash.PtMumbai2; +const PROTOCOL_CURRENT = ProtocolsHash.ProxfordY; export function getCodec(codec: CODEC, _proto: ProtocolsHash) { return { @@ -33,7 +33,7 @@ export function getCodec(codec: CODEC, _proto: ProtocolsHash) { }, }; } - +// export class LocalForger implements Forger { constructor(public readonly protocolHash = PROTOCOL_CURRENT) {} @@ -60,10 +60,7 @@ export class LocalForger implements Forger { continue; } else if (content.kind === 'set_deposits_limit' && diff[0] === 'limit') { continue; - } else if ( - content.kind === ('tx_rollup_submit_batch' as unknown) && - diff[0] === 'burn_limit' - ) { + } else if (content.kind === 'smart_rollup_originate' && diff[0] === 'whitelist') { continue; } else { throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`); diff --git a/packages/taquito-local-forging/src/validator.ts b/packages/taquito-local-forging/src/validator.ts index e94fa741b0..59d277f634 100644 --- a/packages/taquito-local-forging/src/validator.ts +++ b/packages/taquito-local-forging/src/validator.ts @@ -10,10 +10,9 @@ import { ProposalsSchema, RevealSchema, RegisterGlobalConstantSchema, + AttestationSchema, EndorsementSchema, TransferTicketSchema, - TxRollupOriginationSchema, - TxRollupSubmitBatchSchema, IncreasePaidStorageSchema, UpdateConsensusKeySchema, DrainDelegateSchema, @@ -31,13 +30,12 @@ type OperationKind = | OpKind.TRANSACTION | OpKind.ORIGINATION | OpKind.BALLOT + | OpKind.ATTESTATION | OpKind.ENDORSEMENT | OpKind.SEED_NONCE_REVELATION | OpKind.PROPOSALS | OpKind.REGISTER_GLOBAL_CONSTANT | OpKind.TRANSFER_TICKET - | OpKind.TX_ROLLUP_ORIGINATION - | OpKind.TX_ROLLUP_SUBMIT_BATCH | OpKind.INCREASE_PAID_STORAGE | OpKind.UPDATE_CONSENSUS_KEY | OpKind.DRAIN_DELEGATE @@ -53,13 +51,12 @@ const OperationKindMapping = { transaction: TransactionSchema, origination: OriginationSchema, ballot: BallotSchema, + attestation: AttestationSchema, endorsement: EndorsementSchema, seed_nonce_revelation: SeedNonceRevelationSchema, proposals: ProposalsSchema, register_global_constant: RegisterGlobalConstantSchema, transfer_ticket: TransferTicketSchema, - tx_rollup_origination: TxRollupOriginationSchema, - tx_rollup_submit_batch: TxRollupSubmitBatchSchema, increase_paid_storage: IncreasePaidStorageSchema, update_consensus_key: UpdateConsensusKeySchema, drain_delegate: DrainDelegateSchema, diff --git a/packages/taquito-local-forging/src/version.ts b/packages/taquito-local-forging/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-local-forging/src/version.ts +++ b/packages/taquito-local-forging/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-local-forging/test/codec.spec.ts b/packages/taquito-local-forging/test/codec.spec.ts index 8694565d57..2721f7e2ab 100644 --- a/packages/taquito-local-forging/test/codec.spec.ts +++ b/packages/taquito-local-forging/test/codec.spec.ts @@ -9,7 +9,13 @@ import { paddedBytesDecoder, } from '../src/codec'; import { Uint8ArrayConsumer } from '../src/uint8array-consumer'; -import { pkhEncoder, publicKeyDecoder, publicKeyEncoder } from '../src/codec'; +import { + publicKeyHashEncoder, + publicKeyHashesEncoder, + publicKeyHashesDecoder, + publicKeyDecoder, + publicKeyEncoder, +} from '../src/codec'; import { DecodeBallotValueError, DecodePvmKindError, @@ -59,23 +65,68 @@ describe('Tests for Entrypoint functions and for encode and decoder error messag ); }); - test(`Verify pkhEncoder`, async () => { - const tz1 = pkhEncoder('tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY'); + test(`Verify publicKeyHashEncoder`, async () => { + const tz1 = publicKeyHashEncoder('tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY'); expect(tz1).toEqual('00c9fc72e8491bd2973e196f04ec6918ad5bcee22d'); - const tz2 = pkhEncoder('tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD'); + const tz2 = publicKeyHashEncoder('tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD'); expect(tz2).toEqual('012ffebbf1560632ca767bc960ccdb84669d284c2c'); - const tz3 = pkhEncoder('tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); + const tz3 = publicKeyHashEncoder('tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); expect(tz3).toEqual('026fde46af0356a0476dae4e4600172dc9309b3aa4'); - const tz4 = pkhEncoder('tz4HQ8VeXAyrZMhES1qLMJAc9uAVXjbMpS8u'); + const tz4 = publicKeyHashEncoder('tz4HQ8VeXAyrZMhES1qLMJAc9uAVXjbMpS8u'); expect(tz4).toEqual('035c14a7a05c10fc8b402fbcdd48dc8136236bf3c1'); - expect(() => pkhEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5')).toThrow(InvalidKeyHashError); + expect(() => publicKeyHashEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5')).toThrow( + InvalidKeyHashError + ); try { - pkhEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); + publicKeyHashEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); } catch (e) { expect(e.message).toContain(`Invalid public key hash "tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5"`); } }); + test(`Verify publicKeyHashesEncoder`, async () => { + const none = publicKeyHashesEncoder(); + expect(none).toEqual('00'); + const empty = publicKeyHashesEncoder([]); + expect(empty).toEqual('ff00000000'); + const tz = publicKeyHashesEncoder([ + 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', + 'tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD', + 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + 'tz4HQ8VeXAyrZMhES1qLMJAc9uAVXjbMpS8u', + ]); + expect(tz).toEqual( + 'ff0000005400c9fc72e8491bd2973e196f04ec6918ad5bcee22d012ffebbf1560632ca767bc960ccdb84669d284c2c026fde46af0356a0476dae4e4600172dc9309b3aa4035c14a7a05c10fc8b402fbcdd48dc8136236bf3c1' + ); + + expect(() => publicKeyHashesEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'])).toThrow( + InvalidKeyHashError + ); + try { + publicKeyHashesEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5']); + } catch (e) { + expect(e.message).toContain(`Invalid public key hash "tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5"`); + } + }); + + test(`Verify publicKeyHashesDecoder`, async () => { + const none = publicKeyHashesDecoder(Uint8ArrayConsumer.fromHexString('00')); + expect(none).toEqual(undefined); + const empty = publicKeyHashesDecoder(Uint8ArrayConsumer.fromHexString('ff00000000')); + expect(empty).toEqual([]); + const tz = publicKeyHashesDecoder( + Uint8ArrayConsumer.fromHexString( + 'ff0000005400c9fc72e8491bd2973e196f04ec6918ad5bcee22d012ffebbf1560632ca767bc960ccdb84669d284c2c026fde46af0356a0476dae4e4600172dc9309b3aa4' + ) + ); + expect(tz).toEqual([ + 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', + 'tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD', + 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + ]); + // + }); + test(`Verify publicKeyEncoder`, async () => { const edpk = publicKeyEncoder('edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'); expect(edpk).toEqual('005c8244b8de7d57795962c1bfc855d0813f8c61eddf3795f804ccdea3e4c82ae9'); @@ -240,13 +291,15 @@ describe('Tests for Entrypoint functions and for encode and decoder error messag test('Verify that pvmKindEncoder functions correctly and returns UnsupportedPvmKindError on unknown case', () => { expect(pvmKindEncoder('arith')).toEqual('00'); expect(pvmKindEncoder('wasm_2_0_0')).toEqual('01'); + expect(pvmKindEncoder('riscv')).toEqual('02'); expect(() => pvmKindEncoder('foobar')).toThrowError(UnsupportedPvmKindError); }); test('Verify that pvmKindDecoder functions correctly and returns DecodePvmKindError on unknown case', () => { expect(pvmKindDecoder(Uint8ArrayConsumer.fromHexString('00'))).toEqual('arith'); expect(pvmKindDecoder(Uint8ArrayConsumer.fromHexString('01'))).toEqual('wasm_2_0_0'); - expect(() => pvmKindDecoder(Uint8ArrayConsumer.fromHexString('02'))).toThrowError( + expect(pvmKindDecoder(Uint8ArrayConsumer.fromHexString('02'))).toEqual('riscv'); + expect(() => pvmKindDecoder(Uint8ArrayConsumer.fromHexString('03'))).toThrowError( DecodePvmKindError ); }); diff --git a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts index c87187b634..99057ffa22 100644 --- a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts +++ b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts @@ -287,8 +287,6 @@ describe('Forge and parse operations default protocol', () => { pvm_kind: 'wasm_2_0_0', kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, @@ -299,9 +297,6 @@ describe('Forge and parse operations default protocol', () => { expect(forged).toContain( '0000035323212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' ); - expect(forged).toContain( - '000000770300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); expect(forged).toContain('000000020369'); }); diff --git a/packages/taquito-michel-codec/pack-test-tool/package.json b/packages/taquito-michel-codec/pack-test-tool/package.json index 7b197fd4b6..2ac301d543 100644 --- a/packages/taquito-michel-codec/pack-test-tool/package.json +++ b/packages/taquito-michel-codec/pack-test-tool/package.json @@ -1,6 +1,6 @@ { "name": "pack-test-tool", - "version": "17.5.2", + "version": "19.0.0", "description": "Generate pack test data via Tezos RPC", "main": "pack-test-tool.js", "private": true, @@ -8,7 +8,7 @@ "author": "Eugene Zagidullin ", "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^17.5.2", + "@taquito/rpc": "^19.0.0", "yargs": "^17.7.2" } } diff --git a/packages/taquito-michel-codec/package.json b/packages/taquito-michel-codec/package.json index 6bca14b4e2..b5f8c6d924 100644 --- a/packages/taquito-michel-codec/package.json +++ b/packages/taquito-michel-codec/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/michel-codec", - "version": "17.5.2", + "version": "19.0.0", "description": "Michelson parser/validator/formatter", "keywords": [ "tezos", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2" + "@taquito/core": "^19.0.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-michel-codec/src/michelson-typecheck.ts b/packages/taquito-michel-codec/src/michelson-typecheck.ts index 0b105c0afc..cfcb5a73c5 100644 --- a/packages/taquito-michel-codec/src/michelson-typecheck.ts +++ b/packages/taquito-michel-codec/src/michelson-typecheck.ts @@ -410,7 +410,6 @@ function assertDataValidInternal(d: MichelsonData, t: MichelsonType, ctx: Contex 'SECP256K1PublicKeyHash', 'P256PublicKeyHash', 'ContractHash', - 'TxRollupL2Address', 'RollupAddress' ) !== null ) { diff --git a/packages/taquito-michel-codec/src/michelson-types.ts b/packages/taquito-michel-codec/src/michelson-types.ts index 25baf8a1c5..84388207b3 100644 --- a/packages/taquito-michel-codec/src/michelson-types.ts +++ b/packages/taquito-michel-codec/src/michelson-types.ts @@ -400,6 +400,7 @@ export enum Protocol { PtMumbaii = 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', PtMumbai2 = 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', + ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', // temporary protocol hash } @@ -432,7 +433,8 @@ const protoLevel: Record = { PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc: 16, PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1: 16, PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17, - ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 18, + ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, + ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 20, }; export function ProtoGreaterOrEqual(a: ProtocolID, b: ProtocolID): boolean { diff --git a/packages/taquito-michel-codec/src/utils.ts b/packages/taquito-michel-codec/src/utils.ts index 9525712880..009204beea 100644 --- a/packages/taquito-michel-codec/src/utils.ts +++ b/packages/taquito-michel-codec/src/utils.ts @@ -46,7 +46,10 @@ export class MichelsonError extends TaquitoError { * @param path Path to a node caused the error * @param message An error message */ - constructor(public readonly val: T, public readonly message: string) { + constructor( + public readonly val: T, + public readonly message: string + ) { super(); this.name = 'MichelsonError'; } @@ -274,8 +277,7 @@ export type TezosIDType = | 'P256Signature' | 'GenericSignature' | 'ChainID' - | 'RollupAddress' - | 'TxRollupL2Address'; + | 'RollupAddress'; export type TezosIDPrefix = [number, number[]]; // payload length, prefix @@ -309,7 +311,6 @@ export const tezosPrefix: Record = { GenericSignature: [64, [4, 130, 43]], // sig(96) ChainID: [4, [87, 82, 0]], RollupAddress: [20, [1, 128, 120, 31]], - TxRollupL2Address: [20, [6, 161, 166]], }; export function checkDecodeTezosID( diff --git a/packages/taquito-michel-codec/src/version.ts b/packages/taquito-michel-codec/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-michel-codec/src/version.ts +++ b/packages/taquito-michel-codec/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-michelson-encoder/package.json b/packages/taquito-michelson-encoder/package.json index ccb7796ec0..340549e1d8 100644 --- a/packages/taquito-michelson-encoder/package.json +++ b/packages/taquito-michelson-encoder/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/michelson-encoder", - "version": "17.5.2", + "version": "19.0.0", "description": "converts michelson data and types into convenient JS/TS objects", "keywords": [ "tezos", @@ -67,9 +67,9 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, diff --git a/packages/taquito-michelson-encoder/src/schema/types.ts b/packages/taquito-michelson-encoder/src/schema/types.ts index d23a97f947..74656bc1a0 100644 --- a/packages/taquito-michelson-encoder/src/schema/types.ts +++ b/packages/taquito-michelson-encoder/src/schema/types.ts @@ -21,8 +21,7 @@ export type BaseTokenSchema = { | 'chest' | 'chest_key' | 'signature' - | 'unit' - | 'tx_rollup_l2_address'; + | 'unit'; schema: string; }; export type OrTokenSchema = { __michelsonType: 'or'; schema: Record }; diff --git a/packages/taquito-michelson-encoder/src/tokens/comparable/tx_rollup_l2_address.ts b/packages/taquito-michelson-encoder/src/tokens/comparable/tx_rollup_l2_address.ts deleted file mode 100644 index 281130e147..0000000000 --- a/packages/taquito-michelson-encoder/src/tokens/comparable/tx_rollup_l2_address.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { BaseTokenSchema } from '../../schema/types'; -import { - b58decodeL2Address, - encodeL2Address, - validateAddress, - ValidationResult, -} from '@taquito/utils'; -import { - ComparableToken, - SemanticEncoding, - Token, - TokenFactory, - TokenValidationError, -} from '../token'; - -/** - * @category Error - * @description Error that indicates a failure happening when parsing encoding/executing a Tx Rollup L2 Address - */ -export class TxRollupL2AddressValidationError extends TokenValidationError { - name = 'TxRollupL2AddressValidationError'; - constructor(public value: unknown, public token: TxRollupL2AddressToken, message: string) { - super(value, token, message); - } -} - -export class TxRollupL2AddressToken extends ComparableToken { - static prim: 'tx_rollup_l2_address' = 'tx_rollup_l2_address' as const; - - constructor( - protected val: { prim: string; args: any[]; annots: any[] }, - protected idx: number, - protected fac: TokenFactory - ) { - super(val, idx, fac); - } - - public ToBigMapKey(val: any) { - const decoded = b58decodeL2Address(val); - return { - key: { bytes: decoded }, - type: { prim: 'bytes' }, - }; - } - - /** - * @throws {@link TxRollupL2AddressValidationError} - */ - private validate(value: any) { - if (validateAddress(value) !== ValidationResult.VALID) { - throw new TxRollupL2AddressValidationError( - value, - this, - `tx_rollup_l2_address is not valid: ${JSON.stringify(value)}` - ); - } - } - - /** - * @throws {@link TxRollupL2AddressValidationError} - */ - public Encode(args: string[]): any { - const val = args.pop(); - if (!val) { - throw new TxRollupL2AddressValidationError( - val, - this, - `arg missing to encode: this -> "${JSON.stringify(val)}"` - ); - } - this.validate(val); - - return { string: val }; - } - - /** - * @throws {@link TxRollupL2AddressValidationError} - */ - public EncodeObject(val: any, semantic?: SemanticEncoding): any { - this.validate(val); - - if (semantic && semantic[TxRollupL2AddressToken.prim]) { - return semantic[TxRollupL2AddressToken.prim](val); - } - return { string: val }; - } - - /** - * @throws {@link TxRollupL2AddressValidationError} - */ - public Execute(val: { bytes?: string; string?: string }): string { - if (val.string) { - return val.string; - } - if (!val.bytes) { - throw new TxRollupL2AddressValidationError( - val, - this, - `value cannot be missing string and byte value. must have one ${JSON.stringify(val)}` - ); - } - return encodeL2Address(val.bytes); - } - public ExtractSchema() { - return TxRollupL2AddressToken.prim; - } - - generateSchema(): BaseTokenSchema { - return { - __michelsonType: TxRollupL2AddressToken.prim, - schema: TxRollupL2AddressToken.prim, - }; - } - - /** - * @throws {@link TxRollupL2AddressValidationError} - */ - public ToKey({ bytes, string }: { bytes?: string; string?: string }) { - if (string) { - return string; - } - if (!bytes) { - throw new TxRollupL2AddressValidationError( - bytes, - this, - `value cannot be missing string and byte value. must have one: bytes = ${JSON.stringify( - bytes - )}` - ); - } - return encodeL2Address(bytes); - } - - findAndReturnTokens(tokenToFind: string, tokens: Token[]): Token[] { - if (TxRollupL2AddressToken.prim === tokenToFind) { - tokens.push(this); - } - return tokens; - } -} diff --git a/packages/taquito-michelson-encoder/src/tokens/tokens.ts b/packages/taquito-michelson-encoder/src/tokens/tokens.ts index 8543e966e1..b0bb2640e3 100644 --- a/packages/taquito-michelson-encoder/src/tokens/tokens.ts +++ b/packages/taquito-michelson-encoder/src/tokens/tokens.ts @@ -12,8 +12,6 @@ import { MapToken } from './map'; import { BoolToken } from './comparable/bool'; -import { TxRollupL2AddressToken } from './comparable/tx_rollup_l2_address'; - import { OrToken } from './or'; import { ContractToken } from './contract'; @@ -51,7 +49,6 @@ export const tokens = [ StringToken, BigMapToken, AddressToken, - TxRollupL2AddressToken, MapToken, BoolToken, OrToken, diff --git a/packages/taquito-michelson-encoder/src/version.ts b/packages/taquito-michelson-encoder/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-michelson-encoder/src/version.ts +++ b/packages/taquito-michelson-encoder/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-michelson-encoder/test/tokens/address.spec.ts b/packages/taquito-michelson-encoder/test/tokens/address.spec.ts index 4f07f7af5b..c758103054 100644 --- a/packages/taquito-michelson-encoder/test/tokens/address.spec.ts +++ b/packages/taquito-michelson-encoder/test/tokens/address.spec.ts @@ -47,135 +47,3 @@ describe('Address token', () => { }); }); }); -describe('Address Token with txr1', () => { - let token: AddressToken; - beforeEach(() => { - token = new AddressToken({ prim: 'address', args: [], annots: [] }, 0, null as any); - }); - - describe('test ToBigMapKey', () => { - it('to bytes', () => { - expect(token.ToBigMapKey('txr1MfFbj6diPLS2MN2ntoid6cyuk4mUzLibP')).toEqual({ - key: { bytes: '02012e7a294c836eeb02010b907c2632b88ed3e23a00' }, - type: { prim: 'bytes' }, - }); - }); - }); - - describe('EncodeObject', () => { - it("should add string to object with key 'string'", () => { - expect(token.EncodeObject('txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL')).toEqual({ - string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', - }); - }); - - it('test semantic', () => { - const val1 = token.EncodeObject('txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', { - address: () => ({ string: 'tester' }), - }); - const val2 = token.EncodeObject('txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', { - address: (arg) => ({ string: arg }), - }); - expect(val1).toEqual({ string: 'tester' }); - expect(val2).toEqual({ string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' }); - }); - - it('should throw error with invalid args', () => { - expect(() => token.EncodeObject('txr1')).toThrowError(AddressValidationError); - expect(() => token.EncodeObject([])).toThrowError(AddressValidationError); - expect(() => token.EncodeObject({})).toThrowError(AddressValidationError); - expect(() => token.EncodeObject(1)).toThrowError(AddressValidationError); - expect(() => token.EncodeObject('tz4QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn')).toThrowError( - AddressValidationError - ); - }); - }); - - describe('Encode', () => { - it('should encode address to object with key "string"', () => { - expect(token.Encode(['txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL'])).toEqual({ - string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', - }); - }); - it('should throw error if address not valid', () => { - expect(() => token.Encode(['something'])).toThrowError(AddressValidationError); - expect(() => token.Encode(['', '', '', ''])).toThrowError(AddressValidationError); - expect(() => token.Encode([])).toThrowError(AddressValidationError); - expect(() => token.Encode(['1'])).toThrowError(AddressValidationError); - try { - token.Encode(['async']); - } catch (ex) { - expect(ex.name).toEqual('AddressValidationError'); - } - }); - }); - describe('generateSchema', () => { - it('should generate properly', () => { - expect(token.generateSchema()).toEqual({ - __michelsonType: 'address', - schema: 'address', - }); - }); - }); - - describe('Execute', () => { - it('should throw if no bytes or string', () => { - expect(() => token.Execute({ string: '', bytes: '' })).toThrowError(AddressValidationError); - }); - it('should return string', () => { - expect(token.Execute({ string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', bytes: '' })).toEqual( - 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' - ); - expect( - token.Execute({ bytes: '02f16e732d45ba6f24d5ec421f20ab199b3a82907100', string: '' }) - ).toEqual('txr1jZaQfi9zdwzJteYkRBSN9D7RDvMh1QNkL'); - }); - }); - describe('Tokey', () => { - it('should change bytes to pkh', () => { - expect(token.ToKey({ bytes: '02012e7a294c836eeb02010b907c2632b88ed3e23a00' })).toEqual( - 'txr1MfFbj6diPLS2MN2ntoid6cyuk4mUzLibP' - ); - expect(token.ToKey({ string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' })).toEqual( - 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' - ); - }); - it('throw error if empty', () => { - expect(() => token.ToKey({ bytes: '', string: '' })).toThrowError(AddressValidationError); - }); - }); - describe('compare', () => { - it('should order addresses correctly', () => { - expect( - token.compare( - 'KT1CDEg2oY3VfMa1neB7hK5LoVMButvivKYv', - 'tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD' - ) - ).toEqual(1); - expect( - token.compare( - 'tz3YjfexGakCDeCseXFUpcXPSAN9xHxE9TH2', - 'tz1ccqAEwfPgeoipnXtjAv1iucrpQv3DFmmS' - ) - ).toEqual(1); - expect( - token.compare( - 'KT1CDEg2oY3VfMa1neB7hK5LoVMButvivKYv', - 'KT1XM8VUFBiM9AC5czWU15fEeE9nmuEYWt3Y' - ) - ).toEqual(-1); - expect( - token.compare( - 'txr1YpFMKsYwTJ4YBmYqy2kw4pxCUgeQkZmwo', - 'txr1YpFMKsYwTJ4YBmYqy2kw4pxCUgeQkZmwo' - ) - ).toEqual(0); - }); - }); - describe('find return tokens', () => { - it('should return or not return token', () => { - expect(token.findAndReturnTokens('address', [])).toEqual([token]); - expect(token.findAndReturnTokens('tx_rollup_l2_address', [])).toEqual([]); - }); - }); -}); diff --git a/packages/taquito-michelson-encoder/test/tokens/contract.spec.ts b/packages/taquito-michelson-encoder/test/tokens/contract.spec.ts index 2c3b0a0a82..fbce3258d9 100644 --- a/packages/taquito-michelson-encoder/test/tokens/contract.spec.ts +++ b/packages/taquito-michelson-encoder/test/tokens/contract.spec.ts @@ -1,4 +1,3 @@ -import { b58decode } from '@taquito/utils'; import { ContractToken, ContractValidationError } from './../../src/tokens/contract'; describe('Contract Token Tests', () => { @@ -13,46 +12,20 @@ describe('Contract Token Tests', () => { }); describe('EncodeObject', () => { - it('should encode address to string', () => { - expect(token.EncodeObject('txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL')).toEqual({ - string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', - }); - }); - it('should throw error when improper args', () => { expect(() => token.EncodeObject('test')).toThrowError(ContractValidationError); expect(() => token.EncodeObject(0)).toThrowError(ContractValidationError); expect(() => token.EncodeObject([])).toThrowError(ContractValidationError); }); - - it('should handle semantics', () => { - expect( - token.EncodeObject('txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', { - contract: () => ({ string: 'test' }), - }).string - ).toEqual('test'); - }); }); + describe('execute', () => { - const decoded = b58decode('txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL'); - it('should return contract address', () => { - expect(token.Execute({ bytes: '', string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' })).toEqual( - 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' - ); - expect(token.Execute({ bytes: decoded, string: '' })).toEqual( - 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL' - ); - }); it('should throw error', () => { expect(() => token.Execute({ bytes: '', string: '' })).toThrowError(ContractValidationError); }); }); + describe('Encode', () => { - it('should return string', () => { - expect(token.Encode(['txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL'])).toEqual({ - string: 'txr1XHHx4KH3asGN5CMpdqzQA3c7HkfniPRxL', - }); - }); it('should throw error', () => { expect(() => token.Encode(['test'])).toThrowError(ContractValidationError); expect(() => token.Encode([1])).toThrowError(ContractValidationError); @@ -71,6 +44,7 @@ describe('Contract Token Tests', () => { expect(token.ExtractSchema()).toEqual('contract'); }); }); + describe('find and return token', () => { it('should find this token or return without', () => { expect(token.findAndReturnTokens('contract', [])).toEqual([token]); diff --git a/packages/taquito-michelson-encoder/test/tokens/tx_rollup_l2_address.spec.ts b/packages/taquito-michelson-encoder/test/tokens/tx_rollup_l2_address.spec.ts deleted file mode 100644 index 3889c843a4..0000000000 --- a/packages/taquito-michelson-encoder/test/tokens/tx_rollup_l2_address.spec.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { b58decodeL2Address } from '@taquito/utils'; -import { - TxRollupL2AddressToken, - TxRollupL2AddressValidationError, -} from './../../src/tokens/comparable/tx_rollup_l2_address'; - -describe('TxRollupL2Address Token', () => { - let token: TxRollupL2AddressToken; - const bytes = b58decodeL2Address('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf'); - beforeEach(() => { - token = new TxRollupL2AddressToken( - { prim: 'tx_rollup_l2_address', args: [], annots: [] }, - 0, - null as any - ); - }); - - describe('test ToBigMapKey', () => { - it('to email bytes', () => { - expect(token.ToBigMapKey('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf')).toEqual({ - key: { bytes }, - type: { prim: 'bytes' }, - }); - }); - }); - - describe('EncodeObject', () => { - it('Should encode address to string', () => { - expect(token.EncodeObject('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf')).toEqual({ - string: 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf', - }); - }); - - it('test semantic', () => { - const val = token.EncodeObject('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf', { - tx_rollup_l2_address: () => ({ string: 'tester' }), - }); - const val2 = token.EncodeObject('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf', { - tx_rollup_l2_address: (arg) => ({ string: arg }), - }); - expect(val).toEqual({ string: 'tester' }); - expect(val2).toEqual({ string: 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf' }); - }); - - it('Should throw a new validation error when address is not valid', () => { - expect(() => token.EncodeObject('tz4').toThrowError(TxRollupL2AddressValidationError)); - expect(() => - token - .EncodeObject('tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn') - .toThrowError(TxRollupL2AddressValidationError) - ); - expect(() => token.EncodeObject(1).toThrowError(TxRollupL2AddressValidationError)); - expect(() => token.EncodeObject([]).toThrowError(TxRollupL2AddressValidationError)); - }); - }); - - describe('Encode', () => { - it('Should encode address to string', () => { - expect(token.Encode(['tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf'])).toEqual({ - string: 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf', - }); - }); - - it('Should throw a validation error when address is not valid', () => { - expect(() => token.Encode(['test'])).toThrowError(TxRollupL2AddressValidationError); - expect(() => token.Encode([])).toThrowError(TxRollupL2AddressValidationError); - expect(() => token.Encode(['', '', '', ''])).toThrowError(TxRollupL2AddressValidationError); - expect(() => token.Encode(['1'])).toThrowError(TxRollupL2AddressValidationError); - - try { - token.Encode(['test']); - } catch (ex) { - expect(ex.name).toEqual('TxRollupL2AddressValidationError'); - } - }); - }); - - describe('generateSchema', () => { - it('Should generate the schema properly', () => { - expect(token.generateSchema()).toEqual({ - __michelsonType: 'tx_rollup_l2_address', - schema: 'tx_rollup_l2_address', - }); - }); - }); - describe('ToBigMapKey', () => { - it('should equal expected', () => { - expect(() => token.ToBigMapKey('')); - }); - }); - describe('Execute', () => { - it('should throw error if not bytes', () => { - expect(() => token.Execute({ string: '' })).toThrowError(TxRollupL2AddressValidationError); - expect(() => token.Execute({ bytes: '' })).toThrowError(TxRollupL2AddressValidationError); - expect(() => token.Execute({ bytes: '', string: '' })).toThrowError( - TxRollupL2AddressValidationError - ); - }); - it('should return string', () => { - expect(token.Execute({ bytes: '', string: 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf' })).toEqual( - 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf' - ); - }); - it('should return string', () => { - expect(token.Execute({ bytes })).toEqual('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf'); - }); - }); - describe('ToKey', () => { - it('tz4 address should be returned', () => { - expect(token.ToKey({ bytes })).toEqual('tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf'); - expect(token.ToKey({ string: 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf' })).toEqual( - 'tz49XoaXbDZcWi2R1iKxQUxtBWXt4g4S1qtf' - ); - }); - it('should throw error when incorrect provided', () => { - expect(() => token.ToKey({ bytes: '' })).toThrowError(TxRollupL2AddressValidationError); - }); - }); - describe('extract schema', () => { - it('should be prim value of token', () => { - expect(token.ExtractSchema()).toEqual('tx_rollup_l2_address'); - }); - }); - describe('find return tokens', () => { - it('should return array with prim of this token', () => { - expect(token.findAndReturnTokens('tx_rollup_l2_address', [])).toEqual([token]); - expect(token.findAndReturnTokens('else', [])).toEqual([]); - }); - }); -}); diff --git a/packages/taquito-remote-signer/package.json b/packages/taquito-remote-signer/package.json index e928825931..51a1dfde93 100644 --- a/packages/taquito-remote-signer/package.json +++ b/packages/taquito-remote-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/remote-signer", - "version": "17.5.2", + "version": "19.0.0", "description": "Remote signer provider", "keywords": [ "tezos", @@ -62,10 +62,10 @@ "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { diff --git a/packages/taquito-remote-signer/src/version.ts b/packages/taquito-remote-signer/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-remote-signer/src/version.ts +++ b/packages/taquito-remote-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-rpc/package.json b/packages/taquito-rpc/package.json index 903c3e7e57..2210323c52 100644 --- a/packages/taquito-rpc/package.json +++ b/packages/taquito-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/rpc", - "version": "17.5.2", + "version": "19.0.0", "description": "Provides low level methods, and types to invoke RPC calls from a Nomadic Tezos RPC node", "keywords": [ "tezos", @@ -66,9 +66,9 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/packages/taquito-rpc/src/opkind.ts b/packages/taquito-rpc/src/opkind.ts index b7e163d4b7..80b6a47c21 100644 --- a/packages/taquito-rpc/src/opkind.ts +++ b/packages/taquito-rpc/src/opkind.ts @@ -4,26 +4,23 @@ export enum OpKind { REVEAL = 'reveal', TRANSACTION = 'transaction', ACTIVATION = 'activate_account', + ATTESTATION = 'attestation', ENDORSEMENT = 'endorsement', + PREATTESTATION = 'preattestation', PREENDORSEMENT = 'preendorsement', SET_DEPOSITS_LIMIT = 'set_deposits_limit', + DOUBLE_PREATTESTATION_EVIDENCE = 'double_preattestation_evidence', DOUBLE_PREENDORSEMENT_EVIDENCE = 'double_preendorsement_evidence', + ATTESTATION_WITH_SLOT = 'attestation_with_slot', ENDORSEMENT_WITH_SLOT = 'endorsement_with_slot', SEED_NONCE_REVELATION = 'seed_nonce_revelation', + DOUBLE_ATTESTATION_EVIDENCE = 'double_attestation_evidence', DOUBLE_ENDORSEMENT_EVIDENCE = 'double_endorsement_evidence', DOUBLE_BAKING_EVIDENCE = 'double_baking_evidence', PROPOSALS = 'proposals', BALLOT = 'ballot', FAILING_NOOP = 'failing_noop', REGISTER_GLOBAL_CONSTANT = 'register_global_constant', - TX_ROLLUP_ORIGINATION = 'tx_rollup_origination', - TX_ROLLUP_SUBMIT_BATCH = 'tx_rollup_submit_batch', - TX_ROLLUP_COMMIT = 'tx_rollup_commit', - TX_ROLLUP_RETURN_BOND = 'tx_rollup_return_bond', - TX_ROLLUP_FINALIZE_COMMITMENT = 'tx_rollup_finalize_commitment', - TX_ROLLUP_REMOVE_COMMITMENT = 'tx_rollup_remove_commitment', - TX_ROLLUP_REJECTION = 'tx_rollup_rejection', - TX_ROLLUP_DISPATCH_TICKETS = 'tx_rollup_dispatch_tickets', TRANSFER_TICKET = 'transfer_ticket', INCREASE_PAID_STORAGE = 'increase_paid_storage', UPDATE_CONSENSUS_KEY = 'update_consensus_key', diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index f8e910a99c..815dda2650 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -17,6 +17,8 @@ import { CurrentQuorumResponse, DelegateResponse, DelegatesResponse, + AttestationRightsQueryArguments, + AttestationRightsResponse, EndorsingRightsQueryArguments, EndorsingRightsResponse, EntrypointsResponse, @@ -38,22 +40,21 @@ import { SaplingDiffResponse, ScriptResponse, StorageResponse, - TxRollupInboxResponse, - TxRollupStateResponse, UnparsingMode, VotesListingsResponse, VotingInfoResponse, VotingPeriodBlockResult, TicketTokenParams, AllTicketBalances, - PendingOperations, + PendingOperationsV1, + PendingOperationsV2, PendingOperationsQueryArguments, - OriginationProofParams, RPCSimulateOperationParam, } from './types'; export interface RPCOptions { block: string; + version?: 0 | 1 | '0' | '1'; } export const defaultChain = 'main'; @@ -85,6 +86,10 @@ export interface RpcClientInterface { args: BakingRightsQueryArguments, options?: RPCOptions ): Promise; + getAttestationRights( + args: AttestationRightsQueryArguments, + options?: RPCOptions + ): Promise; getEndorsingRights( args: EndorsingRightsQueryArguments, options?: RPCOptions @@ -118,12 +123,6 @@ export interface RpcClientInterface { getSaplingDiffById(id: string, options?: RPCOptions): Promise; getSaplingDiffByContract(contract: string, options?: RPCOptions): Promise; getProtocols(options?: RPCOptions): Promise; - getTxRollupState(txRollupId: string, options?: RPCOptions): Promise; - getTxRollupInbox( - txRollupId: string, - blockLevel: string, - options?: RPCOptions - ): Promise; getStorageUsedSpace(contract: string, options?: RPCOptions): Promise; getStoragePaidSpace(contract: string, options?: RPCOptions): Promise; getTicketBalance( @@ -132,8 +131,9 @@ export interface RpcClientInterface { options?: RPCOptions ): Promise; getAllTicketBalances(contract: string, options?: RPCOptions): Promise; - getPendingOperations(args: PendingOperationsQueryArguments): Promise; - getOriginationProof(params: OriginationProofParams, options?: RPCOptions): Promise; + getPendingOperations( + args: PendingOperationsQueryArguments + ): Promise; } export enum RPCMethodName { @@ -156,6 +156,7 @@ export enum RPCMethodName { GET_DELEGATE = 'getDelegate', GET_DELEGATES = 'getDelegates', GET_VOTING_INFO = 'getVotingInfo', + GET_ATTESTATION_RIGHTS = 'getAttestationRights', GET_ENDORSING_RIGHTS = 'getEndorsingRights', GET_ENTRYPOINTS = 'getEntrypoints', GET_LIVE_BLOCKS = 'getLiveBlocks', @@ -168,8 +169,6 @@ export enum RPCMethodName { GET_SCRIPT = 'getScript', GET_STORAGE = 'getStorage', GET_SUCCESSOR_PERIOD = 'getSuccessorPeriod', - GET_TX_ROLLUP_INBOX = 'getTxRollupInbox', - GET_TX_ROLLUP_STATE = 'getTxRollupState', GET_VOTES_LISTINGS = 'getVotesListings', PACK_DATA = 'packData', GET_STORAGE_USED_SPACE = 'getStorageUsedSpace', @@ -177,5 +176,4 @@ export enum RPCMethodName { GET_TICKET_BALANCE = 'getTicketBalance', GET_ALL_TICKET_BALANCES = 'getAllTicketBalances', GET_PENDING_OPERATIONS = 'getPendingOperations', - GET_ORIGINATION_PROOF = 'getOriginationProof', } diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index dc34aea7b2..6d63c58ecd 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -20,6 +20,8 @@ import { DelegateResponse, DelegatesResponse, VotingInfoResponse, + AttestationRightsQueryArguments, + AttestationRightsResponse, EndorsingRightsQueryArguments, EndorsingRightsResponse, EntrypointsResponse, @@ -41,16 +43,14 @@ import { SaplingDiffResponse, ScriptResponse, StorageResponse, - TxRollupInboxResponse, - TxRollupStateResponse, UnparsingMode, VotesListingsResponse, VotingPeriodBlockResult, TicketTokenParams, AllTicketBalances, PendingOperationsQueryArguments, - PendingOperations, - OriginationProofParams, + PendingOperationsV1, + PendingOperationsV2, RPCSimulateOperationParam, } from '../types'; import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core'; @@ -74,8 +74,8 @@ type RpcMethodParam = | BigMapKey | BakingRightsQueryArguments | PendingOperationsQueryArguments - | EndorsingRightsQueryArguments - | OriginationProofParams; + | AttestationRightsQueryArguments + | EndorsingRightsQueryArguments; const defaultTtl = 1000; @@ -162,12 +162,10 @@ export class RpcClientCache implements RpcClientInterface { throw new InvalidContractAddressError(address, invalidDetail(addressValidation)); } } + /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Get the block's hash, its unique identifier. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-hash */ async getBlockHash({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -184,11 +182,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-live-blocks */ async getLiveBlocks({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -205,12 +200,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address address from which we want to retrieve the balance - * @param options contains generic configuration for rpc calls - * - * @description Access the balance of a contract. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the spendable balance of a contract, excluding frozen bonds * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance */ async getBalance( @@ -232,12 +224,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the storage - * @param options contains generic configuration for rpc calls - * @throws {@link InvalidContractAddressError} + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the data of the contract. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStorage( @@ -259,12 +248,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the script - * @param options contains generic configuration for rpc calls - * @throws {@link InvalidContractAddressError} + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the code and data of the contract. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script */ async getScript( @@ -286,13 +272,10 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the script * @param unparsingMode default is { unparsing_mode: "Readable" } - * @param options contains generic configuration for rpc calls - * @throws {@link InvalidContractAddressError} + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the script of the contract and normalize it using the requested unparsing mode. - * */ async getNormalizedScript( address: string, @@ -316,12 +299,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete status of a contract. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id */ async getContract( @@ -343,12 +323,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the manager - * @param options contains generic configuration for rpc calls - * - * @description Access the manager key of a contract. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the manager of an implicit contract * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-manager-key */ async getManagerKey( @@ -370,12 +347,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the delegate (baker) - * @param options contains generic configuration for rpc calls - * - * @description Access the delegate of a contract, if any. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the delegate of a contract, if any * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-delegate */ async getDelegate( @@ -397,14 +371,10 @@ export class RpcClientCache implements RpcClientInterface { } /** - * + * @deprecated Deprecated in favor of getBigMapKeyByID * @param address contract address from which we want to retrieve the big map key - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in the big map storage of the contract. - * - * @deprecated Deprecated in favor of getBigMapKeyByID - * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get */ async getBigMapKey( @@ -429,13 +399,10 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param id Big Map ID * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method)) - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in a big map. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr */ async getBigMapExpr( @@ -458,12 +425,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address delegate address which we want to retrieve - * @param options contains generic configuration for rpc calls - * - * @description Fetches information about a delegate from RPC. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Everything about a delegate * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh */ async getDelegates( @@ -485,15 +449,11 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param address delegate address which we want to retrieve - * @param options contains generic configuration for rpc calls - * - * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period. - * - * @see https://tezos.gitlab.io/kathmandu/rpc.html#get-block-id-context-delegates-pkh-voting-info + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-voting-info */ - async getVotingInfo( address: string, { block }: { block: string } = defaultRPCOptions @@ -513,11 +473,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description All constants - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants */ async getConstants({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -534,15 +491,12 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls. See examples for various available sytaxes. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) and version. * @description All the information about a block - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id - * @example getBlock() will default to /main/chains/block/head. - * @example getBlock({ block: head~2 }) will return an offset of 2 blocks. - * @example getBlock({ block: BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2 }) will return an offset of 2 blocks from given block hash.. + * @example getBlock() will default to `/main/chains/block/head?version=0` which shows { kind: endorsement } + * @example getBlock({ block: 'head~2', version: 1 }) will return an offset of 2 from head blocks and shows { kind: attestation } + * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. */ async getBlock({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK, [block]); @@ -556,11 +510,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description The whole block header - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-header */ async getBlockHeader({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -577,11 +528,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) and version * @description All the metadata associated to the block - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-metadata */ async getBlockMetadata({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -598,12 +546,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param args contains optional query arguments - * @param options contains generic configuration for rpc calls - * + * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round) + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the list of delegates allowed to bake a block. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights */ async getBakingRights( @@ -624,12 +569,34 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param args contains optional query arguments + * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Retrieves the delegates allowed to attest a block + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights + */ + async getAttestationRights( + args: AttestationRightsQueryArguments = {}, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_ATTESTATION_RIGHTS, + [block, args] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getAttestationRights(args, { block }); + this.put(key, response); + return response; + } + } + + /** + * @deprecated Deprecated in favor of getAttestationRights + * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) * @param options contains generic configuration for rpc calls - * - * @description Retrieves the list of delegates allowed to bake a block. - * + * @description Retrieves the delegates allowed to endorse a block * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights */ async getEndorsingRights( @@ -651,10 +618,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Ballots casted so far during a voting period - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballot-list */ async getBallotList({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -671,11 +636,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description Sum of ballots casted so far during a voting period. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Sum of ballots casted so far during a voting period * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballots */ async getBallots({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -690,11 +652,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current proposal under evaluation. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal */ async getCurrentProposal({ @@ -715,11 +674,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current expected quorum. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum */ async getCurrentQuorum({ @@ -738,11 +694,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description List of delegates with their voting weight, in number of rolls. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description List of delegates with their voting power * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings */ async getVotesListings({ @@ -761,11 +714,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description List of proposals with number of supporters. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description List of proposals with number of supporters * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-proposals */ async getProposals({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -782,12 +732,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param data operation contents to forge - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Forge an operation returning the unsigned bytes - * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations */ async forgeOperations( @@ -798,11 +745,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param signedOpBytes signed bytes to inject - * - * @description Inject an operation in node and broadcast it. Returns the ID of the operation. The `signedOperationContents` should be constructed using a contextual RPCs from the latest block and signed by the client. By default, the RPC will wait for the operation to be (pre-)validated before answering. See RPCs under /blocks/prevalidation for more details on the prevalidation context. - * + * @description Inject an operation in node and broadcast it and return the ID of the operation * @see https://tezos.gitlab.io/api/rpc.html#post-injection-operation */ async injectOperation(signedOpBytes: string): Promise { @@ -810,12 +754,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param ops Operations to apply - * @param options contains generic configuration for rpc calls - * - * @description Simulate the validation of an operation - * + * @param options contains generic configuration for rpc calls to specified block and version + * @description Simulate the application of the operations with the context of the given block and return the result of each operation application * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations */ async preapplyOperations( @@ -826,13 +767,10 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param contract address of the contract we want to get the entrypoints of - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Return the list of entrypoints of the contract - * @throws {@link InvalidContractAddressError} * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-entrypoints - * * @version 005_PsBABY5H */ async getEntrypoints( @@ -854,11 +792,10 @@ export class RpcClientCache implements RpcClientInterface { } /** + * @deprecated Deprecated in favor of simulateOperation * @param op Operation to run - * @param options contains generic configuration for rpc calls - * - * @description Run an operation without signature checks - * + * @param options contains generic configuration for rpc calls to specified block and version + * @description Run an operation with the context of the given block and without signature checks and return the operation application result, including the consumed gas. * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-operation */ async runOperation( @@ -870,11 +807,9 @@ export class RpcClientCache implements RpcClientInterface { /** * @param op Operation to simulate - * @param options contains generic configuration for rpc calls - * - * @description Simulate an operation - * - * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/nairobi-openapi.json + * @param options contains generic configuration for rpc calls to specified block and version + * @description Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result. + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/oxford-openapi.json */ async simulateOperation( op: RPCSimulateOperationParam, @@ -885,10 +820,8 @@ export class RpcClientCache implements RpcClientInterface { /** * @param code Code to run - * @param options contains generic configuration for rpc calls - * - * @description Run a piece of code in the current context - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Run a Michelson script in the current context * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-code */ async runCode( @@ -900,10 +833,8 @@ export class RpcClientCache implements RpcClientInterface { /** * @param viewScriptParams Parameters of the script view to run - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Simulate a call to a michelson view - * */ async runScriptView( { unparsing_mode = 'Readable', ...rest }: RPCRunScriptViewParam, @@ -920,10 +851,8 @@ export class RpcClientCache implements RpcClientInterface { /** * @param viewParams Parameters of the view to run - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Simulate a call to a view following the TZIP-4 standard. See https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints. - * */ async runView( { unparsing_mode = 'Readable', ...rest }: RPCRunViewParam, @@ -950,14 +879,14 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param data Data to pack - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK - * + * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the the RPC to pack. + * This precaution helps protect you and your applications users from RPC nodes that have been compromised. + * A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint. + * A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package. * @example packData({ data: { string: "test" }, type: { prim: "string" } }) - * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data */ async packData( @@ -988,13 +917,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description Voting period of current block. - * - * @example getCurrentPeriod() will default to current voting period for /main/chains/block/head. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period */ async getCurrentPeriod({ @@ -1013,13 +937,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description Voting period of next block. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-successor-period */ async getSuccessorPeriod({ @@ -1040,12 +960,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param id Sapling state ID - * @param options contains generic configuration for rpc calls - * - * @description Access the value associated with a sapling state ID. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the root and a diff of a state starting from an optional offset which is zero by default * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff */ async getSaplingDiffById( @@ -1067,12 +984,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param contract address of the contract we want to get the sapling diff - * @param options contains generic configuration for rpc calls - * - * @description Access the value associated with a sapling state. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the root and a diff of a state starting from an optional offset which is zero by default * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff */ async getSaplingDiffByContract( @@ -1093,6 +1007,11 @@ export class RpcClientCache implements RpcClientInterface { } } + /** + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description get current and next protocol + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols + */ async getProtocols({ block }: { block: string } = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROTOCOLS, [ block, @@ -1106,49 +1025,10 @@ export class RpcClientCache implements RpcClientInterface { } } - async getTxRollupState( - txRollupId: string, - { block }: { block: string } = defaultRPCOptions - ): Promise { - const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_TX_ROLLUP_STATE, [ - block, - txRollupId, - ]); - if (this.has(key)) { - return this.get(key); - } else { - const response = this.rpcClient.getTxRollupState(txRollupId, { block }); - this.put(key, response); - return response; - } - } - - async getTxRollupInbox( - txRollupId: string, - blockLevel: string, - { block }: { block: string } = defaultRPCOptions - ): Promise { - const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_TX_ROLLUP_INBOX, [ - block, - txRollupId, - blockLevel, - ]); - if (this.has(key)) { - return this.get(key); - } else { - const response = this.rpcClient.getTxRollupInbox(txRollupId, blockLevel, { block }); - this.put(key, response); - return response; - } - } - /** - * * @param contract address of the contract we want to retrieve storage information of - * @param options contains generic configuration for rpc calls - * - * @description Access the amount of used space used in a contract's storage - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the used storage space of the contract * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStorageUsedSpace( @@ -1170,12 +1050,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * * @param contract address of the contract we want to retrieve storage information of - * @param options contains generic configuration for rpc calls - * - * @description Access the amount of paid space in a contract's storage - * + * @param options contains generic configuration for rpc calls to specified block (default to head) += * @description Access the paid storage space of the contract * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStoragePaidSpace( @@ -1197,12 +1074,11 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param contract address of the contract we want to retrieve ticket balance of - * @param ticket Ticket token parameter object that contains ticketer, content type, and content - * @param options contains generic configuration for rpc calls + * @param contract implicit or originated address we want to retrieve ticket balance of + * @param ticket object to specify a ticket by ticketer, content type and content + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the contract's balance of ticket with specified ticketer, content type, and content. - * @example ticket{ ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } } + * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } } * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes */ async getTicketBalance( @@ -1226,9 +1102,8 @@ export class RpcClientCache implements RpcClientInterface { } /** - * - * @param contract address of the contract to retrieve all ticket balances from - * @param options contains generic configuration for rpc calls + * @param contract originated address we want to retrieve ticket balances of + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage. * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes */ @@ -1252,13 +1127,13 @@ export class RpcClientCache implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) - * @param args has 5 optional properties. We support version 1 with new encoding as version 0 will be deprecated soon. The rest of the properties is to filter pending operations response + * @param args has 5 optional properties. We support version 1 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response * @default args { version: '1', applied: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } * @see https://tezos.gitlab.io/CHANGES.html?highlight=pending_operations#id4 */ async getPendingOperations( args: PendingOperationsQueryArguments = {} - ): Promise { + ): Promise { const key = this.formatCacheKey( this.rpcClient.getRpcUrl(), RPCMethodName.GET_PENDING_OPERATIONS, @@ -1272,28 +1147,4 @@ export class RpcClientCache implements RpcClientInterface { return response; } } - - /** - * - * @param params contains the PVM kind and kernel to generate the origination proof from - * @description rpc call to generate the origination proof needed for the smart rollup originate operation - * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes - */ - async getOriginationProof( - params: OriginationProofParams, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - const key = this.formatCacheKey( - this.rpcClient.getRpcUrl(), - RPCMethodName.GET_ORIGINATION_PROOF, - [block, params] - ); - if (this.has(key)) { - return this.get(key); - } else { - const response = this.rpcClient.getOriginationProof(params, { block }); - this.put(key, response); - return response; - } - } } diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index e8125e2954..0e4381ca5b 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -2,7 +2,12 @@ * @packageDocumentation * @module @taquito/rpc */ -import { HttpBackend, HttpResponseError, STATUS_CODE } from '@taquito/http-utils'; +import { + HttpBackend, + HttpRequestOptions, + HttpResponseError, + STATUS_CODE, +} from '@taquito/http-utils'; import BigNumber from 'bignumber.js'; import { defaultChain, @@ -29,6 +34,8 @@ import { DelegateResponse, DelegatesResponse, VotingInfoResponse, + AttestationRightsQueryArguments, + AttestationRightsResponse, EndorsingRightsQueryArguments, EndorsingRightsResponse, EntrypointsResponse, @@ -55,13 +62,11 @@ import { UnparsingMode, VotesListingsResponse, VotingPeriodBlockResult, - TxRollupStateResponse, - TxRollupInboxResponse, TicketTokenParams, AllTicketBalances, PendingOperationsQueryArguments, - PendingOperations, - OriginationProofParams, + PendingOperationsV1, + PendingOperationsV2, RPCSimulateOperationParam, } from './types'; import { castToBigNumber } from './utils/utils'; @@ -135,11 +140,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Get the block's hash, its unique identifier. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-hash */ async getBlockHash({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -151,11 +153,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-live-blocks */ async getLiveBlocks({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -167,12 +166,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address address from which we want to retrieve the balance - * @param options contains generic configuration for rpc calls - * - * @description Access the balance of a contract. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the spendable balance of a contract, excluding frozen bonds * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance */ async getBalance( @@ -190,12 +186,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the storage - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the data of the contract. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStorage( @@ -212,12 +205,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the script - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the code and data of the contract. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script */ async getScript( @@ -234,13 +224,10 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the script * @param unparsingMode default is { unparsing_mode: "Readable" } - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the script of the contract and normalize it using the requested unparsing mode. - * */ async getNormalizedScript( address: string, @@ -260,12 +247,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete status of a contract. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id */ async getContract( @@ -284,12 +268,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the manager - * @param options contains generic configuration for rpc calls - * - * @description Access the manager key of a contract. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the manager of an implicit contract * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-manager-key */ async getManagerKey( @@ -306,12 +287,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address contract address from which we want to retrieve the delegate (baker) - * @param options contains generic configuration for rpc calls - * - * @description Access the delegate of a contract, if any. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the delegate of a contract, if any * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-delegate */ async getDelegate( @@ -338,14 +316,10 @@ export class RpcClient implements RpcClientInterface { } /** - * + * @deprecated Deprecated in favor of getBigMapKeyByID * @param address contract address from which we want to retrieve the big map key - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in the big map storage of the contract. - * - * @deprecated Deprecated in favor of getBigMapKeyByID - * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get */ async getBigMapKey( @@ -366,13 +340,10 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param id Big Map ID * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method)) - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in a big map. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr */ async getBigMapExpr( @@ -387,12 +358,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address delegate address which we want to retrieve - * @param options contains generic configuration for rpc calls - * - * @description Fetches information about a delegate from RPC. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Everything about a delegate * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh */ async getDelegates( @@ -415,6 +383,8 @@ export class RpcClient implements RpcClientInterface { 'staking_balance', 'delegated_balance', 'voting_power', + 'total_delegated_stake', + 'staking_denominator', ]); return { @@ -441,13 +411,10 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param address delegate address which we want to retrieve - * @param options contains generic configuration for rpc calls - * - * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period. - * - * @see https://tezos.gitlab.io/kathmandu/rpc.html#get-block-id-context-delegates-pkh-voting-info + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-voting-info */ async getVotingInfo( @@ -464,11 +431,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description All constants - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants */ async getConstants({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -514,31 +478,27 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls. See examples for various available syntaxes. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) and version. * @description All the information about a block - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id - * @example getBlock() will default to /main/chains/block/head. - * @example getBlock({ block: head~2 }) will return an offset of 2 blocks. - * @example getBlock({ block: BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2 }) will return an offset of 2 blocks from given block hash.. + * @example getBlock() will default to `/main/chains/block/head?version=0` which shows { kind: endorsement } + * @example getBlock({ block: 'head~2', version: 1 }) will return an offset of 2 from head blocks and shows { kind: attestation } + * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. */ - async getBlock({ block }: RPCOptions = defaultRPCOptions): Promise { - const response = await this.httpBackend.createRequest({ + async getBlock({ block, version }: RPCOptions = defaultRPCOptions): Promise { + const requestOptions: HttpRequestOptions = { url: this.createURL(`/chains/${this.chain}/blocks/${block}`), method: 'GET', - }); - - return response; + }; + if (version !== undefined) { + requestOptions.query = { version }; + } + return await this.httpBackend.createRequest(requestOptions); } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description The whole block header - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-header */ async getBlockHeader({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -551,29 +511,28 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) and version * @description All the metadata associated to the block - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-metadata */ - async getBlockMetadata({ block }: RPCOptions = defaultRPCOptions): Promise { - const response = await this.httpBackend.createRequest({ + async getBlockMetadata({ + block, + version, + }: RPCOptions = defaultRPCOptions): Promise { + const requestOptions: HttpRequestOptions = { url: this.createURL(`/chains/${this.chain}/blocks/${block}/metadata`), method: 'GET', - }); - - return response; + }; + if (version !== undefined) { + requestOptions.query = { version }; + } + return await this.httpBackend.createRequest(requestOptions); } /** - * - * @param args contains optional query arguments - * @param options contains generic configuration for rpc calls - * + * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round) + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the list of delegates allowed to bake a block. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights */ async getBakingRights( @@ -590,12 +549,29 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param args contains optional query arguments + * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Retrieves the delegates allowed to attest a block + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights + */ + async getAttestationRights( + args: AttestationRightsQueryArguments = {}, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/attestation_rights`), + method: 'GET', + query: args, + }); + + return response; + } + + /** + * @deprecated Deprecated in favor of getAttestationRights + * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) * @param options contains generic configuration for rpc calls - * - * @description Retrieves the list of delegates allowed to bake a block. - * + * @description Retrieves the delegates allowed to endorse a block * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights */ async getEndorsingRights( @@ -612,10 +588,8 @@ export class RpcClient implements RpcClientInterface { } /** - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Ballots casted so far during a voting period - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballot-list */ async getBallotList({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -628,11 +602,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description Sum of ballots casted so far during a voting period. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Sum of ballots casted so far during a voting period * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballots */ async getBallots({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -646,11 +617,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current proposal under evaluation. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal */ async getCurrentProposal({ @@ -665,11 +633,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current expected quorum. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum */ async getCurrentQuorum({ @@ -684,11 +649,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description List of delegates with their voting weight, in number of rolls. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description List of delegates with their voting power * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings */ async getVotesListings({ @@ -710,11 +672,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description List of proposals with number of supporters. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description List of proposals with number of supporters * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-proposals */ async getProposals({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -731,12 +690,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param data operation contents to forge - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Forge an operation returning the unsigned bytes - * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations */ async forgeOperations( @@ -753,11 +709,8 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param signedOpBytes signed bytes to inject - * - * @description Inject an operation in node and broadcast it. Returns the ID of the operation. The `signedOperationContents` should be constructed using a contextual RPCs from the latest block and signed by the client. By default, the RPC will wait for the operation to be (pre-)validated before answering. See RPCs under /blocks/prevalidation for more details on the prevalidation context. - * + * @description Inject an operation in node and broadcast it and return the ID of the operation * @see https://tezos.gitlab.io/api/rpc.html#post-injection-operation */ async injectOperation(signedOpBytes: string): Promise { @@ -771,37 +724,30 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param ops Operations to apply - * @param options contains generic configuration for rpc calls - * - * @description Simulate the validation of an operation - * + * @param options contains generic configuration for rpc calls to specified block and version + * @description Simulate the application of the operations with the context of the given block and return the result of each operation application * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations */ async preapplyOperations( ops: PreapplyParams, - { block }: RPCOptions = defaultRPCOptions + { block, version }: RPCOptions = defaultRPCOptions ): Promise { - const response = await this.httpBackend.createRequest( - { - url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/preapply/operations`), - method: 'POST', - }, - ops - ); - - return response; + const requestOptions: HttpRequestOptions = { + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/preapply/operations`), + method: 'POST', + }; + if (version !== undefined) { + requestOptions.query = { version }; + } + return await this.httpBackend.createRequest(requestOptions, ops); } /** - * * @param contract address of the contract we want to get the entrypoints of - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Return the list of entrypoints of the contract - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-entrypoints - * * @version 005_PsBABY5H */ async getEntrypoints( @@ -822,59 +768,52 @@ export class RpcClient implements RpcClientInterface { } /** + * @deprecated Deprecated in favor of simulateOperation * @param op Operation to run - * @param options contains generic configuration for rpc calls - * - * @description Run an operation without signature checks - * + * @param options contains generic configuration for rpc calls to specified block and version + * @description Run an operation with the context of the given block and without signature checks and return the operation application result, including the consumed gas. * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-operation */ async runOperation( op: RPCRunOperationParam, - { block }: RPCOptions = defaultRPCOptions + { block, version }: RPCOptions = defaultRPCOptions ): Promise { - const response = await this.httpBackend.createRequest( - { - url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_operation`), - method: 'POST', - }, - op - ); - - return response; + const requestOptions: HttpRequestOptions = { + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_operation`), + method: 'POST', + }; + if (version !== undefined) { + requestOptions.query = { version }; + } + return await this.httpBackend.createRequest(requestOptions, op); } /** * @param op Operation to simulate - * @param options contains generic configuration for rpc calls - * - * @description Simulate an operation on the blockchain - * - * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/nairobi-openapi.json + * @param options contains generic configuration for rpc calls to specified block and version + * @description Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result. + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/oxford-openapi.json */ async simulateOperation( op: RPCSimulateOperationParam, - { block }: RPCOptions = defaultRPCOptions + { block, version }: RPCOptions = defaultRPCOptions ): Promise { - const response = await this.httpBackend.createRequest( - { - url: this.createURL( - `/chains/${this.chain}/blocks/${block}/helpers/scripts/simulate_operation` - ), - method: 'POST', - }, - op - ); - - return response; + const requestOptions: HttpRequestOptions = { + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/helpers/scripts/simulate_operation` + ), + method: 'POST', + }; + if (version !== undefined) { + requestOptions.query = { version }; + } + return await this.httpBackend.createRequest(requestOptions, op); } /** * @param code Code to run - * @param options contains generic configuration for rpc calls - * - * @description Run a piece of code in the current context - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Run a Michelson script in the current context * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-code */ async runCode( @@ -894,10 +833,8 @@ export class RpcClient implements RpcClientInterface { /** * @param viewScriptParams Parameters of the script view to run - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Simulate a call to a michelson view - * */ async runScriptView( { unparsing_mode = 'Readable', ...rest }: RPCRunScriptViewParam, @@ -919,10 +856,8 @@ export class RpcClient implements RpcClientInterface { /** * @param viewParams Parameters of the view to run - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Simulate a call to a view following the TZIP-4 standard. See https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints. - * */ async runView( { unparsing_mode = 'Readable', ...rest }: RPCRunViewParam, @@ -948,19 +883,14 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param data Data to pack - * @param options contains generic configuration for rpc calls - * + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the the RPC to pack. * This precaution helps protect you and your applications users from RPC nodes that have been compromised. * A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint. * A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package. - * * @example packData({ data: { string: "test" }, type: { prim: "string" } }) - * - * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data */ async packData(data: PackDataParams, { block }: RPCOptions = defaultRPCOptions) { @@ -991,13 +921,8 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description Voting period of current block. - * - * @example getCurrentPeriod() will default to current voting period for /main/chains/block/head. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period */ async getCurrentPeriod({ @@ -1012,13 +937,9 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param options contains generic configuration for rpc calls - * - * @description Voting period of next block. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head. - * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-successor-period */ async getSuccessorPeriod({ @@ -1033,12 +954,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param id Sapling state ID - * @param options contains generic configuration for rpc calls - * - * @description Access the value associated with a sapling state ID. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the root and a diff of a state starting from an optional offset which is zero by default * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff */ async getSaplingDiffById( @@ -1052,12 +970,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param contract address of the contract we want to get the sapling diff - * @param options contains generic configuration for rpc calls - * - * @description Access the value associated with a sapling state. - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Returns the root and a diff of a state starting from an optional offset which is zero by default * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff */ async getSaplingDiffByContract( @@ -1072,6 +987,11 @@ export class RpcClient implements RpcClientInterface { }); } + /** + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description get current and next protocol + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols + */ async getProtocols({ block }: { block: string } = defaultRPCOptions): Promise { return this.httpBackend.createRequest({ url: this.createURL(`/chains/${this.chain}/blocks/${block}/protocols`), @@ -1080,58 +1000,9 @@ export class RpcClient implements RpcClientInterface { } /** - * - * @param tx_rollup_id the transaction rollup ID - * @param options contains generic configuration for rpc calls - * - * @description Access the state of a rollup - * - * @see https://tezos.gitlab.io/jakarta/rpc.html#get-block-id-context-tx-rollup-tx-rollup-id-state - */ - - async getTxRollupState( - txRollupId: string, - { block }: { block: string } = defaultRPCOptions - ): Promise { - return this.httpBackend.createRequest({ - url: this.createURL( - `/chains/${this.chain}/blocks/${block}/context/tx_rollup/${txRollupId}/state` - ), - method: 'GET', - }); - } - - /** - * - * @param tx_rollup_id the transaction rollup ID - * @param block_level the block level - * @param options contains generic configuration for rpc calls - * - * @description Access the inbox of a transaction rollup - * - * @see https://tezos.gitlab.io/jakarta/rpc.html#get-block-id-context-tx-rollup-tx-rollup-id-inbox-block-level - */ - - async getTxRollupInbox( - txRollupId: string, - blockLevel: string, - { block }: { block: string } = defaultRPCOptions - ): Promise { - return this.httpBackend.createRequest({ - url: this.createURL( - `/chains/${this.chain}/blocks/${block}/context/tx_rollup/${txRollupId}/inbox/${blockLevel}` - ), - method: 'GET', - }); - } - - /** - * * @param contract address of the contract we want to retrieve storage information of - * @param options contains generic configuration for rpc calls - * - * @description Access the amount of used space in a contract's storage - * + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the used storage space of the contract * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStorageUsedSpace( @@ -1147,12 +1018,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param contract address of the contract we want to retrieve storage information of - * @param options contains generic configuration for rpc calls - * - * @description Access the amount of paid space in a contract's storage - * + * @param options contains generic configuration for rpc calls to specified block (default to head) += * @description Access the paid storage space of the contract * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStoragePaidSpace( @@ -1168,10 +1036,9 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param contract implicit or originated address we want to retrieve ticket balance of * @param ticket object to specify a ticket by ticketer, content type and content - * @param options contains generic configuration for rpc calls + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the contract's balance of ticket with specified ticketer, content type, and content. * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } } * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes @@ -1193,9 +1060,8 @@ export class RpcClient implements RpcClientInterface { } /** - * * @param contract originated address we want to retrieve ticket balances of - * @param options contains generic configuration for rpc calls + * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage. * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes */ @@ -1213,38 +1079,17 @@ export class RpcClient implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) - * @param args has 5 optional properties. We support version 1 with new encoding as version 0 will be deprecated soon. The rest of the properties is to filter pending operations response + * @param args has 5 optional properties. We support version 1 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response * @default args { version: '1', applied: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } * @see https://tezos.gitlab.io/CHANGES.html?highlight=pending_operations#id4 */ async getPendingOperations( args: PendingOperationsQueryArguments = {} - ): Promise { - return this.httpBackend.createRequest({ + ): Promise { + return this.httpBackend.createRequest({ url: this.createURL(`/chains/${this.chain}/mempool/pending_operations`), method: 'GET', query: args, }); } - - /** - * - * @param params contains the PVM kind and kernel to generate the origination proof from - * @description rpc call to generate the origination proof needed for a smart rollup originate operation - * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes - */ - async getOriginationProof( - params: OriginationProofParams, - { block }: { block: string } = defaultRPCOptions - ): Promise { - return this.httpBackend.createRequest( - { - url: this.createURL( - `/chains/${this.chain}/blocks/${block}/context/smart_rollups/all/origination_proof` - ), - method: 'POST', - }, - params - ); - } } diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index c459fb0b69..4cf5471d53 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -33,84 +33,32 @@ export type OtherElts = other_elts: OtherEltsInner; }; -type State = - | { - inode: Inode; - } - | { - other_elts: OtherElts; - }; - export interface Inode { length: string; proofs: [string | null, string | null]; } -type TxRollupProofContextHash = - | { - value: string; - } - | { - node: string; - }; - -export interface TxRollupProof { - version: number; - before: TxRollupProofContextHash; - after: TxRollupProofContextHash; - state: State[]; -} - -export interface TxRollupCommitment { - level: number; - messages: string[]; - predecessor?: string; - inbox_merkle_root: string; -} - -export interface TxRollupDeposit { - sender: string; - destination: string; - ticket_hash: string; - amount: string; -} - -export interface TxRollupMessage { - batch?: string; - deposit?: TxRollupDeposit; -} - -export interface TxRollupPreviousMessageResult { - context_hash: string; - withdraw_list_hash: string; -} - -export interface TxRollupTicketsInfo { - contents: MichelsonV1Expression; - ty: MichelsonV1Expression; - ticketer: string; - amount: string; - claimer: string; -} export interface DelegatesResponse { - balance?: BigNumber; full_balance?: BigNumber; current_frozen_deposits?: BigNumber; - frozen_deposits?: BigNumber; - frozen_balance?: BigNumber; - frozen_balance_by_cycle?: Frozenbalancebycycle[]; - frozen_deposits_limit?: BigNumber; staking_balance: BigNumber; + frozen_deposits_limit?: BigNumber; delegated_contracts: string[]; delegated_balance: BigNumber; deactivated: boolean; grace_period: number; + total_delegated_stake?: BigNumber; + staking_denominator?: BigNumber; voting_power?: BigNumber; current_ballot?: BallotVote; current_proposals?: string[]; remaining_proposals?: number; active_consensus_key?: string; pending_consensus_keys?: PendingConsensusKey[]; + balance?: BigNumber; + frozen_deposits?: BigNumber; + frozen_balance?: BigNumber; + frozen_balance_by_cycle?: Frozenbalancebycycle[]; } export type PendingConsensusKey = { @@ -140,6 +88,8 @@ export type BigMapKey = { export type LiquidityBakingToggleVotes = 'on' | 'off' | 'pass'; +export type AdaptiveIssuanceVote = 'on' | 'off' | 'pass'; + export interface BlockFullHeader { level: number; proto: number; @@ -154,13 +104,24 @@ export interface BlockFullHeader { priority?: number; proof_of_work_nonce: string; seed_nonce_hash?: string; - liquidity_baking_escape_vote?: boolean | LiquidityBakingToggleVotes; liquidity_baking_toggle_vote?: LiquidityBakingToggleVotes; + adaptive_issuance_vote?: AdaptiveIssuanceVote; + liquidity_baking_escape_vote?: boolean | LiquidityBakingToggleVotes; signature: string; } +export type InlinedAttestationKindEnum = OpKind.ATTESTATION; + export type InlinedEndorsementKindEnum = OpKind.ENDORSEMENT; +export interface InlinedAttestationContents { + kind: InlinedAttestationKindEnum; + slot?: number; + round?: number; + block_payload_hash?: string; + level: number; +} + export interface InlinedEndorsementContents { kind: InlinedEndorsementKindEnum; slot?: number; @@ -169,6 +130,14 @@ export interface InlinedEndorsementContents { level: number; } +export interface InlinedPreattestationContents { + kind: OpKind.PREATTESTATION; + slot: number; + level: number; + round: number; + block_payload_hash: string; +} + export interface InlinedPreEndorsementContents { kind: OpKind.PREENDORSEMENT; slot: number; @@ -177,12 +146,24 @@ export interface InlinedPreEndorsementContents { block_payload_hash: string; } +export interface InlinedAttestation { + branch: string; + operations: InlinedAttestationContents; + signature?: string; +} + export interface InlinedEndorsement { branch: string; operations: InlinedEndorsementContents; signature?: string; } +export interface InlinedPreattestation { + branch: string; + operations: InlinedPreattestationContents; + signature?: string; +} + export interface InlinedPreEndorsement { branch: string; operations: InlinedPreEndorsementContents; @@ -191,6 +172,14 @@ export interface InlinedPreEndorsement { export type BallotVote = 'nay' | 'yay' | 'pass'; +export interface OperationContentsAttestation { + kind: OpKind.ATTESTATION; + level: number; + slot?: number; + round?: number; + block_payload_hash?: string; +} + export interface OperationContentsEndorsement { kind: OpKind.ENDORSEMENT; level: number; @@ -199,6 +188,13 @@ export interface OperationContentsEndorsement { block_payload_hash?: string; } +export interface OperationContentsPreattestation { + kind: OpKind.PREATTESTATION; + slot: number; + level: number; + round: number; + block_payload_hash: string; +} export interface OperationContentsPreEndorsement { kind: OpKind.PREENDORSEMENT; slot: number; @@ -207,6 +203,12 @@ export interface OperationContentsPreEndorsement { block_payload_hash: string; } +export interface OperationContentsDoublePreattestation { + kind: OpKind.DOUBLE_PREATTESTATION_EVIDENCE; + op1: InlinedPreattestation; + op2: InlinedPreattestation; +} + export interface OperationContentsDoublePreEndorsement { kind: OpKind.DOUBLE_PREENDORSEMENT_EVIDENCE; op1: InlinedPreEndorsement; @@ -223,6 +225,12 @@ export interface OperationContentsSetDepositsLimit { limit?: string; } +export interface OperationContentsAttestationWithSlot { + kind: OpKind.ATTESTATION_WITH_SLOT; + endorsement: InlinedAttestation; + slot: number; +} + export interface OperationContentsEndorsementWithSlot { kind: OpKind.ENDORSEMENT_WITH_SLOT; endorsement: InlinedEndorsement; @@ -240,6 +248,13 @@ export interface OperationContentsVdfRevelation { solution: string[]; } +export interface OperationContentsDoubleAttestation { + kind: OpKind.DOUBLE_ATTESTATION_EVIDENCE; + op1: InlinedAttestation; + op2: InlinedAttestation; + slot?: number; +} + export interface OperationContentsDoubleEndorsement { kind: OpKind.DOUBLE_ENDORSEMENT_EVIDENCE; op1: InlinedEndorsement; @@ -333,103 +348,6 @@ export interface OperationContentsRegisterGlobalConstant { value: MichelsonV1Expression; } -export interface OperationContentsTxRollupOrigination { - kind: OpKind.TX_ROLLUP_ORIGINATION; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - tx_rollup_origination: any; -} - -export interface OperationContentsTxRollupSubmitBatch { - kind: OpKind.TX_ROLLUP_SUBMIT_BATCH; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - content: string; - burn_limit?: string; -} - -export interface OperationContentsTxRollupCommit { - kind: OpKind.TX_ROLLUP_COMMIT; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - commitment: TxRollupCommitment; -} - -export interface OperationContentsTxRollupReturnBond { - kind: OpKind.TX_ROLLUP_RETURN_BOND; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; -} - -export interface OperationContentsTxRollupFinalizeCommitment { - kind: OpKind.TX_ROLLUP_FINALIZE_COMMITMENT; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; -} - -export interface OperationContentsTxRollupRemoveCommitment { - kind: OpKind.TX_ROLLUP_REMOVE_COMMITMENT; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; -} - -export interface OperationContentsTxRollupRejection { - kind: OpKind.TX_ROLLUP_REJECTION; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - level: number; - message: TxRollupMessage; - message_position: string; - message_path: string[]; - message_result_hash: string; - message_result_path: string[]; - previous_message_result: TxRollupPreviousMessageResult; - previous_message_result_path: string[]; - proof: TxRollupProof | string; -} - -export interface OperationContentsTxRollupDispatchTickets { - kind: OpKind.TX_ROLLUP_DISPATCH_TICKETS; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - tx_rollup: string; - level: number; - context_hash: string; - message_index: number; - message_result_path: string[]; - tickets_info: TxRollupTicketsInfo[]; -} - export interface OperationContentsTransferTicket { kind: OpKind.TRANSFER_TICKET; source: string; @@ -482,8 +400,8 @@ export interface OperationContentsSmartRollupOriginate { storage_limit: string; pvm_kind: PvmKind; kernel: string; - origination_proof: string; parameters_ty: MichelsonV1Expression; + whitelist?: string[]; } export interface OperationContentsSmartRollupAddMessages { @@ -565,11 +483,15 @@ export interface OperationContentsSmartRollupTimeout { } export type OperationContents = + | OperationContentsAttestation + | OperationContentsPreattestation + | OperationContentsDoublePreattestation | OperationContentsEndorsement | OperationContentsPreEndorsement | OperationContentsDoublePreEndorsement | OperationContentsRevelation | OperationContentsVdfRevelation + | OperationContentsDoubleAttestation | OperationContentsDoubleEndorsement | OperationContentsDoubleBaking | OperationContentsActivateAccount @@ -579,17 +501,11 @@ export type OperationContents = | OperationContentsTransaction | OperationContentsOrigination | OperationContentsDelegation + | OperationContentsAttestationWithSlot | OperationContentsEndorsementWithSlot | OperationContentsFailingNoop | OperationContentsRegisterGlobalConstant | OperationContentsSetDepositsLimit - | OperationContentsTxRollupOrigination - | OperationContentsTxRollupSubmitBatch - | OperationContentsTxRollupCommit - | OperationContentsTxRollupReturnBond - | OperationContentsTxRollupFinalizeCommitment - | OperationContentsTxRollupRemoveCommitment - | OperationContentsTxRollupRejection | OperationContentsTransferTicket | OperationContentsUpdateConsensusKey | OperationContentsDrainDelegate @@ -603,7 +519,14 @@ export type OperationContents = | OperationContentsSmartRollupRecoverBond | OperationContentsSmartRollupTimeout; -export interface OperationContentsAndResultMetadataExtended { +export interface OperationContentsAndResultMetadataExtended1 { + balance_updates?: OperationMetadataBalanceUpdates[]; + delegate: string; + consensus_power: number; + consensus_key: string; +} + +export interface OperationContentsAndResultMetadataExtended0 { balance_updates?: OperationMetadataBalanceUpdates[]; delegate: string; slots?: number[]; @@ -611,6 +534,13 @@ export interface OperationContentsAndResultMetadataExtended { consensus_key?: string; } +export interface OperationContentsAndResultMetadataPreattestation { + balance_updates?: OperationMetadataBalanceUpdates[]; + delegate: string; + consensus_power: number; + consensus_key?: string; +} + export interface OperationContentsAndResultMetadataPreEndorsement { balance_updates?: OperationMetadataBalanceUpdates[]; delegate: string; @@ -652,60 +582,12 @@ export interface OperationContentsAndResultMetadata { balance_updates?: OperationMetadataBalanceUpdates[]; } -export interface OperationContentsAndResultMetadataTxRollupOrigination { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupOrigination; - internal_operation_results?: InternalOperationResult[]; -} - -export interface OperationContentsAndResultMetadataTxRollupSubmitBatch { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupSubmitBatch; - internal_operation_results?: InternalOperationResult[]; -} - -export interface OperationContentsAndResultMetadataTxRollupCommit { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupCommit; - internal_operation_results?: InternalOperationResult[]; -} - -export interface OperationContentsAndResultMetadataTxRollupReturnBond { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupReturnBond; - internal_operation_results?: InternalOperationResult[]; -} - -export interface OperationContentsAndResultMetadataTxRollupFinalizeCommitment { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupFinalizeCommitment; - internal_operation_results?: InternalOperationResult[]; -} - -export interface OperationContentsAndResultMetadataTxRollupRemoveCommitment { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupRemoveCommitment; - internal_operation_results?: InternalOperationResult[]; -} - -export interface OperationContentsAndResultMetadataTxRollupRejection { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupRejection; - internal_operation_results?: InternalOperationResult[]; -} - export interface OperationContentsAndResultMetadataTransferTicket { balance_updates?: OperationMetadataBalanceUpdates[]; operation_result: OperationResultTransferTicket; internal_operation_results?: InternalOperationResult[]; } -export interface OperationContentsAndResultMetadataTxRollupDispatchTickets { - balance_updates?: OperationMetadataBalanceUpdates[]; - operation_result: OperationResultTxRollupDispatchTickets; - internal_operation_results?: InternalOperationResult[]; -} - export interface OperationContentsAndResultMetadataIncreasePaidStorage { balance_updates?: OperationMetadataBalanceUpdates[]; operation_result: OperationResultIncreasePaidStorage; @@ -771,13 +653,31 @@ export interface OperationContentsAndResultMetadataSmartRollupTimeout { internal_operation_results?: InternalOperationResult[]; } +export interface OperationContentsAndResultAttestation { + kind: OpKind.ATTESTATION; + block_payload_hash?: string; + level: number; + round?: number; + slot?: number; + metadata: OperationContentsAndResultMetadataExtended1; +} + export interface OperationContentsAndResultEndorsement { kind: OpKind.ENDORSEMENT; block_payload_hash?: string; level: number; round?: number; slot?: number; - metadata: OperationContentsAndResultMetadataExtended; + metadata: OperationContentsAndResultMetadataExtended0; +} + +export interface OperationContentsAndResultPreattestation { + kind: OpKind.PREATTESTATION; + slot: number; + level: number; + round: number; + block_payload_hash: string; + metadata: OperationContentsAndResultMetadataPreattestation; } export interface OperationContentsAndResultPreEndorsement { @@ -789,17 +689,32 @@ export interface OperationContentsAndResultPreEndorsement { metadata: OperationContentsAndResultMetadataPreEndorsement; } +export interface OperationContentsAndResultDoublePreattestation { + kind: OpKind.DOUBLE_PREATTESTATION_EVIDENCE; + op1: InlinedPreattestation; + op2: InlinedPreattestation; + metadata: OperationContentsAndResultMetadata; +} + +export interface OperationContentsAndResultAttestationWithSlot { + kind: OpKind.ATTESTATION_WITH_SLOT; + endorsement: InlinedAttestation; + slot: number; + metadata: OperationContentsAndResultMetadataExtended1; +} + export interface OperationContentsAndResultDoublePreEndorsement { kind: OpKind.DOUBLE_PREENDORSEMENT_EVIDENCE; op1: InlinedPreEndorsement; op2: InlinedPreEndorsement; metadata: OperationContentsAndResultMetadata; } + export interface OperationContentsAndResultEndorsementWithSlot { kind: OpKind.ENDORSEMENT_WITH_SLOT; endorsement: InlinedEndorsement; slot: number; - metadata: OperationContentsAndResultMetadataExtended; + metadata: OperationContentsAndResultMetadataExtended0; } export interface OperationContentsAndResultRevelation { @@ -809,6 +724,14 @@ export interface OperationContentsAndResultRevelation { metadata: OperationContentsAndResultMetadata; } +export interface OperationContentsAndResultDoubleAttestation { + kind: OpKind.DOUBLE_ATTESTATION_EVIDENCE; + op1: InlinedAttestation; + op2: InlinedAttestation; + slot?: number; + metadata: OperationContentsAndResultMetadata; +} + export interface OperationContentsAndResultDoubleEndorsement { kind: OpKind.DOUBLE_ENDORSEMENT_EVIDENCE; op1: InlinedEndorsement; @@ -903,95 +826,6 @@ export interface OperationContentsAndResultSetDepositsLimit { metadata: OperationContentsAndResultMetadataSetDepositsLimit; } -export interface OperationContentsAndResultTxRollupOrigination { - kind: OpKind.TX_ROLLUP_ORIGINATION; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - tx_rollup_origination: any; - metadata: OperationContentsAndResultMetadataTxRollupOrigination; -} - -export interface OperationContentsAndResultTxRollupSubmitBatch { - kind: OpKind.TX_ROLLUP_SUBMIT_BATCH; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - content: string; - burn_limit?: string; - metadata: OperationContentsAndResultMetadataTxRollupSubmitBatch; -} - -export interface OperationContentsAndResultTxRollupCommit { - kind: OpKind.TX_ROLLUP_COMMIT; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - commitment: TxRollupCommitment; - metadata: OperationContentsAndResultMetadataTxRollupCommit; -} - -export interface OperationContentsAndResultTxRollupReturnBond { - kind: OpKind.TX_ROLLUP_RETURN_BOND; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - metadata: OperationContentsAndResultMetadataTxRollupReturnBond; -} - -export interface OperationContentsAndResultTxRollupFinalizeCommitment { - kind: OpKind.TX_ROLLUP_FINALIZE_COMMITMENT; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - metadata: OperationContentsAndResultMetadataTxRollupFinalizeCommitment; -} - -export interface OperationContentsAndResultTxRollupRemoveCommitment { - kind: OpKind.TX_ROLLUP_REMOVE_COMMITMENT; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - metadata: OperationContentsAndResultMetadataTxRollupRemoveCommitment; -} - -export interface OperationContentsAndResultTxRollupRejection { - kind: OpKind.TX_ROLLUP_REJECTION; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - rollup: string; - level: number; - message: TxRollupMessage; - message_position: string; - message_path: string[]; - message_result_hash: string; - message_result_path: string[]; - previous_message_result: TxRollupPreviousMessageResult; - previous_message_result_path: string[]; - proof: TxRollupProof | string; - metadata: OperationContentsAndResultMetadataTxRollupRejection; -} - export interface OperationContentsAndResultTransferTicket { kind: OpKind.TRANSFER_TICKET; source: string; @@ -1008,22 +842,6 @@ export interface OperationContentsAndResultTransferTicket { metadata: OperationContentsAndResultMetadataTransferTicket; } -export interface OperationContentsAndResultTxRollupDispatchTickets { - kind: OpKind.TX_ROLLUP_DISPATCH_TICKETS; - source: string; - fee: string; - counter: string; - gas_limit: string; - storage_limit: string; - tx_rollup: string; - level: number; - context_hash: string; - message_index: number; - message_result_path: string[]; - tickets_info: TxRollupTicketsInfo[]; - metadata: OperationContentsAndResultMetadataTxRollupDispatchTickets; -} - export interface OperationContentsAndResultUpdateConsensusKey { kind: OpKind.UPDATE_CONSENSUS_KEY; source: string; @@ -1070,8 +888,8 @@ export interface OperationContentsAndResultSmartRollupOriginate { storage_limit: string; pvm_kind: PvmKind; kernel: string; - origination_proof: string; parameters_ty: MichelsonV1Expression; + whitelist?: string[]; metadata: OperationContentsAndResultMetadataSmartRollupOriginate; } @@ -1119,7 +937,6 @@ export interface OperationContentsAndResultSmartRollupCement { gas_limit: string; storage_limit: string; rollup: string; - commitment: string; metadata: OperationContentsAndResultMetadataSmartRollupCement; } @@ -1161,11 +978,15 @@ export interface OperationContentsAndResultSmartRollupTimeout { } export type OperationContentsAndResult = + | OperationContentsAndResultAttestation + | OperationContentsAndResultPreattestation + | OperationContentsAndResultDoublePreattestation | OperationContentsAndResultEndorsement | OperationContentsAndResultPreEndorsement | OperationContentsAndResultDoublePreEndorsement | OperationContentsAndResultRevelation | OperationContentsAndResultDoubleEndorsement + | OperationContentsAndResultDoubleAttestation | OperationContentsAndResultDoubleBaking | OperationContentsAndResultActivateAccount | OperationContentsAndResultProposals @@ -1174,17 +995,10 @@ export type OperationContentsAndResult = | OperationContentsAndResultTransaction | OperationContentsAndResultOrigination | OperationContentsAndResultDelegation + | OperationContentsAndResultAttestationWithSlot | OperationContentsAndResultEndorsementWithSlot | OperationContentsAndResultRegisterGlobalConstant | OperationContentsAndResultSetDepositsLimit - | OperationContentsAndResultTxRollupOrigination - | OperationContentsAndResultTxRollupSubmitBatch - | OperationContentsAndResultTxRollupCommit - | OperationContentsAndResultTxRollupDispatchTickets - | OperationContentsAndResultTxRollupReturnBond - | OperationContentsAndResultTxRollupFinalizeCommitment - | OperationContentsAndResultTxRollupRemoveCommitment - | OperationContentsAndResultTxRollupRejection | OperationContentsAndResultTransferTicket | OperationContentsAndResultIncreasePaidStorage | OperationContentsAndResultUpdateConsensusKey @@ -1261,6 +1075,34 @@ export interface BakingRightsResponseItem { export type BakingRightsResponse = BakingRightsResponseItem[]; +export type AttestationRightsArgumentsDelegate = string | string[]; +export type AttestationRightsArgumentsCycle = number | number[]; +export type AttestationRightsArgumentsLevel = number | number[]; + +export interface AttestationRightsQueryArguments { + level?: AttestationRightsArgumentsLevel; + cycle?: AttestationRightsArgumentsCycle; + delegate?: AttestationRightsArgumentsDelegate; + consensus_key?: string; +} + +export interface AttestationRightsResponseItemDelegates { + delegate: string; + first_slot: number; + attestation_power: number; + consensus_key: string; +} + +export interface AttestationRightsResponseItem { + level: number; + delegate?: string; + delegates?: AttestationRightsResponseItemDelegates[]; + slots?: number[]; + estimated_time?: Date; +} + +export type AttestationRightsResponse = AttestationRightsResponseItem[]; + export type EndorsingRightsArgumentsDelegate = string | string[]; export type EndorsingRightsArgumentsCycle = number | number[]; export type EndorsingRightsArgumentsLevel = number | number[]; @@ -1278,6 +1120,7 @@ export interface EndorsingRightsResponseItemDelegates { endorsing_power: number; consensus_key?: string; } + export interface EndorsingRightsResponseItem { level: number; delegate?: string; @@ -1303,7 +1146,15 @@ export interface BallotsResponse { pass: BigNumber; } -export type PeriodKindResponse = 'proposal' | 'exploration' | 'cooldown' | 'promotion' | 'adoption'; +export type PeriodKindResponse = + | 'proposal' + | 'exploration' + | 'cooldown' + | 'promotion' + | 'adoption' + | 'testing_vote' + | 'testing' + | 'promotion_vote'; export type CurrentProposalResponse = string | null; @@ -1321,6 +1172,15 @@ export type ProposalsResponseItem = [string, BigNumber]; export type ProposalsResponse = ProposalsResponseItem[]; +export type HeaderContentEnum = 'activate' | 'activate_testchain'; + +export interface HeaderContent { + command: HeaderContentEnum; + hash: string; + fitness: string[]; + protocol_parameters: string; +} + export interface BlockHeaderResponse { protocol: string; chain_id: string; @@ -1333,6 +1193,7 @@ export interface BlockHeaderResponse { operations_hash: string; fitness: string[]; context: string; + content: HeaderContent; payload_hash?: string; payload_round?: number; priority?: number; @@ -1466,75 +1327,6 @@ export type InternalOperationResultEnum = | OperationResultOrigination | OperationResultEvent; -export interface OperationResultTxRollupOrigination { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - originated_rollup?: string; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupSubmitBatch { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - paid_storage_size_diff?: string; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupDispatchTickets { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - paid_storage_size_diff?: string; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupCommit { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupReturnBond { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupFinalizeCommitment { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - level?: number; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupRemoveCommitment { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - level?: number; - errors?: TezosGenericOperationError[]; -} - -export interface OperationResultTxRollupRejection { - status: OperationResultStatusEnum; - balance_updates?: OperationBalanceUpdates; - consumed_gas?: string; - consumed_milligas?: string; - errors?: TezosGenericOperationError[]; -} - export interface OperationResultTransferTicket { status: OperationResultStatusEnum; balance_updates?: OperationBalanceUpdates; @@ -1587,7 +1379,7 @@ export interface OperationResultSmartRollupOriginate { address?: string; genesis_commitment_hash?: string; consumed_milligas?: string; - size: string; + size?: string; errors?: TezosGenericOperationError[]; } @@ -1708,15 +1500,7 @@ export type OperationResult = | OperationResultSmartRollupRefute | OperationResultSmartRollupRecoverBond | OperationResultSmartRollupTimeout - | OperationResultSmartRollupExecuteOutboxMessage - | OperationResultTxRollupOrigination - | OperationResultTxRollupSubmitBatch - | OperationResultTxRollupDispatchTickets - | OperationResultTxRollupCommit - | OperationResultTxRollupReturnBond - | OperationResultTxRollupFinalizeCommitment - | OperationResultTxRollupRemoveCommitment - | OperationResultTxRollupRejection; + | OperationResultSmartRollupExecuteOutboxMessage; export interface OperationResultTransaction { status: OperationResultStatusEnum; @@ -1786,49 +1570,74 @@ export type MetadataBalanceUpdatesKindEnum = | 'accumulator' | 'burned' | 'commitment' - | 'minted'; + | 'minted' + | 'staking'; export enum METADATA_BALANCE_UPDATES_CATEGORY { + BAKING_BONUSES = 'baking bonuses', BAKING_REWARDS = 'baking rewards', - REWARDS = 'rewards', - FEES = 'fees', - DEPOSITS = 'deposits', - LEGACY_REWARDS = 'legacy_rewards', - LEGACY_FEES = 'legacy_fees', - LEGACY_DEPOSITS = 'legacy_deposits', BLOCK_FEES = 'block fees', - NONCE_REVELATION_REWARDS = 'nonce revelation rewards', - DOUBLE_SIGNING_EVIDENCE_REWARDS = 'double signing evidence rewards', - ENDORSING_REWARDS = 'endorsing rewards', - BAKING_BONUSES = 'baking bonuses', - STORAGE_FEES = 'storage fees', - PUNISHMENTS = 'punishments', - LOST_ENDORSING_REWARDS = 'lost endorsing rewards', - SUBSIDY = 'subsidy', + BONDS = 'bonds', + BOOTSTRAP = 'bootstrap', BURNED = 'burned', COMMITMENT = 'commitment', - BOOTSTRAP = 'bootstrap', + DELEGATE_DENOMINATOR = 'delegate_denominator', + DELEGATOR_NUMERATOR = 'delegator_numerator', + DEPOSITS = 'deposits', + ENDORSING_REWARDS = 'endorsing rewards', INVOICE = 'invoice', + LOST_ENDORSING_REWARDS = 'lost endorsing rewards', MINTED = 'minted', - TX_ROLLUP_REJECTION_REWARDS = 'tx_rollup_rejection_rewards', - TX_ROLLUP_REJECTION_PUNISHMENTS = 'tx_rollup_rejection_punishments', - BONDS = 'bonds', + NONCE_REVELATION_REWARDS = 'nonce revelation rewards', + PUNISHMENTS = 'punishments', + SMART_ROLLUP_REFUTATION_PUNISHMENTS = 'smart_rollup_refutation_punishments', + SMART_ROLLUP_REFUTATION_REWARDS = 'smart_rollup_refutation_rewards', + STORAGE_FEES = 'storage fees', + SUBSIDY = 'subsidy', + UNSTAKED_DEPOSITS = 'unstaked_deposits', } + export type MetadataBalanceUpdatesCategoryEnum = METADATA_BALANCE_UPDATES_CATEGORY; -export type MetadataBalanceUpdatesOriginEnum = 'block' | 'migration' | 'subsidy' | 'simulation'; +export type MetadataBalanceUpdatesOriginEnum = + | 'block' + | 'migration' + | 'subsidy' + | 'simulation' + | 'delayed_operation'; + +export type FrozenStaker = SingleStaker | SharedStaker | Baker; + +export type Staker = SingleStaker | SharedStaker; + +export interface SingleStaker { + contract: string; + delegate: string; +} + +export interface SharedStaker { + delegate: string; +} + +export interface Baker { + baker: string; +} export interface OperationMetadataBalanceUpdates { kind: MetadataBalanceUpdatesKindEnum; - category?: MetadataBalanceUpdatesCategoryEnum; contract?: string; + change: string; + origin?: MetadataBalanceUpdatesOriginEnum; + delayed_operation_hash?: string; + category?: MetadataBalanceUpdatesCategoryEnum; + staker?: FrozenStaker | Staker; delegate?: string; participation?: boolean; revelation?: boolean; committer?: string; + bond_id?: string; cycle?: number; - change: string; - origin?: MetadataBalanceUpdatesOriginEnum; + delegator?: string; } export type OperationResultStatusEnum = 'applied' | 'failed' | 'skipped' | 'backtracked'; @@ -1872,7 +1681,7 @@ export interface LazyStorageDiffUpdatesBigMap { export type CommitmentsAndCiphertexts = [ SaplingTransactionCommitment, - SaplingTransactionCiphertext + SaplingTransactionCiphertext, ]; export type SaplingTransactionCommitment = string; @@ -1917,6 +1726,7 @@ export interface OperationContentsAndResultMetadataOrigination { } export type ConstantsResponse = ConstantsResponseCommon & + ConstantsResponseProto018 & ConstantsResponseProto017 & ConstantsResponseProto016 & ConstantsResponseProto015 & @@ -1960,6 +1770,87 @@ export interface ConstantsResponseCommon { export type Ratio = { numerator: number; denominator: number }; +export interface ConstantsResponseProto018 + extends Omit< + ConstantsResponseProto017, + | 'baking_reward_bonus_per_slot' + | 'baking_reward_fixed_portion' + | 'double_baking_punishment' + | 'endorsing_reward_per_slot' + | 'frozen_deposits_percentage' + | 'liquidity_baking_subsidy' + | 'ratio_of_frozen_deposits_slashed_per_double_endorsement' + | 'seed_nonce_revelation_tip' + | 'smart_rollup_enable' + | 'tx_rollup_commitment_bond' + | 'tx_rollup_cost_per_byte_ema_factor' + | 'tx_rollup_enable' + | 'tx_rollup_finality_period' + | 'tx_rollup_hard_size_limit_per_inbox' + | 'tx_rollup_hard_size_limit_per_message' + | 'tx_rollup_max_commitments_count' + | 'tx_rollup_max_inboxes_count' + | 'tx_rollup_max_messages_per_inbox' + | 'tx_rollup_max_ticket_payload_size' + | 'tx_rollup_max_withdrawals_per_batch' + | 'tx_rollup_origination_size' + | 'tx_rollup_rejection_max_proof_size' + | 'tx_rollup_sunset_level' + | 'tx_rollup_withdraw_period' + > { + adaptive_issuance_activation_vote_enable: boolean; + adaptive_issuance_launch_ema_threshold: number; + adaptive_rewards_params: { + center_dz: { + denominator: string; + numerator: string; + }; + growth_rate: { + denominator: string; + numerator: string; + }; + issuance_ratio_max: { + denominator: string; + numerator: string; + }; + issuance_ratio_min: { + denominator: string; + numerator: string; + }; + max_bonus: string; + radius_dz: { + denominator: string; + numerator: string; + }; + }; + autostaking_enable: boolean; + edge_of_staking_over_delegation: number; + global_limit_of_staking_over_baking: number; + issuance_weights: { + attesting_reward_weight: number; + baking_reward_bonus_weight: number; + baking_reward_fixed_portion_weight: number; + base_total_issued_per_minute: string; + liquidity_baking_subsidy_weight: number; + seed_nonce_revelation_tip_weight: number; + vdf_revelation_tip_weight: number; + }; + limit_of_delegation_over_baking: number; + minimal_frozen_stake: string; + percentage_of_frozen_deposits_slashed_per_double_attestation: number; + percentage_of_frozen_deposits_slashed_per_double_baking: number; + smart_rollup_private_enable: boolean; + smart_rollup_reveal_activation_level: { + dal_page: number; + dal_parameters: number; + metadata: number; + raw_data: { + Blake2B: number; + }; + }; + smart_rollup_riscv_pvm_enable: boolean; + zk_rollup_max_ticket_payload_size: number; +} export type ConstantsResponseProto017 = ConstantsResponseProto016; export interface ConstantsResponseProto016 @@ -2021,14 +1912,15 @@ export interface ConstantsResponseProto015 export interface DalParametric { feature_enable: boolean; number_of_slots: number; + attestation_lag: number; + attestation_threshold?: number; + blocks_per_epoch?: number; + redundancy_factor?: number; + page_size?: number; + slot_size?: number; number_of_shards: number; endorsement_lag?: number; availability_threshold: number; - slot_size?: number; - redundancy_factor?: number; - page_size?: number; - attestation_threshold?: number; - blocks_per_epoch?: number; } export interface ConstantsResponseProto014 extends ConstantsResponseProto013 { @@ -2215,9 +2107,9 @@ export interface BlockMetadata { voting_period_kind?: string; voting_period_info?: VotingPeriodBlockResult; nonce_hash?: string; - consumed_gas: string; - deactivated: string[]; - balance_updates: OperationBalanceUpdates; + consumed_gas?: string; + deactivated?: string[]; + balance_updates?: OperationBalanceUpdates; liquidity_baking_escape_ema?: number; liquidity_baking_toggle_ema?: number; implicit_operations_results?: SuccessfulManagerOperationResult[]; @@ -2346,28 +2238,10 @@ export type LastRemovedCommitmentHashes = { last_message_hash: string; commitment_hash: string; }; -export interface TxRollupStateResponse { - last_removed_commitment_hashes?: LastRemovedCommitmentHashes; - finalized_commitments: Next; - unfinalized_commitments: Next; - uncommitted_inboxes: Next; - commitment_newest_hash?: string; - tezos_head_level?: number; - burn_per_byte: string; - allocated_storage: string; - occupied_storage: string; - inbox_ema: number; - commitments_watermark?: number; -} - -export interface TxRollupInboxResponse { - inbox_length: number; - cumulated_size: number; - merkle_root: string; -} export interface PendingOperationsQueryArguments { - version?: '1'; + version?: '1' | '2'; + validated?: boolean; applied?: boolean; refused?: boolean; outdated?: boolean; @@ -2383,7 +2257,7 @@ type FailedProcessedOperation = Pick< error: TezosGenericOperationError[]; }; -export interface PendingOperations { +export interface PendingOperationsV1 { applied: Pick[]; refused: FailedProcessedOperation[]; outdated: FailedProcessedOperation[]; @@ -2392,14 +2266,19 @@ export interface PendingOperations { unprocessed: Pick[]; } +export interface PendingOperationsV2 { + validated: Pick[]; + refused: FailedProcessedOperation[]; + outdated: FailedProcessedOperation[]; + branch_refused: FailedProcessedOperation[]; + branch_delayed: FailedProcessedOperation[]; + unprocessed: Pick[]; +} + export enum PvmKind { WASM2 = 'wasm_2_0_0', ARITH = 'arith', -} - -export interface OriginationProofParams { - kind: PvmKind; - kernel: string; + RISCV = 'riscv', } export interface SmartRollupPublishCommitment { diff --git a/packages/taquito-rpc/src/version.ts b/packages/taquito-rpc/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-rpc/src/version.ts +++ b/packages/taquito-rpc/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index c0b01d97cb..66e6ae963a 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -2446,6 +2446,19 @@ export const blockMetadata = { }, ], }; +export const attestationRights = [ + { + level: 151187, + delegates: [ + { + delegate: 'tz3Q1fwk1vh3zm5LqyUV9e2wZBdaEXcovh2r', + first_slot: 79, + attestation_power: 326, + consensus_key: 'tz3Q1fwk1vh3zm5LqyUV9e2wZBdaEXcovh2r', + }, + ], + }, +]; export const endorsingRights = [ { level: 516500, @@ -3434,29 +3447,29 @@ export const blockIthacanetResponse = { ], }; -export const blockJakartanetResponse = { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'BLivfHQoHCtixrwXCNnsMQj33F3mLukQBBh4KoJ9AT6ADvLz7Ev', +export const blockKathmandunetResponse = { + protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + chain_id: 'NetXi2ZagzEsXbZ', + hash: 'BLHBkJLRFwRhs1Nvrbrf8gVnVgSxx5515iTdizVnagm97baSXNF', header: { - level: 63401, + level: 133163, proto: 2, - predecessor: 'BLzrD8thayxjzCxQAy2y3WYg7Rqvh59V3FX2UpDZdNkoeutt935', - timestamp: '2022-05-09T22:46:29Z', + predecessor: 'BMD5idn9K4pGGAk9EbXBgUicYzTeDJLhY2a75Xfq6WNfahiRWZy', + timestamp: '2022-08-24T17:48:35Z', validation_pass: 4, - operations_hash: 'LLoaagEt9R7Tujwg4rnn5asisJ1e1cnnvN7aqvTmX4cr8i9jK5qjE', - fitness: ['02', '0000f7a9', '', 'ffffffff', '00000000'], - context: 'CoVAg76cML89Kqfgcsir6EPNjs6aTjB7ESWaTBSJsCUys4tzoDf2', - payload_hash: 'vh2RohN1n4qVrPifqwdhvPty2qFmeHfhhKWh7qwJF5vQHuze25Jz', - payload_round: 0, - proof_of_work_nonce: '4abb58b400000000', - liquidity_baking_toggle_vote: 'off', + operations_hash: 'LLobDJY3zxBWiCiHUryckHzkGSDknfKDwbALteiURoPcfkRmEfoxr', + fitness: ['02', '0002082b', '', 'ffffffff', '00000001'], + context: 'CoWDgrLLcSaBXq2sbZ5jwcoNkAuLmMHUurE8GTVd5SfPpRdP9MgF', + payload_hash: 'vh3LQUfufR7Z1soGCLdFymvHyW1aHokiEzN8eov9rcgQ4zvWeCuN', + payload_round: 1, + proof_of_work_nonce: 'ae384fb900000000', + liquidity_baking_toggle_vote: 'pass', signature: - 'sigcRoFAEPYkmtMRGReeSd5tjnSNfgAntG3H5aHyTk4WSKc42QVzj5xHf9RsDvkyGSgLsm7hvYVoQ27p8pd9QYSmNUWdS11t', + 'signuyFG2mYvJh4WZSzVrSTBTUe7wvS9NYbFqUUqrAEp9ktwjYi8PSwEoTo2Z6cvmZAzPo9ZaSrnehuejvKpYpdXVnazSiHR', }, metadata: { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - next_protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + next_protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', test_chain_status: { status: 'not_running', }, @@ -3479,32 +3492,31 @@ export const blockJakartanetResponse = { max_size: 524288, }, ], - proposer: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', - baker: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + proposer: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + baker: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', level_info: { - level: 63401, - level_position: 63400, - cycle: 15, - cycle_position: 1960, + level: 133163, + level_position: 133162, + cycle: 32, + cycle_position: 2090, expected_commitment: false, }, voting_period_info: { voting_period: { - index: 15, + index: 32, kind: 'proposal', - start_position: 61440, + start_position: 131072, }, - position: 1960, - remaining: 2135, + position: 2090, + remaining: 2005, }, nonce_hash: null, - consumed_gas: '1521000', deactivated: [], balance_updates: [ { kind: 'accumulator', category: 'block fees', - change: '-380', + change: '-16643', origin: 'block', }, { @@ -3515,24 +3527,24 @@ export const blockJakartanetResponse = { }, { kind: 'contract', - contract: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', - change: '10000380', + contract: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + change: '10016643', origin: 'block', }, { kind: 'minted', category: 'baking bonuses', - change: '-8533426', + change: '-8700580', origin: 'block', }, { kind: 'contract', - contract: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', - change: '8533426', + contract: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + change: '8700580', origin: 'block', }, ], - liquidity_baking_toggle_ema: 521773279, + liquidity_baking_toggle_ema: 0, implicit_operations_results: [ { kind: 'transaction', @@ -3541,7 +3553,7 @@ export const blockJakartanetResponse = { int: '1', }, { - int: '158500000100', + int: '332905000100', }, { int: '100', @@ -3567,1267 +3579,198 @@ export const blockJakartanetResponse = { origin: 'subsidy', }, ], - consumed_gas: '205', - consumed_milligas: '204975', + consumed_milligas: '205035', storage_size: '4632', }, ], - consumed_milligas: '1521000', + consumed_milligas: '24380000', }, operations: [ [ { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'oodkkuZhFs4vfU7iYUQxoQgukBybT7MakLAetVFg2Qx4MxDbvfh', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 0, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', - endorsement_power: 1389, - }, - }, - ], - signature: - 'sigQFZbKyETsWini9WfDLNEvB74V2C3pcjb7SKnU9ZqUvJwsn8hSbhTEi6tUisUgoqXNfFq86UPmcWxY1oxzdJWv55nQn2iz', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'oniP1RkPbXkYx6JqScJFo7zTaeh8Yk3EvYKCk4LeTLwapxZhcKf', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 1, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1WzwobH5AFz3ea8n2UEramfYm1LY96hKJK', - endorsement_power: 328, - }, - }, - ], - signature: - 'sigNtMYSRZcwbUL1zJmM1M4VimtoT3wPtUJV3B8aZwjFFR74o8wV62Zte7QNM6umJug4LxYbxg9LMSNxLrLziUcvMtvR7RbP', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ooVsncQsfHFiPniZeJ6RiyFwMnEmac1apTZhjecZH5TeX6AHhx1', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 2, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', - endorsement_power: 471, - }, - }, - ], - signature: - 'sigQmXbRPsprFhuac6eeW66qp9Nf2RoHyjeNBwHYXSixdP7LiXNirCFAWB7YwV5cF3kQtaAqRTH21BjFbJo96ZAGTh6kK2PE', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'op3CxsBNtV1bkXM6rwqN7kW4AQ9pZYtnDDkZVNEgKGV7i1s5CXk', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', + protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + chain_id: 'NetXi2ZagzEsXbZ', + hash: 'onyJZz2gwEmspLbZaCd2P7Ws5RF7od6j2685VYrTPDaEZhpDbvx', + branch: 'BLeoVyx5LNjQ4ZvnpvdrgFszvSn9KPJVcqmApLaa6bn6VS1vNig', contents: [ { kind: 'endorsement', - slot: 3, - level: 63400, + slot: 2696, + level: 133162, round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', + block_payload_hash: 'vh2vcfabPoDQuNw6HQkZtWEzZkHe1uAmhF2sxta7varX3vriHPKD', metadata: { - delegate: 'tz1MvCE9dczhoij2bd4sLL2AfVuMtWfFAoCN', - endorsement_power: 220, + delegate: 'tz1ehn3nZ8PhiJ2ygtLM3Z5hVtSzU4ZKgqLZ', + endorsement_power: 6, }, }, ], signature: - 'sigf34YLEzjWP3iF5KPzBTAgv4942SgvwRje4dByVEVMVKGWSb48ygUdXtg7umiEfKVrNx5zoq6xTCXXb1T9wCFkGDQyCSHA', + 'sigUqaWrk8u6zckJvLfivskoC5mkK62swsfNFq2eAuhFaghLC9LfahFMaEVag3pLjz4WjouVnYa4gekqs85kgH1s7p2hHyP3', }, + ], + [], + [], + [ { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'op5xBzwaZ3xkSMLgpnUrJAR4baCjKAgNQjQCzDAo5hFZShe33or', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', + protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + chain_id: 'NetXi2ZagzEsXbZ', + hash: 'ooBghN2ok5EpgEuMqYWqvfwNLBiK9eNFoPai91iwqk2nRCyUKgE', + branch: 'BMNHgXcGnPQo2daGRvXnFV5DX7QfqCwpssPtaL4NWkUhuhYWwdS', contents: [ { - kind: 'endorsement', - slot: 4, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', + kind: 'increase_paid_storage', + source: 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG', + fee: '349', + counter: '108123', + gas_limit: '1000', + storage_limit: '0', + amount: '2', + destination: 'KT1Vjr5PFC2Qm5XbSQZ8MdFZLgYMzwG5WZNh', metadata: { - delegate: 'tz1iTzWpFhURP5EnWqAc9hUkuVe2b2tSAGXC', - endorsement_power: 317, + balance_updates: [ + { + kind: 'contract', + contract: 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG', + change: '-349', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '349', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'contract', + contract: 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG', + change: '-500', + origin: 'block', + }, + { + kind: 'burned', + category: 'storage fees', + change: '500', + origin: 'block', + }, + ], + consumed_milligas: '1000000', + }, }, }, ], signature: - 'sigbCpffpWqNLYY8ehNZHwVGEt2RCT46zHjNZxM5YuUVg9tYRA6Kt99PMwMQCy8Y7HfVP54LnoH3xyDXi339Up5hMYP2VLQi', + 'sigdUXgzV3FcbhV7qUAYGCbV86xZEpcBq1S3Acng974GvG8rULLnoNkXn1dvKvfbfvz3zChYCpjcDmR8f1shjAg1uSksceRp', }, { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'op4Z6oKBNLpm43LZp3NyKFujNcPd891neF5LouVewHDd13Yg33o', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', + protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + chain_id: 'NetXi2ZagzEsXbZ', + hash: 'oorMQ4cCHReHtUdyEqpWBjyAgu59AWYMzSP5bSwi2gSGGHBSLF5', + branch: 'BKuq9qvyUfiZH64z7J7nxKAt7HGA1m2rgiR24XrCsAEgBh2JJd1', contents: [ { - kind: 'endorsement', - slot: 5, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', + kind: 'transaction', + source: 'tz1ejWMc4oNPuYJcs2UBFALuzQy3jKcZxEwL', + fee: '673', + counter: '84777', + gas_limit: '4224', + storage_limit: '0', + amount: '0', + destination: 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q', metadata: { - delegate: 'tz1XGwK6kkiJaq2ZEJYcWEj5Tc8bcV6pNHqV', - endorsement_power: 226, + balance_updates: [ + { + kind: 'contract', + contract: 'tz1ejWMc4oNPuYJcs2UBFALuzQy3jKcZxEwL', + change: '-673', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '673', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + storage: { + prim: 'Unit', + }, + consumed_milligas: '2123011', + storage_size: '133', + }, + internal_operation_results: [ + { + kind: 'event', + source: 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q', + nonce: 0, + type: { + prim: 'or', + args: [ + { + prim: 'nat', + }, + { + prim: 'string', + }, + ], + }, + tag: 'event', + payload: { + prim: 'Left', + args: [ + { + int: '10', + }, + ], + }, + result: { + status: 'applied', + consumed_milligas: '1000000', + }, + }, + { + kind: 'event', + source: 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q', + nonce: 1, + type: { + prim: 'or', + args: [ + { + prim: 'nat', + annots: ['%number'], + }, + { + prim: 'string', + annots: ['%words'], + }, + ], + }, + tag: 'event', + payload: { + prim: 'Right', + args: [ + { + string: 'lorem ipsum', + }, + ], + }, + result: { + status: 'applied', + consumed_milligas: '1000000', + }, + }, + ], }, }, ], signature: - 'sigPTqcf6fHWkWoD9C3LL7KDFguvjrSgZ6p4yf3GvdMWuGxeY6aaWmFNxLRyzt3c3ALmEm3EwZNX79kSCccumXyC8Jrb9Vav', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ooB93dyDk13ASFL8y4EbtQdjDVcqkGxXZQUjgpMJ45aWSYG6vae', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 6, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1KkJtLB9pMdLKNpVRNZw9zmysrxKmYcRGU', - endorsement_power: 368, - }, - }, - ], - signature: - 'siggGigRRh4LqDir1Bjgheve9dzi3wQDWnfGrbGtfcshZEr9PmanTb8VK2RAdCLFnHyhTC1cTZ5Va3h9QWWk5FsQBVEYkUqA', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'oo9D3ajMuU362tHD91ooE72s3EmPWq7aaQmSn8ir7wHLVNYMxpu', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 9, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', - endorsement_power: 355, - }, - }, - ], - signature: - 'sigtxzPKVendcBHhHPUKLN88qpL8Ge3mnKeJnXXp1E8VT9ZKxzcgBeA8JTo2idzicNEcoimzUXDPGfomrFhCMtiv6DxcmQFy', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'onjJxn5oipcyRPQnmZfMo2HPvrHud4toAANnRX7ARkT5gvyYXNX', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 12, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1ccniXhg7WdHVJfvnXMVMihxitQTijQeEd', - endorsement_power: 111, - }, - }, - ], - signature: - 'sigXiaGXhC9H3F1VLXuL8h7AL1Xu3YDfMthY348fNxx8Przh38VNWVs68ELNa682WYGyLXYEgL76rpt76yxdQEb6ohsU9Nmy', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'onuXN99bd5DhE63jJWD5pcQQebT5tT7LKxkQnJvHRa6k9GtBFS3', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 14, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1RuHDSj9P7mNNhfKxsyLGRDahTX5QD1DdP', - endorsement_power: 323, - }, - }, - ], - signature: - 'siga5gLgGCXnfrHJQJRKxze5TXD4dZFYkMu15A3z3CFZoHocEhPJxQr9YkEzJHMZTbT5Wkfr2yVDXM2XHC8TBecCaRpB9p5o', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'opBaGizW8iuRFpy24PWExWRmfp8Da7rZ5RnLrpFwM1rwyt7DYqg', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 17, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1hm7NuCGNSKZQLQSawjUnehJcX8yCBcCAq', - endorsement_power: 280, - }, - }, - ], - signature: - 'sigbVaSBRhiZFJ9ne4AiNZwf6HFQo212BVzAn96HLmovsQAqAd8diUXEoUuTvav9z1d3NGobuQD4NuvnBg7bBmwyLUcSdnZU', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ooPowq4hovzxUb67axpg6hbRhHie5x6oFehiy68NRVDVdJ3pero', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 18, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1hoyMUiJYYr4FRPMU8Z7WJzYkqgjygjaTy', - endorsement_power: 343, - }, - }, - ], - signature: - 'sigw9Ve969dwbpFiZSPNXgH9LKPfusyxKrYUXvA3gyErR6AhwYBgUtcrbeDbXvLbFcGzKztVPNP7ZNtZ2zfPJw4cTTcpNH32', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ooh8tXizxmbpA9HUqgNkKsVnzYREkBhNWq1kCsLfsnVe194wQYQ', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 19, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1Q6VpNkHPsdTaoKJ7hFF9kAycrs1wxYZQY', - endorsement_power: 80, - }, - }, - ], - signature: - 'sigcVE9tMqxxydNp9NVePq86wvRFVmd5K7ay6nq9MURw5TFL6YxnFhL9sDLwxGEmkMk6L3vf7W94pLWzmDRtKSh7edyJpLx4', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ontAWJPLYyTvqoMMYY5KbA9fECjCVo9FdW1mPgvPELVxDJwvAYA', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 20, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', - endorsement_power: 307, - }, - }, - ], - signature: - 'sigNjxaUBWhR3ppDEHq7x4gjwtCJ2PR5Yr5GzJYHwhPLenkerPwYSQiE5NEsjVV6CmTQN2jCrRXsfvZSxgNoWkGMtmKocsjQ', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'oo2bMFcvpg2EFGnYxTDhM9w1v4XwTLPjKr2bVTJS6uxKi8u85CA', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 22, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1cXeGHP8Urj2pQRwpAkCdPGbCdqFUPsQwU', - endorsement_power: 141, - }, - }, - ], - signature: - 'sigb6k3e1hsQtJkzFUNXxDdEM8Pz9mT5hvX7nBo4586krePFuBvjcYQSsoUKvBC9hBRxANSv5DnbRj5ySenD6p1d3tygtyPo', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'opBjvNqfRjnWaP8LPfxBJzAX8dMGZp5Fi9ogCaknXo1anLzquVz', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 26, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc', - endorsement_power: 332, - }, - }, - ], - signature: - 'sigmxp4mrHbtjjfGvnbnQGictJAws1uGGBQ2u4GRpQAqWCukz8Us5kwpeAWDnbyMEMZM6f7e4SzHH558TzRoPzkypg8mGLUA', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'onyKnSuaZERZJMoK4FobMio7Pa5V4vsSx32nfdJQSxWcofQHwrm', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 32, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', - endorsement_power: 341, - }, - }, - ], - signature: - 'sigoVLK4Pyakb3oqxSsHSdBPbA2uJ3a36gdiKukUzyhQ5SSfe8DDnn3QzsfDyTSzDWs2bE6p5RNWf6MLm2qZgv3z1v77NMPb', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'opHupJB4w7WJvx8bDJbMYNcTvgUEgwWXD54FBgg6oScqj1n5znz', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 37, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1KhTJVAkKc5zhN29VBA3uEijtCKy6kfNBP', - endorsement_power: 361, - }, - }, - ], - signature: - 'signkqd9KuDqmNn6PAs8ekkW3L1xL29ojMBfFrRNoAkyfeEptkEB4FZEq1BgwuhBQ6uywKUycVhtMi8hzTnKP1MUWhBeYmBV', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'opUbx3eAV1cMFjy3KWrhCPHYD3pAkHyuV1aUNJwEbvM5tyPdSxi', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 47, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1XpntqFmUYqAJw3qMxjGMR4m8rJUrvuMnp', - endorsement_power: 304, - }, - }, - ], - signature: - 'sigr3fuug1YVi1jhJ3zqHFgw5JQGDHpKAKy3L3XJJa3NT6DQapFsvSgxzfaVWJ4fKoBQWvvKdiFeBgaXmTcV51eVNmaerhD7', - }, - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ooVheinh7dJFdMFsnvKA6RQiHZN5EZTASay4BnPGP5sTKQH7igX', - branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', - contents: [ - { - kind: 'endorsement', - slot: 123, - level: 63400, - round: 0, - block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', - metadata: { - delegate: 'tz1funU3PjPsuXvmtXMgnAckY1s4pNT6V7WJ', - endorsement_power: 61, - }, - }, - ], - signature: - 'sigjAJmfrSUJxxPFqPqZPXTzktZZ6rFBgD4MsVtnStVGwSvSBsZkqdFCrHFDbq8CM2HsGowKvknQqBn4KdVutviTVqh6mBuM', - }, - ], - [], - [], - [ - { - protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', - chain_id: 'NetXLH1uAxK7CCh', - hash: 'ooxVg6Ggafc8BZQ463DYN6L5n91kZT7vicBNauVoTvP6N2H5UAU', - branch: 'BLK2bAvb39oqRLzZnofB3ht1F5iR1Po2WDdmq2i7pSzSVgEtV8u', - contents: [ - { - kind: 'tx_rollup_origination', - source: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - fee: '380', - counter: '173977', - gas_limit: '1521', - storage_limit: '4020', - tx_rollup_origination: {}, - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - change: '-380', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '380', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'contract', - contract: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - change: '-1000000', - origin: 'block', - }, - { - kind: 'burned', - category: 'storage fees', - change: '1000000', - origin: 'block', - }, - ], - consumed_gas: '1421', - consumed_milligas: '1420108', - originated_rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', - }, - }, - }, - { - kind: 'tx_rollup_submit_batch', - source: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - fee: '476', - counter: '173978', - gas_limit: '2209', - storage_limit: '0', - rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', - content: '626c6f62', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - change: '-476', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '476', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_gas: '2109', - consumed_milligas: '2108268', - paid_storage_size_diff: '0', - }, - }, - }, - { - kind: 'tx_rollup_commit', - source: 'tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY', - fee: '735', - counter: '182217', - gas_limit: '3838', - storage_limit: '0', - rollup: 'txr1Nbn66mC1yYHBkfD3ink45XVJso6QJZeHe', - commitment: { - level: 1, - messages: ['txmr344vtdPzvWsfnoSd3mJ3MCFA5ehKLQs1pK9WGcX4FEACg1rVgC'], - predecessor: 'txc3PQbuB4fmpXMq2NqXGpCnu8EDotTWeHf5w3jJRpyQHSNKRug3U', - inbox_merkle_root: 'txi3Ef5CSsBWRaqQhWj2zg51J3tUqHFD47na6ex7zcboTG5oXEFrm', - }, - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY', - change: '-735', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '735', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_gas: '3738', - consumed_milligas: '3737532', - }, - }, - }, - { - kind: 'tx_rollup_finalize_commitment', - source: 'tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY', - fee: '507', - counter: '182232', - gas_limit: '2602', - storage_limit: '0', - rollup: 'txr1RHjM395hdwNfgpM8GixQrPAimk7i2Tjy1', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY', - change: '-507', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '507', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_gas: '2502', - consumed_milligas: '2501420', - level: 0, - }, - }, - }, - { - kind: 'tx_rollup_dispatch_tickets', - source: 'tz1inuxjXxKhd9e4b97N1Wgz7DwmZSxFcDpM', - fee: '835', - counter: '252405', - gas_limit: '4354', - storage_limit: '86', - tx_rollup: 'txr1YMZxstAHqQ9V313sYjLBCHBXsvSmDZuTs', - level: 4, - context_hash: 'CoV7iqRirVx7sZa5TAK9ymoEJBrW6z4hwwrzMhz6YLeHYXrQwRWG', - message_index: 0, - message_result_path: ['txM2eYt63gJ98tv3z4nj3aWPMzpjLnW9xpUdmz4ftMnbvNG34Y4wB'], - tickets_info: [ - { - contents: { - string: 'third-deposit', - }, - ty: { - prim: 'string', - }, - ticketer: 'KT1EMQxfYVvhTJTqMiVs2ho2dqjbYfYKk6BY', - amount: '2', - claimer: 'tz1inuxjXxKhd9e4b97N1Wgz7DwmZSxFcDpM', - }, - ], - }, - { - kind: 'tx_rollup_remove_commitment', - source: 'tz1M1PXyMAhAsXroc6DtuWUUeHvb79ZzCnCp', - fee: '574', - counter: '252310', - gas_limit: '3272', - storage_limit: '0', - rollup: 'txr1YMZxstAHqQ9V313sYjLBCHBXsvSmDZuTs', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1M1PXyMAhAsXroc6DtuWUUeHvb79ZzCnCp', - change: '-574', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '574', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_gas: '3172', - consumed_milligas: '3171088', - level: 0, - }, - }, - }, - { - kind: 'tx_rollup_rejection', - source: 'tz1MDU45gNc9Ko1Q9obcz6hQkKSMiQRib6GZ', - fee: '2837', - counter: '266515', - gas_limit: '11633', - storage_limit: '0', - rollup: 'txr1V16e1hXyVKndP4aE8cujRfryoHTiHK9fG', - level: 11, - message: { - batch: - '01b2530bd9f4d594ee6116286cbb045a972305e38e6365b396f49d153815fbdd15c8974b7fdc50aee4bc3f8195e95075ab0fca5d31927917ede7a408fe70c61cd4a0525b2836eca0e797cdf9ae9b3bf58735fd62a7bf21775d46940ae9bd83a8d501130187e8c631aba41d88a67da49cf5f4db947fdf5a76084f1d4b6c14531f6582b239db26dd0375ca7172cdbecd8b6f080ffa58c748f83cc7a2afce164c1bcc53712ff5a9e50c39fb0172acda0a', - }, - message_position: '0', - message_path: ['txi1WZKF1fkUWfKbmaHbb5b8gn68rKSyUy4k7NnSVY4p79BKYz5RB'], - message_result_hash: 'txmr344vtdPzvWsfnoSd3mJ3MCFA5ehKLQs1pK9WGcX4FEACg1rVgC', - message_result_path: ['txM2eYt63gJ98tv3z4nj3aWPMzpjLnW9xpUdmz4ftMnbvNG34Y4wB'], - previous_message_result: { - context_hash: 'CoVUv68XdJts8f6Ysaoxm4jnt4JKXfqx8WYVFnkj2UFfgKHJUrLs', - withdraw_list_hash: 'txw1sFoLju3ySMAdY6v1dcHUMqJ4Zxc1kcynC8xkYgCmH6bpNSDhV', - }, - previous_message_result_path: ['txM2eYt63gJ98tv3z4nj3aWPMzpjLnW9xpUdmz4ftMnbvNG34Y4wB'], - proof: { - version: 3, - before: { node: 'CoVUv68XdJts8f6Ysaoxm4jnt4JKXfqx8WYVFnkj2UFfgKHJUrLs' }, - after: { node: 'CoUn3twa3TmvNby5VAGeN2jHvzbfpmJAXcyDHJuLLAuuLiaZZnzC' }, - state: [ - { - inode: { - length: '14', - proofs: [ - 'CoVbQczQE6uDug4tWErtLgszzZBRDJKEGHgcQp8jGYSEfBLnsMXH', - 'CoWZ31tY65qh38Sfgm64Ny8kDTLQQMr5xuRDkDkz1JopiBnPDu11', - ], - }, - }, - { - inode: { - length: '6', - proofs: [ - 'CoVecMq8ageb8fsmr6MPdNDH583cEpfCjVu8dQJpBP4J5GxM4Fex', - 'CoUh6FXy5xrEqSswAJ8MmAWcJMUiLyCq53RQiEHoHdovYxzXLHVE', - ], - }, - }, - { - inode: { - length: '3', - proofs: [null, 'CoVPGhaCkq2yV5JJs8Bxq1idndEhBn3SCJe3rSH5eYvr9BnRnv8i'], - }, - }, - { - inode: { - length: '3', - proofs: [ - 'CoWawEsrigKz7nfmXdCE84Rj6sJzzSj3RdeyuySjaxzhFZ17EFjb', - 'CoVWwp2qJWcRXvNA4adk9nUHRvKT22qY8QEoaAYK2Fz5tviyCaBw', - ], - }, - }, - { - other_elts: { - node: [ - [ - '0287e8c631aba41d88a67da49cf5f4db947fdf5a76', - { value: 'CoW4fTVfN6WBZ6XqT38EqLzn5raQUYkjSL4Ce7J2KsGKcFPjgUJy' }, - ], - [ - '050000000100000002', - { value: 'CoWQdcsnqDRRNEb1F4dRSPffKXfAnBXhhdpwo5mMyQibrXx5BKmF' }, - ], - ], - }, - }, - { - other_elts: { - other_elts: { value: '00000000' }, - }, - }, - { - inode: { - length: '3', - proofs: [ - 'CoW1wvLQ8e7wwDXM431GKDFZ5FJMTu9aGtHCY6NE9jmcH2rBn3UU', - 'CoWVAyWNj6anjKBcoGmpEKpcURyTSvjPBJiHs8TcWruhVwNKzbiv', - ], - }, - }, - { - other_elts: { - node: [ - [ - '0000000000', - { value: 'CoWXftiVdu561NbMwSyvQ8aJ5mPNCdCiyL3e9MP5fpb12nhEa6BQ' }, - ], - [ - '0000000001', - { value: 'CoVjtgM389FfgNSs91E4J7mVWwvtAVkPCV8UrGR8onjUmbvAYFz1' }, - ], - ], - }, - }, - { - other_elts: { - other_elts: { - value: - '00000000000000070000003087bdec4b6745183b7ea589128f836e037e92a8e7fbad7818c0e371840b78aca9cceb24d627c59ace2962c9b801606016', - }, - }, - }, - { - other_elts: { - node: [ - [ - '021d4b6c14531f6582b239db26dd0375ca7172cdbe', - { value: 'CoWG69nMHdez4s8SahwsB2m5ZPCLqPre7Qmi5uwdJ9nhFsEX7RdN' }, - ], - ], - }, - }, - { - other_elts: { - other_elts: { value: '00000001' }, - }, - }, - { - inode: { - length: '8', - proofs: [ - 'CoV8yd9SQTRz1ic9WyiMNAfyTq3Q9Jq9iUwNPtT3Tuxm999F2GnY', - 'CoW6PzNAZdnTY1NB1AXS5gx23BGpm66FvBW2yahScM4d8LEa3csN', - ], - }, - }, - { - inode: { - length: '4', - proofs: [ - 'CoWKdEp4XjM5dYvDJoYzsa9ofVRrqKrwbryd9TmKD9uTT1pVHTfb', - 'CoUzXw8c38PwQdyMUo7ZatPL5xWRfLuAuCQFvtMJJu3T5jt9qDLq', - ], - }, - }, - { - inode: { - length: '3', - proofs: [ - 'CoWFsG1gkdG17aE9emaKrhEJEhc41VMpmG4mmTmjt6wPkdjfJmhj', - 'CoV4P6w3UKpWRmbFJVL1x46YHaxCBVNqJKBYhT29W9pjK2Vum5a2', - ], - }, - }, - { - other_elts: { - node: [ - [ - '04cd8b6f080ffa58c748f83cc7a2afce164c1bcc53712ff5a9e50c39fb0172acda', - { value: 'CoW4fTVfN6WBZ6XqT38EqLzn5raQUYkjSL4Ce7J2KsGKcFPjgUJy' }, - ], - [ - '050000000000000000', - { value: 'CoVd2R5Mf2KMjBgCDpPYEmgQVbg7fXCcv6hmfFKUPyiNotbkKqkf' }, - ], - ], - }, - }, - { - other_elts: { - other_elts: { value: '0032' }, - }, - }, - { - other_elts: { - node: [ - [ - '050000000000000001', - { value: 'CoVZMPkooCZg5EDUd7PqvowuM7pknwEbcjGSaKzeCrsJUynoWKvR' }, - ], - ], - }, - }, - { - other_elts: { - other_elts: { value: '0028' }, - }, - }, - ], - }, - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1MDU45gNc9Ko1Q9obcz6hQkKSMiQRib6GZ', - change: '-2837', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '2837', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'freezer', - category: 'bonds', - contract: 'tz1Lg9iLTS8Hk6kLfTN6rrrL9gYPfsTQ9z75', - bond_id: { tx_rollup: 'txr1V16e1hXyVKndP4aE8cujRfryoHTiHK9fG' }, - change: '-10000000000', - origin: 'block', - }, - { - kind: 'burned', - category: 'tx_rollup_rejection_punishments', - change: '10000000000', - origin: 'block', - }, - { - kind: 'minted', - category: 'tx_rollup_rejection_rewards', - change: '-5000000000', - origin: 'block', - }, - { - kind: 'contract', - contract: 'tz1MDU45gNc9Ko1Q9obcz6hQkKSMiQRib6GZ', - change: '5000000000', - origin: 'block', - }, - ], - consumed_gas: '11533', - consumed_milligas: '11532006', - }, - }, - }, - { - kind: 'tx_rollup_return_bond', - source: 'tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes', - fee: '512', - counter: '36', - gas_limit: '2676', - storage_limit: '0', - rollup: 'txr1TeZQiQrjaEop11Lh8fpsTdyJgQvr5igST', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes', - change: '-512', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '512', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'freezer', - category: 'bonds', - contract: 'tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes', - bond_id: { - tx_rollup: 'txr1TeZQiQrjaEop11Lh8fpsTdyJgQvr5igST', - }, - change: '-10000000000', - origin: 'block', - }, - { - kind: 'contract', - contract: 'tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes', - change: '10000000000', - origin: 'block', - }, - ], - consumed_milligas: '2575028', - }, - }, - }, - ], - signature: - 'sigmpiJiuk1wbno2KAvxFufUkZ4JnrTuuxmVWmGVP3bPKNft8Nv8LZwkKAKtvUeBSiBEMxa5vAxcKc5FddwZvhjuZyydZeKD', - }, - ], - ], -}; - -export const blockKathmandunetResponse = { - protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', - chain_id: 'NetXi2ZagzEsXbZ', - hash: 'BLHBkJLRFwRhs1Nvrbrf8gVnVgSxx5515iTdizVnagm97baSXNF', - header: { - level: 133163, - proto: 2, - predecessor: 'BMD5idn9K4pGGAk9EbXBgUicYzTeDJLhY2a75Xfq6WNfahiRWZy', - timestamp: '2022-08-24T17:48:35Z', - validation_pass: 4, - operations_hash: 'LLobDJY3zxBWiCiHUryckHzkGSDknfKDwbALteiURoPcfkRmEfoxr', - fitness: ['02', '0002082b', '', 'ffffffff', '00000001'], - context: 'CoWDgrLLcSaBXq2sbZ5jwcoNkAuLmMHUurE8GTVd5SfPpRdP9MgF', - payload_hash: 'vh3LQUfufR7Z1soGCLdFymvHyW1aHokiEzN8eov9rcgQ4zvWeCuN', - payload_round: 1, - proof_of_work_nonce: 'ae384fb900000000', - liquidity_baking_toggle_vote: 'pass', - signature: - 'signuyFG2mYvJh4WZSzVrSTBTUe7wvS9NYbFqUUqrAEp9ktwjYi8PSwEoTo2Z6cvmZAzPo9ZaSrnehuejvKpYpdXVnazSiHR', - }, - metadata: { - protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', - next_protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', - test_chain_status: { - status: 'not_running', - }, - max_operations_ttl: 120, - max_operation_data_length: 32768, - max_block_header_length: 289, - max_operation_list_length: [ - { - max_size: 4194304, - max_op: 2048, - }, - { - max_size: 32768, - }, - { - max_size: 135168, - max_op: 132, - }, - { - max_size: 524288, - }, - ], - proposer: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', - baker: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', - level_info: { - level: 133163, - level_position: 133162, - cycle: 32, - cycle_position: 2090, - expected_commitment: false, - }, - voting_period_info: { - voting_period: { - index: 32, - kind: 'proposal', - start_position: 131072, - }, - position: 2090, - remaining: 2005, - }, - nonce_hash: null, - deactivated: [], - balance_updates: [ - { - kind: 'accumulator', - category: 'block fees', - change: '-16643', - origin: 'block', - }, - { - kind: 'minted', - category: 'baking rewards', - change: '-10000000', - origin: 'block', - }, - { - kind: 'contract', - contract: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', - change: '10016643', - origin: 'block', - }, - { - kind: 'minted', - category: 'baking bonuses', - change: '-8700580', - origin: 'block', - }, - { - kind: 'contract', - contract: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', - change: '8700580', - origin: 'block', - }, - ], - liquidity_baking_toggle_ema: 0, - implicit_operations_results: [ - { - kind: 'transaction', - storage: [ - { - int: '1', - }, - { - int: '332905000100', - }, - { - int: '100', - }, - { - bytes: '01e927f00ef734dfc85919635e9afc9166c83ef9fc00', - }, - { - bytes: '0115eb0104481a6d7921160bc982c5e0a561cd8a3a00', - }, - ], - balance_updates: [ - { - kind: 'minted', - category: 'subsidy', - change: '-2500000', - origin: 'subsidy', - }, - { - kind: 'contract', - contract: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5', - change: '2500000', - origin: 'subsidy', - }, - ], - consumed_milligas: '205035', - storage_size: '4632', - }, - ], - consumed_milligas: '24380000', - }, - operations: [ - [ - { - protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', - chain_id: 'NetXi2ZagzEsXbZ', - hash: 'onyJZz2gwEmspLbZaCd2P7Ws5RF7od6j2685VYrTPDaEZhpDbvx', - branch: 'BLeoVyx5LNjQ4ZvnpvdrgFszvSn9KPJVcqmApLaa6bn6VS1vNig', - contents: [ - { - kind: 'endorsement', - slot: 2696, - level: 133162, - round: 0, - block_payload_hash: 'vh2vcfabPoDQuNw6HQkZtWEzZkHe1uAmhF2sxta7varX3vriHPKD', - metadata: { - delegate: 'tz1ehn3nZ8PhiJ2ygtLM3Z5hVtSzU4ZKgqLZ', - endorsement_power: 6, - }, - }, - ], - signature: - 'sigUqaWrk8u6zckJvLfivskoC5mkK62swsfNFq2eAuhFaghLC9LfahFMaEVag3pLjz4WjouVnYa4gekqs85kgH1s7p2hHyP3', - }, - ], - [], - [], - [ - { - protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', - chain_id: 'NetXi2ZagzEsXbZ', - hash: 'ooBghN2ok5EpgEuMqYWqvfwNLBiK9eNFoPai91iwqk2nRCyUKgE', - branch: 'BMNHgXcGnPQo2daGRvXnFV5DX7QfqCwpssPtaL4NWkUhuhYWwdS', - contents: [ - { - kind: 'increase_paid_storage', - source: 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG', - fee: '349', - counter: '108123', - gas_limit: '1000', - storage_limit: '0', - amount: '2', - destination: 'KT1Vjr5PFC2Qm5XbSQZ8MdFZLgYMzwG5WZNh', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG', - change: '-349', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '349', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'contract', - contract: 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG', - change: '-500', - origin: 'block', - }, - { - kind: 'burned', - category: 'storage fees', - change: '500', - origin: 'block', - }, - ], - consumed_milligas: '1000000', - }, - }, - }, - ], - signature: - 'sigdUXgzV3FcbhV7qUAYGCbV86xZEpcBq1S3Acng974GvG8rULLnoNkXn1dvKvfbfvz3zChYCpjcDmR8f1shjAg1uSksceRp', - }, - { - protocol: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', - chain_id: 'NetXi2ZagzEsXbZ', - hash: 'oorMQ4cCHReHtUdyEqpWBjyAgu59AWYMzSP5bSwi2gSGGHBSLF5', - branch: 'BKuq9qvyUfiZH64z7J7nxKAt7HGA1m2rgiR24XrCsAEgBh2JJd1', - contents: [ - { - kind: 'transaction', - source: 'tz1ejWMc4oNPuYJcs2UBFALuzQy3jKcZxEwL', - fee: '673', - counter: '84777', - gas_limit: '4224', - storage_limit: '0', - amount: '0', - destination: 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1ejWMc4oNPuYJcs2UBFALuzQy3jKcZxEwL', - change: '-673', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '673', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - storage: { - prim: 'Unit', - }, - consumed_milligas: '2123011', - storage_size: '133', - }, - internal_operation_results: [ - { - kind: 'event', - source: 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q', - nonce: 0, - type: { - prim: 'or', - args: [ - { - prim: 'nat', - }, - { - prim: 'string', - }, - ], - }, - tag: 'event', - payload: { - prim: 'Left', - args: [ - { - int: '10', - }, - ], - }, - result: { - status: 'applied', - consumed_milligas: '1000000', - }, - }, - { - kind: 'event', - source: 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q', - nonce: 1, - type: { - prim: 'or', - args: [ - { - prim: 'nat', - annots: ['%number'], - }, - { - prim: 'string', - annots: ['%words'], - }, - ], - }, - tag: 'event', - payload: { - prim: 'Right', - args: [ - { - string: 'lorem ipsum', - }, - ], - }, - result: { - status: 'applied', - consumed_milligas: '1000000', - }, - }, - ], - }, - }, - ], - signature: - 'sigfSTrupvjTWBW4NNXJHLyNEd6gUuD3Jzm9YZzSrH82X3somYZPpgCayRTkzmk1NwxGQCKJHLGsv7xxhVNKsgtxTqF8FEqe', + 'sigfSTrupvjTWBW4NNXJHLyNEd6gUuD3Jzm9YZzSrH82X3somYZPpgCayRTkzmk1NwxGQCKJHLGsv7xxhVNKsgtxTqF8FEqe', }, ], ], @@ -5048,7 +3991,7 @@ export const blockLimanetResponse = { ], }; -export const blockMondaynetResponse = { +export const blockWeeklynetResponse = { protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', chain_id: 'NetXrxsLyu6hTHx', hash: 'BLxSQZzbnjL8yWqo8fJDE6cy2ATPmqQSaLKtheFBzAz4QVTcm5h', @@ -5364,33 +4307,6 @@ export const blockMondaynetResponse = { ], }; -export const txRollupState = { - last_removed_commitment_hashes: null, - finalized_commitments: { - next: 0, - }, - unfinalized_commitments: { - next: 0, - }, - uncommitted_inboxes: { - newest: 0, - oldest: 0, - }, - commitment_newest_hash: null, - tezos_head_level: 63691, - burn_per_byte: '0', - allocated_storage: '4000', - occupied_storage: '40', - inbox_ema: 0, - commitments_watermark: null, -}; - -export const txRollupInbox = { - inbox_length: 1, - cumulated_size: 4, - merkle_root: 'txi3Ef5CSsBWRaqQhWj2zg51J3tUqHFD47na6ex7zcboTG5oXEFrm', -}; - export const ticketBalancesResponse = [ { ticketer: 'KT1X6mCNdfQZSpyU9zZw9sWckPVJyz2X8vwD', @@ -5659,8 +4575,6 @@ export const smartRollupOriginateResponse = { pvm_kind: 'wasm_2_0_0', kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, @@ -5895,7 +4809,6 @@ export const smartRollupCementResponse = { gas_limit: '6986', storage_limit: '0', rollup: 'sr1CCHLfB1jjz4ikB2bm4XGPvTjafVgUzhLB', - commitment: 'src12mERNVEb3N1EVmbUbudctzajiezmd3q6EsgLexkgxNCHK8PNBi', metadata: { balance_updates: [ { diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index 617137543b..9048af5407 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -15,6 +15,7 @@ import { blockHeader, blockMetadata, bakingRights, + attestationRights, endorsingRights, ballotList, ballots, @@ -30,8 +31,6 @@ import { blockResponse, protocols, constants, - txRollupInbox, - txRollupState, ticketBalancesResponse, pendingOperationsResponse, } from './data/rpc-responses'; @@ -45,8 +44,6 @@ describe('RpcClientCache test', () => { const address = 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn'; const contractAddress = 'KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4D'; - const txRollupId = 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w'; - const blockLevel = '0'; const ticketToken = { ticketer: contractAddress, content_type: { prim: 'string' }, @@ -75,6 +72,7 @@ describe('RpcClientCache test', () => { getBlockHeader: jest.fn(), getBlockMetadata: jest.fn(), getBakingRights: jest.fn(), + getAttestationRights: jest.fn(), getEndorsingRights: jest.fn(), getBallotList: jest.fn(), getBallots: jest.fn(), @@ -89,8 +87,6 @@ describe('RpcClientCache test', () => { getCurrentPeriod: jest.fn(), getSuccessorPeriod: jest.fn(), getProtocols: jest.fn(), - getTxRollupInbox: jest.fn(), - getTxRollupState: jest.fn(), getTicketBalance: jest.fn(), getAllTicketBalances: jest.fn(), getPendingOperations: jest.fn(), @@ -116,6 +112,7 @@ describe('RpcClientCache test', () => { mockRpcClient.getBlockHeader.mockReturnValue(blockHeader); mockRpcClient.getBlockMetadata.mockReturnValue(blockMetadata); mockRpcClient.getBakingRights.mockReturnValue(bakingRights); + mockRpcClient.getAttestationRights.mockReturnValue(attestationRights); mockRpcClient.getEndorsingRights.mockReturnValue(endorsingRights); mockRpcClient.getBallotList.mockReturnValue(ballotList); mockRpcClient.getBallots.mockReturnValue(ballots); @@ -129,8 +126,6 @@ describe('RpcClientCache test', () => { mockRpcClient.getCurrentPeriod.mockReturnValue(currentPeriod); mockRpcClient.getSuccessorPeriod.mockReturnValue(successorPeriod); mockRpcClient.getProtocols.mockReturnValue(protocols); - mockRpcClient.getTxRollupInbox.mockReturnValue(txRollupInbox); - mockRpcClient.getTxRollupState.mockReturnValue(txRollupState); mockRpcClient.getTicketBalance.mockReturnValue('3'); mockRpcClient.getAllTicketBalances.mockReturnValue(ticketBalancesResponse); mockRpcClient.getPendingOperations.mockReturnValue(pendingOperationsResponse); @@ -162,6 +157,7 @@ describe('RpcClientCache test', () => { await rpcCache.getBlockHeader(); await rpcCache.getBlockMetadata(); await rpcCache.getBakingRights(); + await rpcCache.getAttestationRights(); await rpcCache.getEndorsingRights(); await rpcCache.getBallotList(); await rpcCache.getBallots(); @@ -178,8 +174,6 @@ describe('RpcClientCache test', () => { await rpcCache.getCurrentPeriod(); await rpcCache.getSuccessorPeriod(); await rpcCache.getProtocols(); - await rpcCache.getTxRollupInbox(txRollupId, blockLevel); - await rpcCache.getTxRollupState(txRollupId); await rpcCache.getTicketBalance(contractAddress, { ticketer: contractAddress, content_type: { prim: 'string' }, @@ -238,6 +232,9 @@ describe('RpcClientCache test', () => { expect(rpcCache.getAllCachedData()['rpcTest/getBakingRights/head/{}/'].response).toEqual( bakingRights ); + expect(rpcCache.getAllCachedData()['rpcTest/getAttestationRights/head/{}/'].response).toEqual( + attestationRights + ); expect(rpcCache.getAllCachedData()['rpcTest/getEndorsingRights/head/{}/'].response).toEqual( endorsingRights ); @@ -268,13 +265,6 @@ describe('RpcClientCache test', () => { successorPeriod ); expect(rpcCache.getAllCachedData()['rpcTest/getProtocols/head/'].response).toEqual(protocols); - expect( - rpcCache.getAllCachedData()[`rpcTest/getTxRollupInbox/head/${txRollupId}/${blockLevel}/`] - .response - ).toEqual(txRollupInbox); - expect( - rpcCache.getAllCachedData()[`rpcTest/getTxRollupState/head/${txRollupId}/`].response - ).toEqual(txRollupState); expect( rpcCache.getAllCachedData()[ `rpcTest/getTicketBalance/head/${contractAddress}/${JSON.stringify(ticketToken)}/` @@ -315,6 +305,7 @@ describe('RpcClientCache test', () => { await rpcCache.getBlockHeader(block); await rpcCache.getBlockMetadata(block); await rpcCache.getBakingRights({ level: 1111 }, block); + await rpcCache.getAttestationRights({ level: 151187 }, block); await rpcCache.getEndorsingRights({ level: 1111 }, block); await rpcCache.getBallotList(block); await rpcCache.getBallots(block); @@ -331,8 +322,6 @@ describe('RpcClientCache test', () => { await rpcCache.getCurrentPeriod(block); await rpcCache.getSuccessorPeriod(block); await rpcCache.getProtocols(block); - await rpcCache.getTxRollupInbox(txRollupId, blockLevel, block); - await rpcCache.getTxRollupState(txRollupId, block); await rpcCache.getTicketBalance( contractAddress, { @@ -405,6 +394,10 @@ describe('RpcClientCache test', () => { expect( rpcCache.getAllCachedData()[`rpcTest/getBakingRights/${block.block}/{"level":1111}/`].response ).toEqual(bakingRights); + expect( + rpcCache.getAllCachedData()[`rpcTest/getAttestationRights/${block.block}/{"level":151187}/`] + .response + ).toEqual(attestationRights); expect( rpcCache.getAllCachedData()[`rpcTest/getEndorsingRights/${block.block}/{"level":1111}/`] .response @@ -443,14 +436,6 @@ describe('RpcClientCache test', () => { expect(rpcCache.getAllCachedData()[`rpcTest/getProtocols/${block.block}/`].response).toEqual( protocols ); - expect( - rpcCache.getAllCachedData()[ - `rpcTest/getTxRollupInbox/${block.block}/${txRollupId}/${blockLevel}/` - ].response - ).toEqual(txRollupInbox); - expect( - rpcCache.getAllCachedData()[`rpcTest/getTxRollupState/${block.block}/${txRollupId}/`].response - ).toEqual(txRollupState); expect( rpcCache.getAllCachedData()[ `rpcTest/getTicketBalance/${block.block}/${contractAddress}/${JSON.stringify(ticketToken)}/` @@ -484,6 +469,7 @@ describe('RpcClientCache test', () => { await rpcCache.getBlockHeader(); await rpcCache.getBlockMetadata(); await rpcCache.getBakingRights(); + await rpcCache.getAttestationRights(); await rpcCache.getEndorsingRights(); await rpcCache.getBallotList(); await rpcCache.getBallots(); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index 09fd3a84ef..ba5d08f4b1 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -15,31 +15,19 @@ import { RPCRunScriptViewParam, OperationContentsAndResultSetDepositsLimit, METADATA_BALANCE_UPDATES_CATEGORY, - OperationContentsAndResultTxRollupOrigination, - OperationContentsAndResultTxRollupSubmitBatch, - OperationContentsAndResultTxRollupCommit, - OperationContentsAndResultTxRollupFinalizeCommitment, - OperationContentsAndResultTxRollupDispatchTickets, - MichelsonV1ExpressionBase, - MichelsonV1ExpressionExtended, - OperationContentsAndResultTxRollupRemoveCommitment, - OperationContentsAndResultTxRollupRejection, - Inode, - OtherElts, OperationContentsAndResultIncreasePaidStorage, OperationResultEvent, OperationContentsAndResultTransferTicket, - OperationContentsAndResultTxRollupReturnBond, OperationContentsAndResultUpdateConsensusKey, OperationContentsAndResultDrainDelegate, - TxRollupProof, ConstantsResponseProto015, OperationContentsAndResultSmartRollupOriginate, OperationContentsAndResultSmartRollupAddMessages, OperationContentsAndResultSmartRollupExecuteOutboxMessage, RPCRunOperationParam, OperationMetadataBalanceUpdates, - PendingOperations, + PendingOperationsV1, + PendingOperationsV2, OperationContentsAndResultSmartRollupCement, OperationContentsAndResultSmartRollupPublish, OperationContentsAndResultSmartRollupRefute, @@ -52,10 +40,9 @@ import { } from '../src/types'; import { blockIthacanetResponse, - blockJakartanetResponse, blockKathmandunetResponse, blockLimanetResponse, - blockMondaynetResponse, + blockWeeklynetResponse, delegatesIthacanetResponse, delegatesKathmandunetResponse, votingInfoKathmandunetResponse, @@ -2847,426 +2834,8 @@ describe('RpcClient test', () => { expect(content.metadata.operation_result.consumed_milligas).toEqual('1000000'); }); - it('should access the properties of the operation type tx_rollup_origination, proto 13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[0] as OperationContentsAndResultTxRollupOrigination; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_ORIGINATION); - expect(content.source).toEqual('tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ'); - expect(content.fee).toEqual('380'); - expect(content.counter).toEqual('173977'); - expect(content.gas_limit).toEqual('1521'); - expect(content.storage_limit).toEqual('4020'); - expect(content.tx_rollup_origination).toBeDefined(); - - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ' - ); - expect(content.metadata.balance_updates![0].change).toEqual('-380'); - expect(content.metadata.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('380'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - expect(content.metadata.operation_result.consumed_gas).toBeDefined(); - expect(content.metadata.operation_result.consumed_gas).toEqual('1421'); - expect(content.metadata.operation_result.consumed_milligas).toBeDefined(); - expect(content.metadata.operation_result.consumed_milligas).toEqual('1420108'); - expect(content.metadata.operation_result.originated_rollup).toEqual( - 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w' - ); - - expect(content.metadata.operation_result.balance_updates).toBeDefined(); - expect(content.metadata.operation_result.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.operation_result.balance_updates![0].contract).toEqual( - 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ' - ); - expect(content.metadata.operation_result.balance_updates![0].change).toEqual('-1000000'); - expect(content.metadata.operation_result.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.operation_result.balance_updates![1].kind).toEqual('burned'); - expect(content.metadata.operation_result.balance_updates![1].category).toEqual( - 'storage fees' - ); - expect(content.metadata.operation_result.balance_updates![1].change).toEqual('1000000'); - expect(content.metadata.operation_result.balance_updates![1].origin).toEqual('block'); - }); - - it('should access the properties of the operation type tx_rollup_submit_batch, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[1] as OperationContentsAndResultTxRollupSubmitBatch; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_SUBMIT_BATCH); - expect(content.source).toEqual('tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ'); - expect(content.fee).toEqual('476'); - expect(content.counter).toEqual('173978'); - expect(content.gas_limit).toEqual('2209'); - expect(content.storage_limit).toEqual('0'); - expect(content.rollup).toEqual('txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w'); - expect(content.content).toEqual('626c6f62'); - - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ' - ); - expect(content.metadata.balance_updates![0].change).toEqual('-476'); - expect(content.metadata.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('476'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - expect(content.metadata.operation_result.balance_updates).toBeDefined(); - expect(content.metadata.operation_result.consumed_gas).toEqual('2109'); - expect(content.metadata.operation_result.consumed_milligas).toEqual('2108268'); - expect(content.metadata.operation_result.paid_storage_size_diff).toEqual('0'); - }); - - it('should access the properties of the operation type tx_rollup_commit, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[2] as OperationContentsAndResultTxRollupCommit; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_COMMIT); - expect(content.source).toEqual('tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY'); - expect(content.fee).toEqual('735'); - expect(content.counter).toEqual('182217'); - expect(content.gas_limit).toEqual('3838'); - expect(content.storage_limit).toEqual('0'); - expect(content.rollup).toEqual('txr1Nbn66mC1yYHBkfD3ink45XVJso6QJZeHe'); - - expect(content.commitment).toBeDefined(); - expect(content.commitment.level).toEqual(1); - expect(content.commitment.messages[0]).toEqual( - 'txmr344vtdPzvWsfnoSd3mJ3MCFA5ehKLQs1pK9WGcX4FEACg1rVgC' - ); - expect(content.commitment.predecessor).toEqual( - 'txc3PQbuB4fmpXMq2NqXGpCnu8EDotTWeHf5w3jJRpyQHSNKRug3U' - ); - expect(content.commitment.inbox_merkle_root).toEqual( - 'txi3Ef5CSsBWRaqQhWj2zg51J3tUqHFD47na6ex7zcboTG5oXEFrm' - ); - - expect(content.metadata.balance_updates).toBeDefined(); - - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY' - ); - expect(content.metadata.balance_updates![0].change).toEqual('-735'); - expect(content.metadata.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('735'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - expect(content.metadata.operation_result.balance_updates).toBeDefined(); - expect(content.metadata.operation_result.consumed_gas).toEqual('3738'); - expect(content.metadata.operation_result.consumed_milligas).toEqual('3737532'); - }); - - it('should access the properties of the operation type tx_rollup_finalize_commitment, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[3] as OperationContentsAndResultTxRollupFinalizeCommitment; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_FINALIZE_COMMITMENT); - expect(content.source).toEqual('tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY'); - expect(content.fee).toEqual('507'); - expect(content.counter).toEqual('182232'); - expect(content.gas_limit).toEqual('2602'); - expect(content.storage_limit).toEqual('0'); - expect(content.rollup).toEqual('txr1RHjM395hdwNfgpM8GixQrPAimk7i2Tjy1'); - - expect(content.metadata.balance_updates).toBeDefined(); - - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz1gqDrJYH8rTkdG3gCLTtRA1d7UZDjYFNRY' - ); - expect(content.metadata.balance_updates![0].change).toEqual('-507'); - expect(content.metadata.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('507'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - expect(content.metadata.operation_result.balance_updates).toBeDefined(); - expect(content.metadata.operation_result.consumed_gas).toEqual('2502'); - expect(content.metadata.operation_result.consumed_milligas).toEqual('2501420'); - expect(content.metadata.operation_result.level).toEqual(0); - }); - - it('should access the properties of the operation type tx_rollup_dispatch_tickets, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[4] as OperationContentsAndResultTxRollupDispatchTickets; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_DISPATCH_TICKETS); - expect(content.source).toEqual('tz1inuxjXxKhd9e4b97N1Wgz7DwmZSxFcDpM'); - expect(content.fee).toEqual('835'); - expect(content.counter).toEqual('252405'); - expect(content.gas_limit).toEqual('4354'); - expect(content.storage_limit).toEqual('86'); - expect(content.tx_rollup).toEqual('txr1YMZxstAHqQ9V313sYjLBCHBXsvSmDZuTs'); - expect(content.level).toEqual(4); - expect(content.context_hash).toEqual('CoV7iqRirVx7sZa5TAK9ymoEJBrW6z4hwwrzMhz6YLeHYXrQwRWG'); - expect(content.message_index).toEqual(0); - expect(content.message_result_path).toBeDefined(); - expect(content.message_result_path[0]).toEqual( - 'txM2eYt63gJ98tv3z4nj3aWPMzpjLnW9xpUdmz4ftMnbvNG34Y4wB' - ); - - expect(content.tickets_info).toBeDefined(); - - expect((content.tickets_info[0].contents as MichelsonV1ExpressionBase).string).toEqual( - 'third-deposit' - ); - expect((content.tickets_info[0].ty as MichelsonV1ExpressionExtended).prim).toEqual('string'); - expect(content.tickets_info[0].ticketer).toEqual('KT1EMQxfYVvhTJTqMiVs2ho2dqjbYfYKk6BY'); - expect(content.tickets_info[0].amount).toEqual('2'); - expect(content.tickets_info[0].claimer).toEqual('tz1inuxjXxKhd9e4b97N1Wgz7DwmZSxFcDpM'); - }); - - it('should access the properties of the operation type tx_rollup_remove_commitment, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[5] as OperationContentsAndResultTxRollupRemoveCommitment; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_REMOVE_COMMITMENT); - expect(content.source).toEqual('tz1M1PXyMAhAsXroc6DtuWUUeHvb79ZzCnCp'); - expect(content.fee).toEqual('574'); - expect(content.counter).toEqual('252310'); - expect(content.gas_limit).toEqual('3272'); - expect(content.storage_limit).toEqual('0'); - expect(content.rollup).toEqual('txr1YMZxstAHqQ9V313sYjLBCHBXsvSmDZuTs'); - - expect(content.metadata.balance_updates).toBeDefined(); - - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz1M1PXyMAhAsXroc6DtuWUUeHvb79ZzCnCp' - ); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('574'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - expect(content.metadata.operation_result.balance_updates).toBeDefined(); - expect(content.metadata.operation_result.consumed_gas).toEqual('3172'); - expect(content.metadata.operation_result.consumed_milligas).toEqual('3171088'); - expect(content.metadata.operation_result.level).toEqual(0); - }); - - it('should access the properties of the operation type tx_rollup_rejection, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[6] as OperationContentsAndResultTxRollupRejection; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_REJECTION); - expect(content.source).toEqual('tz1MDU45gNc9Ko1Q9obcz6hQkKSMiQRib6GZ'); - expect(content.fee).toEqual('2837'); - expect(content.counter).toEqual('266515'); - expect(content.gas_limit).toEqual('11633'); - expect(content.storage_limit).toEqual('0'); - expect(content.rollup).toEqual('txr1V16e1hXyVKndP4aE8cujRfryoHTiHK9fG'); - expect(content.level).toEqual(11); - - expect(content.message.batch).toBeDefined(); - expect(content.message.batch).toEqual( - '01b2530bd9f4d594ee6116286cbb045a972305e38e6365b396f49d153815fbdd15c8974b7fdc50aee4bc3f8195e95075ab0fca5d31927917ede7a408fe70c61cd4a0525b2836eca0e797cdf9ae9b3bf58735fd62a7bf21775d46940ae9bd83a8d501130187e8c631aba41d88a67da49cf5f4db947fdf5a76084f1d4b6c14531f6582b239db26dd0375ca7172cdbecd8b6f080ffa58c748f83cc7a2afce164c1bcc53712ff5a9e50c39fb0172acda0a' - ); - expect(content.message_position).toEqual('0'); - expect(content.message_path[0]).toEqual( - 'txi1WZKF1fkUWfKbmaHbb5b8gn68rKSyUy4k7NnSVY4p79BKYz5RB' - ); - expect(content.message_result_hash).toEqual( - 'txmr344vtdPzvWsfnoSd3mJ3MCFA5ehKLQs1pK9WGcX4FEACg1rVgC' - ); - expect(content.message_result_path[0]).toEqual( - 'txM2eYt63gJ98tv3z4nj3aWPMzpjLnW9xpUdmz4ftMnbvNG34Y4wB' - ); - - expect(content.previous_message_result).toBeDefined(); - expect(content.previous_message_result.context_hash).toEqual( - 'CoVUv68XdJts8f6Ysaoxm4jnt4JKXfqx8WYVFnkj2UFfgKHJUrLs' - ); - expect(content.previous_message_result.withdraw_list_hash).toEqual( - 'txw1sFoLju3ySMAdY6v1dcHUMqJ4Zxc1kcynC8xkYgCmH6bpNSDhV' - ); - expect(content.previous_message_result_path[0]).toEqual( - 'txM2eYt63gJ98tv3z4nj3aWPMzpjLnW9xpUdmz4ftMnbvNG34Y4wB' - ); - - expect(content.proof).toBeDefined(); - - const proof = content.proof as TxRollupProof; - expect(proof.version).toEqual(3); - expect((proof.before as { node: string }).node).toEqual( - 'CoVUv68XdJts8f6Ysaoxm4jnt4JKXfqx8WYVFnkj2UFfgKHJUrLs' - ); - expect((proof.after as { node: string }).node).toEqual( - 'CoUn3twa3TmvNby5VAGeN2jHvzbfpmJAXcyDHJuLLAuuLiaZZnzC' - ); - - expect(proof.state).toBeDefined(); - - const inodeState1 = (proof.state[0] as { inode: Inode }).inode; - expect(inodeState1.length).toEqual('14'); - expect(inodeState1.proofs).toEqual([ - 'CoVbQczQE6uDug4tWErtLgszzZBRDJKEGHgcQp8jGYSEfBLnsMXH', - 'CoWZ31tY65qh38Sfgm64Ny8kDTLQQMr5xuRDkDkz1JopiBnPDu11', - ]); - - const inodeState2 = (proof.state[2] as { inode: Inode }).inode; - expect(inodeState2.length).toEqual('3'); - expect(inodeState2.proofs).toEqual([ - null, - 'CoVPGhaCkq2yV5JJs8Bxq1idndEhBn3SCJe3rSH5eYvr9BnRnv8i', - ]); - - const otherEltsNode = ( - (proof.state[4] as { other_elts: OtherElts }).other_elts as { - node: [string, { value: string }][]; - } - ).node; - expect(otherEltsNode[0]).toEqual([ - '0287e8c631aba41d88a67da49cf5f4db947fdf5a76', - { value: 'CoW4fTVfN6WBZ6XqT38EqLzn5raQUYkjSL4Ce7J2KsGKcFPjgUJy' }, - ]); - - const otherEltsOtherElts = ( - (proof.state[5] as { other_elts: OtherElts }).other_elts as { - other_elts: { value: any }; - } - ).other_elts; - expect(otherEltsOtherElts).toEqual({ value: '00000000' }); - - expect(content.metadata.balance_updates).toBeDefined(); - - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz1MDU45gNc9Ko1Q9obcz6hQkKSMiQRib6GZ' - ); - expect(content.metadata.balance_updates![0].change).toEqual('-2837'); - expect(content.metadata.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('2837'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - - expect(content.metadata.operation_result.balance_updates).toBeDefined(); - expect(content.metadata.operation_result.balance_updates![0].kind).toEqual('freezer'); - expect(content.metadata.operation_result.balance_updates![0].category!).toEqual('bonds'); - expect(content.metadata.operation_result.balance_updates![0].contract!).toEqual( - 'tz1Lg9iLTS8Hk6kLfTN6rrrL9gYPfsTQ9z75' - ); - expect(content.metadata.operation_result.balance_updates![0].bond_id!.tx_rollup).toEqual( - 'txr1V16e1hXyVKndP4aE8cujRfryoHTiHK9fG' - ); - expect(content.metadata.operation_result.balance_updates![0].change).toEqual('-10000000000'); - expect(content.metadata.operation_result.balance_updates![0].origin!).toEqual('block'); - - expect(content.metadata.operation_result.balance_updates![1].kind).toEqual('burned'); - expect(content.metadata.operation_result.balance_updates![1].category!).toEqual( - 'tx_rollup_rejection_punishments' - ); - expect(content.metadata.operation_result.balance_updates![1].change).toEqual('10000000000'); - expect(content.metadata.operation_result.balance_updates![1].origin!).toEqual('block'); - - expect(content.metadata.operation_result.balance_updates![2].kind).toEqual('minted'); - expect(content.metadata.operation_result.balance_updates![2].category!).toEqual( - 'tx_rollup_rejection_rewards' - ); - expect(content.metadata.operation_result.balance_updates![2].change).toEqual('-5000000000'); - expect(content.metadata.operation_result.balance_updates![2].origin!).toEqual('block'); - - expect(content.metadata.operation_result.balance_updates![3].kind).toEqual('contract'); - expect(content.metadata.operation_result.balance_updates![3].contract!).toEqual( - 'tz1MDU45gNc9Ko1Q9obcz6hQkKSMiQRib6GZ' - ); - expect(content.metadata.operation_result.balance_updates![3].change).toEqual('5000000000'); - expect(content.metadata.operation_result.balance_updates![3].origin!).toEqual('block'); - - expect(content.metadata.operation_result.consumed_gas).toEqual('11533'); - expect(content.metadata.operation_result.consumed_milligas).toEqual('11532006'); - }); - - it('should access the properties of operation type tx_rollup_return_bond, proto13', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockJakartanetResponse)); - - const response = await client.getBlock(); - const content = response.operations[3][0] - .contents[7] as OperationContentsAndResultTxRollupReturnBond; - - expect(content.kind).toEqual(OpKind.TX_ROLLUP_RETURN_BOND); - expect(content.source).toEqual('tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes'); - expect(content.fee).toEqual('512'); - expect(content.counter).toEqual('36'); - expect(content.gas_limit).toEqual('2676'); - expect(content.storage_limit).toEqual('0'); - expect(content.rollup).toEqual('txr1TeZQiQrjaEop11Lh8fpsTdyJgQvr5igST'); - - expect(content.metadata.balance_updates).toBeDefined(); - expect(content.metadata.balance_updates![0].kind).toEqual('contract'); - expect(content.metadata.balance_updates![0].contract).toEqual( - 'tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes' - ); - expect(content.metadata.balance_updates![0].change).toEqual('-512'); - expect(content.metadata.balance_updates![0].origin).toEqual('block'); - - expect(content.metadata.balance_updates![1].kind).toEqual('accumulator'); - expect(content.metadata.balance_updates![1].category).toEqual('block fees'); - expect(content.metadata.balance_updates![1].change).toEqual('512'); - expect(content.metadata.balance_updates![1].origin).toEqual('block'); - - expect(content.metadata.operation_result.status).toEqual('applied'); - expect(content.metadata.operation_result.balance_updates![0].kind).toEqual('freezer'); - expect(content.metadata.operation_result.balance_updates![0].category).toEqual('bonds'); - expect(content.metadata.operation_result.balance_updates![0].contract).toEqual( - 'tz2Q3efwpRvKL2Tvta8h6N5niV54Rw8iSEes' - ); - expect(content.metadata.operation_result.balance_updates![0].bond_id!.tx_rollup).toEqual( - 'txr1TeZQiQrjaEop11Lh8fpsTdyJgQvr5igST' - ); - expect(content.metadata.operation_result.balance_updates![0].change).toEqual('-10000000000'); - expect(content.metadata.operation_result.balance_updates![0].origin).toEqual('block'); - expect(content.metadata.operation_result.consumed_milligas).toEqual('2575028'); - }); - it('should be able to access the properties of operation type transfer_ticket, proto14', async () => { - httpBackend.createRequest.mockReturnValue(Promise.resolve(blockMondaynetResponse)); + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockWeeklynetResponse)); const response = await client.getBlock(); const content = response.operations[3][0] .contents[1] as OperationContentsAndResultTransferTicket; @@ -3802,19 +3371,20 @@ describe('RpcClient test', () => { metadata: { balance_updates: [ { - category: 'storage fees', - kind: 'burned', + kind: 'minted', + category: 'baking bonuses', + change: '-266662', origin: 'block', }, { - category: 'block fees', - change: '374', - kind: 'accumulator', + kind: 'freezer', + category: 'deposits', + staker: { + baker: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + }, + change: '266662', origin: 'block', }, - { - category: 'legacy_rewards', - }, ], }, }, @@ -3828,11 +3398,10 @@ describe('RpcClient test', () => { 'balance_updates' ] as OperationMetadataBalanceUpdates[]) : []; - expect(balanceUpdate![0]['category']).toEqual(METADATA_BALANCE_UPDATES_CATEGORY.STORAGE_FEES); - expect(balanceUpdate![1]['category']).toEqual(METADATA_BALANCE_UPDATES_CATEGORY.BLOCK_FEES); - expect(balanceUpdate![2]['category']).toEqual( - METADATA_BALANCE_UPDATES_CATEGORY.LEGACY_REWARDS + expect(balanceUpdate![0]['category']).toEqual( + METADATA_BALANCE_UPDATES_CATEGORY.BAKING_BONUSES ); + expect(balanceUpdate![1]['category']).toEqual(METADATA_BALANCE_UPDATES_CATEGORY.DEPOSITS); }); }); @@ -3860,19 +3429,20 @@ describe('RpcClient test', () => { metadata: { balance_updates: [ { - category: 'storage fees', - kind: 'burned', + kind: 'minted', + category: 'baking rewards', + change: '-266667', origin: 'block', }, { - category: 'block fees', - change: '374', - kind: 'accumulator', + kind: 'freezer', + category: 'deposits', + staker: { + baker: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + }, + change: '266667', origin: 'block', }, - { - category: 'legacy_rewards', - }, ], }, }, @@ -3886,11 +3456,10 @@ describe('RpcClient test', () => { 'balance_updates' ] as OperationMetadataBalanceUpdates[]) : []; - expect(balanceUpdate![0]['category']).toEqual(METADATA_BALANCE_UPDATES_CATEGORY.STORAGE_FEES); - expect(balanceUpdate![1]['category']).toEqual(METADATA_BALANCE_UPDATES_CATEGORY.BLOCK_FEES); - expect(balanceUpdate![2]['category']).toEqual( - METADATA_BALANCE_UPDATES_CATEGORY.LEGACY_REWARDS + expect(balanceUpdate![0]['category']).toEqual( + METADATA_BALANCE_UPDATES_CATEGORY.BAKING_REWARDS ); + expect(balanceUpdate![1]['category']).toEqual(METADATA_BALANCE_UPDATES_CATEGORY.DEPOSITS); }); }); @@ -4155,69 +3724,6 @@ describe('RpcClient test', () => { }); }); - describe('getTxRollupState', () => { - it('should query the correct url and return a rollup state response', async () => { - const mockResponse = { - last_removed_commitment_hashes: null, - finalized_commitments: { - next: 0, - }, - unfinalized_commitments: { - next: 0, - }, - uncommitted_inboxes: { - newest: 0, - oldest: 0, - }, - commitment_newest_hash: null, - tezos_head_level: 63691, - burn_per_byte: '0', - allocated_storage: '4000', - occupied_storage: '40', - inbox_ema: 0, - commitments_watermark: null, - }; - - httpBackend.createRequest.mockReturnValue(Promise.resolve(mockResponse)); - - const txRollupState = await client.getTxRollupState('txrID'); - - expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ - method: 'GET', - url: `root/chains/test/blocks/head/context/tx_rollup/txrID/state`, - }); - - expect(txRollupState).toBeDefined(); - expect(txRollupState).toEqual(mockResponse); - }); - }); - - describe('getTxRollupInbox', () => { - it('should query the correct url and return a rollup inbox response', async () => { - httpBackend.createRequest.mockReturnValue( - Promise.resolve({ - inbox_length: 1, - cumulated_size: 4, - merkle_root: 'txi3Ef5CSsBWRaqQhWj2zg51J3tUqHFD47na6ex7zcboTG5oXEFrm', - }) - ); - - const txRollupInbox = await client.getTxRollupInbox('txrID', '0'); - - expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ - method: 'GET', - url: `root/chains/test/blocks/head/context/tx_rollup/txrID/inbox/0`, - }); - - expect(txRollupInbox).toBeDefined(); - expect(txRollupInbox!.inbox_length).toEqual(1); - expect(txRollupInbox!.cumulated_size).toEqual(4); - expect(txRollupInbox!.merkle_root).toEqual( - 'txi3Ef5CSsBWRaqQhWj2zg51J3tUqHFD47na6ex7zcboTG5oXEFrm' - ); - }); - }); - describe('smartRollupOriginate', () => { it('should have correct types to access smart_rollup_originate results', async () => { httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupOriginateResponse)); @@ -4235,9 +3741,6 @@ describe('RpcClient test', () => { expect(content.kernel).toEqual( '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' ); - expect(content.origination_proof).toEqual( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); expect(content.parameters_ty).toEqual({ prim: 'bytes' }); const soruResult = content.metadata.operation_result; @@ -4373,7 +3876,6 @@ describe('RpcClient test', () => { expect(content.gas_limit).toEqual('6986'); expect(content.storage_limit).toEqual('0'); expect(content.rollup).toEqual('sr1CCHLfB1jjz4ikB2bm4XGPvTjafVgUzhLB'); - expect(content.commitment).toEqual('src12mERNVEb3N1EVmbUbudctzajiezmd3q6EsgLexkgxNCHK8PNBi'); const soruResult = content.metadata.operation_result; @@ -4558,7 +4060,8 @@ describe('RpcClient test', () => { describe('getPendingOperations', () => { it('should query the correct url and retrun pending operations in mempool', async () => { httpBackend.createRequest.mockReturnValue(Promise.resolve(pendingOperationsResponse)); - const response: PendingOperations = await client.getPendingOperations(); + const response: PendingOperationsV1 | PendingOperationsV2 = + await client.getPendingOperations(); expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ method: 'GET', diff --git a/packages/taquito-sapling/README.md b/packages/taquito-sapling/README.md index 0f7bce8920..f024e4bb64 100644 --- a/packages/taquito-sapling/README.md +++ b/packages/taquito-sapling/README.md @@ -1,6 +1,6 @@ # Taquito Sapling package -_Documentation can be found [here](https://tezostaquito.io/docs/next/sapling)_ +_Documentation can be found [here](https://tezostaquito.io/docs/next/sapling)_ _TypeDoc style documentation is available on-line [here](https://tezostaquito.io/typedoc/modules/_taquito_sapling.html)_ ## General Information @@ -24,7 +24,7 @@ The returned balance is in mutez. import { TezosToolkit, RpcReadAdapter } from '@taquito/taquito'; import { SaplingToolkit, InMemorySpendingKey } from '@taquito/sapling'; -const tezos = new TezosToolkit('https://jakartanet.ecadinfra.com/'); +const tezos = new TezosToolkit('https://ghostnet.ecadinfra.com/'); const saplingContract = await tezos.contract.at('KT1UYwMR6Q6LZnwQEi77DSBrAjKT1tEJb245'); @@ -33,8 +33,8 @@ const inMemorySpendingKey = await InMemorySpendingKey.fromMnemonic('YOUR_MNEMONI const readProvider = new RpcReadAdapter(tezos.rpc); const saplingToolkit = new SaplingToolkit( - { saplingSigner: inMemorySpendingKey }, - { contractAddress: saplingContract.address, memoSize: 8 }, + { saplingSigner: inMemorySpendingKey }, + { contractAddress: saplingContract.address, memoSize: 8 }, readProvider ) @@ -50,7 +50,7 @@ A shielded transaction allows sending tokens from a Tezos account (tz1, tz2, tz3 import { TezosToolkit, RpcReadAdapter } from '@taquito/taquito'; import { SaplingToolkit, InMemorySpendingKey } from '@taquito/sapling'; -const tezos = new TezosToolkit('https://jakartanet.ecadinfra.com/'); +const tezos = new TezosToolkit('https://ghostnet.ecadinfra.com/'); // set up your signer on the TezosToolkit as usual const saplingContract = await tezos.contract.at('KT1UYwMR6Q6LZnwQEi77DSBrAjKT1tEJb245'); @@ -59,8 +59,8 @@ const inMemorySpendingKey = await InMemorySpendingKey.fromMnemonic('YOUR_MNEMONI const readProvider = new RpcReadAdapter(tezos.rpc); const saplingToolkit = new SaplingToolkit( - { saplingSigner: inMemorySpendingKey }, - { contractAddress: saplingContract.address, memoSize: 8 }, + { saplingSigner: inMemorySpendingKey }, + { contractAddress: saplingContract.address, memoSize: 8 }, readProvider ) diff --git a/packages/taquito-sapling/package.json b/packages/taquito-sapling/package.json index 92fd700f87..4e119f1c19 100644 --- a/packages/taquito-sapling/package.json +++ b/packages/taquito-sapling/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/sapling", - "version": "17.5.2", + "version": "19.0.0", "description": "Allows reading and preparing sapling transactions", "keywords": [ "tezos", @@ -68,10 +68,10 @@ "@airgap/sapling-wasm": "0.0.9", "@stablelib/nacl": "^1.0.4", "@stablelib/random": "^1.0.2", - "@taquito/core": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1", diff --git a/packages/taquito-sapling/src/version.ts b/packages/taquito-sapling/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-sapling/src/version.ts +++ b/packages/taquito-sapling/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-signer/package.json b/packages/taquito-signer/package.json index 2c19951474..d796c58dac 100644 --- a/packages/taquito-signer/package.json +++ b/packages/taquito-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/signer", - "version": "17.5.2", + "version": "19.0.0", "description": "Provide signing functionality to be with taquito", "keywords": [ "tezos", @@ -72,9 +72,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", diff --git a/packages/taquito-signer/src/version.ts b/packages/taquito-signer/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-signer/src/version.ts +++ b/packages/taquito-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-tzip12/package.json b/packages/taquito-tzip12/package.json index d5a40db427..6cd770ba41 100644 --- a/packages/taquito-tzip12/package.json +++ b/packages/taquito-tzip12/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/tzip12", - "version": "17.5.2", + "version": "19.0.0", "description": "Tzip12", "keywords": [ "tezos", @@ -62,10 +62,10 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/tzip16": "^17.5.2" + "@taquito/core": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/tzip16": "^19.0.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-tzip12/src/version.ts b/packages/taquito-tzip12/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-tzip12/src/version.ts +++ b/packages/taquito-tzip12/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-tzip16/package.json b/packages/taquito-tzip16/package.json index 308bf286b2..61e541f0b0 100644 --- a/packages/taquito-tzip16/package.json +++ b/packages/taquito-tzip16/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/tzip16", - "version": "17.5.2", + "version": "19.0.0", "description": "Tzip16", "keywords": [ "tezos", @@ -61,12 +61,12 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/taquito": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/taquito": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, diff --git a/packages/taquito-tzip16/src/version.ts b/packages/taquito-tzip16/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-tzip16/src/version.ts +++ b/packages/taquito-tzip16/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-utils/package.json b/packages/taquito-utils/package.json index 95090c5aa2..f78310abfc 100644 --- a/packages/taquito-utils/package.json +++ b/packages/taquito-utils/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/utils", - "version": "17.5.2", + "version": "19.0.0", "description": "converts michelson data and types into convenient JS/TS objects", "keywords": [ "tezos", @@ -64,7 +64,7 @@ "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^17.5.2", + "@taquito/core": "^19.0.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/packages/taquito-utils/src/constants.ts b/packages/taquito-utils/src/constants.ts index cf66473c74..6af505c530 100644 --- a/packages/taquito-utils/src/constants.ts +++ b/packages/taquito-utils/src/constants.ts @@ -43,15 +43,6 @@ export enum Prefix { SASK = 'sask', // sapling_spending_key ZET1 = 'zet1', // sapling_address - //rollups - TXR1 = 'txr1', - TXI = 'txi', - TXM = 'txm', - TXC = 'txc', - TXMR = 'txmr', - TXRL = 'txM', - TXW = 'txw', - SR1 = 'sr1', SRC1 = 'src1', } @@ -101,14 +92,6 @@ export const prefix = { [Prefix.SASK]: new Uint8Array([11, 237, 20, 92]), [Prefix.ZET1]: new Uint8Array([18, 71, 40, 223]), - [Prefix.TXR1]: new Uint8Array([1, 128, 120, 31]), - [Prefix.TXI]: new Uint8Array([79, 148, 196]), - [Prefix.TXM]: new Uint8Array([79, 149, 30]), - [Prefix.TXC]: new Uint8Array([79, 148, 17]), - [Prefix.TXMR]: new Uint8Array([18, 7, 206, 87]), - [Prefix.TXRL]: new Uint8Array([79, 146, 82]), - [Prefix.TXW]: new Uint8Array([79, 150, 72]), - [Prefix.SR1]: new Uint8Array([6, 124, 117]), [Prefix.SRC1]: new Uint8Array([17, 165, 134, 138]), }; @@ -138,13 +121,6 @@ export const prefixLength: { [key: string]: number } = { [Prefix.VH]: 32, [Prefix.SASK]: 169, [Prefix.ZET1]: 43, - [Prefix.TXR1]: 20, - [Prefix.TXI]: 32, - [Prefix.TXM]: 32, - [Prefix.TXC]: 32, - [Prefix.TXMR]: 32, - [Prefix.TXRL]: 32, - [Prefix.TXW]: 32, [Prefix.SR1]: 20, [Prefix.SRC1]: 32, diff --git a/packages/taquito-utils/src/taquito-utils.ts b/packages/taquito-utils/src/taquito-utils.ts index e626c10602..47a014aee3 100644 --- a/packages/taquito-utils/src/taquito-utils.ts +++ b/packages/taquito-utils/src/taquito-utils.ts @@ -91,19 +91,11 @@ export function b58decode(payload: string) { [prefix.tz3.toString()]: '0002', }; - const rollupPrefMap = { - [prefix.txr1.toString()]: '02', - }; - const pref = prefixMap[new Uint8Array(buf.slice(0, 3)).toString()]; - const rollupPref = rollupPrefMap[new Uint8Array(buf.slice(0, 4)).toString()]; if (pref) { // tz addresses const hex = buf2hex(buf.slice(3)); return pref + hex; - } else if (rollupPref) { - const hex = buf2hex(buf.slice(4)); - return rollupPref + hex + '00'; } else { // other (kt addresses) return '01' + buf2hex(buf.slice(3, 42)) + '00'; @@ -138,9 +130,6 @@ export function encodePubKey(value: string) { }; return b58cencode(value.substring(4), pref[value.substring(0, 4)]); - } else if (value.substring(0, 2) === '02') { - // 42 also works but the removes the 00 padding at the end - return b58cencode(value.substring(2, value.length - 2), prefix.txr1); } return b58cencode(value.substring(2, 42), prefix.KT); } diff --git a/packages/taquito-utils/src/validators.ts b/packages/taquito-utils/src/validators.ts index 90df84e822..16ad2c98ac 100644 --- a/packages/taquito-utils/src/validators.ts +++ b/packages/taquito-utils/src/validators.ts @@ -62,7 +62,7 @@ function validatePrefixedValue(value: string, prefixes: Prefix[]) { } const implicitPrefix = [Prefix.TZ1, Prefix.TZ2, Prefix.TZ3, Prefix.TZ4]; -const contractPrefix = [Prefix.KT1, Prefix.TXR1]; +const contractPrefix = [Prefix.KT1]; const signaturePrefix = [Prefix.EDSIG, Prefix.P2SIG, Prefix.SPSIG, Prefix.SIG]; const pkPrefix = [Prefix.EDPK, Prefix.SPPK, Prefix.P2PK, Prefix.BLPK]; const operationPrefix = [Prefix.O]; diff --git a/packages/taquito-utils/src/verify-signature.ts b/packages/taquito-utils/src/verify-signature.ts index 658a0cb867..3b8560aafb 100644 --- a/packages/taquito-utils/src/verify-signature.ts +++ b/packages/taquito-utils/src/verify-signature.ts @@ -23,7 +23,7 @@ type SigPrefix = Prefix.EDSIG | Prefix.SPSIG | Prefix.P2SIG | Prefix.SIG; * @description Verify signature of a payload * * @param messageBytes The forged message including the magic byte (11 for block, - * 12 for preendorsement, 13 for endorsement, 3 for generic, 5 for the PACK format of michelson) + * 12 for preattestation/preendorsement, 13 for attestation/endorsement, 3 for generic, 5 for the PACK format of michelson) * @param publicKey The public key to verify the signature against * @param signature The signature to verify * @returns A boolean indicating if the signature matches diff --git a/packages/taquito-utils/src/version.ts b/packages/taquito-utils/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito-utils/src/version.ts +++ b/packages/taquito-utils/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito-utils/test/taquito-utils.spec.ts b/packages/taquito-utils/test/taquito-utils.spec.ts index dcda875e77..3846f37c87 100644 --- a/packages/taquito-utils/test/taquito-utils.spec.ts +++ b/packages/taquito-utils/test/taquito-utils.spec.ts @@ -51,12 +51,6 @@ describe('encodePubKey', () => { 'KT1XM8VUFBiM9AC5czWU15fEeE9nmuEYWt3Y' ); }); - - it('Should encode address properly (txr1)', () => { - expect(encodePubKey('02f16e732d45ba6f24d5ec421f20ab199b3a82907100')).toEqual( - 'txr1jZaQfi9zdwzJteYkRBSN9D7RDvMh1QNkL' - ); - }); }); describe('encodeKey', () => { diff --git a/packages/taquito-utils/test/validators.spec.ts b/packages/taquito-utils/test/validators.spec.ts index cee06be362..0759d76f9d 100644 --- a/packages/taquito-utils/test/validators.spec.ts +++ b/packages/taquito-utils/test/validators.spec.ts @@ -42,26 +42,42 @@ describe('validateAddress', () => { ); expect(validateAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmYW')).toEqual(ValidationResult.VALID); - expect(validateAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmY1')).toEqual(ValidationResult.INVALID_CHECKSUM); + expect(validateAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmY1')).toEqual( + ValidationResult.INVALID_CHECKSUM + ); }); }); describe('validateSmartRollupAddress', () => { it('Validate smart rollup address properly', () => { - expect(validateSmartRollupAddress('tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn')).toEqual(ValidationResult.NO_PREFIX_MATCHED); - expect(validateSmartRollupAddress('KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4D')).toEqual(ValidationResult.NO_PREFIX_MATCHED); - expect(validateSmartRollupAddress('tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m')).toEqual(ValidationResult.NO_PREFIX_MATCHED); - expect(validateSmartRollupAddress('tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN')).toEqual(ValidationResult.NO_PREFIX_MATCHED); + expect(validateSmartRollupAddress('tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn')).toEqual( + ValidationResult.NO_PREFIX_MATCHED + ); + expect(validateSmartRollupAddress('KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4D')).toEqual( + ValidationResult.NO_PREFIX_MATCHED + ); + expect(validateSmartRollupAddress('tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m')).toEqual( + ValidationResult.NO_PREFIX_MATCHED + ); + expect(validateSmartRollupAddress('tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN')).toEqual( + ValidationResult.NO_PREFIX_MATCHED + ); expect(validateSmartRollupAddress('KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4D%test')).toEqual( ValidationResult.NO_PREFIX_MATCHED ); - expect(validateSmartRollupAddress('tz4EECtMxAuJ9UDLaiMZH7G1GCFYUWsj8HZn')).toEqual(ValidationResult.NO_PREFIX_MATCHED); + expect(validateSmartRollupAddress('tz4EECtMxAuJ9UDLaiMZH7G1GCFYUWsj8HZn')).toEqual( + ValidationResult.NO_PREFIX_MATCHED + ); expect(validateSmartRollupAddress('test')).toEqual(ValidationResult.NO_PREFIX_MATCHED); expect(validateSmartRollupAddress('')).toEqual(ValidationResult.NO_PREFIX_MATCHED); - expect(validateSmartRollupAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmYW')).toEqual(ValidationResult.VALID); - expect(validateSmartRollupAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmY1')).toEqual(ValidationResult.INVALID_CHECKSUM); + expect(validateSmartRollupAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmYW')).toEqual( + ValidationResult.VALID + ); + expect(validateSmartRollupAddress('sr166cywS6HJx9gmqMU28Vo284gPQaPcGmY1')).toEqual( + ValidationResult.INVALID_CHECKSUM + ); }); }); @@ -99,9 +115,6 @@ describe('validateContractAddress', () => { expect(validateContractAddress('KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4D')).toEqual( ValidationResult.VALID ); - expect(validateContractAddress('txr1YNMEtkj5Vkqsbdmt7xaxBTMRZjzS96UAi')).toEqual( - ValidationResult.VALID - ); expect(validateContractAddress('tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn')).toEqual( ValidationResult.NO_PREFIX_MATCHED ); @@ -111,9 +124,6 @@ describe('validateContractAddress', () => { expect(validateContractAddress('tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN')).toEqual( ValidationResult.NO_PREFIX_MATCHED ); - expect(validateContractAddress('txr1YNMEtkj5Vkqsbdmt7xaxBTMRZjzS96UAu')).toEqual( - ValidationResult.INVALID_CHECKSUM - ); expect( validateContractAddress('KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4Dasdasdasdasdadasd') ).toEqual(ValidationResult.INVALID_CHECKSUM); diff --git a/packages/taquito/README.md b/packages/taquito/README.md index d914feae80..6b655d699e 100644 --- a/packages/taquito/README.md +++ b/packages/taquito/README.md @@ -1,4 +1,4 @@ -# Taquito high-level functions +# Taquito high-level functions *TypeDoc style documentation is available on-line [here](https://tezostaquito.io/typedoc/modules/_taquito_taquito.html)* @@ -7,15 +7,15 @@ The `@taquito/taquito` package contains higher-level functionality that builds u ## CDN Bundle ```html - ``` ## General Information -The `TezosToolkit` is a facade class that surfaces all of the library's capability and allows its configuration through different providers. +The `TezosToolkit` is a facade class that surfaces all of the library's capability and allows its configuration through different providers. -## Install +## Install ``` npm i --save @taquito/taquito @@ -25,7 +25,7 @@ npm i --save @taquito/taquito ## Minimal configuration ### TezosToolkit instantiation -The `TezosToolkit` constructor takes at least an RPC URL as a parameter. When instantiating the toolkit with a URL, a default instance of `RpcClient` is created. The `RpcClient` class is used to interact with the Tezos network. +The `TezosToolkit` constructor takes at least an RPC URL as a parameter. When instantiating the toolkit with a URL, a default instance of `RpcClient` is created. The `RpcClient` class is used to interact with the Tezos network. ```ts import { TezosToolkit } from '@taquito/taquito'; @@ -114,7 +114,7 @@ Tezos.setProvider( ## Estimation -Use the `estimate` member to estimate fees, gas and storage of operations. +Use the `estimate` member to estimate fees, gas and storage of operations. ```ts const estimate = await Tezos.estimate.transfer(transferParams); @@ -125,12 +125,12 @@ const estimate = await Tezos.estimate.transfer(transferParams); Use the `stream` member to subscribe to specific operations: ```ts -Tezos.setProvider({ - config: { shouldObservableSubscriptionRetry: true, streamerPollingIntervalMilliseconds: 15000 } +Tezos.setProvider({ + config: { shouldObservableSubscriptionRetry: true, streamerPollingIntervalMilliseconds: 15000 } }); -const bakerEndorsementFilter = { - and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'endorsement' }] +const bakerAttestationFilter = { + and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'attestation' }] } const bakerDelegation = { @@ -138,7 +138,7 @@ const bakerDelegation = { } const sub = tezos.stream.subscribeOperation({ - or: [bakerEndorsementFilter, bakerDelegation] + or: [bakerAttestationFilter, bakerDelegation] }) sub.on('data', console.log) diff --git a/packages/taquito/assets-manifest.json b/packages/taquito/assets-manifest.json index ad5ea173ec..26d61a3e88 100644 --- a/packages/taquito/assets-manifest.json +++ b/packages/taquito/assets-manifest.json @@ -5,6 +5,6 @@ }, "main.js": { "src": "dist/taquito.min.js", - "integrity": "sha256-IAudONE2JgZYtZNckcPANOL2DTvcX0HGazPJswjX7BY= sha384-J5ygOlCDE1RVb44SWybPUwSi3TpxD5P9q7TeIq7JtmUDJ5XfZyq/cW5DD1Qz0sE9 sha512-JbVJobTiUfaZR8RY52vLe5IBsGgeLkmeqVGz/3OMGFtN2NuJV6Ssa2CwDExQuldlmgGsNDaQiVmUJzG1PMFSDw==" + "integrity": "sha256-rsDgeYuVZSLgaFMjdKP9xoQ+Q/P8w+j9GQuvvTyTNn0= sha384-JODHjGus/aVz3sDof5KPmCm1S/j7vNX6KyFY7bv+Y5nxhO1PxkG1Q4FLN0maS8yy sha512-ehHqhIjo5h6aRYWyudTxeOZ99kqghv4svgcMCVjpMlkKbF7S6bFxR2kGZwJJ6w3Gbw9nGzj5RJdBsKsH700icQ==" } } \ No newline at end of file diff --git a/packages/taquito/package.json b/packages/taquito/package.json index d4d5396a8d..e941386eb0 100644 --- a/packages/taquito/package.json +++ b/packages/taquito/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/taquito", - "version": "17.5.2", + "version": "19.0.0", "description": "High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.", "keywords": [ "tezos", @@ -77,13 +77,13 @@ ] }, "dependencies": { - "@taquito/core": "^17.5.2", - "@taquito/http-utils": "^17.5.2", - "@taquito/local-forging": "^17.5.2", - "@taquito/michel-codec": "^17.5.2", - "@taquito/michelson-encoder": "^17.5.2", - "@taquito/rpc": "^17.5.2", - "@taquito/utils": "^17.5.2", + "@taquito/core": "^19.0.0", + "@taquito/http-utils": "^19.0.0", + "@taquito/local-forging": "^19.0.0", + "@taquito/michel-codec": "^19.0.0", + "@taquito/michelson-encoder": "^19.0.0", + "@taquito/rpc": "^19.0.0", + "@taquito/utils": "^19.0.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, diff --git a/packages/taquito/src/batch/rpc-batch-provider.ts b/packages/taquito/src/batch/rpc-batch-provider.ts index 5902ca5927..1b131d2f6a 100644 --- a/packages/taquito/src/batch/rpc-batch-provider.ts +++ b/packages/taquito/src/batch/rpc-batch-provider.ts @@ -24,7 +24,7 @@ import { TransferTicketParams, IncreasePaidStorageParams, SmartRollupAddMessagesParams, - SmartRollupOriginateParamsWithProof, + SmartRollupOriginateParams, } from '../operations/types'; import { OpKind } from '@taquito/rpc'; import { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param'; @@ -197,7 +197,7 @@ export class OperationBatch extends Provider { * * @param params Smart Rollup Originate operation parameter */ - withSmartRollupOriginate(params: SmartRollupOriginateParamsWithProof) { + withSmartRollupOriginate(params: SmartRollupOriginateParams) { this.operations.push({ kind: OpKind.SMART_ROLLUP_ORIGINATE, ...params }); return this; } diff --git a/packages/taquito/src/constants.ts b/packages/taquito/src/constants.ts index 1fe27244e0..1a5e26a2ab 100644 --- a/packages/taquito/src/constants.ts +++ b/packages/taquito/src/constants.ts @@ -2,8 +2,8 @@ export const DEFAULT_GAS_LIMIT = { DELEGATION: 10600, ORIGINATION: 10600, TRANSFER: 10600, - /* This is used for gas_limit. There is no harm in setting a higher limit. - Only if an account has a balance that is very close to the total gas consumption, + /* This is used for gas_limit. There is no harm in setting a higher limit. + Only if an account has a balance that is very close to the total gas consumption, then this margin can fail the operation. Another benefit of this higher value is that then Dapps build with Taquito 17 can still work with Mumbainet, as this value is higher than the reveal cost in Mumbai. @@ -46,6 +46,7 @@ export enum Protocols { PtMumbaii = 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', PtMumbai2 = 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', + ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -64,7 +65,8 @@ export const protocols = { '015': [Protocols.PtLimaPtL], '016': [Protocols.PtMumbai2], // mumbai v2 '017': [Protocols.PtNairobi], - '018': [Protocols.ProtoALpha], + '019': [Protocols.ProxfordY], + '020': [Protocols.ProtoALpha], }; export enum ChainIds { @@ -83,6 +85,7 @@ export enum ChainIds { MUMBAINET = 'NetXQw6nWSnrJ5t', MUMBAINET2 = 'NetXgbcrNtXD2yA', NAIROBINET = 'NetXyuzvDo2Ugzb', + OXFORDNET2 = 'NetXxWsskGahzQB', } export const getRevealGasLimit = (address: string) => diff --git a/packages/taquito/src/contract/prepare.ts b/packages/taquito/src/contract/prepare.ts index 96955e3bb7..28fbbb8cd7 100644 --- a/packages/taquito/src/contract/prepare.ts +++ b/packages/taquito/src/contract/prepare.ts @@ -28,9 +28,9 @@ import { SmartRollupAddMessagesParams, RPCSmartRollupAddMessagesOperation, RPCSmartRollupOriginateOperation, - SmartRollupOriginateParamsWithProof, ActivationParams, RPCActivateOperation, + SmartRollupOriginateParams, } from '../operations/types'; import { DEFAULT_FEE, @@ -324,9 +324,8 @@ export const createSmartRollupOriginateOperation = async ({ storageLimit, pvmKind, kernel, - originationProof, parametersType, -}: SmartRollupOriginateParamsWithProof) => { +}: SmartRollupOriginateParams) => { return { kind: OpKind.SMART_ROLLUP_ORIGINATE, source, @@ -335,7 +334,6 @@ export const createSmartRollupOriginateOperation = async ({ storage_limit: storageLimit, pvm_kind: pvmKind, kernel, - origination_proof: originationProof, parameters_ty: parametersType, } as RPCSmartRollupOriginateOperation; }; diff --git a/packages/taquito/src/contract/rpc-contract-provider.ts b/packages/taquito/src/contract/rpc-contract-provider.ts index 35dfed1195..7b80cd3c41 100644 --- a/packages/taquito/src/contract/rpc-contract-provider.ts +++ b/packages/taquito/src/contract/rpc-contract-provider.ts @@ -73,7 +73,10 @@ import { PrepareProvider } from '../prepare'; import { FailingNoopOperation } from '../operations/failing-noop-operation'; export class RpcContractProvider extends Provider implements ContractProvider, StorageProvider { - constructor(context: Context, private estimator: EstimationProvider) { + constructor( + context: Context, + private estimator: EstimationProvider + ) { super(context); } contractProviderTypeSymbol = Symbol.for('taquito-contract-provider-type-symbol'); @@ -657,13 +660,8 @@ export class RpcContractProvider extends Provider implements ContractProvider, S params, this.estimator.smartRollupOriginate.bind(this.estimator) ); - const originationProof = await this.rpc.getOriginationProof({ - kind: params.pvmKind, - kernel: params.kernel, - }); - const completeParams = { ...params, originationProof }; - const prepared = await this.prepare.smartRollupOriginate({ ...completeParams, ...estimate }); + const prepared = await this.prepare.smartRollupOriginate({ ...params, ...estimate }); const content = prepared.opOb.contents.find( (op) => op.kind === OpKind.SMART_ROLLUP_ORIGINATE ) as OperationContentsSmartRollupOriginate; diff --git a/packages/taquito/src/operations/errors.ts b/packages/taquito/src/operations/errors.ts index ce95d7dd1c..95dfefbbd8 100644 --- a/packages/taquito/src/operations/errors.ts +++ b/packages/taquito/src/operations/errors.ts @@ -10,8 +10,6 @@ import { OperationResultSmartRollupOriginate, OperationResultTransaction, OperationResultTransferTicket, - OperationResultTxRollupOrigination, - OperationResultTxRollupSubmitBatch, PreapplyResponse, TezosGenericOperationError, } from '@taquito/rpc'; @@ -83,8 +81,6 @@ export type MergedOperationResult = OperationResultTransaction & OperationResultOrigination & OperationResultDelegation & OperationResultRegisterGlobalConstant & - OperationResultTxRollupOrigination & - OperationResultTxRollupSubmitBatch & OperationResultTransferTicket & Partial & OperationResultReveal & { diff --git a/packages/taquito/src/operations/smart-rollup-originate-operation.ts b/packages/taquito/src/operations/smart-rollup-originate-operation.ts index 54da137a02..e42b34bb88 100644 --- a/packages/taquito/src/operations/smart-rollup-originate-operation.ts +++ b/packages/taquito/src/operations/smart-rollup-originate-operation.ts @@ -74,10 +74,6 @@ export class SmartRollupOriginateOperation return this.params.kernel; } - get originationProof() { - return this.params.origination_proof; - } - get errors() { return this.operationResults?.errors; } diff --git a/packages/taquito/src/operations/tx-rollup-batch-operation.ts b/packages/taquito/src/operations/tx-rollup-batch-operation.ts deleted file mode 100644 index de58230af5..0000000000 --- a/packages/taquito/src/operations/tx-rollup-batch-operation.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { - OperationContentsAndResult, - OperationContentsAndResultTxRollupSubmitBatch, -} from '@taquito/rpc'; -import { BigNumber } from 'bignumber.js'; -import { Context } from '../context'; -import { Operation } from './operations'; -import { - FeeConsumingOperation, - ForgedBytes, - GasConsumingOperation, - RPCTxRollupBatchOperation, - StorageConsumingOperation, -} from './types'; - -/** - * @description TxRollupBatchOperation provides utility functions to fetch a newly issued operation of kind tx_rollup_submit_batch - */ -export class TxRollupBatchOperation - extends Operation - implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation -{ - constructor( - hash: string, - private readonly params: RPCTxRollupBatchOperation, - public readonly source: string, - raw: ForgedBytes, - results: OperationContentsAndResult[], - context: Context - ) { - super(hash, raw, results, context); - } - - get operationResults() { - const txrollupBatchOp = - Array.isArray(this.results) && - (this.results.find( - (op) => op.kind === 'tx_rollup_submit_batch' - ) as OperationContentsAndResultTxRollupSubmitBatch); - const result = - txrollupBatchOp && txrollupBatchOp.metadata && txrollupBatchOp.metadata.operation_result; - return result ? result : undefined; - } - - get status() { - return this.operationResults?.status ?? 'unknown'; - } - - get content() { - return this.params.content; - } - - get fee() { - return this.params.fee; - } - - get gasLimit() { - return this.params.gas_limit; - } - - get storageLimit() { - return this.params.storage_limit; - } - - get errors() { - return this.operationResults?.errors; - } - - get consumedGas() { - BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP }); - return this.consumedMilliGas - ? new BigNumber(this.consumedMilliGas).dividedBy(1000).toString() - : undefined; - } - - get consumedMilliGas() { - return this.operationResults?.consumed_milligas; - } -} diff --git a/packages/taquito/src/operations/tx-rollup-origination-operation.ts b/packages/taquito/src/operations/tx-rollup-origination-operation.ts deleted file mode 100644 index 1e246374bb..0000000000 --- a/packages/taquito/src/operations/tx-rollup-origination-operation.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { - OperationContentsAndResult, - OperationContentsAndResultTxRollupOrigination, -} from '@taquito/rpc'; -import { BigNumber } from 'bignumber.js'; -import { Context } from '../context'; -import { Operation } from './operations'; -import { - FeeConsumingOperation, - ForgedBytes, - GasConsumingOperation, - RPCTxRollupOriginationOperation, - StorageConsumingOperation, -} from './types'; - -/** - * @description TxRollupOriginationOperation provides utility functions to fetch a newly issued operation of kind tx_rollup_origination - */ -export class TxRollupOriginationOperation - extends Operation - implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation -{ - /** - * @description Address the newly originate rollup - */ - public readonly originatedRollup?: string; - constructor( - hash: string, - private readonly params: RPCTxRollupOriginationOperation, - public readonly source: string, - raw: ForgedBytes, - results: OperationContentsAndResult[], - context: Context - ) { - super(hash, raw, results, context); - - this.originatedRollup = this.operationResults && this.operationResults.originated_rollup; - } - - get operationResults() { - const rollupOriginationOp = - Array.isArray(this.results) && - (this.results.find( - (op) => op.kind === 'tx_rollup_origination' - ) as OperationContentsAndResultTxRollupOrigination); - const result = - rollupOriginationOp && - rollupOriginationOp.metadata && - rollupOriginationOp.metadata.operation_result; - return result ? result : undefined; - } - - get status() { - return this.operationResults?.status ?? 'unknown'; - } - - get fee() { - return this.params.fee; - } - - get gasLimit() { - return this.params.gas_limit; - } - - get storageLimit() { - return this.params.storage_limit; - } - - get errors() { - return this.operationResults?.errors; - } - - get consumedGas() { - BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP }); - return this.consumedMilliGas - ? new BigNumber(this.consumedMilliGas).dividedBy(1000).toString() - : undefined; - } - - get consumedMilliGas() { - return this.operationResults?.consumed_milligas; - } -} diff --git a/packages/taquito/src/operations/types.ts b/packages/taquito/src/operations/types.ts index 619bdb9bed..9aa4ca8f9e 100644 --- a/packages/taquito/src/operations/types.ts +++ b/packages/taquito/src/operations/types.ts @@ -20,13 +20,11 @@ export type ParamsWithKind = | withKind | withKind | withKind - | withKind - | withKind | withKind | withKind | withKind | withKind - | withKind; + | withKind; export type ParamsWithKindExtended = ParamsWithKind | withKind; @@ -61,8 +59,6 @@ export type RPCOpWithFee = | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation - | RPCTxRollupOriginationOperation - | RPCTxRollupBatchOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation @@ -75,8 +71,6 @@ export type RPCOpWithSource = | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation - | RPCTxRollupOriginationOperation - | RPCTxRollupBatchOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation @@ -93,8 +87,6 @@ export const isOpWithFee = ( 'reveal', 'register_global_constant', 'increase_paid_storage', - 'tx_rollup_origination', - 'tx_rollup_submit_batch', 'transfer_ticket', 'update_consensus_key', 'smart_rollup_add_messages', @@ -113,8 +105,6 @@ export const isOpRequireReveal = ( 'origination', 'register_global_constant', 'increase_paid_storage', - 'tx_rollup_origination', - 'tx_rollup_submit_batch', 'transfer_ticket', 'update_consensus_key', 'smart_rollup_add_messages', @@ -340,53 +330,6 @@ export interface RPCActivateOperation { secret: string; } -/** - * @description RPC tx rollup origination operation - */ -export interface RPCTxRollupOriginationOperation { - kind: OpKind.TX_ROLLUP_ORIGINATION; - fee: number; - gas_limit: number; - storage_limit: number; - source: string; - tx_rollup_origination: object; -} - -/** - * @description Parameters for the `txRollupOriginate` method - */ -export interface TxRollupOriginateParams { - source?: string; - fee?: number; - gasLimit?: number; - storageLimit?: number; -} - -/** - * @description Parameters for the `txRollupSubmitBatch` method - */ -export interface TxRollupBatchParams { - source?: string; - fee?: number; - gasLimit?: number; - storageLimit?: number; - rollup: string; - content: string; -} - -/** - * @description RPC tx rollup batch operation - */ -export interface RPCTxRollupBatchOperation { - kind: OpKind.TX_ROLLUP_SUBMIT_BATCH; - fee: number; - gas_limit: number; - storage_limit: number; - source: string; - rollup: string; - content: string; -} - /** * @description Parameters for the transferTicket contract provider */ @@ -526,6 +469,7 @@ export interface SmartRollupAddMessagesParams { storageLimit?: number; message: string[]; } + export interface SmartRollupOriginateParams { source?: string; fee?: number; @@ -536,10 +480,6 @@ export interface SmartRollupOriginateParams { parametersType: MichelsonV1Expression; } -export interface SmartRollupOriginateParamsWithProof extends SmartRollupOriginateParams { - originationProof: string; -} - export interface RPCSmartRollupOriginateOperation { kind: OpKind.SMART_ROLLUP_ORIGINATE; source: string; @@ -548,7 +488,6 @@ export interface RPCSmartRollupOriginateOperation { storage_limit: number; pvm_kind: PvmKind; kernel: string; - origination_proof: string; parameters_ty: MichelsonV1Expression; } diff --git a/packages/taquito/src/prepare/prepare-provider.ts b/packages/taquito/src/prepare/prepare-provider.ts index b32bc70037..5686f1f8f6 100644 --- a/packages/taquito/src/prepare/prepare-provider.ts +++ b/packages/taquito/src/prepare/prepare-provider.ts @@ -905,18 +905,12 @@ export class PrepareProvider extends Provider implements PreparationProvider { }: SmartRollupOriginateParams): Promise { const { pkh } = await this.getKeys(); - const originationProof = await this.rpc.getOriginationProof({ - kind: rest.pvmKind, - kernel: rest.kernel, - }); - const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants); const op = await createSmartRollupOriginateOperation({ ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS), ...rest, - originationProof, }); const operation = await this.addRevealOperationIfNeeded(op, pkh); diff --git a/packages/taquito/src/read-provider/interface.ts b/packages/taquito/src/read-provider/interface.ts index 4ae39d026e..6a7ba42df8 100644 --- a/packages/taquito/src/read-provider/interface.ts +++ b/packages/taquito/src/read-provider/interface.ts @@ -53,7 +53,6 @@ export interface TzReadProvider { hard_gas_limit_per_block: BigNumber; hard_storage_limit_per_operation: BigNumber; cost_per_byte: BigNumber; - tx_rollup_origination_size?: number; smart_rollup_origination_size: number; }>; diff --git a/packages/taquito/src/read-provider/rpc-read-adapter.ts b/packages/taquito/src/read-provider/rpc-read-adapter.ts index 16710c98ae..83e3c492e0 100644 --- a/packages/taquito/src/read-provider/rpc-read-adapter.ts +++ b/packages/taquito/src/read-provider/rpc-read-adapter.ts @@ -55,7 +55,6 @@ export class RpcReadAdapter implements TzReadProvider { hard_gas_limit_per_block: BigNumber; hard_storage_limit_per_operation: BigNumber; cost_per_byte: BigNumber; - tx_rollup_origination_size?: number; smart_rollup_origination_size: number; }> { const { @@ -65,7 +64,6 @@ export class RpcReadAdapter implements TzReadProvider { hard_gas_limit_per_block, hard_storage_limit_per_operation, cost_per_byte, - tx_rollup_origination_size, smart_rollup_origination_size, } = await this.rpc.getConstants({ block: String(block) }); return { @@ -75,7 +73,6 @@ export class RpcReadAdapter implements TzReadProvider { hard_gas_limit_per_block, hard_storage_limit_per_operation, cost_per_byte, - tx_rollup_origination_size, smart_rollup_origination_size, }; } diff --git a/packages/taquito/src/signer/interface.ts b/packages/taquito/src/signer/interface.ts index 980de2eddd..9416c4a7e4 100644 --- a/packages/taquito/src/signer/interface.ts +++ b/packages/taquito/src/signer/interface.ts @@ -5,7 +5,7 @@ export interface Signer { /** * * @param op Operation to sign - * @param magicByte Magic bytes 11 for block, 12 for preendorsement, 13 for endorsements, 3 for generic, 5 for the PACK format of michelson + * @param magicByte Magic bytes 11 for block, 12 for preattestation/preendorsement, 13 for attestation/endorsements, 3 for generic, 5 for the PACK format of michelson */ sign( op: string, diff --git a/packages/taquito/src/subscribe/filters.ts b/packages/taquito/src/subscribe/filters.ts index eafc9db514..b2c95baa60 100644 --- a/packages/taquito/src/subscribe/filters.ts +++ b/packages/taquito/src/subscribe/filters.ts @@ -17,6 +17,8 @@ const opHashFilter = (op: OperationContent, filter: OpHashFilter) => op.hash === const sourceFilter = (x: OperationContent, filter: SourceFilter) => { switch (x.kind) { + case 'attestation': + return 'metadata' in x && x.metadata.delegate === filter.source; case 'endorsement': return 'metadata' in x && x.metadata.delegate === filter.source; case 'activate_account': diff --git a/packages/taquito/src/version.ts b/packages/taquito/src/version.ts index 904fcab814..15738d8cce 100644 --- a/packages/taquito/src/version.ts +++ b/packages/taquito/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '46a535eea78d77ebb5509ccd1d1cbd01075c7461', - version: '17.5.2', + commitHash: '801b9525f497845e778696ccac8df3a7b0f299d8', + version: '19.0.0', }; diff --git a/packages/taquito/test/batch/rpc-batch-provider.spec.ts b/packages/taquito/test/batch/rpc-batch-provider.spec.ts index e3d8395c4e..fbf67bb7a6 100644 --- a/packages/taquito/test/batch/rpc-batch-provider.spec.ts +++ b/packages/taquito/test/batch/rpc-batch-provider.spec.ts @@ -650,7 +650,6 @@ describe('OperationBatch test', () => { kind: OpKind.SMART_ROLLUP_ORIGINATE, pvmKind: PvmKind.WASM2, kernel: '1234567890', - originationProof: '0987654321', parametersType: { prim: 'bytes' }, }, ]; @@ -668,7 +667,6 @@ describe('OperationBatch test', () => { gas_limit: '1330', storage_limit: '93', kernel: '1234567890', - origination_proof: '0987654321', parameters_ty: { prim: 'bytes' }, pvm_kind: 'wasm_2_0_0', counter: '1', @@ -691,7 +689,6 @@ describe('OperationBatch test', () => { kind: OpKind.SMART_ROLLUP_ORIGINATE, pvmKind: PvmKind.WASM2, kernel: '1234567890', - originationProof: '0987654321', parametersType: { prim: 'bytes' }, gasLimit: 1100, fee: 399, @@ -712,7 +709,6 @@ describe('OperationBatch test', () => { gas_limit: '1100', storage_limit: '95', kernel: '1234567890', - origination_proof: '0987654321', parameters_ty: { prim: 'bytes' }, pvm_kind: 'wasm_2_0_0', counter: '1', @@ -736,7 +732,6 @@ describe('OperationBatch test', () => { kind: OpKind.SMART_ROLLUP_ORIGINATE, pvmKind: PvmKind.WASM2, kernel: '1234567890', - originationProof: '0987654321', parametersType: { prim: 'bytes' }, }, ]; @@ -763,7 +758,6 @@ describe('OperationBatch test', () => { gas_limit: '1330', storage_limit: '93', kernel: '1234567890', - origination_proof: '0987654321', parameters_ty: { prim: 'bytes' }, pvm_kind: 'wasm_2_0_0', counter: '2', diff --git a/packages/taquito/test/contract/helper.ts b/packages/taquito/test/contract/helper.ts index bf3a22a062..20740674da 100644 --- a/packages/taquito/test/contract/helper.ts +++ b/packages/taquito/test/contract/helper.ts @@ -1280,244 +1280,6 @@ export const registerGlobalConstantWithError = { 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg', }; -export const txRollupOriginateNoReveal = { - contents: [ - { - kind: 'tx_rollup_origination', - source: 'tz2Np59GwL7s4NapRiPmU48Nhz65q1kxVmks', - fee: '417', - counter: '236200', - gas_limit: '1521', - storage_limit: '4000', - tx_rollup_origination: {}, - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2Np59GwL7s4NapRiPmU48Nhz65q1kxVmks', - change: '-417', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '417', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'contract', - contract: 'tz2Np59GwL7s4NapRiPmU48Nhz65q1kxVmks', - change: '-1000000', - origin: 'block', - }, - { - kind: 'burned', - category: 'storage fees', - change: '1000000', - origin: 'block', - }, - ], - consumed_milligas: '1420108', - originated_rollup: 'txr1WAEQXaXsM1n4R77G5BDfr8pwiFS5SEbBE', - }, - }, - }, - ], - signature: - 'sigSX6zMYe1S9SjbJmRvqtvsETEYa9pSH9Y1ShpcUr1PwKr1hBxw2pKFUFZ1yuDDcTMB6GkuxuoPvp4pHrMYuC14Q8xyt4Tz', -}; - -export const txRollupOriginateWithReveal = { - contents: [ - { - kind: 'reveal', - source: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - fee: '374', - counter: '236199', - gas_limit: '1100', - storage_limit: '0', - public_key: 'sppk7cjFJ3JSeJEjimFTdDQq4HgJBjr5PCPj4U94CDGVfQeh3gEY19b', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - change: '-374', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '374', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - consumed_milligas: '1000000', - }, - }, - }, - { - kind: 'tx_rollup_origination', - source: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - fee: '481', - counter: '236200', - gas_limit: '1521', - storage_limit: '4000', - tx_rollup_origination: {}, - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - change: '-481', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '481', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'contract', - contract: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - change: '-1000000', - origin: 'block', - }, - { - kind: 'burned', - category: 'storage fees', - change: '1000000', - origin: 'block', - }, - ], - consumed_milligas: '1420108', - originated_rollup: 'txr1gJDqppanLyZJ5Yw9VCNqnHswtv9fQ9brL', - }, - }, - }, - ], - signature: - 'sigSqrxEBiHXwuXgXUB8S67dtSycbFvduxpi2Fn7LeVdefgr7FicV5KajbW1z44hykdZA6Mznef3fpPXAcbfaYBUYdWPPbXG', -}; - -export const txRollupSubmitBatchNoReveal = { - contents: [ - { - kind: 'tx_rollup_submit_batch', - source: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - fee: '580', - counter: '249650', - gas_limit: '2869', - storage_limit: '0', - rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', - content: '626c6f62', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2MRqRjuMz7i7GjFcwTGE3HF3cbh9sQavXX', - change: '-580', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '580', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_milligas: '2768514', - paid_storage_size_diff: '0', - }, - }, - }, - ], - signature: - 'sigey8PfR2sGSVFM7Z6GUyaoNYsehzQDsM9dZysyQ9MMCeB885dXHKuJ7dNUp2pMysq3jwyUqwoDnNRLe5ge2w8ARDVRN5Eb', -}; - -export const txRollupSubmitBatchWithReveal = { - contents: [ - { - kind: 'reveal', - source: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - fee: '374', - counter: '236199', - gas_limit: '1100', - storage_limit: '0', - public_key: 'sppk7cjFJ3JSeJEjimFTdDQq4HgJBjr5PCPj4U94CDGVfQeh3gEY19b', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2SKhBYT6nADXviDrU2HK3nw2jDMfhRNv7P', - change: '-374', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '374', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - consumed_milligas: '1000000', - }, - }, - }, - { - kind: 'tx_rollup_submit_batch', - source: 'tz1QWLc8oL7Bo7BMa6CKfFioeJ4XdmCFf2xZ', - fee: '580', - counter: '249650', - gas_limit: '2869', - storage_limit: '0', - rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', - content: '626c6f62', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2MRqRjuMz7i7GjFcwTGE3HF3cbh9sQavXX', - change: '-580', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '580', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_milligas: '2768514', - paid_storage_size_diff: '0', - }, - }, - }, - ], - signature: - 'sigSqrxEBiHXwuXgXUB8S67dtSycbFvduxpi2Fn7LeVdefgr7FicV5KajbW1z44hykdZA6Mznef3fpPXAcbfaYBUYdWPPbXG', -}; - export const TransferTicketNoReveal = { contents: [ { @@ -1758,8 +1520,6 @@ export const smartRollupOriginateWithReveal = { pvm_kind: 'wasm_2_0_0', kernel: '0061736d0100000001280760037f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f0060000002610311736d6172745f726f6c6c75705f636f72650a726561645f696e707574000011736d6172745f726f6c6c75705f636f72650c77726974655f6f7574707574000111736d6172745f726f6c6c75705f636f72650b73746f72655f77726974650002030504030405060503010001071402036d656d02000a6b65726e656c5f72756e00060aa401042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b5001057f41fe002d0000210341fc002f0100210220002d0000210420002f0100210520011004210620042003460440200041016a200141016b10011a0520052002460440200041076a200610011a0b0b0b1d01017f41dc0141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, diff --git a/packages/taquito/test/contract/rpc-contract-provider.spec.ts b/packages/taquito/test/contract/rpc-contract-provider.spec.ts index e874f4a01d..fc176d99f6 100644 --- a/packages/taquito/test/contract/rpc-contract-provider.spec.ts +++ b/packages/taquito/test/contract/rpc-contract-provider.spec.ts @@ -49,7 +49,6 @@ describe('RpcContractProvider test', () => { getSaplingDiffById: jest.Mock; getProtocols: jest.Mock; getCurrentPeriod: jest.Mock; - getOriginationProof: jest.Mock; getConstants: jest.Mock; }; @@ -81,8 +80,6 @@ describe('RpcContractProvider test', () => { batch: jest.Mock; reveal: jest.Mock; registerGlobalConstant: jest.Mock; - txRollupOriginate: jest.Mock; - txRollupSubmitBatch: jest.Mock; transferTicket: jest.Mock; increasePaidStorage: jest.Mock; updateConsensusKey: jest.Mock; @@ -110,7 +107,6 @@ describe('RpcContractProvider test', () => { getSaplingDiffById: jest.fn(), getProtocols: jest.fn(), getCurrentPeriod: jest.fn(), - getOriginationProof: jest.fn(), getConstants: jest.fn(), }; @@ -142,8 +138,6 @@ describe('RpcContractProvider test', () => { batch: jest.fn(), reveal: jest.fn(), registerGlobalConstant: jest.fn(), - txRollupOriginate: jest.fn(), - txRollupSubmitBatch: jest.fn(), transferTicket: jest.fn(), increasePaidStorage: jest.fn(), updateConsensusKey: jest.fn(), @@ -1449,9 +1443,6 @@ describe('RpcContractProvider test', () => { it('Should have correct returned values with origination being estimated', async () => { const estimate = new Estimate(1230000, 10000, 100, 100); mockEstimate.smartRollupOriginate.mockResolvedValue(estimate); - mockRpcClient.getOriginationProof.mockResolvedValue( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); const smartRollupOriginate = await rpcContractProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel: @@ -1474,8 +1465,6 @@ describe('RpcContractProvider test', () => { parameters_ty: { prim: 'bytes', }, - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', counter: '2', fee: '433', gas_limit: '1330', @@ -1494,9 +1483,6 @@ describe('RpcContractProvider test', () => { it('Should have correct returned values with origination with reveal with specified values for estimate', async () => { const estimate = new Estimate(1230000, 10000, 100, 100); mockEstimate.smartRollupOriginate.mockResolvedValue(estimate); - mockRpcClient.getOriginationProof.mockResolvedValue( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); const smartRollupOriginate = await rpcContractProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel: @@ -1522,8 +1508,6 @@ describe('RpcContractProvider test', () => { parameters_ty: { prim: 'bytes', }, - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', counter: '2', fee: '9999', gas_limit: '12345', @@ -1546,9 +1530,6 @@ describe('RpcContractProvider test', () => { mockEstimate.smartRollupOriginate.mockResolvedValue(estimate); mockReadProvider.isAccountRevealed.mockResolvedValue(true); - mockRpcClient.getOriginationProof.mockResolvedValue( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); const smartRollupOriginate = await rpcContractProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel: @@ -1570,8 +1551,6 @@ describe('RpcContractProvider test', () => { parameters_ty: { prim: 'bytes', }, - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', counter: '1', fee: '433', gas_limit: '1330', diff --git a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts index 0ed30244c1..e21090e8cf 100644 --- a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts +++ b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts @@ -16,8 +16,6 @@ import { registerGlobalConstantNoReveal, registerGlobalConstantWithReveal, registerGlobalConstantWithError, - txRollupOriginateNoReveal, - txRollupSubmitBatchNoReveal, TransferTicketNoReveal, TransferTicketWithReveal, updateConsensusKeyNoReveal, @@ -1127,7 +1125,6 @@ describe('RPCEstimateProvider test wallet', () => { getChainId: jest.Mock; getConstants: jest.Mock; getProtocols: jest.Mock; - getOriginationProof: jest.Mock; }; let mockForger: { @@ -1155,7 +1152,6 @@ describe('RPCEstimateProvider test wallet', () => { getChainId: jest.fn(), getConstants: jest.fn(), getProtocols: jest.fn(), - getOriginationProof: jest.fn(), }; mockForger = { @@ -1374,8 +1370,6 @@ describe('RPCEstimateProvider test wallet', () => { }, }, registerGlobalConstantNoReveal.contents[0], - txRollupOriginateNoReveal.contents[0], - txRollupSubmitBatchNoReveal.contents[0], ], }); const estimate = await estimateProvider.batch([ @@ -1389,7 +1383,6 @@ describe('RPCEstimateProvider test wallet', () => { }, }, ]); - expect(estimate.length).toEqual(5); expect(estimate[0].gasLimit).toEqual(1100); expect(estimate[1].gasLimit).toEqual(1100); expect(estimate[2].gasLimit).toEqual(1330); @@ -1511,7 +1504,6 @@ describe('RPCEstimateProvider test wallet', () => { smart_rollup_origination_size: new BigNumber(6314), }); mockRpcClient.simulateOperation.mockResolvedValue(smartRollupOriginateWithReveal); - mockRpcClient.getOriginationProof.mockResolvedValue('987654321'); const estimate = await estimateProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, diff --git a/packages/taquito/test/helpers.ts b/packages/taquito/test/helpers.ts index 020ebcca85..90b8e9c214 100644 --- a/packages/taquito/test/helpers.ts +++ b/packages/taquito/test/helpers.ts @@ -6,8 +6,6 @@ import { OperationContentsAndResultOrigination, OperationContentsAndResultDelegation, OperationContentsAndResultRegisterGlobalConstant, - OperationContentsAndResultTxRollupOrigination, - OperationContentsAndResultTxRollupSubmitBatch, OperationContentsAndResultTransferTicket, OperationContentsAndResultIncreasePaidStorage, OperationContentsAndResultUpdateConsensusKey, @@ -69,27 +67,6 @@ const defaultRegisterGlobalConstantData = { value: { int: '0' }, }; -const defaultTxRollupOriginateData = { - kind: OpKind.TX_ROLLUP_ORIGINATION as OpKind.TX_ROLLUP_ORIGINATION, - source: 'tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys', - fee: '2991', - counter: '121619', - gas_limit: '26260', - storage_limit: '257', - tx_rollup_origination: {}, -}; - -const defaultTxSubmitBatchData = { - kind: OpKind.TX_ROLLUP_SUBMIT_BATCH as OpKind.TX_ROLLUP_SUBMIT_BATCH, - source: 'tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys', - fee: '2991', - counter: '121619', - gas_limit: '26260', - storage_limit: '257', - rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', - content: '626c6f62', -}; - const defaultTransferTicketData = { kind: OpKind.TRANSFER_TICKET as OpKind.TRANSFER_TICKET, source: 'tz1iedjFYksExq8snZK9MNo4AvXHBdXfTsGX', @@ -333,64 +310,6 @@ export class UpdateConsensusKeyOperationBuilder { } } -export class TxRollupOriginationOperationBuilder { - private result: OperationContentsAndResultTxRollupOrigination['metadata']['operation_result'] = - defaultResult; - private data: Omit; - - constructor( - private _data: Partial> = {} - ) { - this.data = { ...defaultTxRollupOriginateData, ...this._data }; - } - - withResult( - result: Partial - ) { - this.result = { ...defaultResult, ...result }; - return this; - } - - build(): OperationContentsAndResultTxRollupOrigination { - return { - ...this.data, - metadata: { - balance_updates: [], - operation_result: this.result, - }, - }; - } -} - -export class TxRollupSubmitBatchOperationBuilder { - private result: OperationContentsAndResultTxRollupSubmitBatch['metadata']['operation_result'] = - defaultResult; - private data: Omit; - - constructor( - private _data: Partial> = {} - ) { - this.data = { ...defaultTxSubmitBatchData, ...this._data }; - } - - withResult( - result: Partial - ) { - this.result = { ...defaultResult, ...result }; - return this; - } - - build(): OperationContentsAndResultTxRollupSubmitBatch { - return { - ...this.data, - metadata: { - balance_updates: [], - operation_result: this.result, - }, - }; - } -} - export class TransferTicketOperationBuilder { private result: OperationContentsAndResultTransferTicket['metadata']['operation_result'] = defaultResult; diff --git a/packages/taquito/test/operations/tx-rollup-origination-operation.spec.ts b/packages/taquito/test/operations/tx-rollup-origination-operation.spec.ts deleted file mode 100644 index 1d8edfe3b1..0000000000 --- a/packages/taquito/test/operations/tx-rollup-origination-operation.spec.ts +++ /dev/null @@ -1,254 +0,0 @@ -import { ForgedBytes } from '../../src/operations/types'; -import { OperationContentsAndResult } from '@taquito/rpc'; -import { defaultConfigConfirmation } from '../../src/context'; -import { RevealOperationBuilder, TxRollupOriginationOperationBuilder } from '../helpers'; -import { TxRollupOriginationOperation } from '../../src/operations/tx-rollup-origination-operation'; - -describe('TxRollupOriginationOperation', () => { - let fakeContext: any; - const fakeForgedBytes = {} as ForgedBytes; - - const successfulResult = [ - { - kind: 'tx_rollup_origination', - source: 'tz2Np59GwL7s4NapRiPmU48Nhz65q1kxVmks', - fee: '417', - counter: '236200', - gas_limit: '1521', - storage_limit: '4000', - tx_rollup_origination: {}, - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2Np59GwL7s4NapRiPmU48Nhz65q1kxVmks', - change: '-417', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '417', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [ - { - kind: 'contract', - contract: 'tz2Np59GwL7s4NapRiPmU48Nhz65q1kxVmks', - change: '-1000000', - origin: 'block', - }, - { - kind: 'burned', - category: 'storage fees', - change: '1000000', - origin: 'block', - }, - ], - consumed_milligas: '1420108', - originated_rollup: 'txr1WAEQXaXsM1n4R77G5BDfr8pwiFS5SEbBE', - }, - }, - }, - ] as OperationContentsAndResult[]; - - beforeEach(() => { - fakeContext = { - rpc: { - getBlock: jest.fn(), - }, - config: { ...defaultConfigConfirmation }, - }; - - fakeContext.rpc.getBlock.mockResolvedValue({ - operations: [[{ hash: 'oo51jb7sEvPkf7BaTSUW49QztcxgxufLVEj2PUfQ2uw6m61CKLc' }], [], [], []], - header: { - level: 185827, - }, - }); - }); - it('should contains the address of the newly created rollup given a successful result', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.originatedRollup).toEqual('txr1WAEQXaXsM1n4R77G5BDfr8pwiFS5SEbBE'); - }); - - it('originatedRollup is undefined given an wrong result', () => { - const wrongResults: any[] = [ - {}, - [{ kind: 'tx_rollup_origination' }], - [{ kind: 'tx_rollup_origination', metadata: {} }], - ]; - - wrongResults.forEach((result) => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - result, - fakeContext - ); - expect(op.originatedRollup).toBeUndefined(); - }); - }); - - it('should return the fee', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { fee: 450 } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.fee).toEqual(450); - }); - - it('should return the gasLimit', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { gas_limit: 450 } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.gasLimit).toEqual(450); - }); - - it('should return the consumed gas', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.consumedGas).toEqual('1421'); - }); - - it('should return the consumed milligas', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.consumedMilliGas).toEqual('1420108'); - }); - - it('should return the storageLimit', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { storage_limit: 450 } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.storageLimit).toEqual(450); - }); - - it('should return the error if there is one', () => { - const txBuilder = new TxRollupOriginationOperationBuilder(); - - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [ - txBuilder - .withResult({ - status: 'backtracked', - errors: [{ kind: 'temporary', id: 'proto.011-PtHangzH.storage_exhausted.operation' }], - }) - .build(), - ], - fakeContext - ); - expect(op.errors).toBeDefined(); - expect(op.errors?.[0]).toEqual({ - kind: 'temporary', - id: 'proto.011-PtHangzH.storage_exhausted.operation', - }); - }); - - it('error should be undefined when no error', () => { - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.errors).toBeUndefined(); - }); - - it('status should contains status for RegisterGlobalConstant operation only', () => { - const txBuilder = new TxRollupOriginationOperationBuilder(); - const revealBuilder = new RevealOperationBuilder(); - - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [ - revealBuilder.withResult({ status: 'applied' }).build(), - txBuilder.withResult({ status: 'backtracked' }).build(), - ], - fakeContext - ); - expect(op.revealStatus).toEqual('applied'); - expect(op.status).toEqual('backtracked'); - }); - - it('status should contains status for RegisterGlobalConstant operation only', () => { - const txBuilder = new TxRollupOriginationOperationBuilder(); - const revealBuilder = new RevealOperationBuilder(); - - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [ - txBuilder.withResult({ status: 'backtracked' }).build(), - revealBuilder.withResult({ status: 'applied' }).build(), - ], - fakeContext - ); - expect(op.revealStatus).toEqual('applied'); - expect(op.status).toEqual('backtracked'); - }); - - it('revealStatus should be unknown when there is no reveal operation', () => { - const txBuilder = new TxRollupOriginationOperationBuilder(); - - const op = new TxRollupOriginationOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [txBuilder.withResult({ status: 'backtracked' }).build()], - fakeContext - ); - expect(op.revealStatus).toEqual('unknown'); - expect(op.status).toEqual('backtracked'); - }); -}); diff --git a/packages/taquito/test/operations/tx-rollup-submit-batch.spec.ts b/packages/taquito/test/operations/tx-rollup-submit-batch.spec.ts deleted file mode 100644 index e87e6c6c32..0000000000 --- a/packages/taquito/test/operations/tx-rollup-submit-batch.spec.ts +++ /dev/null @@ -1,222 +0,0 @@ -import { ForgedBytes } from '../../src/operations/types'; -import { OperationContentsAndResult } from '@taquito/rpc'; -import { defaultConfigConfirmation } from '../../src/context'; -import { RevealOperationBuilder, TxRollupSubmitBatchOperationBuilder } from '../helpers'; -import { TxRollupBatchOperation } from '../../src/operations/tx-rollup-batch-operation'; - -describe('TxRollupBatchOperation', () => { - let fakeContext: any; - const fakeForgedBytes = {} as ForgedBytes; - - const successfulResult = [ - { - kind: 'tx_rollup_submit_batch', - source: 'tz2MRqRjuMz7i7GjFcwTGE3HF3cbh9sQavXX', - fee: '580', - counter: '249650', - gas_limit: '2869', - storage_limit: '0', - rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', - content: '626c6f62', - metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz2MRqRjuMz7i7GjFcwTGE3HF3cbh9sQavXX', - change: '-580', - origin: 'block', - }, - { - kind: 'accumulator', - category: 'block fees', - change: '580', - origin: 'block', - }, - ], - operation_result: { - status: 'applied', - balance_updates: [], - consumed_milligas: '2768514', - paid_storage_size_diff: '0', - }, - }, - }, - ] as OperationContentsAndResult[]; - - beforeEach(() => { - fakeContext = { - rpc: { - getBlock: jest.fn(), - }, - config: { ...defaultConfigConfirmation }, - }; - - fakeContext.rpc.getBlock.mockResolvedValue({ - operations: [[{ hash: 'oo51jb7sEvPkf7BaTSUW49QztcxgxufLVEj2PUfQ2uw6m61CKLc' }], [], [], []], - header: { - level: 185827, - }, - }); - }); - - it('should return the batch content', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { content: '626c6f62' } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.content).toEqual('626c6f62'); - }); - - it('should return the fee', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { fee: 450 } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.fee).toEqual(450); - }); - - it('should return the gasLimit', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { gas_limit: 450 } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.gasLimit).toEqual(450); - }); - - it('should return the consumed gas', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.consumedGas).toEqual('2769'); - }); - - it('should return the consumed milligas', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.consumedMilliGas).toEqual('2768514'); - }); - it('should return the storageLimit', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - { storage_limit: 450 } as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.storageLimit).toEqual(450); - }); - - it('should return the error if there is one', () => { - const txBuilder = new TxRollupSubmitBatchOperationBuilder(); - - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [ - txBuilder - .withResult({ - status: 'backtracked', - errors: [{ kind: 'temporary', id: 'proto.011-PtHangzH.storage_exhausted.operation' }], - }) - .build(), - ], - fakeContext - ); - expect(op.errors).toBeDefined(); - expect(op.errors?.[0]).toEqual({ - kind: 'temporary', - id: 'proto.011-PtHangzH.storage_exhausted.operation', - }); - }); - - it('error should be undefined when no error', () => { - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - successfulResult, - fakeContext - ); - expect(op.errors).toBeUndefined(); - }); - - it('status should contains status for RegisterGlobalConstant operation only', () => { - const txBuilder = new TxRollupSubmitBatchOperationBuilder(); - const revealBuilder = new RevealOperationBuilder(); - - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [ - revealBuilder.withResult({ status: 'applied' }).build(), - txBuilder.withResult({ status: 'backtracked' }).build(), - ], - fakeContext - ); - expect(op.revealStatus).toEqual('applied'); - expect(op.status).toEqual('backtracked'); - }); - - it('status should contains status for RegisterGlobalConstant operation only', () => { - const txBuilder = new TxRollupSubmitBatchOperationBuilder(); - const revealBuilder = new RevealOperationBuilder(); - - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [ - txBuilder.withResult({ status: 'backtracked' }).build(), - revealBuilder.withResult({ status: 'applied' }).build(), - ], - fakeContext - ); - expect(op.revealStatus).toEqual('applied'); - expect(op.status).toEqual('backtracked'); - }); - - it('revealStatus should be unknown when there is no reveal operation', () => { - const txBuilder = new TxRollupSubmitBatchOperationBuilder(); - - const op = new TxRollupBatchOperation( - 'ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj', - {} as any, - '', - fakeForgedBytes, - [txBuilder.withResult({ status: 'backtracked' }).build()], - fakeContext - ); - expect(op.revealStatus).toEqual('unknown'); - expect(op.status).toEqual('backtracked'); - }); -}); diff --git a/packages/taquito/test/prepare/prepare-provider.spec.ts b/packages/taquito/test/prepare/prepare-provider.spec.ts index d9f03aab4d..0c70aa00bd 100644 --- a/packages/taquito/test/prepare/prepare-provider.spec.ts +++ b/packages/taquito/test/prepare/prepare-provider.spec.ts @@ -33,7 +33,6 @@ describe('PrepareProvider test', () => { getCurrentPeriod: jest.Mock; getConstants: jest.Mock; getManagerKey: jest.Mock; - getOriginationProof: jest.Mock; forgeOperations: jest.Mock; }; @@ -67,7 +66,6 @@ describe('PrepareProvider test', () => { getCurrentPeriod: jest.fn(), getConstants: jest.fn(), getManagerKey: jest.fn(), - getOriginationProof: jest.fn(), forgeOperations: jest.fn(), }; @@ -1039,7 +1037,6 @@ describe('PrepareProvider test', () => { describe('SmartRollupOriginate', () => { it('Should prepare smartRollupOriginate without reveal', async () => { mockReadProvider.isAccountRevealed.mockResolvedValue(true); - mockRpcClient.getOriginationProof.mockResolvedValue('987654321'); const prepared = await prepareProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, @@ -1056,7 +1053,6 @@ describe('PrepareProvider test', () => { kind: 'smart_rollup_originate', pvm_kind: 'wasm_2_0_0', kernel: '123456789', - origination_proof: '987654321', parameters_ty: { prim: 'bytes', }, @@ -1075,7 +1071,6 @@ describe('PrepareProvider test', () => { it('Should prepare smartRollupOriginate with reveal', async () => { mockReadProvider.isAccountRevealed.mockResolvedValue(false); - mockRpcClient.getOriginationProof.mockResolvedValue('987654321'); const prepared = await prepareProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, @@ -1101,7 +1096,6 @@ describe('PrepareProvider test', () => { kind: 'smart_rollup_originate', pvm_kind: 'wasm_2_0_0', kernel: '123456789', - origination_proof: '987654321', parameters_ty: { prim: 'bytes', }, diff --git a/website/package.json b/website/package.json index fb846eb263..67ab8b3bc3 100644 --- a/website/package.json +++ b/website/package.json @@ -88,5 +88,5 @@ "last 1 safari version" ] }, - "version": "17.5.2" + "version": "19.0.0-beta-RC.0" } diff --git a/website/versioned_docs/version-17.1.0/local_forger.md b/website/versioned_docs/version-17.1.0/local_forger.md deleted file mode 100644 index 829103dfd7..0000000000 --- a/website/versioned_docs/version-17.1.0/local_forger.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: Local Forging Package -id: local_forger -author: Michael Kernaghan ---- - -# How to Use the Taquito Local Forging Package - -One of the tools offered by Taquito is the local forging package, which allows you to forge transactions locally without interacting with a node. Here is a step-by-step guide on how to use the Taquito local forging package: - -## Step 1: Import the Local Forger - -You will need to import the LocalForger class from Taquito to use the local forging package. You can do this by adding the following line to your code: - -``` -import { LocalForger } from '@taquito/local-forging'; - -``` - -## Step 2: Create a Transaction - -Next, you must create a transaction you want to forge. You can do this using the Taquito library as you normally would. Here is an example of creating a transaction to transfer 1 XTZ from one address to another: - -``` -import { TezosToolkit } from '@taquito/taquito'; - -const tezos = new TezosToolkit(''); -const from = 'tz1abc...xyz'; -const to = 'tz1def...uvw'; -const amount = 1; - -const transferOperation = await tezos.contract.transfer({ to, amount }).send({ from }); - -``` - -## Step 3: Forge the Transaction - -Once you have created your transaction, you can use the LocalForger class. Here is an example of how to do this: - -``` -const forger = new LocalForger(); -const forgedBytes = await forger.forge(transferOperation); - -``` - -## Step 4: Sign the Transaction - -After the transaction has been forged, you can sign it using your private key. Here is an example of how to sign the transaction: - -``` -const { bytes: signatureBytes } = await tezos.signer.sign(forgedBytes, from); - -``` - -## Step 5: Broadcast the Transaction - -Finally, you can broadcast the signed transaction to the blockchain. Here is an example of how to do this using the Taquito library: - -``` -const operation = await tezos.rpc.sendOperation({ operation: signatureBytes }); - -``` - -That's it! You have now successfully used the Taquito local forging package to simulate the forging and signing of a transaction locally. This can be useful for testing and development, as it allows you to experiment with the transaction process without interacting with the blockchain. \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/react-template.md b/website/versioned_docs/version-17.1.0/react-template.md deleted file mode 100644 index 1dbc9c8c53..0000000000 --- a/website/versioned_docs/version-17.1.0/react-template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: React dapp template -author: Maksym Bykovskyy ---- - -The React dapp template is a starter kit for developing front-end applications running on the Tezos network with the React framework. - -To get started with the React template, please refer to the [Getting Started][get-started] section in the README found in the [React template][repo] repository on Github. - -[get-started]: https://github.com/ecadlabs/taquito-react-template#getting-started -[repo]: https://github.com/ecadlabs/taquito-react-template \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/rpc_nodes_integration_test.md b/website/versioned_docs/version-17.1.0/rpc_nodes_integration_test.md deleted file mode 100644 index edc77b8312..0000000000 --- a/website/versioned_docs/version-17.1.0/rpc_nodes_integration_test.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: RPC nodes -author: Roxane Letourneau ---- - -## Steps to run the tests - -1. The RPC nodes' integration tests are disabled by default. -Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json. - - **nairobinet**: `npm run test:nairobinet rpc-nodes.spec.ts` - -**When all endpoints are accessible for a node, you will obtain:** - -``` -Test calling all methods from RPC node: https://a-node - ✓ Get the head block hash (1376 ms) - ✓ List the ancestors of the head block (1010 ms) - ✓ Access the balance of an address (1024 ms) - ✓ Access the data of a contract (1022 ms) - ✓ Access the code and data of a contract (1096 ms) - ✓ Access the complete status of a contract (1057 ms) - ✓ Access the manager key of a contract (1023 ms) - ✓ Access the delegate of a contract (1023 ms) - ✓ Access the value associated with a key in a big map (3927 ms) - ✓ Fetches information about a delegate from RPC (1590 ms) - ✓ Get all constants from RPC (938 ms) - ✓ Get all the information about a block (1021 ms) - ✓ Get the whole block header (1125 ms) - ✓ Get all the metadata associated to the block (918 ms) - ✓ Retrieves the list of delegates allowed to bake a block (912 ms) - ✓ Retrieves the list of delegates allowed to endorse a block (971 ms) - ✓ Get ballots casted so far during a voting period (1059 ms) - ✓ Get sum of ballots casted so far during a voting period (904 ms) - ✓ Get current period kind (907 ms) - ✓ Get current proposal under evaluation (986 ms) - ✓ Get current expected quorum (920 ms) - ✓ List of delegates with their voting weight, in number of rolls (923 ms) - ✓ List of proposals with number of supporters (1023 ms) - ✓ Forge an operation returning the unsigned bytes (1026 ms) - ✓ Inject an operation in node and broadcast it (1127 ms) - ✓ Simulate the validation of an operation (1022 ms) - ✓ Get the list of entrypoints of the contract (1023 ms) - ✓ Get chain ID (896 ms) - ✓ Run an operation without signature checks (948 ms) -``` - -**Otherwise, you will see which endpoints do not work for a specific node:** - -``` -Test calling all methods from RPC node: https://another-node - ✓ Get the head block hash (888 ms) - ✓ List the ancestors of the head block (782 ms) - ✓ Access the balance of an address (779 ms) - ✓ Access the data of a contract (636 ms) - ✓ Access the code and data of a contract (801 ms) - ✓ Access the complete status of a contract (638 ms) - ✓ Access the manager key of a contract (771 ms) - ✓ Access the delegate of a contract (682 ms) - ✓ Access the value associated with a key in a big map (4200 ms) - ✓ Fetches information about a delegate from RPC (739 ms) - ✓ Get all constants from RPC (633 ms) - ✓ Get all the information about a block (673 ms) - ✓ Get the whole block header (648 ms) - ✓ Get all the metadata associated to the block (646 ms) - ✓ Retrieves the list of delegates allowed to bake a block (814 ms) - ✓ Retrieves the list of delegates allowed to endorse a block (649 ms) - ✕ Get ballots casted so far during a voting period (634 ms) - ✕ Get sum of ballots casted so far during a voting period (707 ms) - ✕ Get current period kind (766 ms) - ✕ Get current proposal under evaluation (654 ms) - ✕ Get current expected quorum (639 ms) - ✕ List of delegates with their voting weight, in number of rolls (630 ms) - ✕ List of proposals with number of supporters (699 ms) - ✓ Forge an operation returning the unsigned bytes (641 ms) - ✓ Inject an operation in node and broadcast it (655 ms) - ✓ Simulate the validation of an operation (653 ms) - ✓ Get the list of entrypoints of the contract (625 ms) - ✓ Get chain ID (636 ms) - ✓ Run an operation without signature checks (626 ms) -``` \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/taquito_utils.md b/website/versioned_docs/version-17.1.0/taquito_utils.md deleted file mode 100644 index aed26f3137..0000000000 --- a/website/versioned_docs/version-17.1.0/taquito_utils.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Taquito Utils -author: Davis Sawali ---- - -## Description -The `@taquito/utils` package provides developers with utility functions in Taquito. - -You can find a full list of available utility functions in Taquito [here](https://tezostaquito.io/typedoc/modules/_taquito_utils.html) - -## Usage Example -To use the functions, simply import the function you need as such: - -```js -import { getPkhfromPk, b58cencode, b58cdecode } from '@taquito/utils'; - -const publicKeyHash = getPkhfromPk('replace_with_publickey'); -const encoded = b58cencode('replace_with_publickey'); -``` - diff --git a/website/versioned_docs/version-17.1.0/tx_rollups.md b/website/versioned_docs/version-17.1.0/tx_rollups.md deleted file mode 100644 index 82c737ce9c..0000000000 --- a/website/versioned_docs/version-17.1.0/tx_rollups.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: Transaction Optimistic Rollups -id: tx_rollups -author: Davis Sawali ---- - -A Transaction Optimistic Rollup (TORU) is an experimental temporary scaling solution to help Tezos developers and users get acquainted with the idea of working with rollups. - -This is a trimmed, more concise documentation of how to do TORU operations in Taquito. If you aren't yet familiar with rollup node interactions, please refer to this [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#transaction-rollups) by Nomadic Labs. - -TORU currently supports the transferring of funds in the form of [tickets](https://tezostaquito.io/docs/tickets). Fund (or ticket) transfers can be done from: -- Layer-1 to layer 2 (deposit) -- Layer-2 to layer 2 (transfer) -- Layer-2 to layer-1 (withdrawal) - -Taquito currently supports **layer-1** operations that facilitate deposits and withdrawals to and from the rollup node. - -## Deposits -To be able to interact or transfer funds on layer-2, you will first need to deposit an amount to an existing layer-2 (tz4) address. - -Depositing tickets from layer-1 to layer-2 can be done via a smart contract that facilitates the transfer to a tz4 address in a specified rollup node. - -An example of such contract can be found [here](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#depositing-assets-on-a-rollup) - -Assuming the contract has been originated, interacting with the contract in Taquito would look something like this: -```javascript -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); - -const deposit = Tezos.contract.at(SMART_CONTRACT_ADDRESS); - -const op = await deposit.methods.default( - 'foobar', - '15', - 'tz4Jxn8MpRndqWUzkuZbQKmE3aNWJzYsSEso', - 'txr1c9XcfmiLSWeqDPamPytns2ZXvwgYA7EpA' -); - -const confirmation = await op.confirmation(); - -console.log(op.hash); -console.log(op.operationResults); -``` -The `default` entrypoint takes in 4 arguments: -- `foobar` is the ticket string -- `15` is the quantity of a ticket string -- `tz4Jxn8MpRndqWUzkuZbQKmE3aNWJzYsSEso` is the layer-2 address that will be the deposit recipient -- `txr1c9XcfmiLSWeqDPamPytns2ZXvwgYA7EpA` is the rollup node id - -If the deposit is successful, you will be returned an operation hash that can be accessed via `op.hash` - -You also might want to look at `op.operationResults` to retrieve the `ticket_hash`. A ticket hash should look something like this: `exprtz9FgfdzufUADVsvP8Gj8d8PZr9RsBEjZ5GQKM8Kp5cKWww7di` - -## Transfer -The exchange of assets in the form of tickets can be done from a layer-2 (`tz4`) address to another layer-2 address. Not to be confused with the `transfer_ticket` operation, this layer-2 operation will not be supported in Taquito. This may change in the future with SCORU (Smart Contract Optimistic Rollups). - -For instructions on how to conduct a transfer in layer-2 using the rollup client, refer to this [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#exchanging-assets-inside-a-rollup) by Nomadic Labs. - -## Withdrawal -A withdrawal of assets from layer-2 back to layer-1 can be done in several steps. - -The first step is to perform a `withdraw` in layer-2 to a layer-1 address in the rollup client. -``` -tezos-tx-rollup-client-alpha withdraw ${qty} of ${ticket_hash} from ${l2_src} to ${l1_dst} -``` - -- `${qty}` is the quantity of a ticket string that you would like to withdraw -- `${ticket_hash}` is the ticket hash that was returned by a deposit -- `${l2_src}` is the BLS pair of keys generated with `tezos-client bls gen key`; or in other words, the tz4 address that holds the tickets -- `${l1_dst}` is the layer-1 address you would like to withdraw the tickets to - -After a successful withdrawal, your assets will exist back in layer-1 in the form of tickets after the [finality period](#Glossary) ends. - -:::warning -Please note that this first step is a layer-2 operation which Taquito does not currently support. -::: - - - -The second step is to use a Tezos operation that will transfer these tickets to a smart contract. You can use your own contracts to process the tickets as you'd like (e.g. allow access to XTZ existing in the tickets, etc). - -This second step is called a `Transfer Ticket` operation, which Taquito supports. - -``` -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); - -const op = await Tezos.contract.transferTicket({ - ticketContents: { "string": "foobar" }, - ticketTy: { "prim": "string" } , - ticketTicketer: 'KT1AL8we1Bfajn2M7i3gQM5PJEuyD36sXaYb', - ticketAmount: 5, - destination: KT1SUT2TBFPCknkBxLqM5eJZKoYVY6mB26Fg, - entrypoint: 'default', -}); -``` -- `ticket_amount` is the amount that you would like to transfer to the smart contract -- `destination` is the address of the smart contract you would like to transfer the tickets to -- `entrypoint` is the entrypoint of the destination smart contract -- `ticket_contents`, `ticket_ty`, and `ticket_ticketer` can be retrieved from running this command using the rollup client (see [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#exchanging-assets-inside-a-rollup)) -``` -tezos-tx-rollup-client-alpha rpc get "/context/head/tickets/${ticket_hash}" -``` - -## Glossary -- `Layer-1` refers to our main protocol networks related to on-chain transactions -- `Layer-2` refers to rollup nodes deployed by any individual/group to receive transactions off-chain -- `TORU` is short for Transactional Optimistic Rollup; the experimental, temporary introduction for rollup nodes -- `SCORU` is short for Smart Contract Optimistic Rollup; the more 'permanent' solution that has yet to be be released -- `Finality Period` refers to the number of blocks needed for the chain to finalize transactions on a rollup node (40,000 blocks on mainnet and testnets, 10 blocks on Mondaynet and Dailynet for ease of testing and demo purposes). See [documentation](https://tezos.gitlab.io/alpha/transaction_rollups.html?highlight=transaction%20rollups#commitments-and-rejections). diff --git a/website/versioned_docs/version-17.1.0/upgrading_guide.md b/website/versioned_docs/version-17.1.0/upgrading_guide.md deleted file mode 100644 index a5cf782d10..0000000000 --- a/website/versioned_docs/version-17.1.0/upgrading_guide.md +++ /dev/null @@ -1,281 +0,0 @@ ---- -title: Upgrading Guide -author: Roxane Letourneau ---- - -# Upgrading to version 12 - -:::note Breaking changes -With this major number update to support the `ithaca` Tezos protocol, we have also implemented some breaking changes to the Taquito API. The following sections explain how to update your projects. -::: - -## The operation confirmations are now done using the `SubscribeProvider` set on the `TezosToolkit` - -The change to the `confirmation` methods includes a breaking change. The polling interval for the confirmation (`confirmationPollingIntervalSecond`) and the streamer configuration (`ConfigStreamer`) have been moved from the `TezosToolkit` to the `PollingSubscribeProvider` class, where they belong logically. - -We previously had two polling interval configurations on the TezosToolkit, one for the confirmation methods and one for the `PollingSubscribeProvider`. These two have been removed from the TezosToolkit. - -**Before version 12:** -```ts -// config to change the polling interval for the confirmations -Tezos.setProvider({ config: { confirmationPollingIntervalSecond: 5 }}); -// config to change the polling interval for the streamer -Tezos.setProvider({ config: { streamerPollingIntervalMilliseconds: 5000 }}); -``` - -**Since version 12:** -```ts -// The polling interval is calculated by default based on the block time -// A different polling interval can be passed in the constructor of the PollingSubscribeProvider if needed -Tezos.setStreamProvider(Tezos.getFactory(PollingSubscribeProvider)({ pollingIntervalMilliseconds:5000 })); -``` - -The configuration regarding the retry strategy for the `PollingSubscribeProvider` has also been moved to its constructor. - -**Before version 12:** -```ts -Tezos.setProvider({ config: { - shouldObservableSubscriptionRetry: true, - observableSubscriptionRetryFunction: retry() - }}); -``` - -**Since version 12:** -```ts -Tezos.setStreamProvider(Tezos.getFactory(PollingSubscribeProvider)({ - shouldObservableSubscriptionRetry: true, - observableSubscriptionRetryFunction: retry() - })); -``` - -## Lambda views (tzip-4 views) - -Since the Hangzhou protocol, the RPC exposes an endpoint (`helpers/scripts/run_view`), allowing us to run the lambda views. In version 12, we changed the implementation to use this endpoint and are not relying on a lambda contract anymore. - -**Breaking change** (primarily for sandbox users): There is no need to deploy a lambda contract anymore. The `read` method of the `ContractView` class no longer takes an optional lambda contract address as a parameter. - - -# Upgrading to version 9 - -Please take note of the two following breaking changes: -- Breaking change introduced for the method `getMultipleValues` of the `BigMapAbstraction` class and the method `getBigMapKeysByID` of the `RpcContractProvider` class: they now return a MichelsonMap instead of an object. This is meant to support keys of type object that are encountered when the Michelson type of the big map key is a `pair`. - -- To give more flexibility to the user on the retry strategy used in the `ObservableSubscription` class, we removed the parameters `observableSubscriptionRetryDelay` and `observableSubscriptionRetries` introduced in version `8.1.1-beta` and replaced them to accept an `OperatorFunction`. When users configure the `ObservableSubscription` to retry on error, we use the `retry` operators from `rxjs` by default. An example showing how to set a custom retry strategy is available [here](https://github.com/ecadlabs/taquito/blob/master/example/example-streamer-custom-retry-logic.ts). - - -# Upgrading to version 8 - -## Breaking change - Typescript upgrade - -We decided to update the Typescript version that we are using to take advantage of the newer features it brings in our Michel-Codec package. - -You might get the following error if a Typescript upgrade is needed in your project: -``` -Error: node_modules/@taquito/michel-codec/dist/types/michelson-types.d.ts:122:34 - error TS1110: Type expected. -export declare type ProtocolID = `${Protocol}`; -``` - -# Upgrading to version 7 - -:::note Breaking changes -With this major number update to support the `delphi` Tezos protocol, we have also implemented some breaking changes to the Taquito API. The following sections explains how to update your projects. -::: - -The following sections explain each breaking change, including: - -- the reasons that motivated it, -- code examples that demonstrate how to update your code (how it was in prior versions versus how it needs to be using v7), and -- potential errors you might get when updating to v7 without making the fixes. - -## Removed the default RPC Node URL - -Before version 7, Taquito shipped with a default RPC node URL. We have removed the default URL, forcing developers to specify the RPC node they wish to use. See [RPC Nodes](rpc_nodes.md) for a list of public and private nodes options. - -The previous default was set in the constructor of the `RpcClient` class. We took this approach so that users can get started quickly, and Taquito should "just work" with minimal fiddling. Users could import a ready-to-use Tezos singleton, an instance of the `TezosToolkit` class using the default RPC URL. - -However, in version 7 of Taquito, we decided to remove the default RPC node URL. The reason behind this choice is to encourage developers to make their own informed choice on which Tezos RPC node (public or private) is best for them. This change also helps avoid dApps using Taquito from centralizing on one public RPC node. Decentralization is an essential part of Tezos, including the node infrastructure level. - -This change impacts the following classes, where it is now required to specify an RPC node in their constructor: - -- `RpcClient` -- `Context` -- `TezosToolkit` - -When creating an instance of the `TezosToolkit`, one must specify the RPC node. It can be a `string` or a [`RpcClient`](rpc_package.md) object. A list of community-run nodes can be accessed [here](rpc_nodes.md#list-of-community-run-nodes). **The `Tezos` singleton, a ready-to-use instance of the `TezosToolkit` class, is no longer supported.** - -### Change required in your code: - -**Before version 7:** - -```js -import { TezosToolkit } from '@taquito/taquito'; -const tezos = new TezosToolkit(); -// or -import { Tezos } from '@taquito/taquito'; -// ready-to-use Tezos singleton -``` - -**Since version 7:** - -```js -import { TezosToolkit } from '@taquito/taquito'; -const tezos = new TezosToolkit('https://YOUR_PREFERRED_RPC_URL_NOW_REQUIRED'); -// or -// Those who were using the Tezos singleton may consider naming the variable like the singleton to avoid renaming it everywhere in their code: -const Tezos = new TezosToolkit('https://YOUR_PREFERRED_RPC_URL_NOW_REQUIRED'); -``` - -### Example Errors if you were using the Tezos singleton - -Here is an example of the compilation error you would get when updating Taquito to version 7, if you do not replace the Tezos singleton with an instance of the TezosToolkit: - -`Module '"../../node_modules/@taquito/taquito/dist/types/taquito"' has no exported member 'Tezos'.` - -### Example Errors when the URL is not set: - -Here are examples of the compilation error you would get when updating Taquito to version 7, if the RPC URL is not specified: - -`An argument for '_rpc' was not provided. Expected 1-2 arguments, but got 0.` - -`Type '(rpcClient: string | RpcClient) => TezosToolkit' is missing the following properties from type 'TezosToolkit': _rpc, _context, _stream, _options, and 20 more.` - -## Changed the name of the contracts default entrypoint - -Version 7 of Taquito introduces a breaking change for implementations that use the `main` method for calling the default entrypoint of a contract. - -Before version 7, there was a synthetic method called `main` in Taquito to interact with the default entrypoint. The `main` name was confusing because it referred to the [default](http://tezos.gitlab.io/whitedoc/michelson.html#the-default-entrypoint) entrypoint in Michelson. - -In version 7, this synthetic entrypoint name has been renamed from `main` to `default.` - -### Changes required in your code: - -This change applies to you if you use the default `main` entrypoint in your code when calling a Tezos smart contract. - -For example, the contract [KT1Jsf33Eh4Mt9zvx1xqW2JQpZGyo4fjW7y9](https://better-call.dev/delphinet/KT1Jsf33Eh4Mt9zvx1xqW2JQpZGyo4fjW7y9/operations) (deployed on Delphinet) has a single entrypoint (default). - -**Before version 7:** - -```js -const contract = await tezos.contract.at('KT1Jsf33Eh4Mt9zvx1xqW2JQpZGyo4fjW7y9'); -const opMethod = await contract.methods.main('2').send(); -``` - -**Since version 7:** - -```js -const contract = await tezos.contract.at('KT1Jsf33Eh4Mt9zvx1xqW2JQpZGyo4fjW7y9'); -const opMethod = await contract.methods.default('2').send(); -``` - -### Error when not replacing main with default: - -If you update to version 7 without replacing main with default in your code, you might get the following error at runtime: -`contract.methods.main is not a function` - -## Removed the `importKey` method from TezosToolkit class - -This method was marked as deprecated in March 2020 and recommended to use the signer provider: `@taquito/signer importKey`. -The purpose of this change was to remove the `@taquito/signer` dependency from `@taquito/taquito` because it increased the bundle size by ~1.1mb while not being necessary for most browser-based use-cases. - -### Change required in your code: - -**Before version 7:** - -```js -import { TezosToolkit } from '@taquito/taquito'; - -const tezos = new TezosToolkit('your_rpc_node'); -tezos.importKey(email, password, mnemonic, secret); -``` - -**Since version 7:** - -```js -import { TezosToolkit } from '@taquito/taquito'; -import { importKey } from '@taquito/signer'; - -const tezos = new TezosToolkit('your_rpc_node'); -importKey(tezos, email, password, mnemonic, secret); -``` - -### Error when the `importKey` function is not replaced - -If you update to version 7 without replacing the `importKey` method in your code, you might get the following compilation error: -`Property 'importKey' does not exist on type 'TezosToolkit'.` - -or this error at runtime: -`importKey is not a function`. - -## Fetching `constants` from the RPC - -Taquito now uses a type union that is composed of specific types for each protocol's economic constants. - -Each protocol can add, change or remove constants. Before v7, Taquito used a single type with optional parameters. We now implement specific types for each protocol's constants for the correctness and avoid bloat over time. - -The `ConstantsResponse` interface in the Taquito RPC package is used when querying the RPC for constants with the `getConstants` method of the `RpcClient` class. Changes made to the interface `ConstantsResponse` are in the table below. Note that not all of them are breaking changes; some new or missing properties are added. - -| Property | Type | Proto | Details | -| ---------------------------------- | ------------------------ | ------- | ----------------------------------------------------------------------- | -| max_anon_ops_per_block? | number | 7 | New in Delphinet, optional in Taquito because not in previous protocols | -| **max_revelations_per_block?** | number | 1 to 6 | **Changed to optional because not in proto 7** | -| **block_reward?** | BigNumber | 1 to 5 | **Changed to optional because not in proto 6 and 7** | -| **initial_endorsers?** | number | 5 to 7 | **type correction, string[ ] changed to number** | -| **delay_per_missing_endorsement?** | BigNumber | 5 to 7 | **type correction, number changed to BigNumber** | -| **endorsement_reward** | BigNumber or BigNumber[] | 1 to 7 | **Added BigNumber[ ] for proto 6 and 7, BigNumber before** | -| baking_reward_per_endorsement? | BigNumber[] | 6 and 7 | Was missing in Taquito | -| test_chain_duration? | BigNumber | 4 to 7 | Was missing in Taquito | -| origination_size? | number | 3 to 7 | Was missing in Taquito | -| **origination_burn?** | string | 1 and 2 | **Changed to optional because only in proto 1 and 2** | -| max_proposals_per_delegate? | number | 3 to 7 | Was missing in Taquito | - -### Example of breaking change: - -The constant `max_revelations_per_block` is part of protocols 1 to 6, but not 7. Thus, we have changed it to an optional property in Taquito. Projects which use `max_revelations_per_block` property in their code need to add a check to ensure that the property is defined. - -**Before version 7:** - -```js -const client = new RpcClient('your_rpc'); -const response = await client.getConstants(); - -const maxRevPerBlock = response.max_revelations_per_block; -``` - -**Since version 7:** - -```js -const client = new RpcClient('your_rpc'); -const response = await client.getConstants(); - -if (response.max_revelations_per_block) { - const maxRevelatioknsPerBlock = response.max_revelations_per_block; -} -``` - -## DerivationType renamed in the LedgerSigner - -:::info Early Adopters of the Taquito Ledger Signer -Ledger support was pre-released in September. Taquito never officially released this package until v7, but some teams adopted the pre-release package early, and this section is relevant only to those early adopters. -::: - -This breaking change can impact the users of the pre-released `ledger-signer` package. - -We have renamed the enum `DerivationType` members to use the curve name. Now `tz1`, `tz2`, and `tz3` become `ED25519`, `SECP256K1`, and `P256`. This enum is used in the optional `derivationType` parameter of the constructor of the `LedgerSigner` class. - -There is another derivation type (`BIPS32_ED25519`), which also uses the tz1 prefix. It is used by the `tezos-client` CLI when paired with a ledger device but is not implemented so far in the `ledger-signer` package. The derivation types being named `tz1`, `tz2`, and `tz3` were potentially an area of confusion in the future, whereas different derivation types use the same signature scheme. - -### Change required in your code: - -No change is required if you are using the default `derivationType` parameter. - -**In early version 7 pre-released:** - -```js -const ledgerSigner = new LedgerSigner(transport, "44'/1729'/0'/0'", true, DerivationType.tz2); -``` - -**Since version 7:** - -```js -const ledgerSigner = new LedgerSigner(transport, "44'/1729'/0'/0'", true, DerivationType.SECP256K1); -``` diff --git a/website/versioned_docs/version-17.5.0/rpc_nodes.md b/website/versioned_docs/version-17.5.0/rpc_nodes.md index 764fca96ce..5395019f9f 100644 --- a/website/versioned_docs/version-17.5.0/rpc_nodes.md +++ b/website/versioned_docs/version-17.5.0/rpc_nodes.md @@ -26,20 +26,18 @@ values={[ | ECAD Labs | Mainnet | https://mainnet.ecadinfra.com | [Check](https://mainnet.ecadinfra.com/chains/main/blocks/head/header) | | ECAD Labs | Ghostnet | https://ghostnet.ecadinfra.com | [Check](https://ghostnet.ecadinfra.com/chains/main/blocks/head/header) | | ECAD Labs | Nairobinet | https://nairobinet.ecadinfra.com | [Check](https://nairobinet.ecadinfra.com/chains/main/blocks/head/header) | -| ECAD Labs | Mumbainet | https://mumbainet.ecadinfra.com | [Check](https://mumbainet.ecadinfra.com/chains/main/blocks/head/header) | | 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) | | 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 | Nairobinet | https://nairobinet.tezos.marigold.dev/ | [Check](https://nairobinet.tezos.marigold.dev/chains/main/blocks/head/header) | -| Marigold | Mumbainet | https://mumbainet.tezos.marigold.dev/ | [Check](https://mumbainet.tezos.marigold.dev/chains/main/blocks/head/header) | *If you are aware of a public node missing from our list or our information is inaccurate, please help us by submitting an issue or pull request on our GitHub page.* -| Provider | Details | +| Provider | Details | |------------------|---------------------------------------------| | TzPro | https://tzpro.io/ | | MIDL.dev | https://midl.dev/tezos-rpc/ | diff --git a/website/versioned_docs/version-17.5.0/wallet_API.md b/website/versioned_docs/version-17.5.0/wallet_API.md index 8ee9ab6412..27b5dc9589 100644 --- a/website/versioned_docs/version-17.5.0/wallet_API.md +++ b/website/versioned_docs/version-17.5.0/wallet_API.md @@ -179,7 +179,7 @@ const wallet = new TempleWallet('MyAwesomeDapp'); The class constructor takes one parameter, the name of your dapp (this will be used later in the transaction confirmation pop-up). After the instantiation, we can connect the wallet by calling the `connect` method: ```js -await wallet.connect('mainnet' | 'mumbainet' | 'nairobinet' | 'ghostnet' | 'mondaynet' | 'sandbox'); +await wallet.connect('mainnet' | 'nairobinet' | 'ghostnet' | 'mondaynet' | 'sandbox'); ``` (Temple used to be called Thanos and some Taquito code still uses the name Thanos.) diff --git a/website/versioned_docs/version-17.1.0/ballot.md b/website/versioned_docs/version-19.0.0/ballot.md similarity index 100% rename from website/versioned_docs/version-17.1.0/ballot.md rename to website/versioned_docs/version-19.0.0/ballot.md diff --git a/website/versioned_docs/version-17.1.0/batch-api.md b/website/versioned_docs/version-19.0.0/batch-api.md similarity index 95% rename from website/versioned_docs/version-17.1.0/batch-api.md rename to website/versioned_docs/version-19.0.0/batch-api.md index e031e70a02..8e8162624c 100644 --- a/website/versioned_docs/version-17.1.0/batch-api.md +++ b/website/versioned_docs/version-19.0.0/batch-api.md @@ -31,7 +31,6 @@ await op2.confirmation(); */ ``` -Tracking the confirmation of transactions and the update of the transaction counter can be very frustrating and cumbersome, this is why Taquito provides the Batch API. The Batch API allows you to group all your transactions together and emit them at once under the same transaction counter value and the same transaction hash. ## How does it work? diff --git a/website/versioned_docs/version-17.1.0/beaconwallet-singleton.md b/website/versioned_docs/version-19.0.0/beaconwallet-singleton.md similarity index 100% rename from website/versioned_docs/version-17.1.0/beaconwallet-singleton.md rename to website/versioned_docs/version-19.0.0/beaconwallet-singleton.md diff --git a/website/versioned_docs/version-17.1.0/cancel_http_requests.md b/website/versioned_docs/version-19.0.0/cancel_http_requests.md similarity index 74% rename from website/versioned_docs/version-17.1.0/cancel_http_requests.md rename to website/versioned_docs/version-19.0.0/cancel_http_requests.md index 93856b1f02..78b9187bf0 100644 --- a/website/versioned_docs/version-17.1.0/cancel_http_requests.md +++ b/website/versioned_docs/version-19.0.0/cancel_http_requests.md @@ -3,6 +3,10 @@ title: Cancel HTTP requests author: Roxane Letourneau --- +:::warning +This document was recently modified to reflect the switch from Axios to Fetch +::: + Having Taquito implemented in composable modules is a design choice to allow users to customize the modules to meet some of their specific needs. One of these needs might be the ability to **cancel** HTTP requests to optimize the network. Indeed, Taquito has heavy methods that make a lot of requests to the RPC. For example, in some cases, users might want to cancel almost immediately a call when using it in user interfaces. It is possible to incorporate some logic into the `HttpBackend` and `RpcClient` classes to fulfill this need. @@ -11,7 +15,11 @@ Here is one example to override `HttpBackend` and/or `RpcClient`: #### **Create a custom** `HttpBackend` -Create a class called `CancellableHttpBackend` which extends the `HttpBackend` class. Override the `createRequest` method to utilize an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to handle and capture abort signals. We also use [Axios](https://github.com/axios/axios) to send HTTP requests. For more information on cancelling Axios requests, refer to [this documentation](https://github.com/axios/axios#cancellation) +Create a class called `CancellableHttpBackend` which extends the `HttpBackend` class. Override the `createRequest` method to utilize an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to handle and capture abort signals. + +:::warning +We currently use the `AbortController` to timeout requests in the `HttpBackend` class. Plase note that this example will override the timeout functionality. If you want to keep the timeout functionality, you can add a custom timeout to call the cancelRequest method after a certain amount of time. +::: ``` ts class CancellableHttpBackend extends HttpBackend { @@ -32,25 +40,36 @@ class CancellableHttpBackend extends HttpBackend { async createRequest( [...] let response; + try { - response = await axios.request({ - url: url + this.serialize(query), - method: method ?? 'GET', - headers: headers, - responseType: resType, + const response = await fetch(urlWithQuery, { + method, + headers, + body: JSON.stringify(data), signal: this.abortController.signal, - transformResponse, - timeout: timeout, - data: data, }); - } catch (err: any) { - throw new HttpResponseError( - `Http error response: (${err.response.status}) ${JSON.stringify(err.response.data)}`, - err.response.status as STATUS_CODE, - err.response.statusText, - JSON.stringify(err.response.data), - url + this.serialize(query) - ) + + if (typeof response === 'undefined') { + throw new Error('Response is undefined'); + } + + // Handle responses with status code >= 400 + if (response.status >= 400) { + const errorData = await response.text(); + throw new HttpResponseError( + ... + ); + } + + if (json) { + return response.json() as T; + } else { + return response.text() as unknown as T; + } + } catch (e: unknown) { + ... + } finally { + clearTimeout(t); } return response.data diff --git a/website/versioned_docs/version-19.0.0/chatbot.md b/website/versioned_docs/version-19.0.0/chatbot.md new file mode 100644 index 0000000000..1a5facbac7 --- /dev/null +++ b/website/versioned_docs/version-19.0.0/chatbot.md @@ -0,0 +1,10 @@ +--- +title: 💬 Support Chatbot +author: Alireza Haghshenas +--- + \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/complex_parameters.md b/website/versioned_docs/version-19.0.0/complex_parameters.md similarity index 97% rename from website/versioned_docs/version-17.1.0/complex_parameters.md rename to website/versioned_docs/version-19.0.0/complex_parameters.md index a85f187f87..b303d04a4f 100644 --- a/website/versioned_docs/version-17.1.0/complex_parameters.md +++ b/website/versioned_docs/version-19.0.0/complex_parameters.md @@ -43,7 +43,7 @@ storage (pair (map %validators nat address)); ``` -In this example, we originate the contract with initial values in the storage. We use the `MichelsonMap` class' of Taquito to initialize [the maps and the bigMap](https://tezostaquito.io/docs/maps_bigmaps). +In this example, we originate the contract with initial values in the storage. We use the `MichelsonMap` class' of Taquito to initialize [the maps and the bigMap](https://tezostaquito.io/docs/maps_bigmaps). As described above, the `map %data` uses a value that we chose between different types. When using Taquito, we need to surround the chosen argument with curly braces. In the current example, we initialize the value in the `map %data` to the boolean true: `{ bool: true }`. @@ -59,7 +59,7 @@ const dataMap = new MichelsonMap(); //key is a string, we choose a boolean for the value dataMap.set('Hello', { bool : true }) -//%records +//%records const recordsBigMap = new MichelsonMap(); recordsBigMap.set( 'FFFF', //key of the bigMap %records is in bytes @@ -89,7 +89,7 @@ importKey(Tezos, secretKey) code : contractJson, storage : { owner : 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address - records: recordsBigMap, + records: recordsBigMap, validators : validatorsMap }}) }).then((contractOriginated) => { @@ -102,7 +102,7 @@ importKey(Tezos, secretKey) ## Calling the function of a contract having a complex object as a parameter -The contract contains a function named `set_child_record`. The parameter of the function is composed of nested pairs regrouping different datatypes (address, `map`, `bytes` and `nat`). Two of its arguments, the `address %address` and the `nat %ttl`, are optional. The `map %data` uses a `string` as its key. The user needs to choose the value of the `map` between different proposed types. +The contract contains a function named `set_child_record`. The parameter of the function is composed of nested pairs regrouping different datatypes (address, `map`, `bytes` and `nat`). Two of its arguments, the `address %address` and the `nat %ttl`, are optional. The `map %data` uses a `string` as its key. The user needs to choose the value of the `map` between different proposed types. Here is the parameter of the function defined in Michelson : @@ -138,7 +138,7 @@ importKey(Tezos, secretKey) }).then(myContract => { const dataMap = new MichelsonMap(); dataMap.set("Hello World", { bool : true }) - let inspect = myContract.methods.set_child_record('tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', dataMap, 'EEEE', 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', 'FFFF', '10').toTransferParams(); + let inspect = myContract.methods.set_child_record('tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', dataMap, 'EEEE', 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', 'FFFF', '10').toTransferParams(); println(JSON.stringify(inspect, null, 2)) }).catch(error => println(`Error: ${JSON.stringify(error, null, 2)}`)); ``` @@ -156,7 +156,7 @@ importKey(Tezos, secretKey) }).then(myContract => { const dataMap = new MichelsonMap(); dataMap.set("Hello World", { bool : true }) - + return myContract.methods.set_child_record( 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address(optional) dataMap, //data @@ -164,7 +164,7 @@ importKey(Tezos, secretKey) 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //owner 'FFFF', //parent '10' //ttl(optional) - ).send(); + ).send(); }).then(op => { println(`Waiting for ${op.hash} to be confirmed...`); return op.confirmation(1).then(() => op.hash); @@ -178,7 +178,7 @@ The `address %address` and the `nat %ttl` of the `set_child_record` function are ```js live noInline // import { TezosToolkit, MichelsonMap } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com') +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com') // import { importKey } from '@taquito/signer'; importKey(Tezos, secretKey) @@ -187,7 +187,7 @@ importKey(Tezos, secretKey) }).then(myContract => { const dataMap = new MichelsonMap(); dataMap.set("Hello World", { nat : '3' }) - + return myContract.methods.set_child_record( null, //address(optional) dataMap, //data @@ -195,7 +195,7 @@ importKey(Tezos, secretKey) 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //owner 'FFFF', //parent undefined //ttl(optional) - ).send(); + ).send(); }).then(op => { println(`Waiting for ${op.hash} to be confirmed...`); return op.confirmation(1).then(() => op.hash); diff --git a/website/versioned_docs/version-17.1.0/confirmation_event_stream.md b/website/versioned_docs/version-19.0.0/confirmation_event_stream.md similarity index 100% rename from website/versioned_docs/version-17.1.0/confirmation_event_stream.md rename to website/versioned_docs/version-19.0.0/confirmation_event_stream.md diff --git a/website/versioned_docs/version-17.1.0/consensus_key.md b/website/versioned_docs/version-19.0.0/consensus_key.md similarity index 88% rename from website/versioned_docs/version-17.1.0/consensus_key.md rename to website/versioned_docs/version-19.0.0/consensus_key.md index 7b9b84b478..bda600b95d 100644 --- a/website/versioned_docs/version-17.1.0/consensus_key.md +++ b/website/versioned_docs/version-19.0.0/consensus_key.md @@ -3,7 +3,7 @@ title: Consensus Keys author: Davis Sawali & Hui-An Yang --- -The "consensus key" feature allows bakers to use a different key, called the consensus key. It will allow for baking and signing consensus operations (i.e. pre-endorsements and endorsements). For more detailed information on consensus keys, refer to [this documentation](https://tezos.gitlab.io/protocols/015_lima.html?highlight=update%20consensus%20key#consensus-key) +The "consensus key" feature allows bakers to use a different key, called the consensus key. It will allow for baking and signing consensus operations (i.e. preattestation/preendorsements and attestation/endorsements). For more detailed information on consensus keys, refer to [this documentation](https://tezos.gitlab.io/protocols/015_lima.html?highlight=update%20consensus%20key#consensus-key) Starting from Lima protocol, these 2 new operations will be available: diff --git a/website/versioned_docs/version-17.1.0/contract-test-collection.md b/website/versioned_docs/version-19.0.0/contract-test-collection.md similarity index 100% rename from website/versioned_docs/version-17.1.0/contract-test-collection.md rename to website/versioned_docs/version-19.0.0/contract-test-collection.md diff --git a/website/versioned_docs/version-17.1.0/contract_call_parameters.md b/website/versioned_docs/version-19.0.0/contract_call_parameters.md similarity index 100% rename from website/versioned_docs/version-17.1.0/contract_call_parameters.md rename to website/versioned_docs/version-19.0.0/contract_call_parameters.md diff --git a/website/versioned_docs/version-17.1.0/contracts-library.md b/website/versioned_docs/version-19.0.0/contracts-library.md similarity index 100% rename from website/versioned_docs/version-17.1.0/contracts-library.md rename to website/versioned_docs/version-19.0.0/contracts-library.md diff --git a/website/versioned_docs/version-17.1.0/dapp_prelaunch.md b/website/versioned_docs/version-19.0.0/dapp_prelaunch.md similarity index 100% rename from website/versioned_docs/version-17.1.0/dapp_prelaunch.md rename to website/versioned_docs/version-19.0.0/dapp_prelaunch.md diff --git a/website/versioned_docs/version-19.0.0/dapp_template.md b/website/versioned_docs/version-19.0.0/dapp_template.md new file mode 100644 index 0000000000..c6a6ccefc6 --- /dev/null +++ b/website/versioned_docs/version-19.0.0/dapp_template.md @@ -0,0 +1,10 @@ +--- +title: Dapp Templates +author: Maksym Bykovskyy +--- + +We've provided a few dapp templates as a starter kit for developing front-end application running on the Tezos network. Here are the links to the templates: + +- [React template](https://github.com/ecadlabs/taquito-react-template) +- [Svelte template](https://github.com/ecadlabs/taquito-svelte-template) + diff --git a/website/versioned_docs/version-17.1.0/drain_account.md b/website/versioned_docs/version-19.0.0/drain_account.md similarity index 98% rename from website/versioned_docs/version-17.1.0/drain_account.md rename to website/versioned_docs/version-19.0.0/drain_account.md index 92000886cb..e56c015f39 100644 --- a/website/versioned_docs/version-17.1.0/drain_account.md +++ b/website/versioned_docs/version-19.0.0/drain_account.md @@ -22,7 +22,7 @@ In the following example, we have not revealed the account that we want to empty ::: ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // import { DEFAULT_FEE } from "@taquito/taquito"; Tezos.signer @@ -87,7 +87,7 @@ The contract we originate is a `manager contract.` It has a `do` method taking a In the example, we estimate the transfer operation before doing it. The associated fees are deducted from the manager's address when draining the account. Thus, for the operation to be successful, the manager's address for that account must contain funds to cover the gas. ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); function transferImplicit(key, mutez) { return [ diff --git a/website/versioned_docs/version-17.1.0/estimate.md b/website/versioned_docs/version-19.0.0/estimate.md similarity index 98% rename from website/versioned_docs/version-17.1.0/estimate.md rename to website/versioned_docs/version-19.0.0/estimate.md index adb12c4c89..75b385e305 100644 --- a/website/versioned_docs/version-17.1.0/estimate.md +++ b/website/versioned_docs/version-19.0.0/estimate.md @@ -1,5 +1,5 @@ --- -title: Estimate Operations +title: Estimate Provider author: Edmond Lee & Roxane Letourneau --- import Tabs from '@theme/Tabs'; @@ -7,7 +7,9 @@ import TabItem from '@theme/TabItem'; Taquito's estimate method can be used to estimate fees, gas, and storage associated with an operation. -## Estimate Values +## The `Estimate` object + +The `Estimate` object has the following properties: [`burnFeeMutez`]: The number of Mutez that will be burned for the storage of the operation. Returns a number. diff --git a/website/versioned_docs/version-17.1.0/events.md b/website/versioned_docs/version-19.0.0/events.md similarity index 92% rename from website/versioned_docs/version-17.1.0/events.md rename to website/versioned_docs/version-19.0.0/events.md index 40938fb861..517e1a3275 100644 --- a/website/versioned_docs/version-17.1.0/events.md +++ b/website/versioned_docs/version-19.0.0/events.md @@ -7,9 +7,9 @@ author: Davis Sawali # Contract Events ## Introduction -Contract events is a way for contracts to deliver event-like information to third-party (off-chain) applications. It can be emitted by using the EMIT instruction in Michelson. +Contract events is a way for contracts to deliver event-like information to third-party (off-chain) applications. It can be emitted by using the EMIT instruction in Michelson. -For more details and examples of how the EMIT instruction works, refer to [this article](https://tezos.gitlab.io/kathmandu/event.html). +For more details and examples of how the EMIT instruction works, refer to [this article](https://tezos.gitlab.io/active/event.html). ## Getting contract events in Taquito You can get the events in a contract through the `eventSchema` field of the `ContractAbstraction`. @@ -58,8 +58,8 @@ const Tezos = new TezosToolkit(RPC_URL); Tezos.setStreamProvider( Tezos.getFactory(PollingSubscribeProvider)({ - shouldObservableSubscriptionRetry: true, - pollingIntervalMilliseconds: 1500 + shouldObservableSubscriptionRetry: true, + pollingIntervalMilliseconds: 1500 }) ); @@ -69,9 +69,9 @@ try { address: 'KT1_CONTRACT_ADDRESS', excludeFailedOperations: true }); - + sub.on('data', console.log); - + } catch (e) { console.log(e); } @@ -79,7 +79,7 @@ try { - `tag` is the tag string that was defined in the smart contract with the EMIT instruction -- `address` is the address of the smart contract that was called +- `address` is the address of the smart contract that was called - `excludeFailedOperations`: In rare cases, events from failed operations can be received by the subscriber. You can use this field to filter out these events (if you pass `true` to this field, only events from successful operations will be received) :::info diff --git a/website/versioned_docs/version-17.1.0/fa2_parameters.md b/website/versioned_docs/version-19.0.0/fa2_parameters.md similarity index 82% rename from website/versioned_docs/version-17.1.0/fa2_parameters.md rename to website/versioned_docs/version-19.0.0/fa2_parameters.md index ce39f02ca5..a272e85078 100644 --- a/website/versioned_docs/version-17.1.0/fa2_parameters.md +++ b/website/versioned_docs/version-19.0.0/fa2_parameters.md @@ -10,14 +10,14 @@ Based on the [TZIP-12 standard](https://gitlab.com/tezos/tzip/-/blob/master/prop In order to be compliant with the standard, a contract (among other requirements) must implement 3 main entrypoints: - **transfer**: an entrypoint to be called to transfer one or multiple tokens from one address to the other -- **update_operators**: a list of parameters to give or withdraw access to users' tokens from third-parties - **balance_of**: an entrypoint meant to be called on-chain in order to get the balance of a specific account +- **update_operators**: a list of parameters to give or withdraw access to users' tokens from third-parties Because the *transfer* and *update_operators* entrypoints require complex Michelson data, it can sometimes be complicated to find the right formatting for the parameters in JavaScript using Taquito. ## Reminder: calling the entrypoint of an FA2 contract -Once you have the address of the contract you want to update, calling the *transfer* or the *update_operators* entrypoint follows the same steps as with any other contract: +Once you have the address of the contract you want to update, calling the `transfer` or the `update_operators` entrypoint follows the same steps as with any other contract: ```typescript import { TezosToolkit } from "@taquito/taquito"; @@ -30,7 +30,7 @@ await op.confirmation(); ## The transfer entrypoint Here is the type signature for the entrypoint parameter in Michelson: -``` +``` (list %transfer (pair (address %from_) @@ -46,7 +46,7 @@ Here is the type signature for the entrypoint parameter in Michelson: ) ) ``` -This means that the entrypoint takes a list of pairs annotated with *%transfer*. Each pair is made on the left side of the account the tokens must be deducted from and on the right side of a second list of transactions holding the recipient of the transfer, the id of the token in question (in case the contract holds multiple tokens with different ids) and the amount to be deducted. +This means that the entrypoint takes a list of pairs annotated with `%transfer`. Each pair is made on the left side of the account the tokens must be deducted from and on the right side of a second list of transactions holding the recipient of the transfer, the id of the token in question (in case the contract holds multiple tokens with different ids) and the amount to be deducted. > Note: Incidentally, this means that the contract can process multiple transfers at the same time, with one spender sending transfers to multiple recipients for one or different token ids. @@ -99,6 +99,42 @@ You can then add as many transactions as you like to be processed by the contrac > Note: the properties holding the addresses of the spender and the recipient both end with an underscore: **from_** and **to_**. +## The balance_of entrypoint +Here is the type signature for the entrypoint parameter in Michelson: +``` +(pair %balance_of + (list %requests + (pair + (address %owner) + (nat %token_id) + ) + ) + (contract %callback + (list + (pair + (pair %request + (address %owner) + (nat %token_id) + ) + (nat %balance) + ) + ) + ) +) +``` +This means that the entrypoint takes a pair annotated as `%balance_of`. On the left side of `%balance_of` pair takes a list of `%requests` structured as a pair of address as `%owner` and nat as `%token_id`. On the right side of `%balance_of` pair takes a contract annotated as `%callback` which the contract entrypoint type signature will be a list of pairs on the left side of the pair as `%request` that constructs with an address as `%owner` and nat as `%token_id` and on the right side as nat as `%balance` + +```typescript +const balance_params = { + request: [ + { + owner: 'tz1XTyqBn4xi9tkRDutpRyQwHxfF8ar4i4Wq', + token_id: '0' + } + ], + callback: 'KT1B9bXnsuqZkxbk2fBJbuhRRf1VpcFz2VV7' +} +``` ## The update_operators entrypoint Here is the type signature for the entrypoint parameter in Michelson: @@ -123,8 +159,8 @@ Here is the type signature for the entrypoint parameter in Michelson: ) ``` -As mentioned above, Michelson lists are represented as arrays in Taquito. -A union value inside a list is represented as an object with one property: the annotation of the left or right side. The value is then represented as usual in Taquito. In the case of the *update_operators* entrypoint, the value is an object whose properties are the annotations of the right-combed pair: +As mentioned above, Michelson lists are represented as arrays in Taquito. +A union value inside a list is represented as an object with one property: the annotation of the left or right side. The value is then represented as usual in Taquito. In the case of the `update_operators` entrypoint, the value is an object whose properties are the annotations of the right-combed pair: ```typescript const operator_params = [ @@ -172,5 +208,4 @@ await batchOp.confirmation(); ``` In the first contract call (to the token contract), the user authorizes the dapp contract to transfer his tokens on his behalf. -In the second contract call (to the dapp contract), the user calls a hypothetical *mint* entrypoint that sends a transaction under the hood to transfer the user's tokens to the contract account. - +In the second contract call (to the dapp contract), the user calls a hypothetical `mint` entrypoint that sends a transaction under the hood to transfer the user's tokens to the contract account. diff --git a/website/versioned_docs/version-19.0.0/failing_noop.md b/website/versioned_docs/version-19.0.0/failing_noop.md new file mode 100644 index 0000000000..a0619e08de --- /dev/null +++ b/website/versioned_docs/version-19.0.0/failing_noop.md @@ -0,0 +1,63 @@ +--- +title: Failing Noop +id: failing_noop +author: Alireza Haghshenas +--- + +## Introduction + +There are use cases for allowing users to sign arbitrary data. It is important to ensure that data cannot be injected into the blockchain. The failing_noop operation can wrap arbitrary data and is guaranteed to fail. + +### Signing a failing_noop using the contract api + +```typescript +const signed = await Tezos.contract.failingNoop({ + arbitrary: "48656C6C6F20576F726C64", // Hex for: Hello World + basedOnBlock: 'head', // Can also be 0, to be based on the genesis block +}); +``` + +The `params.arbitrary` is a `bytes` string, with the hex representation of the payload to be signed. +The field `basedOnBlock` is a `BlockIdentifier`: + +```typescript +type BlockIdentifier = 'head' | `head~${number}` | `B${string}` | number; +``` + +The payload can be signed on `head`, or a specified number of blocks before `head`, or a block referenced by hash, or a block referenced by level. + +### Signing a failing_noop using the wallet api + +```typescript +const signed = await Tezos.wallet.signFailingNoop({ + arbitrary: "48656C6C6F20576F726C64", // Hex for: Hello World + basedOnBlock: 0, +}); + +``` + +Both APIs should return a signed object of the form: + +```json +{ + "signature": "spsig1QVVCiQ6aN2zmut2wKTg4zWLoP9ia4qUY2hBo21odA7P25gqfieFWJMyntaJWmyrd6v3mgjKF5n4d2wcaB3LxkLmd1MoJQ", + "bytes": "df2788eed43ab680c8a2b79969ce4de93b9768cd2786a85ebdfba90ca7612638110000000b48656c6c6f20576f726c64", + "signedContent": { + "branch": "BMQZWtQjSpyJZBVHbABEmVP9VG8yEZPZ3wNftwZdXt6A33ZYatj", + "contents": [ + { + "kind": "failing_noop", + "arbitrary": "48656C6C6F20576F726C64" + } + ] + } +} +``` + +You can verify the signature: + +```typescript +//import { verifySignature } from "@taquito/utils"; + +verifySignature(signed.bytes, await Tezos.signer.publicKey(), signed.prefixSig, new Uint8Array([3])) +``` \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/failwith_errors.md b/website/versioned_docs/version-19.0.0/failwith_errors.md similarity index 100% rename from website/versioned_docs/version-17.1.0/failwith_errors.md rename to website/versioned_docs/version-19.0.0/failwith_errors.md diff --git a/website/versioned_docs/version-17.1.0/forger.md b/website/versioned_docs/version-19.0.0/forger.md similarity index 100% rename from website/versioned_docs/version-17.1.0/forger.md rename to website/versioned_docs/version-19.0.0/forger.md diff --git a/website/versioned_docs/version-17.1.0/global_constant.md b/website/versioned_docs/version-19.0.0/global_constant.md similarity index 100% rename from website/versioned_docs/version-17.1.0/global_constant.md rename to website/versioned_docs/version-19.0.0/global_constant.md diff --git a/website/versioned_docs/version-17.1.0/images/Tzip16ExecuteView.png b/website/versioned_docs/version-19.0.0/images/Tzip16ExecuteView.png similarity index 100% rename from website/versioned_docs/version-17.1.0/images/Tzip16ExecuteView.png rename to website/versioned_docs/version-19.0.0/images/Tzip16ExecuteView.png diff --git a/website/versioned_docs/version-17.1.0/images/diagramTzip16Metadata.png b/website/versioned_docs/version-19.0.0/images/diagramTzip16Metadata.png similarity index 100% rename from website/versioned_docs/version-17.1.0/images/diagramTzip16Metadata.png rename to website/versioned_docs/version-19.0.0/images/diagramTzip16Metadata.png diff --git a/website/versioned_docs/version-17.1.0/images/github.png b/website/versioned_docs/version-19.0.0/images/github.png similarity index 100% rename from website/versioned_docs/version-17.1.0/images/github.png rename to website/versioned_docs/version-19.0.0/images/github.png diff --git a/website/versioned_docs/version-17.1.0/images/gitlab.png b/website/versioned_docs/version-19.0.0/images/gitlab.png similarity index 100% rename from website/versioned_docs/version-17.1.0/images/gitlab.png rename to website/versioned_docs/version-19.0.0/images/gitlab.png diff --git a/website/versioned_docs/version-17.1.0/increase_paid_storage.md b/website/versioned_docs/version-19.0.0/increase_paid_storage.md similarity index 100% rename from website/versioned_docs/version-17.1.0/increase_paid_storage.md rename to website/versioned_docs/version-19.0.0/increase_paid_storage.md diff --git a/website/versioned_docs/version-17.1.0/inmemory_signer.md b/website/versioned_docs/version-19.0.0/inmemory_signer.md similarity index 93% rename from website/versioned_docs/version-17.1.0/inmemory_signer.md rename to website/versioned_docs/version-19.0.0/inmemory_signer.md index a80abd8cd5..503b949641 100644 --- a/website/versioned_docs/version-17.1.0/inmemory_signer.md +++ b/website/versioned_docs/version-19.0.0/inmemory_signer.md @@ -41,7 +41,7 @@ The `fromSecretKey` method takes a secret that is base58 encoded as a parameter. ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey('edsk2rKA8YEExg9Zo2qNPiQnnYheF1DhqjLVmfKdxiFfu5GyGRZRnb') .then((theSigner) => { @@ -58,7 +58,7 @@ InMemorySigner.fromSecretKey('edsk2rKA8YEExg9Zo2qNPiQnnYheF1DhqjLVmfKdxiFfu5GyGR ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey('spsk2Fiz7sGP5fNMJrokp6ynTa4bcFbsRhw58FHXbNf5ProDNFJ5Xq') .then((theSigner) => { @@ -78,7 +78,7 @@ When required, Taquito offers the `b58cencode` function allowing to encode the s // import { b58cencode, prefix, Prefix } from '@taquito/utils'; // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); const b58encodedSecret = b58cencode( '7c842c15c8b0c8fd228e6cb5302a50201f41642dd36b699003fb3c857920bc9d', @@ -119,7 +119,7 @@ Here are three examples with encrypted private keys where the passphrase used is ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey( 'edesk1GXwWmGjXiLHBKxGBxwmNvG21vKBh6FBxc4CyJ8adQQE2avP5vBB57ZUZ93Anm7i4k8RmsHaPzVAvpnHkFF', @@ -139,7 +139,7 @@ InMemorySigner.fromSecretKey( ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey( 'spesk24UQkAiJk8X6AufNtRv1WWPp2BAssEgmijCTQPMgUXweSKPmLdbyAjPmCG1pR2dC9P5UZZVeZcb7zVodUHZ', @@ -159,7 +159,7 @@ InMemorySigner.fromSecretKey( ```js live noInline // import { TezosToolkit } from '@taquito/taquito' // import { InMemorySigner } from '@taquito/signer' -// const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); InMemorySigner.fromSecretKey( 'p2esk28hoUE2J88QNFj2aDX2pjzL7wcVh2g8tkEwtWWguby9M3FHUgSbzvF2Sd7wQ4Kd8crFwvto6gF3otcBuo4T', @@ -188,15 +188,15 @@ With ed25519 default derivation path (Reminder Must be hardened with either h or ```js live noInline // import { TezosToolkit } from '@taquito/taquito // import { InMemorySigner } from '@taquito/signer' - // const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); - - // ed25519 must have all hardened paths - + // const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); + + // ed25519 must have all hardened paths + // using all default values password = '' curve = 'ed25519' and derivationPath "44'/1729'/0'/0'" const params = { mnemonic: 'author crumble medal dose ribbon permit ankle sport final hood shadow vessel horn hawk enter zebra prefer devote captain during fly found despair business' } - + const signer = InMemorySigner.fromMnemonic(params); Tezos.setSignerProvider(signer) @@ -212,7 +212,7 @@ With a non-default derivation path non-hardened with a tz2 address ```js live noInline // import { TezosToolkit } from '@taquito/taquito // import { InMemorySigner } from '@taquito/signer' - // const Tezos = new TezosToolkit('https://nairobinet.ecadinfra.com'); + // const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); const params = { mnemonic: 'author crumble medal dose ribbon permit ankle sport final hood shadow vessel horn hawk enter zebra prefer devote captain during fly found despair business', @@ -234,7 +234,7 @@ With a non-default derivation path non-hardened with a tz2 address ~~To load a faucet key (available from https://faucet.tzalpha.net/) for working a public testnet use the `importKey` function.~~ :::note -Since August 2022, the JSON faucets we used to import with the `importKey` function are no longer available. You can use the following link to fund an address on the different testnets: https://teztnets.xyz/. +Since August 2022, the JSON faucets we used to import with the `importKey` function are no longer available. You can use the following link to fund an address on the different testnets: https://teztnets.com/. ::: ### A simple factory multiple keys/wallets @@ -253,7 +253,7 @@ const signerFactory = async (rpcUrl: string, pk: string) => { }; const bob = await signerFactory('bobs_secret_key'); -const alice = await signerFactory('alices_secret_key'); +const alice = await signerFactory('alice_secret_key'); ``` [0]: https://signatory.io diff --git a/website/versioned_docs/version-17.1.0/lambda_view.md b/website/versioned_docs/version-19.0.0/lambda_view.md similarity index 100% rename from website/versioned_docs/version-17.1.0/lambda_view.md rename to website/versioned_docs/version-19.0.0/lambda_view.md diff --git a/website/versioned_docs/version-17.1.0/ledger_integration_test.md b/website/versioned_docs/version-19.0.0/ledger_integration_test.md similarity index 95% rename from website/versioned_docs/version-17.1.0/ledger_integration_test.md rename to website/versioned_docs/version-19.0.0/ledger_integration_test.md index 00b72a59df..fb84b95a54 100644 --- a/website/versioned_docs/version-17.1.0/ledger_integration_test.md +++ b/website/versioned_docs/version-19.0.0/ledger_integration_test.md @@ -1,5 +1,5 @@ --- -title: Ledger +title: Ledger tests author: Roxane Letourneau --- diff --git a/website/versioned_docs/version-17.1.0/ledger_signer.md b/website/versioned_docs/version-19.0.0/ledger_signer.md similarity index 96% rename from website/versioned_docs/version-17.1.0/ledger_signer.md rename to website/versioned_docs/version-19.0.0/ledger_signer.md index c5d0f6c4de..9a5dff3274 100644 --- a/website/versioned_docs/version-17.1.0/ledger_signer.md +++ b/website/versioned_docs/version-19.0.0/ledger_signer.md @@ -57,12 +57,12 @@ const ledgerSigner = new LedgerSigner(transport); The constructor of the `LedgerSigner` class can take three other parameters. If none are specified, the default values are used. -- path: **default value is "44'/1729'/0'/0'"** - You can use as a parameter the `HDPathTemplate` which refers to `44'/1729'/${account}'/0'`. You have to specify what is the index of the account you want to use. Or you can also use a complete path as a parameter. +- path: **default value is "44'/1729'/0'/0'"** + You can use as a parameter the `HDPathTemplate` which refers to `44'/1729'/${account}'/0'`. You have to specify what is the index of the account you want to use. Or you can also use a complete path as a parameter. _More details about paths below_ -- prompt: **default is true** +- prompt: **default is true** If true, you will be asked on your Ledger device to send your public key for validation. -- derivationType: **default is DerivationType.ED25519** +- derivationType: **default is DerivationType.ED25519** It can be DerivationType.ED25519 | DerivationType.BIP32_ED25519 (tz1), DerivationType.SECP256K1 (tz2) or DerivationType.P256 (tz3). ```js @@ -116,7 +116,7 @@ Tezos.contract console.log(`Waiting for ${op.hash} to be confirmed...`); return op.confirmation(1).then(() => op.hash); }) - .then((hash) => console.log(`Operation injected: https://jakarta.tzstats.com/${hash}`)) + .then((hash) => console.log(`Operation injected: https://ghost.tzstats.com/${hash}`)) .catch((error) => console.log(`Error: ${error} ${JSON.stringify(error, null, 2)}`)); ``` @@ -135,7 +135,7 @@ Tezos.wallet console.log(`Waiting for ${op.opHash} to be confirmed...`); return op.confirmation(1).then(() => op.opHash); }) - .then((hash) => console.log(`Operation injected: https://jakarta.tzstats.com/${hash}`)) + .then((hash) => console.log(`Operation injected: https://ghost.tzstats.com/${hash}`)) .catch((error) => console.log(`Error: ${error} ${JSON.stringify(error, null, 2)}`)); ``` @@ -162,7 +162,7 @@ Where `purpose` is a constant set to `44'` and `coin_type` is set to `1729'` for The path always begins with `44'/1729'` and we see some difference for the three other indexes across the Tezos ecosystem. We can notice that changing any number for the three last indexes of the path (`account' / change / address_index`) will lead to different accounts. **But, to ensure consistency, it is important trying to follow the same convention regarding the structure of the path and which index to increase to access the next address.** In Tezos, we generally see a slight difference in the path compared to the BIP44 specification. It is common to see path made of 4 indexes instead of 5 (default path being `44'/1729'/0'/0'` instead of `44'/1729'/0'/0'/0'`). For example, the default path used by tezos-client is `44'/1729'/0'/0'`. -Based on what is done by the Tezos-client, the default path used by Taquito in the `LedgerSigner` is also `44'/1729'/0'/0'`. Taquito offers a template for the path called `HDPathTemplate`. This template uses four indexes and suggests doing the iteration on the `account` index. +Based on what is done by the Tezos-client, the default path used by Taquito in the `LedgerSigner` is also `44'/1729'/0'/0'`. Taquito offers a template for the path called `HDPathTemplate`. This template uses four indexes and suggests doing the iteration on the `account` index. For example, you can use HDPathTemplate(0) (equivalent to `44'/1729'/0'/0'`) to access the first address, HDPathTemplate(1) equivalent to `44'/1729'/1'/0'`) to access the second address, HDPathTemplate(2) (equivalent to `44'/1729'/2'/0'`) to access the third address... _In order to meet the needs of each user, this template is not imposed by Taquito_. We can see other implementations that use `44'/1729'/0'/0'/0'`, where the next address is accessed by incrementing `account` or `address_index`. @@ -192,14 +192,14 @@ https://medium.com/mycrypto/wtf-is-a-derivation-path-c3493ca2eb52 ## Live example that iterates from the path `44'/1729'/0'/0'` to `44'/1729'/9'/0'` -Having your Ledger device connected to your computer and the `Tezos Wallet App` opened, you can run the following code example. It will scan your Ledger from path `44'/1729'/0'/0'` to `44'/1729'/9'/0'` to get public key hashes and the balance for revealed accounts. Confirmations will be asked on your Ledger to send the public keys. +Having your Ledger device connected to your computer and the `Tezos Wallet App` opened, you can run the following code example. It will scan your Ledger from path `44'/1729'/0'/0'` to `44'/1729'/9'/0'` to get public key hashes and the balance for revealed accounts. Confirmations will be asked on your Ledger to send the public keys. _Note that this example is not intended to be a complete example of paths scanning but only a rough outline of what it is possible to do._ ```js live noInline //import { LedgerSigner, DerivationType, HDPathTemplate } from '@taquito/ledger-signer'; //import { TezosToolkit } from '@taquito/taquito'; // import TransportWebHID from "@ledgerhq/hw-transport-webhid"; -//const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +//const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); TransportWebHID.create().then((transport) => { for (let index = 0, p = Promise.resolve(); index < 10; index++) { diff --git a/website/versioned_docs/version-17.1.0/liquidity_baking.md b/website/versioned_docs/version-19.0.0/liquidity_baking.md similarity index 100% rename from website/versioned_docs/version-17.1.0/liquidity_baking.md rename to website/versioned_docs/version-19.0.0/liquidity_baking.md diff --git a/website/versioned_docs/version-17.1.0/making_transfers.md b/website/versioned_docs/version-19.0.0/making_transfers.md similarity index 99% rename from website/versioned_docs/version-17.1.0/making_transfers.md rename to website/versioned_docs/version-19.0.0/making_transfers.md index 1ea6de0dc9..fdfbcf071e 100644 --- a/website/versioned_docs/version-17.1.0/making_transfers.md +++ b/website/versioned_docs/version-19.0.0/making_transfers.md @@ -1,5 +1,5 @@ --- -title: Transfers +title: Transfers (Transaction) author: Simon Boissonneault-Robert --- diff --git a/website/versioned_docs/version-17.1.0/manager_lambda.md b/website/versioned_docs/version-19.0.0/manager_lambda.md similarity index 100% rename from website/versioned_docs/version-17.1.0/manager_lambda.md rename to website/versioned_docs/version-19.0.0/manager_lambda.md diff --git a/website/versioned_docs/version-17.1.0/maps_bigmaps.md b/website/versioned_docs/version-19.0.0/maps_bigmaps.md similarity index 99% rename from website/versioned_docs/version-17.1.0/maps_bigmaps.md rename to website/versioned_docs/version-19.0.0/maps_bigmaps.md index 034134ded3..c8b16411bb 100644 --- a/website/versioned_docs/version-17.1.0/maps_bigmaps.md +++ b/website/versioned_docs/version-19.0.0/maps_bigmaps.md @@ -28,7 +28,7 @@ Michelson offers two variants of `Maps` that are semantically the same but have This example builds on the Ligo Lang Taco Shop learning resources. -The storage of the contract used in the following example is a map where a key is a natural number (a `nat`), and a value is a pair composed of two values representing the quantity of stock and `tez` tokens, respectively. The contract's source code is available [here](https://ligolang.org/docs/tutorials/get-started/tezos-taco-shop-smart-contract#making-sure-we-get-paid-for-our-tacos). In the example, the contract is originated with initial values using the `MichelsonMap` class' `set` method. +The storage of the contract used in the following example is a map where a key is a natural number (a `nat`), and a value is a pair composed of two values representing the quantity of stock and `tez` tokens, respectively. The contract's source code is available [here](https://ligolang.org/docs/tutorials/taco-shop/tezos-taco-shop-smart-contract/?lang=jsligo). In the example, the contract is originated with initial values using the `MichelsonMap` class' `set` method. Object({ id: val.int })}) -println(`Customised representation of the big_map value: ${JSON.stringify(dataCustom)}`); +println(`Customized representation of the big_map value: ${JSON.stringify(dataCustom)}`); ``` +--- +Here is an example for the `ticket` type: -Here is an example for the `ticket` type: - -```js live noInline +```js live noInline const schema = new Schema({"prim":"ticket","args":[{"prim":"string"}]}); const dataMichelson = {"prim":"Pair","args":[{"string":"KT1PVuv7af4VkPsZVZ8oZz9GSSdGnGBCbFWw"},{"string":"test"},{"int":"2"}]} @@ -380,7 +377,7 @@ const data = schema.Execute(dataMichelson) println(`Default representation of the ticket value returned by the Michelson Encoder: ${JSON.stringify(data, null, 2)}`); const dataCustom = schema.Execute(dataMichelson, { ticket: (val) => val.args[1].string}) -println(`Customised representation of the ticket value: ${JSON.stringify(dataCustom)}`); +println(`Customized representation of the ticket value: ${JSON.stringify(dataCustom)}`); ``` ### How the Schema class is used inside Taquito @@ -397,11 +394,11 @@ The `Schema` class is internally used in Taquito: ## The ParameterSchema class -The `ParameterSchema` class is used to represent the smart contract methods. This class is similar to the `Schema` class except that the `Encode` method expects flattened parameters instead of a javascript object. +The `ParameterSchema` class is used to represent the smart contract methods. This class is similar to the `Schema` class except that the `Encode` method expects flattened parameters instead of a javascript object where `encodeObject` method expects javascript object. -Here is an example: +Here is an example of `encode`: -```js live noInline +```js live noInline const parameterSchema = new ParameterSchema({"prim":"pair","args":[{"prim":"address","annots":[":spender"]},{"prim":"nat","annots":[":value"]}],"annots":["%approve"]}); const michelsonData = parameterSchema.Encode( 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', @@ -409,9 +406,130 @@ const michelsonData = parameterSchema.Encode( ) println(JSON.stringify(michelsonData, null, 2)); ``` +--- +Here is an example of `encodeObject`: +```js live noInline +const parameterSchema = new ParameterSchema({"prim":"pair","args":[{"prim":"address","annots":[":spender"]},{"prim":"nat","annots":[":value"]}],"annots":["%approve"]}); +const michelsonData = parameterSchema.EncodeObject({ + spender: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', + value: '12' +}) +println(JSON.stringify(michelsonData, null, 2)); +``` ### How the ParameterSchema class is used inside Taquito The `ParameterSchema` class is internally used in Taquito: - When we call a method, or a view of a contract using the `ContractAbstraction` class, the `Encode` method is used to transform the parameters into Michelson data. - In the `tzip16` package, when we execute a Michelson view, the `Encode` method is used to transform the parameters into Michelson data. + +## Flattening nested tokens (pair/union) + +In the Michelson language, we can have nested `pair`s or unions (`or`). For example, the following Michelson type is a nested `pair`: + +```js live noInline +const storageSchema = new Schema({ + prim: 'pair', + args: [ + { prim: 'nat', annots: [ '%stored_counter' ] }, + { + prim: 'pair', + args: [ + { prim: 'nat', annots: [ '%threshold' ] }, + { prim: 'list', args: [ { prim: 'key' } ], annots: [ '%keys' ] } + ] + } + ] +}); +const annotatedSchema = storageSchema.ExtractSchema(); +println(JSON.stringify(annotatedSchema, null, 2)); +``` +--- +We can also have a similar definition without the annotations: +```js live noInline +const storageSchema = new Schema({ + prim: 'pair', + args: [ + { prim: 'nat' }, + { + prim: 'pair', + args: [ + { prim: 'nat' }, + { prim: 'list', args: [ { prim: 'key' } ] } + ] + } + ] +}); +const noAnnotationsSchema = storageSchema.ExtractSchema(); +println(JSON.stringify(noAnnotationsSchema, null, 2)); +``` + +In Taquito, we will flatten these nested `pair`s to make it easier to use them in typescript dApps. Please note how the result of `generateSchema` is different in the annotated vs non-annotated cases: + +```js +//annotatedSchema: +{ + "stored_counter": "nat", + "threshold": "nat", + "keys": { + "list": "key" + } +} + +//noAnnotationsSchema: +{ + "0": "nat", + "1": "nat", + "2": { + "list": "key" + } +} +``` + +Here, Taquito developers have made two decisions: +1. The elements of the nested `pair`s are flattened into a single object. +2. The keys of the object are: + 1. the annotations, if they exist + 1. the index of the element otherwise. + +Formally speaking, the fields are the leaves of the three, ordered by traversing the tree (because we omit inner nodes of the tree, there is no difference between pre-order, in-order, or post-order traversal). +Also, in case you have a mixture of annotated and non-annotated fields, the fields numbers will keep increasing, even though annotated fields are named. + +```js live noInline +const storageSchema = new Schema({ + prim: 'pair', + args: [ + { prim: 'nat' }, + { + prim: 'pair', + args: [ + { prim: 'nat', annots: [ '%threshold' ] }, + { prim: 'list', args: [ { prim: 'key' } ] } + ] + } + ] +}); +const mixedSchema = storageSchema.ExtractSchema(); +println(JSON.stringify(mixedSchema, null, 2)); +``` + +### Unions +For unions (`or`), we flatten them similarly, so instead of having `left` and `right` to refer to fields, you use the field number or annotation. + +```js live noInline +const storageSchema = new Schema({ + prim: 'or', + args: [ + { prim: 'nat' }, + { + prim: 'or', + args: [ + { prim: 'nat', annots: [ '%threshold' ] }, + { prim: 'list', args: [ { prim: 'key' } ] } + ] + } + ] +}); +const mixedSchema = storageSchema.ExtractSchema(); +println(JSON.stringify(mixedSchema, null, 2)); +``` diff --git a/website/versioned_docs/version-17.1.0/michelsonmap.md b/website/versioned_docs/version-19.0.0/michelsonmap.md similarity index 100% rename from website/versioned_docs/version-17.1.0/michelsonmap.md rename to website/versioned_docs/version-19.0.0/michelsonmap.md diff --git a/website/versioned_docs/version-17.1.0/mobile_bundle.md b/website/versioned_docs/version-19.0.0/mobile_bundle.md similarity index 100% rename from website/versioned_docs/version-17.1.0/mobile_bundle.md rename to website/versioned_docs/version-19.0.0/mobile_bundle.md diff --git a/website/versioned_docs/version-17.1.0/multisig_doc.md b/website/versioned_docs/version-19.0.0/multisig_doc.md similarity index 100% rename from website/versioned_docs/version-17.1.0/multisig_doc.md rename to website/versioned_docs/version-19.0.0/multisig_doc.md diff --git a/website/versioned_docs/version-17.1.0/on_chain_views.md b/website/versioned_docs/version-19.0.0/on_chain_views.md similarity index 100% rename from website/versioned_docs/version-17.1.0/on_chain_views.md rename to website/versioned_docs/version-19.0.0/on_chain_views.md diff --git a/website/versioned_docs/version-19.0.0/operation_flow.md b/website/versioned_docs/version-19.0.0/operation_flow.md new file mode 100644 index 0000000000..f691deebf8 --- /dev/null +++ b/website/versioned_docs/version-19.0.0/operation_flow.md @@ -0,0 +1,146 @@ +--- +title: Operation Flow +id: operation_flow +author: Michael Kernaghan +--- + +# Taquito Operation Flow +Taquito makes injecting operations into the Tezos blockchain very simple. This can be accomplished by utilizing the Contract API, Wallet API, or the Batch API. + +## Contract API + +### What is the Contract API? +Taquito Contract API provides a simple way to interact with the Tezos blockchain. It provides methods and abstractions to prepare, forge, sign, and send operations to the Tezos blockchain, as well as interact with smart contracts. + +### Installing the Contract API +The Contract API is part of the `@taquito/taquito` package. To install it, run the following command: + +``` +npm install @taquito/taquito + +``` + +### Using the Contract API +The Contract API is exposed through the `contract` property of the `TezosToolkit` object. The `contract` property exposes methods that allow you to interact with smart contracts. + +Below is a quick example of how to use the `transaction` operation via the Contract API. + +```js +import { TezosToolkit } from '@taquito/taquito'; + +const Tezos = new TezosToolkit('RPC address here'); +const op = await Tezos.contract.transfer({ to: 'tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb', amount: 100 }); +await op.confirmation(); +``` + +## Wallet API +Aside from the Contract API, Taquito provides the ability for our users to interact with the Tezos blockchain via the Wallet API. The Wallet API is functionally similar to the Contract API, but it delegates several actions to the wallet (i.e. signing operations). + +### Installing the Wallet API +The Wallet API is part of the `@taquito/taquito` package, so the installation method is the exact same as the Contract API in the section above. + +Once you have installed the `@taquito/taquito` package into your project, however, you will need to install additional packages to use the Wallet API. + +We work closely with the Beacon team to provide a seamless integration with the Beacon wallet. To install the Beacon wallet, run the following command: + +``` +npm install @taquito/beacon-wallet + +``` + +Alternatively, you could also make use of the Temple wallet. To install the Temple wallet, run the following command in your project: + +``` +npm install @temple-wallet/dapp + +``` + +Keep in mind that some wallets may require additional configuration in order to work properly. For example, Temple wallets are accessible via a browser extension. + +### Using the Wallet API + +The Wallet API has a few nuances and can get pretty involved to get started and running. So we've provided a separate document with a more in-depth explanation of the Wallet API. You can find that document [here](./wallet_API.md). + + +## Batch API + +There might come a time where you would want to inject multiple operations at the same time. For example, you would like to transfer funds to multiple accounts at the same time. + +You might think to do something like this: +```typescript +/* + * ONE OF THESE TRANSACTIONS WILL FAIL + * AND YOU WILL GET AN ERROR MESSAGE + */ +const op1 = await contract.methods.interact('tezos').send(); +const op2 = await contract.methods.wait([['unit']]).send(); + +await op1.confirmation(); +await op2.confirmation(); + + +/* + * Error Message returned by the node (since Kathmandu): + * Error while applying operation opHash: + * Only one manager operation per manager per block allowed (found opHash2 with Xtez fee). + * + * Error Message that was returned by the node (before Kathmandu): + * "Error while applying operation opWH2nEcmmzUwK4T6agHg3bn9GDR7fW1ynqWL58AVRAb7aZFciD: + * branch refused (Error: + * Counter 1122148 already used for contract tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb (expected 1122149))" + */ +``` + +Doing something like this will result in an error message. This is because each Tezos account holds a counter that increments every time an operation is included in a block on the network. This feature prevents users from sending two or multiple transactions in a row. + + +Tracking the confirmation of transactions and the update of the transaction counter can be very frustrating and cumbersome, this is why Taquito provides the Batch API. The Batch API allows you to group all your transactions together and emit them at once under the same transaction counter value and the same transaction hash. + + +### Using the Batch API +For a more in-depth explanation of the Batch API, please refer to [this document](./batch-api.md). We provide examples and use cases that you can adopt into your own projects. + +## Customizing the Operation Flow +As developers, there might come a time when you would need to customize the flow of operations to suit your needs. For example, you would like to customize one of the steps in the flow, or you'd like to have just the prepared object and forge them independently. + +We provide a level of independence and customizability if you choose to do so, without using the Contract/Wallet API, the flow of operations would look something like this: + +### Preparing a Transaction Operation +```typescript +import { TezosToolkit } from '@taquito/taquito' +const Tezos = new TezosToolkit(RPC_URL); + +// The PrepareProvider returns a 'PreparedOperation' type object +const prepared = await Tezos.prepare.transaction({ + source: SOURCE_PKH, + to: DESTINATION_PKH, + amount: 5, + fee: +}); + +// The PreparedOperation type object needs to be converted into a forgeable type (ForgeParams) +const forgeable = await Tezos.prepare.toForge(prepared); +``` + +### Forging the Transaction Operation +```typescript +// Import the LocalForger +import { LocalForger } from '@taquito/local-forging'; + + +const forger = new LocalForger(); +const forgedBytes = await forger.forge(forgeable); +``` + +### Signing the Operation +After the transaction operation has been forged, it can be signed as such: +```typescript +const signed = await Tezos.signer.sign(forgedBytes, new Uint8Array([3])) +``` + +### Injecting the Operation +Finally after signing, you can inject your operation to the blockchain. + +```typescript +const op = await Tezos.rpc.injectOperation(signed.sbytes); +``` \ No newline at end of file diff --git a/website/versioned_docs/version-19.0.0/ophash_before_injecting.md b/website/versioned_docs/version-19.0.0/ophash_before_injecting.md new file mode 100644 index 0000000000..6b562bb0ac --- /dev/null +++ b/website/versioned_docs/version-19.0.0/ophash_before_injecting.md @@ -0,0 +1,49 @@ +--- +title: Getting the Operation Hash without Injecting +id: ophash_before_injecting +author: Davis Sawali +--- + +This section serves as a guide to get the operation hash without injecting it into the blockchain. + +## Getting the Operation Hash + +There might come a time when you, the developer, would like to grab the operation hash without injecting it into the blockchain. + +To accomplish that, we have a utility function called `encodeOpHash()` in the `@taquito/utils` package. This function takes in the signed operation bytes in the form of a `string`, and outputs the operation hash of said transaction without injecting it. + +### Usage example + +Here is a simple example on getting the operation hash of a transaction (transfer) operation: + +```js + +// import { TezosToolkit } from '@taquito/taquito'; +// import { encodeOpHash } from '@taquito/utils'; +// import { LocalForger } from '@taquito/local-forging'; + +// const Tezos = new TezosToolkit('RPC_ENDPOINT'); + +const preparedTransfer = await Tezos.prepare.transaction({ + amount: 1, + to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu' +}); + + +// convert prepared operation into a forgeable object +const forgeParams = await Tezos.prepare.toForge(preparedTransfer); + +// forge the transaction operation +const forger = new LocalForger(); +const forgedBytes = await forger.forge(forgeParams); + +// sign the transaction operation +const signedBytes = await Tezos.signer.sign(forgedBytes); + +// get the operation hash using the encodeOpHash() function +const opHash = encodeOpHash(signedBytes.sbytes, new Uint8Array([3])); + +``` + + + diff --git a/website/versioned_docs/version-17.1.0/originate.md b/website/versioned_docs/version-19.0.0/originate.md similarity index 92% rename from website/versioned_docs/version-17.1.0/originate.md rename to website/versioned_docs/version-19.0.0/originate.md index 16becd26cf..eebab219a3 100644 --- a/website/versioned_docs/version-17.1.0/originate.md +++ b/website/versioned_docs/version-19.0.0/originate.md @@ -35,7 +35,7 @@ This requires a signer to be configured, ie: ``` import { importKey } from '@taquito/signer'; import { TezosToolkit } from '@taquito/taquito'; -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); importKey(Tezos, "p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1") ``` @@ -45,11 +45,10 @@ importKey(Tezos, "p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1") ``` import { BeaconWallet } from '@taquito/beacon-wallet'; import { TezosToolkit } from '@taquito/taquito'; -const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); -const option = { name: "nameOfWallet" } +const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); +const option = { name: "nameOfWallet", network: { type: 'ghostnet' }} const wallet = new BeaconWallet(option) -const network = { type: "jakartanet" } -await wallet.requestPermissions({ network }) +await wallet.requestPermissions() Tezos.setWalletProvider(wallet) ``` @@ -68,7 +67,7 @@ This JavaScript object : keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'] } ``` -Is equivilent to this Michelson expression : +Is equivalent to this Michelson expression : ``` (Pair 0 (Pair 1 { "edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t" })) @@ -86,7 +85,7 @@ values={[ ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -115,7 +114,7 @@ Tezos.contract ```js live noInline wallet // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -157,7 +156,7 @@ values={[ ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -182,7 +181,7 @@ Tezos.contract ```js live noInline wallet // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -218,7 +217,7 @@ values={[ ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation @@ -255,7 +254,7 @@ Tezos.contract ```js live noInline wallet // import { TezosToolkit } from '@taquito/taquito'; -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); // const genericMultisigJSONfile = require('./generic.json') // generic.json is referring to Michelson source code in JSON representation diff --git a/website/versioned_docs/version-17.1.0/prepare.md b/website/versioned_docs/version-19.0.0/prepare.md similarity index 99% rename from website/versioned_docs/version-17.1.0/prepare.md rename to website/versioned_docs/version-19.0.0/prepare.md index 67b8c7014d..cbf20f8ad8 100644 --- a/website/versioned_docs/version-17.1.0/prepare.md +++ b/website/versioned_docs/version-19.0.0/prepare.md @@ -1,5 +1,5 @@ --- -title: Preparing Operations +title: Prepare Provider author: Davis Sawali --- diff --git a/website/versioned_docs/version-17.1.0/amendment_and_voting.md b/website/versioned_docs/version-19.0.0/proposal_and_ballot.md similarity index 97% rename from website/versioned_docs/version-17.1.0/amendment_and_voting.md rename to website/versioned_docs/version-19.0.0/proposal_and_ballot.md index 04ce697a79..7ce16dd751 100644 --- a/website/versioned_docs/version-17.1.0/amendment_and_voting.md +++ b/website/versioned_docs/version-19.0.0/proposal_and_ballot.md @@ -1,6 +1,6 @@ --- -title: Amendment and Voting -id: amendment_and_voting +title: Proposal & Ballot +id: proposal_and_ballot author: Davis Sawali --- diff --git a/website/versioned_docs/version-17.1.0/quick_start.md b/website/versioned_docs/version-19.0.0/quick_start.md similarity index 97% rename from website/versioned_docs/version-17.1.0/quick_start.md rename to website/versioned_docs/version-19.0.0/quick_start.md index 13f119c56f..2d2e0687e0 100644 --- a/website/versioned_docs/version-17.1.0/quick_start.md +++ b/website/versioned_docs/version-19.0.0/quick_start.md @@ -49,6 +49,8 @@ Tezos.setProvider({ }); ``` +Alternatively, you can use a `WalletProvider` to interact with a wallet. Please refer to the [Wallet API](wallet_API.md) documentation for more information. + ## Examples ### Get the current Tezos balance for an address @@ -84,7 +86,7 @@ Tezos.setProvider({ }); ``` -The following link can be used to fund an address on the different testnets: https://teztnets.xyz/. +The following link can be used to fund an address on the different testnets: https://teztnets.com/. ### Transfer diff --git a/website/versioned_docs/version-17.1.0/rpc-cache.md b/website/versioned_docs/version-19.0.0/rpc-cache.md similarity index 100% rename from website/versioned_docs/version-17.1.0/rpc-cache.md rename to website/versioned_docs/version-19.0.0/rpc-cache.md diff --git a/website/versioned_docs/version-17.1.0/rpc_nodes.md b/website/versioned_docs/version-19.0.0/rpc_nodes.md similarity index 78% rename from website/versioned_docs/version-17.1.0/rpc_nodes.md rename to website/versioned_docs/version-19.0.0/rpc_nodes.md index a81eef9c0b..6ce4048300 100644 --- a/website/versioned_docs/version-17.1.0/rpc_nodes.md +++ b/website/versioned_docs/version-19.0.0/rpc_nodes.md @@ -23,28 +23,25 @@ values={[ | Provider | Net | URL | Header | |------------------|--------------|------------------------------------------|---------------------------------------------------------------------------------| -| ECAD Labs | Mainnet | https://mainnet.ecadinfra.com | [Check](https://mainnet.ecadinfra.com/chains/main/blocks/head/header) | +| ECAD Labs | Mainnet | https://mainnet.ecadinfra.com | [Check](https://mainnet.ecadinfra.com/chains/main/blocks/head/header) | | ECAD Labs | Ghostnet | https://ghostnet.ecadinfra.com | [Check](https://ghostnet.ecadinfra.com/chains/main/blocks/head/header) | -| ECAD Labs | Nairobinet | https://nairobinet.ecadinfra.com | [Check](https://nairobinet.ecadinfra.com/chains/main/blocks/head/header) | -| ECAD Labs | Mumbainet | https://mumbainet.ecadinfra.com | [Check](https://mumbainet.ecadinfra.com/chains/main/blocks/head/header) | +| ECAD Labs | Oxfordnet | https://oxfordnet.ecadinfra.com | [Check](https://oxfordnet.ecadinfra.com/chains/main/blocks/head/header) | | 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) | | 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 | Nairobinet | https://nairobinet.tezos.marigold.dev/ | [Check](https://nairobinet.tezos.marigold.dev/chains/main/blocks/head/header) | -| Marigold | Mumbainet | https://mumbainet.tezos.marigold.dev/ | [Check](https://mumbainet.tezos.marigold.dev/chains/main/blocks/head/header) | -| TezTools | Mainnet | https://eu01-node.teztools.net/ | [Check](https://eu01-node.teztools.net/chains/main/blocks/head/header) | +| Marigold | Oxfordnet | https://oxfordnet.tezos.marigold.dev/ | [Check](https://oxfordnet.tezos.marigold.dev/chains/main/blocks/head/header) | *If you are aware of a public node missing from our list or our information is inaccurate, please help us by submitting an issue or pull request on our GitHub page.* -| Provider | Details | -|------------------|------------------------------------------------------------------------| -| MIDL.dev | https://midl.dev/tezos-rpc/ | -| TezTools.io | https://t.me/teztools (Telegram) | -| Exaion | https://node.exaion.com | +| Provider | Details | +|------------------|---------------------------------------------| +| TzPro | https://tzpro.io/ | +| MIDL.dev | https://midl.dev/tezos-rpc/ | +| Exaion | https://node.exaion.com | *If you are aware of a private node missing from our list or our information is inaccurate, please help us by submitting an issue or pull request on our GitHub page.* diff --git a/website/versioned_docs/version-19.0.0/rpc_nodes_integration_test.md b/website/versioned_docs/version-19.0.0/rpc_nodes_integration_test.md new file mode 100644 index 0000000000..97e1c8d17b --- /dev/null +++ b/website/versioned_docs/version-19.0.0/rpc_nodes_integration_test.md @@ -0,0 +1,113 @@ +--- +title: RPC tests +author: Roxane Letourneau +--- + +## Steps to run the tests + +1. The RPC nodes' integration tests are disabled by default. +Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json. + + **oxfordnet**: `npm run test:oxfordnet rpc-nodes.spec.ts` + +**When all endpoints are accessible for a node, you will obtain:** + +``` +Test calling all methods from RPC node: https://a-node + ✓ Verify that rpcClient.getBlockHash returns the head block hash (19 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (21 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (14 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (12 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (17 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (15 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (15 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (11 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (21 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (1090 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (16 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (1020 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (18 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (24 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (15 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (17 ms) + ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (14 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (25 ms) + ✓ Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block (19 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (10 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (39 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (11 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (11 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (13 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (10 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (11 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (2019 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (11 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (75 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (13 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (10 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (15 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (12 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (29 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (25 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (12 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (25 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (10 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (11 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (12 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (12 ms) + ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (10 ms) + ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (12 ms) + ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (250 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (683 ms) +``` + +**Otherwise, you will see which endpoints do not work for a specific node:** + +``` +Test calling all methods from RPC node: https://another-node + ✓ Verify that rpcClient.getBlockHash returns the head block hash (486 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (650 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (616 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (534 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (591 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (680 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (605 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (553 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (613 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (3074 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (674 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (612 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (513 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (549 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (516 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (1472 ms) + ✕ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (479 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (1487 ms) + ✕ Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block (539 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (615 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (1670 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (487 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (471 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (462 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (590 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (631 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (600 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (654 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (1585 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (771 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (671 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (614 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (1330 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (1149 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (1111 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (478 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (995 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (665 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (511 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (616 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (488 ms) + ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (486 ms) + ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (561 ms) + ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (1298 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (1060 ms) +``` \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/rpc_package.md b/website/versioned_docs/version-19.0.0/rpc_package.md similarity index 88% rename from website/versioned_docs/version-17.1.0/rpc_package.md rename to website/versioned_docs/version-19.0.0/rpc_package.md index fdab4086d4..3b7ee3109b 100644 --- a/website/versioned_docs/version-17.1.0/rpc_package.md +++ b/website/versioned_docs/version-19.0.0/rpc_package.md @@ -1,5 +1,5 @@ --- -title: RPC Package +title: RPC author: Claude Barde --- @@ -18,7 +18,7 @@ Methods in the RPC package map one-to-one to the corresponding Tezos RPC API end import { RpcClient } from '@taquito/rpc'; -const client = new RpcClient(' https://jakartanet.ecadinfra.com/', 'NetXLH1uAxK7CCh'); +const client = new RpcClient(' https://ghostnet.ecadinfra.com/', 'NetXLH1uAxK7CCh'); ``` The `RpcClient` constructor takes the URL of the node you want to use and the chain ID. @@ -31,7 +31,7 @@ const balance = await client.getBalance('tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb'); console.log('-- Balance:', balance.toNumber()); ``` -The balance is returned as a `BigNumber` and must be converted to a number to output it. +The balance is returned as a `BigNumber` and must be converted to a number to output it. Please note that the returned value is in mutez (micro ꜩ), so if you need the balance in ꜩ, you can divide it by 1000000. ```js // gets head block @@ -96,7 +96,7 @@ const packedData = await client.packData({ data: { string: 'test' }, type: { pri console.log('-- Packed data:', packedData); ``` -You can simulate the `PACK` instruction from Michelson with the `packData` method. +You can simulate the `PACK` instruction from Michelson with the `packData` method. This function will execute Tzip4 views normally referred to as 'Lambda Views'. You can learn more about Tzip4 [here](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints) ```js @@ -111,17 +111,6 @@ const view = await client.runView({ }); ``` -You can obtain the `Origination Proof` for the `smart_rollup_originate` batch operation (not needed for the `smart_rollup_originate` alone) - -This function will obtain the proof needed for the `smart_rollup_originate` batch method -```js -const originationProof = await client.getOriginationProof({ - kernel: 'your kernel', - kind: 'PVM kind' -}) -``` - - ## Full documentation You can find the full documentation at the following address: [https://tezostaquito.io/typedoc/classes/\_taquito_rpc.rpcclient.html](https://tezostaquito.io/typedoc/classes/_taquito_rpc.rpcclient.html) diff --git a/website/versioned_docs/version-17.1.0/sapling.md b/website/versioned_docs/version-19.0.0/sapling.md similarity index 100% rename from website/versioned_docs/version-17.1.0/sapling.md rename to website/versioned_docs/version-19.0.0/sapling.md diff --git a/website/versioned_docs/version-17.1.0/sapling_in_memory_spending_key.md b/website/versioned_docs/version-19.0.0/sapling_in_memory_spending_key.md similarity index 100% rename from website/versioned_docs/version-17.1.0/sapling_in_memory_spending_key.md rename to website/versioned_docs/version-19.0.0/sapling_in_memory_spending_key.md diff --git a/website/versioned_docs/version-17.1.0/sapling_in_memory_viewing_key.md b/website/versioned_docs/version-19.0.0/sapling_in_memory_viewing_key.md similarity index 100% rename from website/versioned_docs/version-17.1.0/sapling_in_memory_viewing_key.md rename to website/versioned_docs/version-19.0.0/sapling_in_memory_viewing_key.md diff --git a/website/versioned_docs/version-17.1.0/set_delegate.md b/website/versioned_docs/version-19.0.0/set_delegate.md similarity index 100% rename from website/versioned_docs/version-17.1.0/set_delegate.md rename to website/versioned_docs/version-19.0.0/set_delegate.md diff --git a/website/versioned_docs/version-17.1.0/signing.md b/website/versioned_docs/version-19.0.0/signing.md similarity index 100% rename from website/versioned_docs/version-17.1.0/signing.md rename to website/versioned_docs/version-19.0.0/signing.md diff --git a/website/versioned_docs/version-17.1.0/smart_rollups.md b/website/versioned_docs/version-19.0.0/smart_rollups.md similarity index 85% rename from website/versioned_docs/version-17.1.0/smart_rollups.md rename to website/versioned_docs/version-19.0.0/smart_rollups.md index efb75fd3dd..1a8e990556 100644 --- a/website/versioned_docs/version-17.1.0/smart_rollups.md +++ b/website/versioned_docs/version-19.0.0/smart_rollups.md @@ -1,13 +1,13 @@ --- title: Smart Rollups -author: Davis Sawali +author: Davis Sawali --- # Smart Optimistic Rollups Rollups are a permissionless scaling implementation for the Tezos blockchain. The idea is that anyone can originate and operate one or more rollups, increasing the overall throughput of the Tezos blockchain. -In Taquito, we have implemented some of the operations included in Mumbai protocol update in regards to smart rollups. In this document, we will go through the operations we support. We also won't go too detailed on how rollups work behind the scenes, if you'd like to understand the feature a bit deeper, you can refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html). +In Taquito, we have implemented some of the operations included in Mumbai protocol update in regards to smart rollups. In this document, we will go through the operations we support. We also won't go too detailed on how rollups work behind the scenes, if you'd like to understand the feature a bit deeper, you can refer to [this document](https://tezos.gitlab.io/active/smart_rollups.html). ## `smart_rollup_originate` @@ -27,11 +27,10 @@ await op.confirmation(); ##### please note - `pvmKind` at this time the only PVM supported is `wasm_2_0_0` -- `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) -- `parametersType` is a MichelsonV1Expression to define the type. -- **Please note** `originationProof` is needed origination in `batch` which can be obtained with the `rpc.getOriginationProof({kernel, kind: PVMKind})` +- `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/active/smart_rollups.html) +- `parametersType` is a MichelsonV1Expression to define the type. -For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) +For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/active/smart_rollups.html#origination) ## `smart_rollup_add_messages` @@ -43,15 +42,15 @@ The main use case of sending messages, is usually to denote contract calls. Thes MESSAGE='[{\ "destination" : "${CONTRACT}", \ "parameters" : "\"Hello world\"", \ - "entrypoint" : "default" + "entrypoint" : "default" }]' -``` +``` If you read closely, the message includes a `destination`, a `parameter`, and an `entrypoint` property. All components needed to **call an entrypoint** of a contract. These messages can then be claimed back into L1 as a legitimate contract call using the `smart_rollup_execute_outbox_message` operation which we will go over in another section of this doc. -for more information, refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html#sending-an-external-inbox-message) +for more information, refer to [this document](https://tezos.gitlab.io/active/smart_rollups.html#external-messages) ### Example ```typescript @@ -64,4 +63,4 @@ const op = await Tezos.contract.smartRollupAddMessages({ await op.confirmation(); ``` -- `message` property receives an array of encoded outbox messages. For more information on how to encode or what message gets encoded, refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html#sending-an-external-inbox-message) +- `message` property receives an array of encoded outbox messages. For more information on how to encode or what message gets encoded \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/smartcontracts.md b/website/versioned_docs/version-19.0.0/smartcontracts.md similarity index 93% rename from website/versioned_docs/version-17.1.0/smartcontracts.md rename to website/versioned_docs/version-19.0.0/smartcontracts.md index 572d0cfe9f..c3e47c61db 100644 --- a/website/versioned_docs/version-17.1.0/smartcontracts.md +++ b/website/versioned_docs/version-19.0.0/smartcontracts.md @@ -26,34 +26,24 @@ The counter contract has two entry points named `increment` and `decrement.` Taq The counter contract's storage is a simple integer that gets increased or decreased based on the calls to the entrypoints. -### Counter Contract in JSLIGO +### Counter Contract in JSLIGO v1.2.0 ``` -type storage = int; - -type parameter = -| ["Increment", int] -| ["Decrement", int] -| ["Reset"]; - -type return_ = [list , storage]; - -/* Two entrypoints */ -const add = ([store, delta] : [storage, int]) : storage => store + delta; -const sub = ([store, delta] : [storage, int]) : storage => store - delta; - -/* Main access point that dispatches to the entrypoints according to - the smart contract parameter. */ -const main = ([action, store] : [parameter, storage]) : return_ => { - return [ - (list([]) as list ), // No operations - (match (action, { - Increment: (n: int) => add ([store, n]), - Decrement: (n: int) => sub ([store, n]), - Reset: () => 0})) - ] -}; +export namespace Counter { + export type storage = int; + type ret = [list, storage]; + + // Three entrypoints + + @entry + const increment = (delta : int, store : storage) : ret => [list([]), store + delta]; + @entry + const decrement = (delta : int, store : storage) : ret => [list([]), store - delta]; + + @entry + const reset = (_u : unit, _s : storage) : ret => [list([]), 0]; +}; ``` You can view this contract and deploy it to a testnet using the [Ligo WebIDE][2] @@ -61,10 +51,10 @@ You can view this contract and deploy it to a testnet using the [Ligo WebIDE][2] ### Counter Contract Michelson source code ``` -{ parameter (or (or (int %decrement) (int %increment)) (unit %reset)) ; +{ parameter (or (unit %reset) (or (int %decrement) (int %increment))) ; storage int ; code { UNPAIR ; - IF_LEFT { IF_LEFT { SWAP ; SUB } { ADD } } { DROP 2 ; PUSH int 0 } ; + IF_LEFT { DROP 2 ; PUSH int 0 } { IF_LEFT { SWAP ; SUB } { ADD } } ; NIL operation ; PAIR } } ``` diff --git a/website/versioned_docs/version-17.1.0/storage_annotations.md b/website/versioned_docs/version-19.0.0/storage_annotations.md similarity index 92% rename from website/versioned_docs/version-17.1.0/storage_annotations.md rename to website/versioned_docs/version-19.0.0/storage_annotations.md index 6763d67634..998103c9ac 100644 --- a/website/versioned_docs/version-17.1.0/storage_annotations.md +++ b/website/versioned_docs/version-19.0.0/storage_annotations.md @@ -36,7 +36,7 @@ values={[ ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.contract .originate({ @@ -62,7 +62,7 @@ Tezos.contract ```js live noInline wallet -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.wallet .originate({ @@ -84,7 +84,7 @@ Tezos.wallet println(`Origination completed.`); }) .catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); -``` +``` @@ -111,7 +111,7 @@ values={[ ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.contract .originate({ @@ -137,7 +137,7 @@ Tezos.contract ```js live noInline wallet -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.wallet .originate({ @@ -159,7 +159,7 @@ Tezos.wallet println(`Origination completed.`); }) .catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); -``` +``` @@ -188,7 +188,7 @@ values={[ ```js live noInline -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.contract .originate({ @@ -215,7 +215,7 @@ Tezos.contract ```js live noInline wallet -// const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); +// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); Tezos.wallet .originate({ @@ -237,6 +237,6 @@ Tezos.wallet println(`Origination completed.`); }) .catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); -``` +``` \ No newline at end of file diff --git a/website/versioned_docs/version-19.0.0/taquito_utils.md b/website/versioned_docs/version-19.0.0/taquito_utils.md new file mode 100644 index 0000000000..236ac867ab --- /dev/null +++ b/website/versioned_docs/version-19.0.0/taquito_utils.md @@ -0,0 +1,212 @@ +--- +title: Taquito Utils +author: Davis Sawali & Roxane Letourneau +--- + +## Description +The `@taquito/utils` package provides developers with utility functions in Taquito. + +You can find a full list of available utility functions in Taquito [here](https://tezostaquito.io/typedoc/modules/_taquito_utils.html) + +## Usage Example +To use the functions, simply import the function you need as such: + +```js +import { getPkhfromPk, b58cencode, b58cdecode } from '@taquito/utils'; + +const publicKeyHash = getPkhfromPk('replace_with_publickey'); +const encoded = b58cencode('replace_with_publickey'); +``` + +## Using Validation Functions from `@taquito/utils` + +Taquito provides functions that allow us to see if an address, a chain, a key hash, a contract address, a public key, or a signature is valid. Note that these validations do not rely on a node but are done based on checksums. Thus, they allow us to check if a value is valid and not if it exists on a chain. The `ValidationResult` returned by these functions is an enum that can take the following values: + +``` +0 = NO_PREFIX_MATCHED, +1 = INVALID_CHECKSUM, +2 = INVALID_LENGTH, +3 = VALID +``` + +### Validate an address + +#### The `validateAddress` function + +This function can be used to validate implicit addresses (tz1, tz2, tz3) and originated addresses (KT1). + +In the following example, the function is first called with a valid public key hash (pkh). It is then called with the same pkh where one character differs (e.g. 'p' instead of 'P'), which results in an invalid checksum. + +```js live noInline +import { validateAddress } from '@taquito/utils'; + +//valid +const pkh = 'tz1L9r8mWmRPndRhuvMCWESLGSVeFzQ9NAWx'; +const validation = validateAddress(pkh); +println(`Calling the validateAddress function with ${pkh} returns ${validation}.`); + +//invalid checksum +const invalidPkh = 'tz1L9r8mWmRpndRhuvMCWESLGSVeFzQ9NAWx'; +const invalidValidation = validateAddress(invalidPkh); +println(`Calling the validateAddress function with ${invalidPkh} returns ${invalidValidation}.`); +``` + +#### The `validateKeyHash` function + +This function is used to validate implicit addresses (tz1, tz2, tz3). + +Here is a valid example with a pkh and an invalid one where the prefix is missing : + +```js live noInline +import { validateKeyHash } from '@taquito/utils'; + +//valid +const keyHash = 'tz1L9r8mWmRPndRhuvMCWESLGSVeFzQ9NAWx'; +const validation = validateKeyHash(keyHash); +println(`Calling the validateKeyHash function with ${keyHash} returns ${validation}.`); + +//invalid prefix +const keyHashWithoutPrefix = 'L9r8mWmRPndRhuvMCWESLGSVeFzQ9NAWx'; +const invalidValidation = validateKeyHash(keyHashWithoutPrefix); +println(`Calling the validateKeyHash function with ${keyHash} returns ${invalidValidation}.`); +``` + +#### The `validateContractAddress` function + +This function is used to validate originated addresses (KT1). + +Here is a valid example with the address of an existing contract : + +```js live noInline +import { validateContractAddress } from '@taquito/utils'; + +//valid +const contractAddress = 'KT1AfxAKKLnEg6rQ6kHdvCWwagjSaxEwURSJ'; +const validation = validateContractAddress(contractAddress); +println(`Calling the validateContractAddress function with ${contractAddress} returns ${validation}.`); +``` + +### Validate a chain + +The `validateChain` function is used to validate a chain id. + +The following example shows a valid result when using the mainnet chain id and an invalid result if the prefix is missing : + +```js live noInline +import { validateChain } from '@taquito/utils'; + +//valid +const chainId = 'NetXdQprcVkpaWU'; +const validation = validateChain(chainId); +println(`Calling the validateChain function with ${chainId} returns ${validation}.`); + +//invalid prefix +const chainIdWithoutPrefix = 'XdQprcVkpaWU'; +const invalidValidation = validateChain(chainIdWithoutPrefix); +println(`Calling the validateChain function with ${chainIdWithoutPrefix} returns ${invalidValidation}.`); +``` + +### Validate a public key + +The `validatePublicKey` is used to check if a public key is valid. + +```js live noInline +import { validatePublicKey } from '@taquito/utils'; + +//valid +const publicKey = 'edpkvS5QFv7KRGfa3b87gg9DBpxSm3NpSwnjhUjNBQrRUUR66F7C9g'; +const validation = validatePublicKey(publicKey); +println(`Calling the validatePublicKey function with ${publicKey} returns ${validation}.`); + +//invalid prefix +const value = 'tz1L9r8mWmRPndRhuvMCWESLGSVeFzQ9NAWx'; +const invalidValidation = validatePublicKey(value); +println(`Calling the validatePublicKey function with ${value} returns ${invalidValidation}.`); +``` + +### Validate a signature + +The `validateSignature` function is used to check if a signature is valid. + +```js live noInline +import { validateSignature } from '@taquito/utils'; + +//valid +const signature = 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg'; +const validation = validateSignature(signature); +println(`Calling the validateSignature function with ${signature} returns ${validation}.`); + +//invalid checksum +const invalidSignature = 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuM'; +const invalidValidation = validateSignature(invalidSignature); +println(`Calling the validateSignature function with ${invalidSignature} returns ${invalidValidation}.`); +``` + +### Validate a Block Hash + +The `validateBlock` function is used to check whether a block hash is valid. + +```js live noInline +import { validateBlock } from '@taquito/utils'; + +//valid +const block ='BLJjnzaPtSsxykZ9pLTFLSfsKuiN3z7SjSPDPWwbE4Q68u5EpBw'; +const validation = validateBlock(block); +println(`Calling the validateBlock function with ${block} returns ${validation}.`); + +//invalid checksum +const invalidBlock ='BMEdgRZbJJrtByoA5Jyuvy8mzp8mefbcrno82nQCAEbBCUhog'; +const invalidValidation = validateBlock(invalidBlock); +println(`Calling the validateBlock function with ${invalidBlock} returns ${invalidValidation}.`); +``` +### Validate an Operation Hash + +The `validateOperation` function is used to check whether an operation hash is valid. + +```js live noInline +import { validateOperation } from '@taquito/utils'; + +//valid +const operation ='ood2Y1FLHH9izvYghVcDGGAkvJFo1CgSEjPfWvGsaz3qypCmeUj'; +const validation = validateOperation(operation); +println(`Calling the validateOperation function with ${operation} returns ${validation}.`); + +//invalid checksum +const invalidOperation ='ont3n75kMA2xeoTdxkGM23h5XhWgyP51WEznc4zCDtGNz1TWSz'; +const invalidValidation = validateOperation(invalidOperation); +println(`Calling the validateOperation function with ${invalidOperation} returns ${invalidValidation}.`); +``` +### Validate a Protocol Hash + +The `validateProtocol` function is used to check whether a protocol hash is valid. + +```js live noInline +import { validateProtocol } from '@taquito/utils'; + +//valid +const protocol ='PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx'; +const validation = validateProtocol(protocol); +println(`Calling the validateProtocol function with ${protocol} returns ${validation}.`); + +//invalid checksum +const invalidProtocol ='PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95b3m53QJiXGmrbU'; +const invalidValidation = validateProtocol(invalidProtocol); +println(`Calling the validateProtocol function with ${invalidProtocol} returns ${invalidValidation}.`); +``` + +# Verification of a signature + +Taquito provides a function named `verifySignature` that allows verifying signatures of payloads. The function takes a message, a public key, and a signature as parameters and returns a boolean indicating if the signature matches. + +Here is an example of a successful verification: + +```js live noInline +import { verifySignature } from '@taquito/utils'; + +const message = '03d0c10e3ed11d7c6e3357f6ef335bab9e8f2bd54d0ce20c482e241191a6e4b8ce6c01be917311d9ac46959750e405d57e268e2ed9e174a80794fbd504e12a4a000141eb3781afed2f69679ff2bbe1c5375950b0e40d00ff000000005e05050505050507070100000024747a32526773486e74516b72794670707352466261313652546656503539684b72654a4d07070100000024747a315a6672455263414c42776d4171776f6e525859565142445439426a4e6a42484a750001'; +const pk = 'sppk7c7hkPj47yjYFEHX85q46sFJGw6RBrqoVSHwAJAT4e14KJwzoey'; +const sig = 'spsig1cdLkp1RLgUHAp13aRFkZ6MQDPp7xCnjAExGL3MBSdMDmT6JgQSX8cufyDgJRM3sinFtiCzLbsyP6d365EHoNevxhT47nx' + +const isValid = verifySignature(message, pk, sig); +println(isValid); +``` diff --git a/website/versioned_docs/version-17.1.0/testing_strategies.md b/website/versioned_docs/version-19.0.0/testing_strategies.md similarity index 96% rename from website/versioned_docs/version-17.1.0/testing_strategies.md rename to website/versioned_docs/version-19.0.0/testing_strategies.md index a667b1aa82..c9149b19a0 100644 --- a/website/versioned_docs/version-17.1.0/testing_strategies.md +++ b/website/versioned_docs/version-19.0.0/testing_strategies.md @@ -3,24 +3,24 @@ title: Taquito Testing Strategies id: testing_strategies author: Michael Kernaghan --- - + ### How Taquito is Tested - + #### General Philosophy - + We write and maintain tests so that we may check that the software we create will do what we think it should do and alert us when it doesn’t. This link offers more detail on software testing philosophy in general: https://www.codesimplicity.com/post/the-philosophy-of-testing/. - + #### Assumptions - + Taquito is a library. It offers tools. To test that Taquito is suitable for use, we must ensure that each tool the library provides does what it is supposed to. We also need to check that changes to support new features have not broken old features. - + We use the following Test Heuristics to achieve these assurance goals. Taquito uses several of these in the CI/CD pipeline. - + ### Unit Tests - + Unit Tests are detailed tests of simple software components at the atomic level. Taquito includes unit tests in each of its packages. Here is an example: - + ```javascript it('Public key returned by ledger device should be compressed adequately for tz1 before b58 encoding', () => { const buff = Buffer.from( @@ -34,17 +34,17 @@ Unit Tests are detailed tests of simple software components at the atomic level. ); }); ``` - + Sometimes a Unit Test will use a Mock to simulate interactions between the software and some external component. We measure how comprehensive our unit test coverage is by running "test code coverage tools" that report on the lines of code that are not touched when running unit tests. We can verify that unit tests are effecctive with "mutation testing" described below. - + ### Integration Tests Integration Tests look to ensure that multiple software components are working together. These components might be created by different teams or run on separate machines. The integration of various components can make these tests susceptible to random failures, but they will be rerun until they pass. Taquito testing routinely runs hundreds of integration tests daily. - + Here is a simple example of an integration test. The test sends Taquito instructions to a live test node with the transactions processed on the blockchain. This test originates a contract on the chain with transfers and verifies that confirmation is received. - + ```javascript - it('Simple transfers with origination', async (done) => { + it('Simple transfers with origination', async () => { const batch = await Tezos.batch() .withTransfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 }) .withTransfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 }) @@ -54,32 +54,31 @@ Here is a simple example of an integration test. The test sends Taquito instruct code: ligoSample, storage: 0, }) - + const op = await batch.send(); await op.confirmation(); expect(op.status).toEqual('applied') - done(); }) ``` - + ### Code Reviews - + We do Code Reviews whenever a developer seeks to merge code. Other team members review it for correctness, accuracy, conformance with Taquito design overall, and suitability. This process will rapidly find problems that testing would either miss or take wasteful cycles to resolve. We will not merge code changes or new features unless they have been code reviewed and all requested changes are determined. - + ### Static Code Analysis - + Static Code Analysis is run during the CICD cycle to do syntactic checks for errors in the code. Often a line marking a merge conflict or a violation of a coding format will cause a static analyzer to complain. During a CICD run, a Pull Request will be examined by [CodeQL](https://codeql.github.com/) and [Snyk](https://snyk.io/). - + ### End-to-End Tests - + Taquito uses the Taquito Test Dapp and the Live Code examples in the documentation as end-to-end tests. The tests exercise the entire software stack between the blockchain node and the user-facing interface. These tests show that all the components are working together. At each Taquito release, these tests are checked, and the results are included in the release. - + ### Mutation Tests - + Mutation testing is a way to verify the effectiveness of unit tests. In addition to the code coverage of unit tests, we can check that the tests are resilient against all sorts of code changes. We all understand the intuition that if you change some code and no test fails, then the tests are missing something. Mutation testing tools allow us to implement this intuition and find missed test cases, confusing tests, missing assertions, etc. Taquito has been using Stryker to identify test mutations and systematically remove them from the code base. For details on how mutation testing works, please see: https://stryker-mutator.io/docs/. - + ### Manual Tests - + When a user raises an issue, Testers will verify the problem using manual methods. For Taquito, such testing could be: a quick Taquito script, checking a result with tezos-client, @@ -88,23 +87,23 @@ rerunning scripts with variations each time, or other exploratory activities around the code base that are not fully scripted tests in the CICD. Ledger Devices require manual testing as they have buttons that an operator must press to authorize signatures and transactions. There are emulators for Ledger Devices, but Taquito testing of ledger devices combines manual and scripted exploratory testing. - + ### Security Tests - + Taquito has implemented some security tests in its integration test suite. These tests check for regressions in the Tezos code that could open known attack techniques. The tests verify that a particular attack is impossible and that appropriate error messaging and exceptions occur when the tests try some well-known attacks. - + ### Performance - + Ecad DevOps maintains an extensive performance tracking monitoring setup using Loki and Grafana, which generates alerts when specific performance parameters are out of band. - + ## Managing Tezos Protocol Migrations with Test Nets - + Each time Tezos changes protocol, there is a new test net, and old ones are deprecated. Contracts originated in a more senior test net must be originated again on the new testnet. We have to update RPC content values and recreate Live Code Example contracts. So each protocol change requires an overhaul of some of the test assets to suit the new protocol. - -The Taquito test suite will run tests in CICD against the current and next test net. There is also testing of “Mondaynet,” which represents the bleeding edge of the available Tezos test code. - + +The Taquito test suite will run tests in CICD against the current and next test net. There is also testing of “Weeklynet,” which represents the bleeding edge of the available Tezos test code. + ECAD Devops maintains a suite of Tezos public nodes that the Tezos community can use. By supporting and monitoring these nodes, ECAD engineers have an overview and insights into the behaviour of these systems and can contribute to problem isolation, bug fixes and general troubleshooting; or specific test scenarios that require DevOps level node access. - -### Mondaynet and Daily net - -To keep up with the current changes proposed for the following Tezos protocol, we can run our integration test suite against the node called "Mondaynet." This node captures the head of the Tezos development branch each Monday. By regression testing this node, we can ascertain changes Taquito may need to make early in the protocol development process. There is also "Daily net," which offers the current Tezos branch head each day. \ No newline at end of file + +### Weeklynet and Daily net + +To keep up with the current changes proposed for the following Tezos protocol, we can run our integration test suite against the node called "Weeklynet." This node captures the head of the Tezos development branch each Monday. By regression testing this node, we can ascertain changes Taquito may need to make early in the protocol development process. There is also "Daily net," which offers the current Tezos branch head each day. \ No newline at end of file diff --git a/website/versioned_docs/version-17.1.0/tezbridge_signer.md b/website/versioned_docs/version-19.0.0/tezbridge_signer.md similarity index 100% rename from website/versioned_docs/version-17.1.0/tezbridge_signer.md rename to website/versioned_docs/version-19.0.0/tezbridge_signer.md diff --git a/website/versioned_docs/version-17.1.0/tezos_domains.md b/website/versioned_docs/version-19.0.0/tezos_domains.md similarity index 100% rename from website/versioned_docs/version-17.1.0/tezos_domains.md rename to website/versioned_docs/version-19.0.0/tezos_domains.md diff --git a/website/versioned_docs/version-17.1.0/tickets.md b/website/versioned_docs/version-19.0.0/tickets.md similarity index 100% rename from website/versioned_docs/version-17.1.0/tickets.md rename to website/versioned_docs/version-19.0.0/tickets.md diff --git a/website/versioned_docs/version-17.1.0/transaction_limits.md b/website/versioned_docs/version-19.0.0/transaction_limits.md similarity index 100% rename from website/versioned_docs/version-17.1.0/transaction_limits.md rename to website/versioned_docs/version-19.0.0/transaction_limits.md diff --git a/website/versioned_docs/version-19.0.0/tutorial.md b/website/versioned_docs/version-19.0.0/tutorial.md new file mode 100644 index 0000000000..226c5eb002 --- /dev/null +++ b/website/versioned_docs/version-19.0.0/tutorial.md @@ -0,0 +1,677 @@ +--- +title: 🧑‍🏫 Tutorial +id: tutorial +author: Alireza Haghshenas +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Introduction + +In this tutorial, we will walk through the process of creating a simple dApp (short for "Decentralized Application") using Taquito. We will: + +1. Create a simple command-line application that reads the balance of an address from the blockchain +1. Establish a high-level understanding of the blockchain, Tezos, dApps, and Taquito +1. Send a `Transfer` operation to the blockchain using Taquito +1. Interact with a smart contract using Taquito +1. Implement a simple GUI dApp + +## Prerequisites + +### Prior knowledge + +In order to follow this tutorial, you need to have some understanding about the following concepts: +- Basic knowledge of JavaScript and programming in general +- A high-level understanding of blockchain technology and ecosystem (we will also cover this briefly in the tutorial) + +### Development machine + +We need a development machine with the following software installed: +- [Node.js](https://nodejs.org): one of the current versions (LTS recommended) +- A code editor like VS Code, or any other editor of your choice +- Optionally: docker (for creating your own key pair) + +This tutorial should work on Windows, Linux, and macOS. On other systems like a Chromebook or a tablet, you might need additional setup not covered in the tutorial. + +:::info +If you are using windows, there are two ways to run the commands in this tutorial: inside a WSL2 terminal, or inside the PowerShell. Generally, WSL2 is recommended for programming. But if you prefer, you can still use PowerShell. If you use WSL2, you can use the same commands as Linux. For PowerShell, we will provide commands in a separate tab **only when they are different from Linux**. +::: + +## Let's start with a simple command-line application {#start-coding} + +In this section, we will create a simple command-line application that shows the balance of an address. This will help us understand the basics of Taquito and the flow of events in a dApp. + +Open a terminal and run the following commands: + + + + +```bash +mkdir my-cli-dapp +cd my-cli-dapp + +npm init -y +npm i -D typescript ts-node +``` + + + + +```bash +md my-cli-dapp +cd my-cli-dapp + +npm init -y +npm i -D typescript ts-node +``` + + + +Then, create a file named `index.ts` in the folder `my-cli-dapp` and add the following code: + +```ts +console.log("Hello Blockchain!"); +``` + +Now, run the following command in the terminal: + +```bash +npx ts-node index.ts +``` + +If everything is done right, you should be able to see the output `Hello Blockchain!` in the terminal. +Now, we can start using Taquito to interact with the Tezos blockchain. +Run the following command to install Taquito: + +```bash +npm i @taquito/taquito +``` + +Now, open the file `index.ts` and replace the code with the following: + +```ts +import { TezosToolkit } from "@taquito/taquito"; + +var tezosToolkit = new TezosToolkit("https://ghostnet.ecadinfra.com"); + +tezosToolkit.tz.getBalance("tz1YvE7Sfo92ueEPEdZceNWd5MWNeMNSt16L").then(balance => { + console.log(balance.toNumber()); +}); +``` + +Running `npx ts-node index.ts` should now show the balance of the specified address. This balance is in units of Mutez (micro Tez). Tez is the currency of Tezos, its code is `XTZ`, and the symbol is `ꜩ`. 1 Tez is 1,000,000 Mutez. + +Congratulations! You have just interacted with the Tezos blockchain using Taquito. In the next section, we will establish a high-level understanding of the blockchain, Tezos, dApps, and Taquito. If you are already familiar with these concepts, you can skip to [Sending a Transfer operation to the blockchain using Taquito](#sending-operations). + +## What is a blockchain? +The blockchain is a way to trust a network of computers run by strangers (so you don't have to trust the individual people). It might seem impossible, but it works. How? + +All computers that form a blockchain run the same software. They also store all the information needed to verify the integrity of the data. So anyone can verify that the data is correct. Techniques from cryptography are used to make this possible. + +In order to work with a blockchain, a high level understanding is enough: + +1. The blockchain is a network of computers that run the same software. +1. The blockchain stores data in a way that anyone can verify the integrity of the data. +1. The data is split into "blocks". Each block contains a list of operations (like sending some tokens from one account to another). +1. Once a block is created and the blockchain reaches a consensus on the information in it, it is impossible to change the data in the block. +1. In order to send an operation to the blockchain, you can send it to any of the nodes participating in the consensus. The node will forward the data to the other nodes. +1. In order to read data from the blockchain, you can send a request to any of the nodes. +1. Anyone can read data from the blockchain. But to send an operation to the blockchain, it needs to be cryptographically signed. + +Like any complex system, the simple overview we just gave is vastly simplified by leaving out a lot of details, and avoiding unnecessary precision. I believe having a good mental model of the system is more important than being precise. As you keep working in the blockchain ecosystem, your mental model will become more accurate over time. + +
+ How does the blockchain work? + +Here, I try to explain the overall mechanism that enables the blockchain to work. This is not necessary to understand the rest of the tutorial. But if you are curious, read on. Also, this is by no means a complete explanation. I am leaving out a lot of details. + +As said earlier, the data to be written to the blockchain is divided into blocks. Each block contains a list of operations, and a cryptographic hash (like sha256) of the block is calculated. The hash is a short string that uniquely identifies the block. The hash of the previous block is also stored in the block. So the blocks are effectively making a chain, hence the name "blockchain". + +This chaining has an interesting property: if you change the data in a block, the hash of the block will change. Because the hash of this block is stored in the next block, the hash of the next block will also change, and now you have to change the hash of all blocks after that. This feels like branching out another chain from the block you changed. Your branch will never reconcile with the original, unmodified chain. + +This also has another interesting property: if you want to make sure that you agree with another computer on the entire contents of the blockchain, you just need to compare the hashes of the last blocks. If the hashes are the same, you agree on the entire contents of the blockchain before that block. + +This is fine as long as all computers agree on the hash. But what if an attacker wants to advertise the wrong block? The network needs a way to establish a "majority" of votes. So that the "honest" nodes can still agree on the correct block even if some nodes are dishonest. This is done using a "consensus algorithm". + +We need to make it hard for an attacker to dominate the honest votes. If every node on the network had the same vote, the attacker could just create a lot of nodes and vote for the wrong block. So, we need a way to have some voting power that favors the real majority. + +When Bitcoin was invented, it used a consensus algorithm called "Proof of Work". In this algorithm, the computers compete to solve a puzzle. The first computer to solve the puzzle gets to create the next block. If an attacker manages to beat the rest of the network on one block, the honest nodes still have a higher chance of finding the next block based on the block they agree on. So, the attacker needs to have more computing power than the rest of the network combined. With a large network like Bitcoin, this is very expensive and not practical. + +While POW is a genius solution, it is also very energy-intensive. It is estimated that the Bitcoin network uses as much energy as the entire country of Argentina. This is not sustainable. + +A later generation of blockchains introduced the "Proof of Stake". In this algorithm, the computers that participate in the consensus are selected based on the amount of tokens they have. The more tokens you have, the higher your chance of being selected to create the next block. This is much more energy-efficient. The Tezos blockchain uses this algorithm. +
+ +## What makes Tezos different? {#about-tezos} + +Some interesting features in Tezos are designed to address the shortcomings of the earlier generations of blockchain. When Tezos was created, it had these benefits over existing blockchains: + +1. Proof of stake (It is now being adopted by some other blockchains as well). This eliminates a big problem with earlier blockchains: the need for a lot of energy to run the network. +1. Evolution of the blockchain. Remember that the blockchain is a network of computers that run the same software. This means that if you want to upgrade the software, all the nodes need to be upgraded at the same time. This is not easy to do. Tezos solves this problem by having evolution baked into the protocol. This means that the blockchain can evolve over time without the need for a "hard fork". +1. Delegation: Users can "delegate" their funds to a "baker". The baker will participate in the network consensus and will receive rewards. The baker will then share the rewards with the delegators. This makes it possible for users to participate in the network consensus without the need to run a node themselves or give control of their funds to a third party. + +Because Tezos is designed to evolve, it is now much more than what it was when it was created. + +Different versions of Tezos protocol are named after historic cities. At the time of this writing, we are in the "Nairobi" era. But the next protocol "Oxford" is being implemented and will be voted on soon, then the next one would be a city that starts with "P". 🤔 I wonder what will happen after we reach Z. 🤷 + +The "mainnet" is the actual Tezos Blockchain. However, there are several "testnets" that are used for testing. One of them is named "ghostnet", and it evolves to the new protocol much earlier than the mainnet, so that the ecosystem has enough time to implement and test the new protocol's features. + +## What is a dApp? + +A dApp is a web application that interacts with a blockchain. The blockchain is the source of truth for the dApp. The dApp usually interacts with the user, reads data from, and writes to the blockchain. The dApp might also communicate with other services, notably a blockchain indexer. But dApps are not limited to these ideas. For instance, one might create a dApp that works as part of an industrial process, and interacts with the blockchain to benefit from its features, like transparency, immutability, and provability. + +## What is Taquito? + +Taquito is a JavaScript library that makes it easy to interact with the Tezos blockchain. It is designed to be used in dApps. It is also used in some wallets and other tools. It is open-source, developed and maintained by ECAD Labs. + +Without Taquito, sending operations to the Tezos blockchain requires you to write a lot of code. Some of that is to: +1. Estimate the costs for the operation +1. Properly encode the operation +1. Sign the operation +1. Inject the operation +1. Get the operation receipt +1. Monitor the chain for inclusion of the operation + +And to implement all these, you need detailed information about different data types, protocols, constants, and algorithms used in the Tezos blockchain. Taquito abstracts away all this complexity and provides a simple API for interacting with the blockchain. + +## Sending a `Transfer` operation to the blockchain using Taquito {#sending-operations} +Now, we want to send an operation to the blockchain. When reading, we just sent a read request. When sending an operation, we need to prove that we own the address. To do this, we need to sign the operation with the private key of the address. + +In the next step, we will simply store the private key in the source code. This is not secure, and you should never do this in a production application. + +Taquito provides an "In Memory Signer" functionality. Use the following command to add that to your project: + +```bash +npm i @taquito/signer +``` + +Open the file `index.ts` and replace the code with the following: + +```ts +import { InMemorySigner } from "@taquito/signer"; +import { TezosToolkit } from "@taquito/taquito"; + +async function main() { + var tezosToolkit = new TezosToolkit("https://ghostnet.ecadinfra.com"); + + // WARNING: DO NOT DO THIS IN PRODUCTION, KEEP YOUR SECRETS SAFE + const signer = await InMemorySigner.fromSecretKey('spsk29SxqYRjnreqGzsYiAUEqxyhDwD8j2J57pJjaGgGtReZVD2UiD'); + + const pkh = await signer.publicKeyHash(); + console.log(pkh); + + tezosToolkit.setProvider({ signer }); + + const op = await tezosToolkit.contract.transfer({ to: 'tz1YvE7Sfo92ueEPEdZceNWd5MWNeMNSt16L', amount: 1 }); + await op.confirmation(); + + console.log(op.hash); +} + +main().catch(console.error); +``` + +Now, if you run your code, you should be able to see the address of the signer (`tz2DZLWLuDRKUuR4BrWetimZ1C6Pg6pPAo3n`) and the hash of the operation in the terminal. + +What is happening here? Let's break it down: + +1. We create a new instance of `TezosToolkit` and pass the URL of the node we want to connect to. +1. We create a new instance of `InMemorySigner` and pass the private key of the address we want to use to sign the operation. +1. We get the public key hash of the address. +1. We set the provider of the `TezosToolkit` instance to the signer we created in step 2. +1. We send a `Transfer` operation to the blockchain. Taquito will automatically do the following behind the scenes: + 1. Estimate the cost of the operation. + 1. Encode the operation. + 1. Sign the operation with the private key. + 1. Send the signed operation to the blockchain. +1. We wait for the operation to be included in a block. +1. We print the hash of the operation. + +For the purpose of this section, I have created a new address and funded it on testnet. You are sharing the same secret key with everyone else going through this tutorial. So don't use this address for anything important. Also, there are two possible reasons why you might not be able to send the operation: +1. Other people testing the code have consumed all the ꜩ in the address, so your operation will fail because of insufficient funds. You can head over to [ghostnet faucet](https://faucet.ghostnet.teztnets.xyz/) and send some ꜩ to the address for free. Or you can get free Testnet Tez right from your terminal: `npx @oxheadalpha/get-tez --amount 100 --network ghostnet` +1. Another person is sending an operation from this address at the same time as you. One address can only send one operation to each block. This is very improbable, but at least you know someone else is going through this tutorial at the same time as you. 😄 + +
+ How to create my own public/private key pair? + + Most users can simply use a wallet to create addresses. This is useful for dApps that run inside a browser. If you are running a dApp as a desktop, mobile, or server process, you can create your own key pair. Here is how you can do it: + + ```bash + docker run --pull always -it --entrypoint sh docker.io/tezos/tezos:latest + + # now you are inside the docker container + octez-client -E https://ghostnet.ecadinfra.com gen keys mysamplekey -s secp256k1 + octez-client -E https://ghostnet.ecadinfra.com show address mysamplekey -S + ``` + The new address you just created has a balance of zero. For the testnet, You can go to [ghostnet faucet](https://faucet.ghostnet.teztnets.xyz/) and send some ꜩ to it for free. On mainnet, you need to buy actual Tez on an exchange. +
+ +Congratulations! You have just sent an operation to the Tezos blockchain using Taquito. + +## Interacting with a smart contract using Taquito + +In this section, we will interact with a smart contract using Taquito. We will mint an NFT on [objkt.com](https://objkt.com) NFT marketplace. + +Well, objk.com is the production service. We will use the testnet one: [ghostnet.objkt.com](https://ghostnet.objkt.com/), because to mint NFT on it, you only need ghostnet ꜩ, which is free. Also, because I want to put my test secret key here, and I don't like to share my mainnet secret key with actual ꜩ in it with everyone. + +The concepts you learn here are not limited to objkt.com or NFTs. You can use the same concepts to interact with any smart contract on the Tezos blockchain. + +Most dApps interact with smart contracts. You can think of a smart contract as a program that runs on the blockchain. The smart contract can store data and execute code. The code is executed when a user sends an operation to one of the smart contract's `entrypoint`s. The smart contract can also send operations to the blockchain, or to other smart contracts. + +In Tezos, smart contracts are written using one of the high-level languages (like Ligo), and compiled to Michelson. Then the contract is originated (deployed) to the blockchain. During origination, an address prefixed with `KT1` is created for the contract. You can then interact with the smart contract by sending operations to this address. + +In objkt.com, any user can create a number of collections and then mint NFTs in any of these collections. I have already created a collection and made our test address (`tz2DZLWLuDRKUuR4BrWetimZ1C6Pg6pPAo3n`) an operator of the collection. So, this user can now mint NFTs in this collection. Check out the collection [here](https://ghostnet.objkt.com/collection/KT1XmD31NdBrTcL7bPF3md6i5g4BbE6s2YLv), and note the number of tokens in it. + +Open the file `index.ts` and change the `main` function to the following: + +```ts +async function main() { + var tezosToolkit = new TezosToolkit("https://ghostnet.ecadinfra.com"); + + const signer = await InMemorySigner.fromSecretKey('spsk29SxqYRjnreqGzsYiAUEqxyhDwD8j2J57pJjaGgGtReZVD2UiD'); + tezosToolkit.setProvider({ signer }); + + const contract = await tezosToolkit.contract.at('KT1JarALvhDLjtFhraeTMGGoeNLUkuL6jGtM'); + const op = await contract.methodsObject.mint_artist({ + collection_id: 71947, + editions: 1, + metadata_cid: '697066733a2f2f516d52325672336775713467594d45366268676b47474a34714656647652786867766e47516d7a6672346d364635', + target: 'tz2DZLWLuDRKUuR4BrWetimZ1C6Pg6pPAo3n' + }).send(); + + await op.confirmation(); + + console.log(op.hash); +} +``` + +What happens here? Let's break it down: +1- We set up the Tezos Toolkit, and the signer as before. +1- We get the contract metadata from the blockchain. This metadata contains information about the contract, including its entrypoints. +1- We call the `mint_artist` entrypoint of the contract. We need to provide the data it expects, which is provided as a javascript object. Taquito will automatically encode this data to be sent to the contract. +1- We wait for the confirmation and print the hash as before. + +Now, if you run your code, you should be able to see the hash of the operation in the terminal. +After about a minute, you should be able to see the new NFT in the collection from [this link](https://ghostnet.objkt.com/collection/KT1XmD31NdBrTcL7bPF3md6i5g4BbE6s2YLv). Because everyone following this tutorial is minting NFTs with the same metadata, all the NFTs in this collection will look the same. However, the number of tokens in the collection should increase by one. + +Congratulations! You have just interacted with a smart contract using Taquito. Additionally, you programmatically minted an NFT. + +Up until now, we have created programs that run in a terminal. While some of the code written to interact with the blockchain might actually be such an application, most of the time, we will usually create dApps that can be accessed in the browser. + +For these "browser dApps", there is a problem: how do we sign the operations? We can't store the secret key in the source code because anyone can see it. We also should not ask users to enter their secret key in our dApp, because that requires them to fully trust our dApp. + +As it turns out, there is an elegant solution to this problem. + +## dApps and Crypto Wallets + +The wallet is a program that stores the user's secrets (like the private key) and signs operations on behalf of the user. The wallet is not part of the dApp. It is a separate program. The wallet is usually a browser extension, a website, a mobile app, or a hardware wallet. The wallet is also responsible for showing the operations to the user and asking them to approve the operation. The user only needs to fully trust the wallet. The dApp cannot make any write operations to the blockchain unless it is signed by the wallet. + +The beacon SDK is a library that provides a standard way for dApps to connect to wallets. The beacon SDK supports several wallets, including Thanos, Temple, and Kukai. You don't need to use the beacon SDK directly. Taquito uses the beacon SDK internally. + +Another interesting component is the indexer/explorer. The way data is stored on the blockchain is optimized for storage, and to facilitate data retrieval that's essential for new operations (like checking the balance of an account). But some other operations might be slow. A blockchain indexer reads all the data from the blockchain and stores it in an optimized way for fast retrieval. Users can interact with that data through the explorer, which is a web application that shows the data in a user-friendly way. Also, dApps can read the data from the indexer to reduce the load on the blockchain and/or to have a faster response time. + +The smart contract is conceptually part of the dApp, but it lives on the blockchain. + +## The flow of events in the dApp + +Here is a high-level summary of the flow of events in the dApp: +1. The user visits the dApp in their browser (by entering the URL or clicking on a link) +1. The browser loads the dApp's code from a web server +1. The dApp is loaded, and the user can interact with it +1. At this stage, the dApp can read data from the blockchain, as long as the data does not need to be limited to a specific user (in our example dApp, the list of ideas can be read by anyone, but to show a list of user's collection, votes, etc., the dApp needs to know who the user is) +1. The user makes an interaction that requires connecting the wallet +1. The dApp shows a popup to the user, asking them to choose a wallet to connect to +1. The user selects a wallet +1. The user visits their wallet (on their phone, computer, a browser extension, in another tab, or even a hardware wallet) and approves the connection +1. The user revisits the dApp. This time, the dApp might be showing additional information (such as the user's collection) or allowing the user to send operations to the blockchain (such as registering an idea or voting on an idea) +1. The user makes an interaction that requires sending an operation to the blockchain +1. The dApp sends the operation to the wallet +1. The wallet shows the operation to the user and asks them to approve it +1. The user approves the operation +1. The wallet sends the signed operation to the blockchain +1. The blockchain processes the operation +1. The dApp can wait for the operation to be included in a block +1. The dApp can read the result of the operation from the blockchain + +```mermaid +sequenceDiagram + actor user + participant browser + participant dApp as dApp
(inside browser) + participant blockchain + participant wallet + participant indexer + participant server as server
(not part of the blockchain) + user->>browser: visits the dApp + browser->>server: request the dApp's code + server->>browser: sends the dApp's code + browser->>dApp: loads and runs the dApp + dApp->>blockchain: can read data from the blockchain + blockchain->>dApp: sends the data + dApp->>indexer: can read indexed data from the indexer/explorer + indexer->>dApp: sends the data + dApp->>user: shows data from the blockchain/indexer/explorer + user->>dApp: makes an interaction that requires connecting the wallet + dApp->>user: shows a popup to connect the wallet + user->>wallet: selects a wallet and visits the wallet + wallet->>user: asks for approval of the connection + user->>wallet: approves the connection + wallet->>dApp: approves the connection + user->>dApp: interacts with dapp that requires sending an operation to the blockchain + dApp->>wallet: sends the operation to the wallet to be signed + wallet->>user: shows the operation to the user and asks for approval + user->>wallet: approves the operation + wallet->>blockchain: sends the signed operation to the blockchain + wallet->>dApp: sends the result of the operation to the dApp + dApp->>blockchain: awaits the inclusion of the operation in a block + dApp->>user: shows the result of the operation +``` + +Alternatively, in a slightly different flow, the wallet sends the signed operation to the dApp, and dApp sends it to the blockchain. From the user's point of view, both flows look the same. + +## Creating a simple dApp that transfers ꜩ from the user's wallet to another address + +We will start by creating a simple dApp that transfers ꜩ from the user's wallet to another address. This will help us understand the flow of events in a dApp and the role of Taquito and Beacon SDK in the process. + +### creating the React app + +Open your terminal and run the following commands: + +```bash +npm create vite@latest my-dapp -- --template react-ts +cd my-dapp +npm i +npm run dev +``` + +The terminal should show a message that says: `➜ Local: http://localhost:4173/` but the port number might be different. +Now open a browser and visit the URL printed in the terminal. You should see a page that says: "Hello, Vite + React". + +
+ Optional: Commit the initial code to git + +```bash +git init +git add . +git commit -m "initial commit" +``` + +
+ +### adding Taquito and Beacon SDK to the React app + +In the next step, we add Taquito and Beacon SDK to the React app, and create a minimal UI to connect to the wallet and transfer ꜩ. + +```bash +npm i @taquito/taquito @taquito/beacon-wallet +``` + +Open the file `index.html` and make the following changes: + +```diff +- Vite + React ++ My dApp +``` + +Open the file `src/App.tsx` and replace the content with the following code: + +```tsx +import { useState } from "react"; +import { TezosToolkit } from "@taquito/taquito"; +import "./App.css"; +import ConnectButton from "./components/ConnectWallet"; +import Transfer from "./components/Transfer"; +import { BeaconWallet } from "@taquito/beacon-wallet"; + +const App = () => { + const [Tezos] = useState( + new TezosToolkit("https://ghostnet.ecadinfra.com") + ); + const [wallet, setWallet] = useState(undefined); + const [userAddress, setUserAddress] = useState(undefined); + + switch (userAddress) { + case undefined: return ; + default: return ; + + } +}; + +export default App; +``` + +### Connecting to the wallet + +The first step in interacting with the blockchain is connecting to the user's wallet. Taquito provides a BeaconWallet class that abstracts away the complexity of connecting to the wallet. The BeaconWallet class is a wrapper around the Beacon SDK. + +Create a new file `src/components/ConnectWallet.tsx` and add the following code: + +```tsx +import { Dispatch, SetStateAction, useEffect } from "react"; +import { TezosToolkit } from "@taquito/taquito"; +import { BeaconWallet } from "@taquito/beacon-wallet"; +import { + NetworkType, +} from "@airgap/beacon-dapp"; + +type ButtonProps = { + Tezos: TezosToolkit; + setUserAddress: Dispatch>; + setWallet: Dispatch>; + wallet: BeaconWallet | undefined; +}; + +const ConnectButton = ({ + Tezos, + setUserAddress, + setWallet, + wallet, +}: ButtonProps): JSX.Element => { + const connectWallet = async (): Promise => { + try { + await wallet!.requestPermissions({ + network: { + type: NetworkType.GHOSTNET, + rpcUrl: "https://ghostnet.ecadinfra.com", + }, + }); + const userAddress = await wallet!.getPKH(); + setUserAddress(userAddress); + } catch (error) { + console.log(error); + } + }; + + useEffect(() => { + (async () => { + const wallet = new BeaconWallet({ + name: "My dApp", + preferredNetwork: NetworkType.GHOSTNET, + disableDefaultEvents: false, + }); + Tezos.setWalletProvider(wallet); + setWallet(wallet); + })(); + }, []); + + return ( +
+ +
+ ); +}; + +export default ConnectButton; + +``` + +### Transferring ꜩ from the user's wallet to another address + +After you connect to the wallet, you can send operations to the blockchain. In this step, we will create a simple UI to transfer ꜩ from the user's wallet to another address. + +Create a new file `src/components/Transfer.tsx` and add the following code: + +```tsx +import { useState } from "react"; +import { TezosToolkit } from "@taquito/taquito"; + +const Transfer = ({ + Tezos, +}: { + Tezos: TezosToolkit; +}): JSX.Element => { + const [recipient, setRecipient] = useState(""); + const [amount, setAmount] = useState(""); + const [loading, setLoading] = useState(false); + + const sendTez = async (): Promise => { + if (recipient && amount) { + setLoading(true); + try { + const op = await Tezos.wallet + .transfer({ to: recipient, amount: parseInt(amount), mutez: true }) + .send(); + await op.confirmation(); + } catch (error) { + console.log(error); + } finally { + setLoading(false); + } + } + }; + + return ( +
+ Recipient: setRecipient(e.target.value)} + /> +
+ Amount in uTez: setAmount(e.target.value)} + /> +
+ +
+ ); +}; + +export default Transfer; + +``` + +### Fixing node-specific dependencies in the browser + +The libraries Taquito and Beacon SDK are designed to run in a Node.js environment. However, we are running them in a browser. This causes some issues. For example, the Beacon SDK uses the Node.js `buffer`, `stream`, and `util` modules. These modules are not available in the browser. Fortunately, there are browser-compatible versions of these modules. We can use these versions instead of the Node.js versions. To do this, we need to install the following packages: + +```bash +npm i buffer stream-browserify util +``` + +Now we need to tell Vite to use these packages instead of the Node.js versions. To do this, open the file `vite.config.ts` and add the following code: + +```tsx +import { defineConfig } from 'vite' +import react from "@vitejs/plugin-react"; + +export default defineConfig({ + define: { + global: {}, + }, + build: { + commonjsOptions: { + transformMixedEsModules: true, + }, + }, + plugins: [react()], + resolve: { + alias: { + buffer: "buffer", + stream: "stream-browserify", + util: "util", + }, + }, +}); +``` + +Also, create a file named `src/polyfills.ts` and add the following code: + +```tsx +import { Buffer } from "buffer"; + +globalThis.Buffer = Buffer; +``` +Also, make the following modification to the file `index.html`: + +```diff +
++ + + + +``` + +### Running the dApp + +Make sure that the command `npm run dev` is still running in the terminal, and that there are no build errors. + +Now, you should be able to see the "Connect Wallet" button in the browser. Clicking on it opens the wallet selection modal. You can choose your favorite wallet and connect to it. After this, you need to visit your wallet to approve the connection. After that, you should be able to see the "Send" button. You can enter an address and an amount (in Mutez, notice the `mutez: true` in `Transfer.tsx`) and click on the "Send" button to send ꜩ to the address. + +If you have not set up a wallet before, clicking on the Kukai wallet opens a page that asks you to create a new wallet. Remember to visit the [ghostnet faucet](https://faucet.ghostnet.teztnets.xyz/) to fund your wallet with some ꜩ. If you want to use that wallet for real ꜩ, you need to back up the mnemonic phrase. But remember that the mnemonic phrase is a secret. Anyone who has access to it can steal your ꜩ. + +## Closing thoughts + +We've come a long way: + 1. We started with a simple command-line application that reads the balance of an address from the blockchain. + 1. Then, we established a high-level understanding of the blockchain, Tezos, dApps, and Taquito. + 1. After that, we sent a `Transfer` operation to the blockchain using Taquito. + 1. Then, we interacted with a smart contract using Taquito. + 1. Finally, we implemented a simple GUI dApp. + +Your journey does not end here. There are many more things to learn. Here are some ideas: + +- Check out the [Taquito documentation](quick_start) to learn more about Taquito. +- Learn a smart contract language like [Ligo](https://ligolang.org/). +- Learn more about Tezos and its ecosystem, check out the [Tezos Developer Portal](https://tezos.com/developers/). +- See what others are doing: Join Tezos community on [Discord](https://discord.gg/tezos), [Reddit](https://www.reddit.com/r/tezos/), [Twitter](https://twitter.com/tezos), and [Telegram](https://t.me/tezosplatform). +- Start building. There is no better way to learn than to build something. You can start with a simple idea and build on it. + +### What is needed to make the dApp production-ready + +Please ensure you read and consider the checklist in [dApp pre-launch checklist](dapp_prelaunch) before you launch your dApp. diff --git a/website/versioned_docs/version-17.1.0/tutorial_links.md b/website/versioned_docs/version-19.0.0/tutorial_links.md similarity index 100% rename from website/versioned_docs/version-17.1.0/tutorial_links.md rename to website/versioned_docs/version-19.0.0/tutorial_links.md diff --git a/website/versioned_docs/version-17.1.0/tzip12.md b/website/versioned_docs/version-19.0.0/tzip12.md similarity index 100% rename from website/versioned_docs/version-17.1.0/tzip12.md rename to website/versioned_docs/version-19.0.0/tzip12.md diff --git a/website/versioned_docs/version-17.1.0/tzip16-sequence-diagram.md b/website/versioned_docs/version-19.0.0/tzip16-sequence-diagram.md similarity index 100% rename from website/versioned_docs/version-17.1.0/tzip16-sequence-diagram.md rename to website/versioned_docs/version-19.0.0/tzip16-sequence-diagram.md diff --git a/website/versioned_docs/version-17.1.0/validators.md b/website/versioned_docs/version-19.0.0/validators.md similarity index 100% rename from website/versioned_docs/version-17.1.0/validators.md rename to website/versioned_docs/version-19.0.0/validators.md diff --git a/website/versioned_docs/version-17.1.0/version.md b/website/versioned_docs/version-19.0.0/version.md similarity index 90% rename from website/versioned_docs/version-17.1.0/version.md rename to website/versioned_docs/version-19.0.0/version.md index 6a2ba0bdf9..a26ee8750c 100644 --- a/website/versioned_docs/version-17.1.0/version.md +++ b/website/versioned_docs/version-19.0.0/version.md @@ -2,15 +2,374 @@ title: Versions author: Jev Bjorsell --- +# Taquito v19.0.0 + +:::info +You might have noticed that we jumped versions from v17.5.0 to v19.0.0 (no v18). We do this as an effort to be in parallel with the current Octez version. +- Oxford - v18 +- Oxford2 - v19 + +Taquito v19 supports Oxford2, and not the previously named Oxford protocol. +::: + +**Potential Breaking Changes**: +Oxford2 comes with quite a few breaking changes, please make sure to update your projects accordingly. + +Oxford2 changes: +- Removed transactional rollups (tx rollup) references in Taquito #2650 +- Removed origination proof from smart rollups #2597 +- Updated all references of `endorsement` into `attestation` for Oxford2 #2599 +- `@taquito/rpc` - Updated RPC types for Oxford2 compatibility #2596 + + +## Summary + +### New Features +- `@taquito/local-forging` - Added new property `whitelist` in smart rollup origination operation #2776 + + +### Documentation + +### Internals + + +# Taquito 17.5.0 + +**Important Note:** +In this version, we replaced instances of `Axios` in favour of `Fetch`. + +We are not expecting any breaking changes, but if there are any issues that you see regarding this, please reach out to the Taquito team. + +## Summary + +### New Features +- `@taquito/taquito` - Expose and publicly `smartContractAbstractionSemantic` #2534 + +### Improvement +- `@taquito/http-utils` - Removed `Axios` as a dependency of Taquito in favour of `fetch`/`node-fetch` #2461 +### Documentation +- Updated RPC nodes on the website [PR#2732](https://github.com/ecadlabs/taquito/pull/2732 +- Updated Michelson encoder documentation to reference `generateSchema` instead of the outdated `extractSchema` #2630 +- Added a Taquito Chatbot assistant for the Taquito website to help answer user questions #2684 + +### Internals +- Removed archive node, and references to it in Taquito [PR#2743](https://github.com/ecadlabs/taquito/pull/2743) +- Updated Sass, Lerna, and Firebase versions [PR#2749](https://github.com/ecadlabs/taquito/pull/2749) +- Updated integration tests to increase speed and reliability #2741 + + +## `@taquito/http-utils` - Removed `Axios` in favour of `fetch` +The `taquito/http-utils` is responsible for handling all HTTP incoming and outgoing HTTP requests in Taquito. It utilized `Axios` as a main dependency to handle requests coming in and out of Taquito. + +Now that browsers and Node have supported `fetch` natively, it makes more sense for us to move towards it. + +Axios came with quite a large dependency tree, as well as multiple workarounds we needed to include for it to work properly (i.e. the `axios-fetch-adapter`) + +With this change we hope for a more stable HTTP handler in Taquito while reducing the package size at the same time. + + +# Taquito v17.4.0 + +**Potential Breaking Changes** : +We have updated various dependencies to the latest version in this release. Please update and test our packages for compatibility. We encourage all users to get in touch with the Taquito team if you encounter any unexpected behaviours and/or side effects. + +## Summary + +### Documentation +- Updated docs on flattening nested Michelson type pairs and unions #2458 #2328 +- Added docs to obtain operation hash before injecting an operation #2550 +- Added details of FA2 contract entrypoint `balance_of` param #2719 +- Updated Wallet API docs to include examples on subscribing to events emitted by Beacon #2707 +- Updated the Taquito test dApp to output events #2707 + +### Internals + - Updated various dependencies [PR#2693](https://github.com/ecadlabs/taquito/pull/2693) [PR#2720](https://github.com/ecadlabs/taquito/pull/2720) + - Added detectOpenHandles argument when running Flextesa integration tests as temporary workaround to Jest throwing circular JSON errors [PR#2721](https://github.com/ecadlabs/taquito/pull/2721) + + +# Taquito v17.3.2 + +## Summary +- Updated Beacon version to v4.0.12 + +## Documentation +- Updated website documentation to group sections by logical order instead of alphabetical #2665 +- Added detail for `getBalance()` method documentation that it returns balances in mutez #2495 + +## Internals +- Minor typo fix on variable name in `RpcEstimateProvider` [PR#2669](https://github.com/ecadlabs/taquito/pull/2669) +- Added `@taquito/core` as an explicit dependency on other packages [PR#2673](https://github.com/ecadlabs/taquito/pull/2673) + +# Taquito v17.3.1 + +## Summary +- This is a patch release to upgrade `@airgap/beacon-sdk` and `@airgap/beacon-dapp` packages to `v4.0.10` [PR#2649](https://github.com/ecadlabs/taquito/pull/2649) +- Updating license to `Apache-2.0` in `package.json` files [PR#2636](https://github.com/ecadlabs/taquito/pull/2636) +- Updated the ledger dependencies [PR#2645](https://github.com/ecadlabs/taquito/pull/2645) +- Applied dependency upgrades in website suggested by dependabot [PR#2645](https://github.com/ecadlabs/taquito/pull/2645) + +# Taquito v17.3.0 + +**A change in Licensing**: +Taquito has moved from `MIT` to `Apache 2.0`. + +**Potential Breaking Changes**: + +- Previously, an `OrToken`'s `EncodeObject` method would accept an object with multiple fields. It now only accepts an object with a single field. +- The `generateSchema` method in an `OrToken` with nested `OrToken`s (as well as `ExtractSchema`) would generate a schema object that was misleading and did not match what `Execute` created or `EncodeObject` accepted. This is now fixed and the behavior is consistent across all methods. +- `OrToken.Execute()` used to throw `OrTokenDecodingError` in case of failure, but now will throw `OrValidationError` + +## Summary + +### New Features + +- `@taquito/michelson-encoder` - The `OrToken`'s `EncodeObject` method now only accepts an object with a single field #2544 + +### Bug Fixes + +- `@taquito/michelson-encoder` - A nested `PairToken` with a mix of fields with `annots` and fields without `annots` could generate the wrong javascript object with `Execute` [#2540](https://github.com/ecadlabs/taquito/issues/2540) +- `@taquito/michelson-encoder` - the `generateSchema` method in a nested `OrToken` now generates a schema that is consistent with `Execute` and `EncodeObject` [#2543](https://github.com/ecadlabs/taquito/issues/2543) + +``` +const schema = { + prim: 'pair', + args: [ + { + prim: 'pair', + args: [ + { + prim: 'pair', + args: [{ prim: 'int' }, { prim: 'int' }], + annots: ['%A3'], + }, + { prim: 'int' }, + ], + }, + { prim: 'bool' }, + ], + }; + + const michelineJson = { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [{ prim: 'Pair', args: [{ int: '11' }, { int: '22' }] }, { int: '33' }], + }, + { prim: 'True' }, + ], + }; + const javaScriptObject = new Schema(schema).Execute(michelineJson); +``` + +Previously, this `javaScriptObject` would be equal to: + +``` +{ + 2: true, + A3: { + 0: 11, + 1: 22, + }, +} +``` + +But now it returns: + +``` +{ + 1: 33, + 2: true, + A3: { + 0: 11, + 1: 22, + }, +} +``` +### Internals + * `integration-tests` config improvement [#2163](https://github.com/ecadlabs/taquito/issues/2163) + * update RPC urls to align with the updated infrastructure [PR#2576](https://github.com/ecadlabs/taquito/pull/2576) [#2633](https://github.com/ecadlabs/taquito/pull/2633) + +## `@taquito/michelson-encoder` - Validate that an `OrToken`'s `EncodeObject` method only accepts an object with a single field + +Previously, an `OrToken`'s `EncodeObject` method would accept an object with multiple fields. It now only accepts an object with a single field. + +``` + const token = createToken({ + prim: 'or', + args: [{ prim: 'int' }, { prim: 'string' }], annots: [] + }, 0) as OrToken; + const javascriptObject = token.EncodeObject({ '0': 10, '1': '10' })); +``` + +Previously, this would return work and the result was the same as `token.EncodeObject({ '0': 10, '1': '10' }))`. Now, this throws an error. + +## `@taquito/michelson-encoder` - For an `OrToken` with nested `OrToken`s, `generateSchema` behaved inconsistently with `Execute` and `EncodeObject` + +Previously, `generateSchema` would generate a schema object that was misleading and did not match what `Execute` created or `EncodeObject` accepted. This is now fixed and the behavior is consistent across all methods. + +``` +const token = createToken( + { + prim: 'or', + args: [ + { + prim: 'bytes', + }, + { + prim: 'or', + annots: ['A'], + args: [ + { + prim: 'or', + args: [{ prim: 'int' }, { prim: 'nat' }], + }, + { prim: 'bool' }, + ], + }, + ], + }, + 0 +) as OrToken; +const schema = token.generateSchema(); +``` + +Previously, `schema` would be equal to: + +``` +{ + __michelsonType: "or", + schema: { + "0": { __michelsonType: "bytes", schema: "bytes" }, + "A": { + __michelsonType: "or", + schema: { + "1": { __michelsonType: "int", schema: "int" }, + "2": { __michelsonType: "nat", schema: "nat" }, + "3": { __michelsonType: "bool", schema: "bool" } + } + } + } +} +``` +Which was inconsistent with what `Execute` created and what `EncodeObject` accepted. +Now it is: + +``` +{ + __michelsonType: 'or', + schema: { + 0: { __michelsonType: 'bytes', schema: 'bytes' }, + 1: { __michelsonType: 'int', schema: 'int' }, + 2: { __michelsonType: 'nat', schema: 'nat' }, + 3: { __michelsonType: 'bool', schema: 'bool' }, + }, +} +``` + +# Taquito v17.2.0 + +**Potential Breaking Changes** : +Further improved error classes + - In `@taquito/sapling` `InvalidMerkleRootError` is renamed to `InvalidMerkleTreeError` + - In `@taquito/sapling` `InvalidParameter` is renamed to `SaplingTransactionViewerError` + - In `@taquito/michel-codec` `InvalidContractError` is renamed to `InvalidMichelsonError` + +## Summary + +### New Features + - Added new RPC endpoint `simulateOperation` #2548 + - Added support for signing `failingNoop` operation in `Contract API` and `Wallet API` #952 #2507 + +### Bug Fixes +- Updated sapling live code example contract on website #2542 + +### Improvement + Improved error classes for the following packages: + - `@taquito-sapling` #2568 + - `@taquito-michel-codec` #2568 + +### Documentation + - Updated local forger documentation #2571 + - Adjusted website wallet page design and removed website lambda view page broken link #1652 + +### Internals + - Updated beacon dependency to v4.0.6 #2584 + - Updated estimation process to use `simulateOperation()` instead of `runOperation()` #2548 + - Updated website dependencies [PR#2587](https://github.com/ecadlabs/taquito/pull/2587) + +## `@taquito/taquito` - Add support of failing_noop operation in Contract and Wallet API +Taquito now supports the `failing_noop` operation + +``` +const Tezos = new TezosToolkit(rpcUrl); + +Tezos.setWalletProvider(wallet) +const signedW = await Tezos.wallet.signFailingNoop({ +arbitrary: char2Bytes("Hello World"), +basedOnBlock: 0, +}); + +Tezos.setSignerProvider(signer) +const signedC = await Tezos.contract.signFailingNoop({ +arbitrary: char2Bytes("Hello World"), +basedOnBlock: 'genesis', +}); +``` + +## `@taquito/rpc` - Add support of simulateOperation RPC call + +``` +const Tezos = new TezosToolkit(rpcUrl) +let account ='tz1...' +let counter = Number((await Tezos.rpc.getContract(account, {block: 'head'})).counter) +const op = { + chain_id: await Tezos.rpc.getChainId(), + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [{ + kind: OpKind.TRANSACTION, + counter: (counter + 1).toString(), + source: account, + destination: account, + fee: '0', + gas_limit: '1100', + storage_limit: '600', + amount: '1', + }] + } +}; + +let simulate = await Tezos.rpc.simulateOperation(op)).contents[0] +``` +# Taquito v17.1.1 +## Summary +This is a patch release to fix a potential issue with `verifySignature()` and `hex2buf()` util method. +### Bug Fixes +- Fixed a potentially exploitable behaviour where `verifySignature()` was allowing an appended character to a message payload and still verify the signature correctly. It has now been fixed to validate against odd length characters #2578 + # Taquito v17.1.0 **Potential Breaking Changes** - Updated RxJS version from v6.6.3 to v7.8.1 - Updated TS version into v4.2.4 - Please be wary due to the RxJS version upgrade, we've been seeing intermittent timeouts when testing against a Flextesa sandbox. This behaviour is **not** present when using it against a regular node (Mainnet, Nairobinet, etc). We are still investigating what the cause might be. #2261 +Some other subtle changes that might affect some developers: +- In `@taquito/taquito` - `IntegerError` is renamed to `InvalidBalanceError` +- In `@taquito/taquito` - `PrepareProvider` used to throw `RevealEstimateError` now will throw `PublicKeyNotFoundError` +- In `@taquito/tzip-16` - `MetadataNotFound` is renamed to `ContractMetadataNotFoundError` +- In `@taquito/tzip-16` - `InvalidMetadata` is renamed to `InvalidContractMetadataError` +- In `@taquito/tzip-16` - `InvalidMetadataType` is renamed to `InvalidContractMetadataTypeError` +- In `@taquito/tzip-16` - `BigMapMetadataNotFound` is renamed to `BigMapContractMetadataNotFoundError` +- In `@taquito/tzip-16` - `UriNotFound` is renamed to `UriNotFoundError` +- In `@taquito/tzip-16` - `InvalidUri` is renamed to `InvalidUriError` +- In `@taquito/tzip-16` - `ProtocolNotSupported` is renamed to `ProtocolNotSupportedError` +- In `@taquito/tzip-16` - `UnconfiguredMetadataProviderError` is renamed to `UnconfiguredContractMetadataProviderError` +- In `@taquito/tzip-16` - `ForbiddenInstructionInViewCode` is renamed to `ForbiddenInstructionInViewCodeError` + ## Summary ### New Features -- Exposed the injector to be customizable from the TezosToolkit class #1344 +- Exposed the injector to be customizable from the TezosToolkit class #1344 ### Improvement - Simplified generated Lambda for `transferToContract` [PR#2404](https://github.com/ecadlabs/taquito/pull/2404) @@ -40,7 +399,7 @@ Protocol Nairobi comes with a couple potential breaking changes for our users: ### New Features - `@taquito/taquito` & `@taquito/michelson-encoder`- Introduced a new feature called `EventAbstraction` that provides an abstraction to Events, similar to `ContractAbstraction` #2128 -- +- ### Bug Fixes - `@taquito/taquito` - Fixed contract call estimation to check for unrevealed keys #2500 @@ -62,12 +421,21 @@ Protocol Nairobi comes with a couple potential breaking changes for our users: ### Internals - Upgrade `netlify-cli` package to fix CI issues [PR#2496](https://github.com/ecadlabs/taquito/pull/2496) # Taquito v16.2.0 - -**Potential Breaking Changes**: -- Some error classes may have been moved to the `@taquito/core` package. Note to developers if they are exporting any error classes to capture errors, there might be a need to adjust the export path - -**Note**: There are significant (backwards compatible) changes to the `@taquito/taquito` package, largely regarding the flow of preparing, estimating, forging, and injecting operations into a node. No breaking changes are expected, but users are welcomed to reach out to the team if any issues arise. - +## **Potential Breaking Changes**: +- Some error classes may have been moved to the `@taquito/core` package. Note to developers if they are exporting any error classes to capture errors, there might be a need to adjust the export path. +- We have an ongoing error class refactoring which includes ticket #1992 (create an error class hierarchy), #1993 (consolidate duplicate errors in Taquito) and #1994 (improve error classes in individual packages, namely `@taquito/utils`, `@taquito/local-forging` and `@taquito/signer`). Here are a list of notable changes: + 1. `@taquito/sapling` Class SaplingToolkit function prepareUnshieldedTransaction used to throw InvalidKeyError now throw a InvalidAddressError instead + 2. `@taquito/rpc` when validateContractAddress used to throw InvalidAddressError will now throw InvalidContractAddressError. + 3. `@taquito/sapling` prepareUnshieldedTransaction function when validateDestinationImplicitAddress used to throw InvalidAddressError now throw InvalidKeyHashError + 4. `@taquito/local-forging` smartRollupAddressDecoder used to throw InvalidAddressError now throw InvalidSmartRollupAddressError + 5. `@taquito/local-forging` used to have class InvalidSmartRollupContractAddressError now is InvalidSmartRollupCommitmentHashError + 6. `@taquito/local-forging` function smartRollupContractAddressEncoder rename to smartRollupCommitmentHashEncoder + 7. `@taquito/signer` PrivateKeyError is replaced by common error InvalidKeyError from `@taquito/core` + +- In `@taquito/michelson-encoder` we introduced a new semantic `{ Some: null}` to EncodeObject() for nested options type like (option (option nat)). The old semantic still works when making contract calls but will look to deprecated them in the future as table below. And the corresponding `Execute()` will now return new semantic `{ Some: 1 }` as previously return `1` will be deprecated soon. #2344 +![image](https://github.com/ecadlabs/taquito/assets/106410553/455e7f9f-9d6a-4503-bb89-8f337c322063) + +**Note**: There are also significant (backwards compatible) changes to the `@taquito/taquito` package, largely regarding the flow of preparing, estimating, forging, and injecting operations into a node. No breaking changes are expected, but users are welcomed to reach out to the team if any issues arise. ## Summary ### New Features @@ -105,8 +473,8 @@ const Tezos = new TezosToolkit(RPC_URL); Tezos.setStreamProvider( Tezos.getFactory(PollingSubscribeProvider)({ - shouldObservableSubscriptionRetry: true, - pollingIntervalMilliseconds: 1500 + shouldObservableSubscriptionRetry: true, + pollingIntervalMilliseconds: 1500 }) ); @@ -116,9 +484,9 @@ try { address: 'KT1_CONTRACT_ADDRESS', excludeFailedOperations: true }); - + sub.on('data', console.log); - + } catch (e) { console.log(e); } @@ -184,7 +552,7 @@ const op = await Tezos.contract.smartRollupOriginate({ ### `@taquito/taquito` - Added utility functions in prepare provider to accomodate forging and operation pre-apply (dry runs) Provided 2 utility functions to convert results from the `PrepareProvider` (`PreparedOperation` type objects) into `ForgeParams` and `PreapplyParams` ```typescript! -// pre-apply +// pre-apply const prepared = await Tezos.prepare.transaction({ amount: 1, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu' @@ -208,8 +576,8 @@ const forgedBytes = await forger.forge(params); - `@taquito/taquito` Support new operation `smart_rollup_add_messages` #2309 - `@taquito/taquito` Updated `transferTicket` operation in the contract API to support ticket transfers between implicit accounts #2320 - `@taquito/local-forging` Support new Mumbai operations #2308 - - `smart_rollup_originate`, - - `smart_rollup_add_messages`, + - `smart_rollup_originate`, + - `smart_rollup_add_messages`, - `smart_rollup_execute_outbox_message` - `@taquito/local-forging` updated validation to allow tz4 addresses #2350 - `@taquito/rpc` support Mumbai operation types in the RPC package #2307 @@ -355,11 +723,11 @@ const op = await Tezos.wallet.increasePaidStorage({ - `@taquito/michelson-encoder` fix MapTypecheck bug triggered by nested maps ending with a big_map #1762 ### Documentation -- Auto hide sticky navbar for mobile view to increase readability on mobile devices. +- Auto hide sticky navbar for mobile view to increase readability on mobile devices. PR: https://github.com/ecadlabs/taquito/pull/2236 ### Internals -- Start running integration tests against testnets for external PRs. +- Start running integration tests against testnets for external PRs. PR: https://github.com/ecadlabs/taquito/pull/2221 ## `@taquito/taquito` drain_delegate operation support @@ -537,9 +905,9 @@ try { tag: 'tagName', address: 'KT1_CONTRACT_ADDRESS' }); - + sub.on('data', console.log); - + } catch (e) { console.log(e); } @@ -562,7 +930,7 @@ VotingInfoResponse = { ## `@taquito/ledger-signer` - Add support for bip25519 curve -We added support for the bip32-ed25519 derivation scheme in the ledger package. It can be used as follows: +We added support for the bip32-ed25519 derivation scheme in the ledger package. It can be used as follows: ```typescript const transport = await TransportNodeHid.create(); @@ -602,7 +970,7 @@ Before version 14.1.0, it was impossible to specify the amount, the fee, the `ga const contract = Tezos.contract.at('contactAddress'); const batch = Tezos.contract.batch() .withContractCall(contract.methods.entrypointName("entrypointParam", { fee: 100, gasLimit: 1000, storageLimit: 10 }) - .withContractCall(...) + .withContractCall(...) const batchOp = await batch.send(); await batchOp.confirmation(); @@ -687,7 +1055,7 @@ const op = await Tezos.contract.increasePaidStorage({ ## `@taquito/local-forger` - Support the `increase_paid_storage` operation and the `Emit` instruction -We added support to forge and parse the new operation kind `increase_paid_storage`. +We added support to forge and parse the new operation kind `increase_paid_storage`. We added support for the new Michelson instruction `Emit`, which can emit contract events when part of a contract script. @@ -697,9 +1065,9 @@ We added support for the new Michelson instruction `Emit`, which can emit contra ## `@taquito/taquito` - Replace `consumed_gas` with `consumed_milligas` -In Kathmandu, the property `consumed_gas` that was previously deprecated in favor of `consumed_milligas` has been removed. +In Kathmandu, the property `consumed_gas` that was previously deprecated in favor of `consumed_milligas` has been removed. -In Taquito (Contract API), the classes that extend the `Operation` class like `BatchOperation`, `DelegateOperation`, `OriginationOperation`, `TransactionOperation`, and so on, have a `consumedGas` getter. We did an internal change to calculate the consumed gas based on the consumed milligas, so there is no breaking change for the users. We also implemented a new `consumedMilligas` getter which returns the consumed milligas. +In Taquito (Contract API), the classes that extend the `Operation` class like `BatchOperation`, `DelegateOperation`, `OriginationOperation`, `TransactionOperation`, and so on, have a `consumedGas` getter. We did an internal change to calculate the consumed gas based on the consumed milligas, so there is no breaking change for the users. We also implemented a new `consumedMilligas` getter which returns the consumed milligas. On the wallet API side, the `WalletOperation` class has a `receipt` method that returns a `Receipt` object containing a `totalGas` property. It is now calculated based on the consumed milligas, and we added an additional `totalMilliGas` property. @@ -735,18 +1103,18 @@ RunScriptViewResult = { }; ``` -## Sapling package +## Sapling package We implemented a package `@taquito/sapling` providing functionality for Sapling. For documentation, please refer to the following link: https://tezostaquito.io/docs/next/sapling We added a post-install script that fetches the z cash parameters required to initialize the sapling state. Excluding the files from the package avoids having an unsustainable bundle size. The files `saplingOutputParams.js` and `saplingSpendParams.js` will be created in the users `node_modules/@taquito/sapling` folder and avoid them having to download and inject those files. -As the next steps for the sapling package, we will provide interfaces for the key providers, making it easier to generate the proof and produced signature from a remote signer or a ledger. We currently offer an `InMemorySpendingKey` that must be used appropriately, given your risk profile. We will be looking for integration with wallets as well. +As the next steps for the sapling package, we will provide interfaces for the key providers, making it easier to generate the proof and produced signature from a remote signer or a ledger. We currently offer an `InMemorySpendingKey` that must be used appropriately, given your risk profile. We will be looking for integration with wallets as well. ## `@taquito/taquito` - Added support for the `transfer_ticket` operation -The `transfer_ticket` operation allows transferring tickets from an implicit account to a smart contract. +The `transfer_ticket` operation allows transferring tickets from an implicit account to a smart contract. ```typescript const Tezos = new TezosToolkit('https://jakartanet.ecadinfra.com'); @@ -768,7 +1136,7 @@ const op = await Tezos.contract.transferTicket({ ## `@taquito/michelson-encoder` - Display contract storage properly when it contains a `ticket` inside a `map` -We fixed a bug in the michelson-encoder package that prevented displaying the contract storage when it contained tickets inside a map. +We fixed a bug in the michelson-encoder package that prevented displaying the contract storage when it contained tickets inside a map. ## `@taquito/michelson-encoder` - `Schema.generateSchema()` fails for `sapling_transaction_deprecated` @@ -800,7 +1168,7 @@ We are now using the beacon-dapp's `getDAppClientInstance` method instead of the ## `@taquito/local-forging` - Pure JS implementation -To accommodate users working in native mobile development, we added a separate pure JS bundle that can be imported. +To accommodate users working in native mobile development, we added a separate pure JS bundle that can be imported. The bundle wraps functions in the `@taquito/local-forging` package into a single variable called `taquito_local_forging`. To use the JS bundle for your project, download the zip file under `Assets` on the [release page](https://github.com/ecadlabs/taquito/releases). @@ -859,7 +1227,7 @@ The `liquidity_baking_escape_vote` property in `BlockFullHeader` is replaced wit The `OperationBalanceUpdatesItem` can now contain a `bond_id` property of type `BondId`. `BondId` has a `tx_rollup` property. -The `OperationResultTxRollupOrigination` can now contain a `ticket_hash` property. +The `OperationResultTxRollupOrigination` can now contain a `ticket_hash` property. The `METADATA_BALANCE_UPDATES_CATEGORY` enum contains an additional `BONDS` category. @@ -875,8 +1243,8 @@ Added support to forge and unforge the new operation kinds `transfer_ticket`, `t ## `@taquito/michelson-encoder` - Added support for the the new type`tx_rollup_l2_address` -We created a new class `TxRollupL2AddressToken` in the michelson-encoder to support the new Michelson type `tx_rollup_l2_address`. This type is used to identify accounts on transaction rollups' ledgers. Those accounts are prefixed with `tz4`. -The `TxRollupL2AddressToken` class allows users of Taquito to pass `tz4` addresses in storage or smart contract entry points using the Taquito JS abstraction. +We created a new class `TxRollupL2AddressToken` in the michelson-encoder to support the new Michelson type `tx_rollup_l2_address`. This type is used to identify accounts on transaction rollups' ledgers. Those accounts are prefixed with `tz4`. +The `TxRollupL2AddressToken` class allows users of Taquito to pass `tz4` addresses in storage or smart contract entry points using the Taquito JS abstraction. ## `@taquito/michel-codec` - Added support for the new type`tx_rollup_l2_address` and the new instruction `MIN_BLOCK_TIME` @@ -920,7 +1288,7 @@ await op.confirmation(); The `txRollupSubmitBatch` method also takes optional `storageLimit`, `gasLimit` and `fee` as parameters. ## Known Issues -- Version stamp is out of date, resulting in `getVersionInfo()` to return the older version (12.1.0) instead of the current release candidate. This will be fixed in the full release. +- Version stamp is out of date, resulting in `getVersionInfo()` to return the older version (12.1.0) instead of the current release candidate. This will be fixed in the full release. # Taquito v12.1.0-beta @@ -940,10 +1308,10 @@ The `txRollupSubmitBatch` method also takes optional `storageLimit`, `gasLimit` ## Compatibility with the Jakarta protocol -We addressed the Jakarta protocol's breaking changes, making this version of Taquito compatible with the Jakarta protocol. This early integration has been possible by using the Mondaynet testnet. +We addressed the Jakarta protocol's breaking changes, making this version of Taquito compatible with the Jakarta protocol. This early integration has been possible by using the Mondaynet testnet. The Jakarta protocol addresses the [malleability issue](https://tezos.gitlab.io/alpha/sapling.html#preventing-malleability) discovered in Sapling. It introduces changes around the sapling related types and instructions that are now supported in Taquito: -- The encoding of `sapling_transaction` has changed; we added support for it in the `@taquito/local-forging` package and support for `sapling_transaction_deprecated`. +- The encoding of `sapling_transaction` has changed; we added support for it in the `@taquito/local-forging` package and support for `sapling_transaction_deprecated`. - The optional type returned by the `SAPLING_VERIFY_UPDATE` instruction contains an additional property named `bound_data`. We added support for it in the `@taquito/michel-codec` package. @@ -993,10 +1361,10 @@ new RpcClient('url', 'chain', new HttpBackend(50000)); ## Compatibility with the Jakarta protocol -We addressed the Jakarta protocol's breaking changes, making this version of Taquito compatible with the Jakarta protocol. This early integration has been possible by using the Mondaynet testnet. +We addressed the Jakarta protocol's breaking changes, making this version of Taquito compatible with the Jakarta protocol. This early integration has been possible by using the Mondaynet testnet. The Jakarta protocol addresses the [malleability issue](https://tezos.gitlab.io/alpha/sapling.html#preventing-malleability) discovered in Sapling. It introduces changes around the sapling related types and instructions that are now supported in Taquito: -- The encoding of `sapling_transaction` has changed; we added support for it in the `@taquito/local-forging` package and support for `sapling_transaction_deprecated`. +- The encoding of `sapling_transaction` has changed; we added support for it in the `@taquito/local-forging` package and support for `sapling_transaction_deprecated`. - The optional type returned by the `SAPLING_VERIFY_UPDATE` instruction contains an additional property named `bound_data`. We added support for it in the `@taquito/michel-codec` package. @@ -1061,10 +1429,10 @@ new RpcClient('url', 'chain', new HttpBackend(50000)); - @taquito/taquito - Allow estimating operations using a wallet #1387 ### Documentation -- Examples of using the BeaconWallet instance as a singleton #1045: https://tezostaquito.io/docs/beaconwallet-singleton +- Examples of using the BeaconWallet instance as a singleton #1045: https://tezostaquito.io/docs/beaconwallet-singleton - Fixed link to Tezos faucet #1383 - Updated all website examples to show contract and wallet API example variants #493 -- Algolia improvements - Fixed search bar returning dead links and duplicates #1411 +- Algolia improvements - Fixed search bar returning dead links and duplicates #1411 @@ -1093,19 +1461,19 @@ Example of an endorsement before Ithaca: } ``` -## @taquito/local-forging - Support for the new instruction `SUB_MUTEZ` +## @taquito/local-forging - Support for the new instruction `SUB_MUTEZ` We added support to forge and parse operations containing the new `SUB_MUTEZ` instruction in the `Localforger` class. -> [SUB_MUTEZ] is similar to the mutez case of the SUB instruction but its return type is option mutez instead of mutez. This allows subtracting mutez values without failing in case of underflow. +> [SUB_MUTEZ] is similar to the mutez case of the SUB instruction but its return type is option mutez instead of mutez. This allows subtracting mutez values without failing in case of underflow. *source: https://tezos.gitlab.io/protocols/012ithaca.html#michelson* ## @taquito/rpc - Updated the `RpcClient` types based on the changes to the balance updates and the new type of operations -Support has been added to represent the new operations `Preendorsement`, `Double_preendorsement_evidence`, `Set_deposits_limit`, and the new properties in operations result for `Endorsement` operations. +Support has been added to represent the new operations `Preendorsement`, `Double_preendorsement_evidence`, `Set_deposits_limit`, and the new properties in operations result for `Endorsement` operations. -We also support balance updates' new "kinds" and "type". +We also support balance updates' new "kinds" and "type". The new balance update kinds are `accumulator`, `minted`, `burned`, and `commitment`. @@ -1196,7 +1564,7 @@ Another change has been made regarding the confirmation method of the operations The change to the `confirmation` methods includes a breaking change. The polling interval for the confirmation and the streamer configuration has been moved from the `TezosToolkit` to the `PollingSubscribeProvider` class, where they belong logically. -**BREAKING CHANGE:** +**BREAKING CHANGE:** The `confirmationPollingIntervalSecond` and the `ConfigStreamer` are removed from the `TezosToolkit`. Configuration for the PollingSubscribeProvider needs to be specified in its constructor: @@ -1225,12 +1593,12 @@ Reduction of the bundle size: ## @taquito/taquito - Use the RPC `run_view` to execute lambda views -Before version 12, we used a constantly failing lambda contract to execute the tzip4 (lambda) views. The result of the view was retrieved in the returned error. This implementation was a workaround, and since the Hangzhou protocol, the RPC exposes an endpoint (`helpers/scripts/run_view`) allowing us to execute that kind of view. +Before version 12, we used a constantly failing lambda contract to execute the tzip4 (lambda) views. The result of the view was retrieved in the returned error. This implementation was a workaround, and since the Hangzhou protocol, the RPC exposes an endpoint (`helpers/scripts/run_view`) allowing us to execute that kind of view. We implemented a method called `runView` in the `@taquito/rpc` package, and we now use this method to execute the tzip4 views. Before version 12, the lambda view was only enabled on the "contract" and not the "wallet" API as it relied on getting the result from an error. The feature is now enabled on the "wallet" API too. -**Breaking change** (primarily for sandbox users): There is no need to deploy a lambda contract anymore. The `read` method of the `ContractView` class no longer takes an optional lambda contract address as a parameter. +**Breaking change** (primarily for sandbox users): There is no need to deploy a lambda contract anymore. The `read` method of the `ContractView` class no longer takes an optional lambda contract address as a parameter. Before version 12, when calling the `at` method to instantiate a `Contractabstraction`, a call was made to the RPC to fetch the chain id. The chain id was needed to select the right lambda contract to execute the view. As a performance improvement, we removed this call from the `at` method, removing one call to the RPC on each ContractAbstraction instantiation. The chain id can now be passed as a parameter of the `read` method or it will be fetched when calling this method. @@ -1250,7 +1618,7 @@ The Taquito codebase is doing different calls to the RPC to construct the variou ## @taquito/taquito - Use the LocalForger by default instead of the RpcForger -Before version 12, the default forger set on the `TezosToolkit` was the `RpcForger`. It is important to ensure that the node is trusted when forging with the RPC and users can change the forger implementation by calling the `setForgerProvider` method. +Before version 12, the default forger set on the `TezosToolkit` was the `RpcForger`. It is important to ensure that the node is trusted when forging with the RPC and users can change the forger implementation by calling the `setForgerProvider` method. As the Taquito local forging implementation provided in the `@taquito/local-forger` package has been battle-tested in the past month, we decided to change the default forger configured in the `TezosToolkit` in favor of the local one. @@ -1282,7 +1650,7 @@ await contact.methods.methodName().send(); ## @taquito/taquito - Allow estimating operations using a wallet -The estimate API only worked with a configured signer and not a wallet. It has been fixed to allow estimation of operations using a configured wallet. +The estimate API only worked with a configured signer and not a wallet. It has been fixed to allow estimation of operations using a configured wallet. Note that the wallet account needs to be revealed to conduct any estimate as Taquito has no access to the wallet's public key required to simulate a reveal operation. # Taquito v11.2.0-beta @@ -1453,7 +1821,7 @@ Here is an example where a contract contains a view named `myView`, it can be si ```typescript= const contract = Tezos.contract.at('KT1...'); const res = contract.contractViews.myView(param).executeView({ - viewCaller: 'KT1...' + viewCaller: 'KT1...' }); ``` @@ -1478,7 +1846,7 @@ const p = new Parser(parserOptions); In the release note v11.0.0-beta, there was a note about the following limitation: > Only the 'init' property can be used if you want to originate a contract having a global constant in the storage section of its code. Do not use the `storage` property, which depends on the `Michelson-Encoder`. -> +> > Here is an example: > ```typescript= > const op = await Tezos.contract.originate({ @@ -1545,13 +1913,13 @@ We encourage all developers to update their projects to use version Taquito v11 ### New features - Hangzhou protocol - `@taquito/taquito` - Support for the new operation kind `register_global_constant` on the contract, batch and estimate APIs #1075 -- ``@taquito/local-forging` +- ``@taquito/local-forging` - Support the new types and instructions related to operations-on-timelock #1070 - Support the new `constant` primitive #1077 - Support the new operation kind `register_global_constant` #1077 - Support the new high-level section `view` and the `VIEW` instruction #1074 - `@taquito/michelson-encoder` - Support new types related to operations-on-timelock #1071 -- `@taquito/michel-codec` +- `@taquito/michel-codec` - Support the new types and instruction related to operations-on-timelock #1072 - Support the new high-level section `view` and the `VIEW` instruction #1073 @@ -1588,7 +1956,7 @@ const op = await Tezos.contract.originate({ ## `@taquito/taquito` - Support the new operation kind `register_global_constant` on the contract, batch and estimate APIs -The new manager operation `register_global_constant` has been added to the contract, batch, and estimate APIs. This new operation allows users to register Micheline expressions in a global table of constants. +The new manager operation `register_global_constant` has been added to the contract, batch, and estimate APIs. This new operation allows users to register Micheline expressions in a global table of constants. A `registerGlobalConstant` method is available on the `ContractProvider` class. A `value` representing the Micheline expression to register in its JSON format is required as a parameter. The `registerGlobalConstant` method returns an instance of `RegisterGlobalConstantOperation` containing a `globalConstantHash` member that corresponds to the index(hash) of the newly registered constant. @@ -1603,15 +1971,15 @@ await op.confirmation(); const hash = op.globalConstantHash; // expr... ``` -After registering an expression as a global constant, the occurrences of this expression in a smart contract code can be replaced by its corresponding hash, allowing users to originate larger contracts. More details about the new `global constant` feature and examples using the batch API are available on the following documentation page: https://tezostaquito.io/docs/global_constant - +After registering an expression as a global constant, the occurrences of this expression in a smart contract code can be replaced by its corresponding hash, allowing users to originate larger contracts. More details about the new `global constant` feature and examples using the batch API are available on the following documentation page: https://tezostaquito.io/docs/global_constant + ## `@taquito/michelson-encoder` - Support new types related to operations-on-timelock New tokens (ChestToken and ChestKeyToken) have been implemented in the Michelson-encoder package to support the new types `chest` and `chest_key` and allow data conversion between Michelson and js. ## `@taquito/utils` - Provide utility to verify signatures -Taquito provides a function named `verifySignature` that allows verifying signatures of payloads. The function takes a message, a public key, and a signature as parameters and returns a boolean indicating if the signature matches. +Taquito provides a function named `verifySignature` that allows verifying signatures of payloads. The function takes a message, a public key, and a signature as parameters and returns a boolean indicating if the signature matches. The crypto library [stablelib](https://www.npmjs.com/package/@stablelib/ed25519) is used instead of [libsodium](https://www.npmjs.com/package/libsodium) in order not to drastically increase the bundle size of the `@taquito/utils` package. Here is an example of use: @@ -1628,9 +1996,9 @@ await verifySignature(message, pk, sig); ## `@taquito/rpc` - Support for the RPC endpoint`context/contracts/{contract}/script/normalized` -A new method on the RpcClient named `getNormalizedScript` is available. If global constants are present in the code of a smart contract, `getNormalizedScript` returns the expanded script. In contrast, the global constants are not expanded in the response provided by the `getScript` method. +A new method on the RpcClient named `getNormalizedScript` is available. If global constants are present in the code of a smart contract, `getNormalizedScript` returns the expanded script. In contrast, the global constants are not expanded in the response provided by the `getScript` method. -Internally in Taquito, the usage of `getScript` has been replaced by `getNormalizedScript` to ensure that all script passed to the Michelson-Encoder won't contain global constant because the `Michelson-Encoder` does not support the global constant in this current release (11.0.0-beta). +Internally in Taquito, the usage of `getScript` has been replaced by `getNormalizedScript` to ensure that all script passed to the Michelson-Encoder won't contain global constant because the `Michelson-Encoder` does not support the global constant in this current release (11.0.0-beta). ## Preliminary support for Idiazabalnet protocol @@ -1649,7 +2017,7 @@ If you have feature or issue requests, please create an issue on http://github.c # Taquito v10.2.1-beta - Updated beacon-sdk to version 2.3.5: https://github.com/airgap-it/beacon-sdk/releases/tag/v2.3.5 -- RpcClientCache - Store the Promises instead of the resolved values in the cache: +- RpcClientCache - Store the Promises instead of the resolved values in the cache: When requests were done in parallel to the same RPC endpoint, they were not hitting the cache. This is solved by storing the promise in the cache as soon as the first request is made. If another request tries to reach the same URL, during the configured TTL, the cached promise is returned. More details can be found here: https://github.com/ecadlabs/taquito/discussions/916 # Taquito v10.2.0-beta @@ -1668,7 +2036,7 @@ More details can be found here: https://github.com/ecadlabs/taquito/discussions/ ## @taquito/contract-library - Ability to bundle smart-contract scripts and entrypoints for ContractAbstration instantiation -A new package named `@taquito/contract-library` has been added to the Taquito library. +A new package named `@taquito/contract-library` has been added to the Taquito library. To improve (d)App performance, we aim to provide ways to reduce the number of calls made by Taquito to the RPC. The `@taquito/contracts-library` package allows developers to embed the smart-contract scripts into the application, preventing Taquito from loading this data from the RPC for every user. @@ -1841,7 +2209,7 @@ A fix has been made to change the behavior of the `PollingSubscribeProvider`, wh ### Enhancements -- **Breaking changes** - @taquito/michelson-encoder - Improvement to the `Schema.ExtractSchema()` method #960 and #933 +- **Breaking changes** - @taquito/michelson-encoder - Improvement to the `Schema.ExtractSchema()` method #960 and #933 @@ -1858,7 +2226,7 @@ The support for the new `liquidity_baking_escape_ema` and `implicit_operations_r ## @taquito/taquito - Drain an unrevealed account -Since v9.1.0-beta, the fees associated with a reveal operation are estimated using the RPC instead of using the old 1420 default value. When draining an unrevealed account, the fees associated with the reveal operation needs to be subtracted from the initial balance (as well as the fees related to the actual transaction operation). The reveal fee has changed from 1420 to 374 (based on the simulation using the RPC). However, the constants file was still using the 1420 value, leading to a remaining amount of 1046 in the account when trying to empty it. The default value has been adjusted on the constants file to match this change. +Since v9.1.0-beta, the fees associated with a reveal operation are estimated using the RPC instead of using the old 1420 default value. When draining an unrevealed account, the fees associated with the reveal operation needs to be subtracted from the initial balance (as well as the fees related to the actual transaction operation). The reveal fee has changed from 1420 to 374 (based on the simulation using the RPC). However, the constants file was still using the 1420 value, leading to a remaining amount of 1046 in the account when trying to empty it. The default value has been adjusted on the constants file to match this change. ## @taquito/rpc - Type ContractBigMapDiffItem has BigNumber's but values are string's @@ -1968,7 +2336,7 @@ println(JSON.stringify(extractSchema, null, 2)); Based on the information returned by the `ExtractSchema` method, the storage can be writen as follow: ```typescript= const bigMap = new MichelsonMap(); -bigMap.set('tz1...', { // address +bigMap.set('tz1...', { // address 0: 'tz1...', // address 1:10 // nat }); @@ -2013,7 +2381,7 @@ If you have feature or issue requests, please create an issue on http://github.c ## @taquito/michelson-encoder - Accept bytes in Uint8Array -The only format accepted in the Michelson-encoder for the type bytes was the hexadecimal string. We added support for the type Uint8Array. It is now possible to call an entry point or originate a contract using a Uint8Array or a hexadecimal string. +The only format accepted in the Michelson-encoder for the type bytes was the hexadecimal string. We added support for the type Uint8Array. It is now possible to call an entry point or originate a contract using a Uint8Array or a hexadecimal string. ## @taquito/http-utils - Make http requests cancelable @@ -2026,7 +2394,7 @@ The `bls12_381_fr`, `bls12_381_g1`, and `bls12_381_g2` tokens were missing in th ## @taquito/michelson-encoder - Added sapling_state and sapling_transaction tokens -The `sapling_state` and `sapling_transaction` tokens were missing in the Michelson-Encoder since the Edo protocol and have been added. +The `sapling_state` and `sapling_transaction` tokens were missing in the Michelson-Encoder since the Edo protocol and have been added. Note that no additional abstractions or ability to decrypt Sapling transactions have been implemented so far. @@ -2138,7 +2506,7 @@ If you have feature or issue requests, please create an issue on http://github.c ### Enhancements - Florence compatibility support -- Allows fetching big map with a key of type string, number, or object. +- Allows fetching big map with a key of type string, number, or object. - Accept an operator for the retry strategy of the `ObservableSubscription` class - Updated beacon-sdk version to v2.2.5 which includes several performance improvements for p2p pairing. @@ -2150,7 +2518,7 @@ If you have feature or issue requests, please create an issue on http://github.c This version ships with official support for the new Florence protocol which will come into effect on Mainnet in May. -## @taquito/taquito - Allows fetching big map with a key of type string, number, or object. +## @taquito/taquito - Allows fetching big map with a key of type string, number, or object. In the precedent versions, fetching a value in a big map required the parameter to be a string, even in such cases when the key of the big map was a number. The `get` and `getMultipleValues` methods of the `BigMapAbstraction` and `getBigMapKeyByID` and `getBigMapKeysByID` methods of the `RpcContractProvider` class now accept a string, a number or an object for the key we want to fetch. @@ -2241,9 +2609,9 @@ A note on how to use the Kukai wallet for testing on Edonet has been added to th ### Documentation updates -- [Tickets](https://tezostaquito.io/docs/tickets) +- [Tickets](https://tezostaquito.io/docs/tickets) - [Local pack/unpack, including bigmaps.](https://tezostaquito.io/docs/maps_bigmaps#local-packing-for-big-maps) -- Rename Thanos to Temple wallet. +- Rename Thanos to Temple wallet. - Build time pre-requisites for Taquito. - Documentation website examples now uses the edonet testnet @@ -2259,7 +2627,7 @@ This feature is _opt-in_, meaning that the Taquito user must enable it to benefi Developers can now test and evaluate new features and bug fixes as soon as possible without having to clone and locally link Taquito. Preview builds are published to our npm preview registry from all pull requests (except PR's from forks). -IMPORTANT NOTE: Preview builds are not official releases. They are helpful for testing and evaluating new features in Taquito. Preview builds may contain incomplete features or features that have not been fully tested. +IMPORTANT NOTE: Preview builds are not official releases. They are helpful for testing and evaluating new features in Taquito. Preview builds may contain incomplete features or features that have not been fully tested. ## Fetch multiple bigmaps at once. @@ -2279,21 +2647,21 @@ v8.1 supports Florence net. All the Taquito integration tests are run against th ## Documentation Additions and Improvments -Documentation on the Taquito website continues to grow and be refined. Developers can now read docs explaining what tickets are, their use cases, and example code reading tickets with various data values. +Documentation on the Taquito website continues to grow and be refined. Developers can now read docs explaining what tickets are, their use cases, and example code reading tickets with various data values. -Live code examples on the website now use Edonet. +Live code examples on the website now use Edonet. CodeBlock and Playground folders, along with contracts that work with live code, now rely on the Edonet testnet. -For enabling local pack (MichelCodecPacker()) for big map values, there are now instructions and documentation about the benefits of doing so. +For enabling local pack (MichelCodecPacker()) for big map values, there are now instructions and documentation about the benefits of doing so. -Developers can now opt in to use Taquito's local pack implementation when fetching Big Map values. This feature makes fetching Big Map values 50% faster. Big Map keys need to be serialized or PACK'ed, and Taquito relied on the Tezos PACK RPC to PACK the bigmap keys. +Developers can now opt in to use Taquito's local pack implementation when fetching Big Map values. This feature makes fetching Big Map values 50% faster. Big Map keys need to be serialized or PACK'ed, and Taquito relied on the Tezos PACK RPC to PACK the bigmap keys. -By relying on the local pack implementation, we eliminate one RPC roundtrip when fetching Big Map Values. To enable this feature, developers must call the `tezos. setPackerProvider(new MichelCodecPacker());` on the program's TezosToolkit instance. +By relying on the local pack implementation, we eliminate one RPC roundtrip when fetching Big Map Values. To enable this feature, developers must call the `tezos. setPackerProvider(new MichelCodecPacker());` on the program's TezosToolkit instance. -## Website now uses Netlify +## Website now uses Netlify -Netlify provides the deployment/hosting of the Taquito website. The primary motivation is so that we get full preview deployments of the website from PRs. +Netlify provides the deployment/hosting of the Taquito website. The primary motivation is so that we get full preview deployments of the website from PRs. ## More RPC endpoints added to Taquito @@ -2311,7 +2679,7 @@ We will soon be working on integrating Florence, the next Tezos protocol update Developer Experience is our high-priority item, and we have improvements in our backlog that we plan to start work. We are improving the `michelson-encoder implementation to open the door for Type generation from contracts and to provide easier discoverability of what parameters endpoints and initial storage take. Stay tuned! -We have a good practice of Continuous Delivery in Taquito, but we plan to take this to the next level. Stay tuned! +We have a good practice of Continuous Delivery in Taquito, but we plan to take this to the next level. Stay tuned! If you have feature or issue requests, please create an issue on http://github.com/ecadlabs/taquito/issues or join us on the Taquito community support channel on Telegram https://t.me/tezostaquito diff --git a/website/versioned_docs/version-17.1.0/wallet_API.md b/website/versioned_docs/version-19.0.0/wallet_API.md similarity index 85% rename from website/versioned_docs/version-17.1.0/wallet_API.md rename to website/versioned_docs/version-19.0.0/wallet_API.md index 660ac19bb2..5fb8a1c1b3 100644 --- a/website/versioned_docs/version-17.1.0/wallet_API.md +++ b/website/versioned_docs/version-19.0.0/wallet_API.md @@ -1,40 +1,37 @@ --- title: Wallet API +id: wallet_API author: Claude Barde --- ## What is the Wallet API? -The Tezos blockchain is a fantastic tool, but it is self-contained. Except for the transactions you send to it, it has no interaction with the outside world. However, it would be amazing to interact with it, such as making payments, reading the balance of an account, or recording data in a smart contract. This interaction is what the Wallet API (and Taquito in general) achieves. The Wallet API provides a new yet familiar way to interact with the blockchain and smart contracts by delegating several actions that Taquito previously handled to the wallets. This delegation offers more flexibility for both developers and users and gives the ecosystem more space to evolve. +You have learned how to use Taquito to interact with the Tezos blockchain. Up to this document, we used a signer to sign operations. Interactive dApps (short for "decentralized Apps") commonly use a wallet to sign operations. The Wallet API provides a new yet familiar way to interact with the blockchain and smart contracts by delegating several actions that Taquito previously handled to the wallets. This delegation offers more flexibility for both developers and users and gives the ecosystem more space to evolve. From a user's perspective, the workflow is as follows: -## Installing the Wallet API - -The first thing to do is to use the wallet API is to install it. You just need to install the Taquito package to use the wallet API: +1. The user has a wallet installed and configured on their device. (Or they might be using a web-based wallet) +2. The user visits a dApp. +3. The user takes action to interact with the dApp. +4. The dApp asks the user to connect their wallet. +5. The user selects their wallet. +6. The wallet asks the user to confirm the connection. +7. When the dApp wants to send an operation, it asks the wallet to sign it. This might need additional confirmation from the user. +8. There are two possibilities here: + 1. The wallet signs the operation and sends (injects) it to the blockchain. + 2. The wallet sends the signed operation to the dApp, and the dApp sends it to the network. +9. The dApp can now wait for the operation to be confirmed. -``` -npm install @taquito/taquito +The main benefit of this workflow is that the user does not have to trust a dApp with their private key. The private key never leaves the wallet. -``` - -or - -``` -yarn add @taquito/taquito - -``` - -Make sure you have the latest version (`7.1.0` when this article was written, but the API became available from `6.3.2-beta.0`). +## Installing the Wallet API -Once the package is downloaded, you can install the wallet of your choice. The wallet API supports different kinds of wallets. The _Beacon_ and _Temple_ wallets are available to use at the moment. You can install one or both wallets, depending on your requirements: +The first thing to do is to use the wallet API is to install it. You just need to install the Taquito package to use the wallet API: ``` -npm install @taquito/beacon-wallet - -npm install @temple-wallet/dapp - +npm install @taquito/taquito @taquito/beacon-wallet @temple-wallet/dapp ``` -Remember that some wallets may require an extra step in addition to the package installation. For example, Temple must be used with an extension installed in the browser. We will explain the requirements for the different wallets in detail in the sections below. +A separate step from setting up the wallet in the dApp code as a developer is to set up the wallet as the user. This step is different for each wallet (e.g., Temple needs the user to install a browser extension). Some wallets are browser extensions, while others are mobile apps or web wallets. +We will explain the requirements for the different wallets in detail in the sections below. ## Connecting the wallet @@ -66,7 +63,7 @@ Then, you can start initializing the wallet: const options = { name: 'MyAwesomeDapp', iconUrl: 'https://tezostaquito.io/img/favicon.svg', - preferredNetwork: 'ghostnet', + network: { type: 'ghostnet' }, eventHandlers: { PERMISSION_REQUEST_SUCCESS: { handler: async (data) => { @@ -78,21 +75,24 @@ const options = { const wallet = new BeaconWallet(options); ``` -The necessary bare minimum to instantiate the wallet is an object with a `name` property that contains the name of your dapp. However, the Beacon wallet allows you to customize your dapp responses to different events. In the example above, instead of getting the default Beacon pop-up after the user connects the wallet, it will display the available data in the console. You can use whatever solution you prefer for feedback. You can find a list of all the default handlers [in the beacon-sdk Github repo](https://github.com/airgap-it/beacon-sdk/blob/master/packages/beacon-dapp/src/events.ts). +The necessary bare minimum to instantiate the wallet is an object with a `name` property that contains the name of your dapp and the network you want it to point to. In this case, we choose to point it to `ghostnet`. However, the Beacon wallet allows you to customize your dapp responses to different events. In the example above, instead of getting the default Beacon pop-up after the user connects the wallet, it will display the available data in the console. You can use whatever solution you prefer for feedback. You can find a list of all the default handlers [in the beacon-sdk Github repo](https://github.com/airgap-it/beacon-sdk/blob/master/packages/beacon-dapp/src/events.ts). -> Note: if you want to use the Kukai wallet for testing on ghostnet, you must use the optional property `preferredNetwork` and set it to `ghostnet`, otherwise the mainnet version of the Kukai wallet will open. +> Note: Previous versions of Beacon used to have a `preferredNetwork` property instead of `network`. This property has been removed in the latest version of Beacon, and you must now use the `network` property. The Beacon wallet requires an extra step to set up the network to connect to and the permissions: ```js -await wallet.requestPermissions({ - network: { - type: 'mainnet' | 'ghostnet' | 'jakartanet' | 'custom', - }, -}); +// TODO: subscribe to events, more information below +await wallet.requestPermissions(); ``` -You can choose among `mainnet`, `jakartanet` `ghostnet` and `custom` to set up the network. Once the permissions have been configured, you can get the user's address by calling the `getPKH` method on the wallet: +:::note Subscribe to Events to be notified of changes in the wallet +Please check out the section [Subscribing to events](#subscribing-to-events) to learn how to subscribe to events and be notified of changes in the wallet. +::: + +In previous versions of Beacon, you were able to set the `network` property when doing `requestPermissions()`. This behavior was removed from Beacon, and you must now set the network when instantiating the wallet. + +You can choose among `mainnet`, `oxfordnet`, `ghostnet` and `custom` to set up the network. Once the permissions have been configured, you can get the user's address by calling the `getPKH` method on the wallet: ```js const userAddress = await wallet.getPKH(); @@ -120,13 +120,29 @@ Make sure you have the Beacon browser extension installed (the extension offers // const wallet = new BeaconWallet(options); wallet - .requestPermissions({ network: { type: 'ghostnet' } }) + .requestPermissions() .then((_) => wallet.getPKH()) .then((address) => println(`Your address: ${address}`)); Tezos.setWalletProvider(wallet); ``` +### Subscribing to events + +While your dApp is connected to the wallet, different events can happen on the wallet side. A reactive dApp can subscribe to these events and update the UI to create a good user experience. +The different types of events are defined in the type `BeaconEvent` that can be imported from `"@airgap/beacon-sdk"`. Some of the events are: `ACTIVE_ACCOUNT_SET`, `PAIR_SUCCESS`, `SIGN_REQUEST_SUCCESS`. +To see all possible events, please check out the [BeaconEvent in Beacon SDK documentation](https://typedocs.walletbeacon.io/enums/beaconevent.html). + +You can subscribe to any of these events as follows: + +```ts +await wallet.client.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, (data) => { + // logic to update the active account in your dApp's UI + console.log(data.address); +}); +await wallet.requestPermissions(); +``` + ### - Development wallets During the development of your dapp, you may prefer a less "user-friendly" option that gives you more information and details than a more user-friendly wallet. You may also want to install and set up a wallet quickly that requires less boilerplate than the Beacon SDK. In these cases, use the Temple Wallet (for a quick setup using the Temple wallet extension). @@ -163,7 +179,7 @@ const wallet = new TempleWallet('MyAwesomeDapp'); The class constructor takes one parameter, the name of your dapp (this will be used later in the transaction confirmation pop-up). After the instantiation, we can connect the wallet by calling the `connect` method: ```js -await wallet.connect('mainnet' | 'mumbainet' | 'nairobinet' | 'ghostnet' | 'mondaynet' | 'sandbox'); +await wallet.connect('mainnet' | 'oxfordnet' | 'nairobinet' | 'ghostnet' | 'mondaynet' | 'sandbox'); ``` (Temple used to be called Thanos and some Taquito code still uses the name Thanos.) @@ -197,12 +213,12 @@ Tezos.setProvider({ wallet }); //import { TempleWallet } from '@temple-wallet/dapp'; TempleWallet.isAvailable() .then(() => { - const mywallet = new TempleWallet('MyAwesomeDapp'); - mywallet + const myWallet = new TempleWallet('MyAwesomeDapp'); + myWallet .connect('ghostnet') .then(() => { - Tezos.setWalletProvider(mywallet); - return mywallet.getPKH(); + Tezos.setWalletProvider(myWallet); + return myWallet.getPKH(); }) .then((pkh) => { println(`Your address: ${pkh}`); @@ -257,7 +273,7 @@ Transactions to smart contracts operate in the same fashion as transactions to a ## Calling a smart contract -Sending a transaction to a smart contract to update its storage will be a different type of action as it implies targetting a specific entrypoint and formatting correctly the data to be sent. +Sending a transaction to a smart contract to update its storage will be a different type of action as it implies targeting a specific entrypoint and formatting correctly the data to be sent. Fortunately, Taquito will make this operation go like a breeze! First, you need the contract abstraction created with the address of the smart contract you are targeting: @@ -721,7 +737,7 @@ const op = await Tezos.wallet.transfer({ to: 'tz1...', amount: 2 }).send(); await op.confirmation(); ``` -If you want to send a transaction to a contract, the process is very similar with the addition of the `parameter` property that must point to the entrypoint you are targetting and the value you want to pass: +If you want to send a transaction to a contract, the process is very similar with the addition of the `parameter` property that must point to the entrypoint you are targeting and the value you want to pass: ```js const op = await Tezos.wallet diff --git a/website/versioned_docs/version-17.1.0/wallets.md b/website/versioned_docs/version-19.0.0/wallets.md similarity index 100% rename from website/versioned_docs/version-17.1.0/wallets.md rename to website/versioned_docs/version-19.0.0/wallets.md diff --git a/website/versioned_docs/version-17.1.0/web3js_taquito.md b/website/versioned_docs/version-19.0.0/web3js_taquito.md similarity index 99% rename from website/versioned_docs/version-17.1.0/web3js_taquito.md rename to website/versioned_docs/version-19.0.0/web3js_taquito.md index 607625b365..f875578218 100644 --- a/website/versioned_docs/version-17.1.0/web3js_taquito.md +++ b/website/versioned_docs/version-19.0.0/web3js_taquito.md @@ -1,5 +1,5 @@ --- -title: Web3js/Taquito differences +title: web3js vs Taquito id: web3js_taquito author: Claude Barde --- diff --git a/website/versioned_sidebars/version-17.1.0-sidebars.json b/website/versioned_sidebars/version-19.0.0-sidebars.json similarity index 56% rename from website/versioned_sidebars/version-17.1.0-sidebars.json rename to website/versioned_sidebars/version-19.0.0-sidebars.json index da89ec9910..786f242d2c 100644 --- a/website/versioned_sidebars/version-17.1.0-sidebars.json +++ b/website/versioned_sidebars/version-19.0.0-sidebars.json @@ -8,58 +8,110 @@ "collapsible": false, "items": [ "quick_start", - "react-template", - "amendment_and_voting", - "batch_API", - "ballot", - "beaconwallet-singleton", - "confirmation_event_stream", + "tutorial", + "operation_flow", + "rpc_nodes", + "web3js_taquito", + "chatbot" + ] + }, + { + "type": "category", + "label": "Taquito Providers", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "prepare", + "estimate" + ] + }, + { + "type": "category", + "label": "Operations", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "making_transfers", + "originate", "consensus_key", - "contract_call_parameters", - "set_delegate", - "dapp_prelaunch", - "estimate", - "subscribe_event", - "fa2_parameters", "global_constant", "increase_paid_storage", - "lambda_view", - "liquidity_baking", - "local_forger", + "set_delegate", + "smart_rollups", + "proposal_and_ballot", + "failing_noop" + ] + }, + { + "type": "category", + "label": "Smart Contracts", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "smartcontracts", + "contract_call_parameters", + "fa2_parameters", "manager_lambda", + "multisig_doc" + ] + }, + { + "type": "category", + "label": "Wallets", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "beaconwallet-singleton", + "wallets", + "transaction_limits" + ] + }, + { + "type": "category", + "label": "Michelson", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ "maps_bigmaps", "michelsonmap", - "multisig_doc", - "on_chain_views", - "originate", - "prepare", - "rpc_nodes", - "rpc_package", - "signing", - "smartcontracts", - "contracts_collection", - "tezos_domains", - "tickets", - "transaction_limits", - "making_transfers", - "tutorial_links", + "tickets" + ] + }, + { + "type": "category", + "label": "Views", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "lambda_view", + "on_chain_views" + ] + }, + { + "type": "category", + "label": "Contract and Token Metadata", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ "tzip12", - "metadata-tzip16", - "validators", - "wallet_API", - "wallets", - "web3js_taquito", - "subscribe_event", - "smart_rollups" + "metadata-tzip16" ] }, { "type": "category", - "label": "Signer", + "label": "Signers", "className": "sidebarHeader", "collapsed": false, "collapsible": false, "items": [ + "signing", "inmemory_signer", "ledger_signer" ] @@ -71,14 +123,15 @@ "collapsed": false, "collapsible": false, "items": [ + "rpc_package", "michelson_encoder", "contracts-library", "taquito_utils", { "type": "category", "label": "Sapling", - "collapsed": true, - "collapsible": true, + "collapsed": false, + "collapsible": false, "items": [ "sapling", "sapling_in_memory_spending_key", @@ -89,24 +142,19 @@ }, { "type": "category", - "label": "Optimistic Rollups", - "className": "sidebarHeader", - "collapsed": false, - "collapsible": false, - "items": [ - "tx_rollups" - ] - }, - { - "type": "category", - "label": "Advanced Examples", + "label": "Advanced Scenarios", "className": "sidebarHeader", "collapsed": false, "collapsible": false, "items": [ + "ophash_before_injecting", + "drain_account", "complex_parameters", + "confirmation_event_stream", + "subscribe_event", + "liquidity_baking", "storage_annotations", - "drain_account" + "tezos_domains" ] }, { @@ -134,17 +182,36 @@ }, { "type": "category", - "label": "Native Mobile Development", + "label": "Dapp Development", "className": "sidebarHeader", "collapsed": false, "collapsible": false, "items": [ - "mobile_bundle" + "mobile_bundle", + "dapp_template", + "dapp_prelaunch" ] }, { - "Upgrading Guide": [ - "upgrading_guide" + "type": "category", + "label": "Taquito Public API", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "wallet_API", + "batch_API" + ] + }, + { + "type": "category", + "label": "Misc", + "className": "sidebarHeader", + "collapsed": false, + "collapsible": false, + "items": [ + "tutorial_links", + "contracts_collection" ] }, { diff --git a/website/versions.json b/website/versions.json index 2f7a18ca1b..95f4982ce5 100644 --- a/website/versions.json +++ b/website/versions.json @@ -1,7 +1,7 @@ [ + "19.0.0", "17.5.0", "17.4.0", "17.3.0", - "17.2.0", - "17.1.0" + "17.2.0" ]