diff --git a/contrib/taquito-rpc-bin/LICENSE b/contrib/taquito-rpc-bin/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/contrib/taquito-rpc-bin/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/contrib/taquito-rpc-bin/NOTICE b/contrib/taquito-rpc-bin/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..49b49415c76a90af0e32bc5985b2d9c55d65edc5 --- /dev/null +++ b/contrib/taquito-rpc-bin/NOTICE @@ -0,0 +1,10 @@ +Copyright 2023 ECAD Labs Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/contrib/taquito-rpc-bin/README.md b/contrib/taquito-rpc-bin/README.md new file mode 100644 index 0000000000000000000000000000000000000000..eb95a9beecad0f5f3a5e7426c5cabc95c4bc6cc2 --- /dev/null +++ b/contrib/taquito-rpc-bin/README.md @@ -0,0 +1,50 @@ +# Taquito RPC-bin package + +*This package is intended to become an alternative to Taquito RPC package, which queries the node in text-mode, using Json as a format for the data, whereas this present package uses binary mode, which reduces the load on the node and the quantity of data transiting on the network. +*Documentation can be found [here](https://tezostaquito.io/docs/rpc_package)* +*TypeDoc style documentation is available on-line [here](https://tezostaquito.io/typedoc/modules/_taquito_rpc.html)* + +`@taquito/rpc-bin` is an npm package that provides low-level methods and types to invoke RPC calls in binary mode from a Nomadic Tezos RPC node, and is intended to be an alternative to `@taquito/rpc`. + +## General Information + +The RPC-bin package can be used to query the RPC API of your chosen node in binary mode. Methods in the RPC package map one-to-one to the corresponding Tezos RPC API endpoints. All responses from the RPC are returns with TypeScript types. + +## Install + +``` +npm i --save @taquito/rpc-bin +``` + +## Usage +### RpcClient + +The constructor of the `RpcClient` takes an RPC URL as a parameter and an optional chain (default is main). + +```ts +import { RpcClient } from '@taquito/rpc-bin'; + +const client = new RpcClient('https://YOUR_PREFERRED_RPC_URL'); + +// Fetching the balance of an account +const balance = await client.getBalance('tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb'); +``` + +### RpcClientCache + +The `RpcClientCache` class aims to improve the performance of dApps built using Taquito by reducing the number of calls made to the RPC. Its constructor takes a RpcClient instance as a parameter and an optional ttl (time to live). The RpcClient responses will be cached for the period defined by the ttl (default is of 1000 milliseconds). The `RpcClientCache` can be injected to the TezosToolkit as follow: + +```ts +import { TezosToolkit } from '@taquito/taquito'; +import { RpcClient, RpcClientCache } from '@taquito/rpc'; + +const rpcClient = new RpcClient('https://YOUR_PREFERRED_RPC_URL'); +const tezos = new TezosToolkit(new RpcClientCache(rpcClient)); +``` +## Additional info + +See the top-level project [https://github.com/ecadlabs/taquito](https://github.com/ecadlabs/taquito) for details on reporting issues, contributing and versioning. + +## Disclaimer + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/contrib/taquito-rpc-bin/package.json b/contrib/taquito-rpc-bin/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6b42931648ec2bb33d3af5d58f76b441d03ac33a --- /dev/null +++ b/contrib/taquito-rpc-bin/package.json @@ -0,0 +1,104 @@ +{ + "name": "@taquito/rpc-bin", + "version": "17.2.0", + "description": "Provides low level methods, and types to invoke RPC calls from a Nomadic Tezos RPC node in binary mode", + "keywords": [ + "tezos", + "blockchain", + "rpc" + ], + "main": "dist/taquito-rpc-bin.umd.js", + "module": "dist/taquito-rpc-bin.es6.js", + "typings": "dist/types/taquito-rpc-bin.d.ts", + "files": [ + "signature.json", + "dist" + ], + "publishConfig": { + "access": "public" + }, + "author": "Simon Boissonneault-Robert ", + "repository": { + "type": "git", + "url": "" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=16" + }, + "scripts": { + "test": "jest --coverage", + "test:watch": "jest --coverage --watch", + "test:prod": "npm run lint && npm run test -- --no-cache", + "lint": "eslint --ext .js,.ts .", + "precommit": "lint-staged", + "prebuild": "rimraf dist", + "version-stamp": "node ../taquito/version-stamping.js", + "build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts ", + "start": "rollup -c rollup.config.ts -w" + }, + "lint-staged": { + "{src,test}/**/*.ts": [ + "prettier --write", + "eslint --fix", + "git add" + ] + }, + "jest": { + "transform": { + ".(ts|tsx)": "ts-jest" + }, + "testEnvironment": "node", + "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", + "moduleFileExtensions": [ + "ts", + "tsx", + "js" + ], + "moduleNameMapper": { + "^@taquito/http-utils$": "/../taquito-http-utils/src/taquito-http-utils.ts" + }, + "coveragePathIgnorePatterns": [ + "/node_modules/", + "/test/" + ], + "collectCoverageFrom": [ + "src/**/*.{js,ts}" + ] + }, + "dependencies": { + "@taquito/core": "^17.2.0", + "@taquito/http-utils": "^17.2.0", + "@taquito/utils": "^17.2.0", + "bignumber.js": "^9.1.0" + }, + "devDependencies": { + "@types/bluebird": "^3.5.36", + "@types/jest": "^26.0.23", + "@types/node": "^16", + "@typescript-eslint/eslint-plugin": "^5.28.0", + "@typescript-eslint/parser": "^5.28.0", + "colors": "^1.4.0", + "coveralls": "^3.1.1", + "cross-env": "^7.0.3", + "eslint": "^8.17.0", + "jest": "^26.6.3", + "jest-config": "^26.6.3", + "lint-staged": "^13.0.1", + "lodash.camelcase": "^4.3.0", + "prettier": "^2.7.0", + "prompt": "^1.3.0", + "replace-in-file": "^6.3.5", + "rimraf": "^3.0.2", + "rollup": "^2.75.6", + "rollup-plugin-json": "^4.0.0", + "rollup-plugin-sourcemaps": "^0.6.3", + "rollup-plugin-typescript2": "^0.32.1", + "shelljs": "^0.8.5", + "ts-jest": "^26.4.4", + "ts-node": "^10.4.0", + "ts-toolbelt": "^9.6.0", + "typescript": "~4.1.5" + }, + "gitHead": "551e35aeff7d6dcde1c72284238c0ed3c3aae77e" +} diff --git a/contrib/taquito-rpc-bin/src/opkind.ts b/contrib/taquito-rpc-bin/src/opkind.ts new file mode 100644 index 0000000000000000000000000000000000000000..b7e163d4b7873e001f0de7419913fa9884e3aebb --- /dev/null +++ b/contrib/taquito-rpc-bin/src/opkind.ts @@ -0,0 +1,42 @@ +export enum OpKind { + ORIGINATION = 'origination', + DELEGATION = 'delegation', + REVEAL = 'reveal', + TRANSACTION = 'transaction', + ACTIVATION = 'activate_account', + ENDORSEMENT = 'endorsement', + PREENDORSEMENT = 'preendorsement', + SET_DEPOSITS_LIMIT = 'set_deposits_limit', + DOUBLE_PREENDORSEMENT_EVIDENCE = 'double_preendorsement_evidence', + ENDORSEMENT_WITH_SLOT = 'endorsement_with_slot', + SEED_NONCE_REVELATION = 'seed_nonce_revelation', + 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', + DRAIN_DELEGATE = 'drain_delegate', + VDF_REVELATION = 'vdf_revelation', + EVENT = 'event', + TICKET_UPDATES = 'ticket_updates', + SMART_ROLLUP_ORIGINATE = 'smart_rollup_originate', + SMART_ROLLUP_ADD_MESSAGES = 'smart_rollup_add_messages', + SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE = 'smart_rollup_execute_outbox_message', + SMART_ROLLUP_PUBLISH = 'smart_rollup_publish', + SMART_ROLLUP_CEMENT = 'smart_rollup_cement', + SMART_ROLLUP_RECOVER_BOND = 'smart_rollup_recover_bond', + SMART_ROLLUP_REFUTE = 'smart_rollup_refute', + SMART_ROLLUP_TIMEOUT = 'smart_rollup_timeout', +} diff --git a/contrib/taquito-rpc-bin/src/rpc-client-interface.ts b/contrib/taquito-rpc-bin/src/rpc-client-interface.ts new file mode 100644 index 0000000000000000000000000000000000000000..f8e910a99c9f3d2951c695722c23fbfda53d9dbd --- /dev/null +++ b/contrib/taquito-rpc-bin/src/rpc-client-interface.ts @@ -0,0 +1,181 @@ +import { BigNumber } from 'bignumber.js'; +import { + BakingRightsQueryArguments, + BakingRightsResponse, + BalanceResponse, + BallotListResponse, + BallotsResponse, + BigMapGetResponse, + BigMapKey, + BigMapResponse, + BlockHeaderResponse, + BlockMetadata, + BlockResponse, + ConstantsResponse, + ContractResponse, + CurrentProposalResponse, + CurrentQuorumResponse, + DelegateResponse, + DelegatesResponse, + EndorsingRightsQueryArguments, + EndorsingRightsResponse, + EntrypointsResponse, + ForgeOperationsParams, + ManagerKeyResponse, + OperationHash, + PackDataParams, + PreapplyParams, + PreapplyResponse, + ProposalsResponse, + ProtocolsResponse, + RPCRunCodeParam, + RPCRunOperationParam, + RPCRunScriptViewParam, + RPCRunViewParam, + RunCodeResult, + RunScriptViewResult, + RunViewResult, + SaplingDiffResponse, + ScriptResponse, + StorageResponse, + TxRollupInboxResponse, + TxRollupStateResponse, + UnparsingMode, + VotesListingsResponse, + VotingInfoResponse, + VotingPeriodBlockResult, + TicketTokenParams, + AllTicketBalances, + PendingOperations, + PendingOperationsQueryArguments, + OriginationProofParams, + RPCSimulateOperationParam, +} from './types'; + +export interface RPCOptions { + block: string; +} + +export const defaultChain = 'main'; +export const defaultRPCOptions: RPCOptions = { block: 'head' }; + +export interface RpcClientInterface { + getBlockHash(options?: RPCOptions): Promise; + getLiveBlocks(options?: RPCOptions): Promise; + getBalance(address: string, options?: RPCOptions): Promise; + getStorage(address: string, options?: RPCOptions): Promise; + getScript(address: string, options?: RPCOptions): Promise; + getNormalizedScript( + address: string, + unparsingMode?: UnparsingMode, + options?: RPCOptions + ): Promise; + getContract(address: string, options?: RPCOptions): Promise; + getManagerKey(address: string, options?: RPCOptions): Promise; + getDelegate(address: string, options?: RPCOptions): Promise; + getBigMapKey(address: string, key: BigMapKey, options?: RPCOptions): Promise; + getBigMapExpr(id: string, expr: string, options?: RPCOptions): Promise; + getDelegates(address: string, options?: RPCOptions): Promise; + getVotingInfo(address: string, options?: RPCOptions): Promise; + getConstants(options?: RPCOptions): Promise; + getBlock(options?: RPCOptions): Promise; + getBlockHeader(options?: RPCOptions): Promise; + getBlockMetadata(options?: RPCOptions): Promise; + getBakingRights( + args: BakingRightsQueryArguments, + options?: RPCOptions + ): Promise; + getEndorsingRights( + args: EndorsingRightsQueryArguments, + options?: RPCOptions + ): Promise; + getBallotList(options?: RPCOptions): Promise; + getBallots(options?: RPCOptions): Promise; + getCurrentProposal(options?: RPCOptions): Promise; + getCurrentQuorum(options?: RPCOptions): Promise; + getVotesListings(options?: RPCOptions): Promise; + getProposals(options?: RPCOptions): Promise; + forgeOperations(data: ForgeOperationsParams, options?: RPCOptions): Promise; + injectOperation(signedOpBytes: string): Promise; + preapplyOperations(ops: PreapplyParams, options?: RPCOptions): Promise; + getEntrypoints(contract: string, options?: RPCOptions): Promise; + runOperation(op: RPCRunOperationParam, options?: RPCOptions): Promise; + simulateOperation(op: RPCSimulateOperationParam, options?: RPCOptions): Promise; + runCode(code: RPCRunCodeParam, options?: RPCOptions): Promise; + runScriptView( + viewScriptParams: RPCRunScriptViewParam, + options?: RPCOptions + ): Promise; + runView(viewParams: RPCRunViewParam, options?: RPCOptions): Promise; + getChainId(): Promise; + packData( + data: PackDataParams, + options?: RPCOptions + ): Promise<{ packed: string; gas: BigNumber | 'unaccounted' | undefined }>; + getRpcUrl(): string; + getCurrentPeriod(options?: RPCOptions): Promise; + getSuccessorPeriod(options?: RPCOptions): Promise; + 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( + contract: string, + ticket: TicketTokenParams, + options?: RPCOptions + ): Promise; + getAllTicketBalances(contract: string, options?: RPCOptions): Promise; + getPendingOperations(args: PendingOperationsQueryArguments): Promise; + getOriginationProof(params: OriginationProofParams, options?: RPCOptions): Promise; +} + +export enum RPCMethodName { + GET_BAKING_RIGHTS = 'getBakingRights', + GET_BALLOTS = 'getBallots', + GET_BALLOT_LIST = 'getBallotList', + GET_BIG_MAP_KEY = 'getBigMapKey', + GET_BIG_MAP_EXPR = 'getBigMapExpr', + GET_BLOCK_HASH = 'getBlockHash', + GET_BLOCK = 'getBlock', + GET_BLOCK_HEADER = 'getBlockHeader', + GET_BLOCK_METADATA = 'getBlockMetadata', + GET_BALANCE = 'getBalance', + GET_CHAIN_ID = 'getChainId', + GET_CONSTANTS = 'getConstants', + GET_CONTRACT = 'getContract', + GET_CURRENT_PERIOD = 'getCurrentPeriod', + GET_CURRENT_PROPOSAL = 'getCurrentProposal', + GET_CURRENT_QUORUM = 'getCurrentQuorum', + GET_DELEGATE = 'getDelegate', + GET_DELEGATES = 'getDelegates', + GET_VOTING_INFO = 'getVotingInfo', + GET_ENDORSING_RIGHTS = 'getEndorsingRights', + GET_ENTRYPOINTS = 'getEntrypoints', + GET_LIVE_BLOCKS = 'getLiveBlocks', + GET_MANAGER_KEY = 'getManagerKey', + GET_NORMALIZED_SCRIPT = 'getNormalizedScript', + GET_PROPOSALS = 'getProposals', + GET_PROTOCOLS = 'getProtocols', + GET_SAPLING_DIFF_BY_CONTRACT = 'getSaplingDiffByContract', + GET_SAPLING_DIFF_BY_ID = 'getSaplingDiffById', + 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', + GET_STORAGE_PAID_SPACE = 'getStoragePaidSpace', + GET_TICKET_BALANCE = 'getTicketBalance', + GET_ALL_TICKET_BALANCES = 'getAllTicketBalances', + GET_PENDING_OPERATIONS = 'getPendingOperations', + GET_ORIGINATION_PROOF = 'getOriginationProof', +} diff --git a/contrib/taquito-rpc-bin/src/rpc-client-modules/rpc-cache.ts b/contrib/taquito-rpc-bin/src/rpc-client-modules/rpc-cache.ts new file mode 100644 index 0000000000000000000000000000000000000000..186cdda118352e6f6050bc5ab21a8355158e75fe --- /dev/null +++ b/contrib/taquito-rpc-bin/src/rpc-client-modules/rpc-cache.ts @@ -0,0 +1,1296 @@ +import { RPCMethodName } from './../rpc-client-interface'; +import BigNumber from 'bignumber.js'; +import { defaultRPCOptions, RpcClientInterface, RPCOptions } from '../rpc-client-interface'; +import { + BakingRightsQueryArguments, + BakingRightsResponse, + BalanceResponse, + BallotListResponse, + BallotsResponse, + BigMapGetResponse, + BigMapKey, + BigMapResponse, + BlockHeaderResponse, + BlockMetadata, + BlockResponse, + ConstantsResponse, + ContractResponse, + CurrentProposalResponse, + CurrentQuorumResponse, + DelegateResponse, + DelegatesResponse, + VotingInfoResponse, + EndorsingRightsQueryArguments, + EndorsingRightsResponse, + EntrypointsResponse, + ForgeOperationsParams, + ManagerKeyResponse, + OperationHash, + PackDataParams, + PreapplyParams, + PreapplyResponse, + ProposalsResponse, + ProtocolsResponse, + RPCRunCodeParam, + RPCRunOperationParam, + RPCRunScriptViewParam, + RPCRunViewParam, + RunCodeResult, + RunScriptViewResult, + RunViewResult, + SaplingDiffResponse, + ScriptResponse, + StorageResponse, + TxRollupInboxResponse, + TxRollupStateResponse, + UnparsingMode, + VotesListingsResponse, + VotingPeriodBlockResult, + TicketTokenParams, + AllTicketBalances, + PendingOperationsQueryArguments, + PendingOperations, + OriginationProofParams, + RPCSimulateOperationParam, +} from '../types'; +import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core'; +import { + validateContractAddress, + validateAddress, + ValidationResult, + invalidDetail, +} from '@taquito/utils'; + +interface CachedDataInterface { + [key: string]: { + handle: () => void; + response: Promise; + }; +} + +type RpcMethodParam = + | string + | UnparsingMode + | BigMapKey + | BakingRightsQueryArguments + | PendingOperationsQueryArguments + | EndorsingRightsQueryArguments + | OriginationProofParams; + +const defaultTtl = 1000; + +/*** + * @description RpcClientCache acts as a decorator over the RpcClient instance by caching responses for the period defined by the ttl. + */ +export class RpcClientCache implements RpcClientInterface { + private _cache: CachedDataInterface = {}; + /** + * + * @param rpcClient rpcClient responsible of the interaction with Tezos network through an rpc node + * @param ttl number representing the time to live (default 1000 milliseconds) + * + * @example new RpcClientCache(new RpcClient('https://mainnet.api.tez.ie/')) + */ + constructor(private rpcClient: RpcClientInterface, private ttl = defaultTtl) {} + + getAllCachedData() { + return this._cache; + } + /** + * @description Remove all the data in the cache. + * + */ + deleteAllCachedData() { + for (const key in this._cache) { + delete this._cache[key]; + } + } + + private formatCacheKey( + rpcUrl: string, + rpcMethodName: RPCMethodName, + rpcMethodParams: RpcMethodParam[], + rpcMethodData?: object + ) { + let paramsToString = ''; + rpcMethodParams.forEach((param) => { + paramsToString = + typeof param === 'object' + ? paramsToString + JSON.stringify(param) + '/' + : paramsToString + param + '/'; + }); + return rpcMethodData + ? `${rpcUrl}/${rpcMethodName}/${paramsToString}${JSON.stringify(rpcMethodData)}/` + : `${rpcUrl}/${rpcMethodName}/${paramsToString}`; + } + + private has(key: string) { + return key in this._cache; + } + + private get(key: string) { + return this._cache[key].response; + } + + private put(key: string, response: Promise) { + const handle = setTimeout(() => { + return this.remove(key); + }, this.ttl); + + Object.assign(this._cache, { [key]: { handle, response } }); + } + + private remove(key: string) { + if (key in this._cache) { + delete this._cache[key]; + } + } + + private validateAddress(address: string) { + const addressValidation = validateAddress(address); + if (addressValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(address, invalidDetail(addressValidation)); + } + } + + private validateContract(address: string) { + const addressValidation = validateContractAddress(address); + if (addressValidation !== ValidationResult.VALID) { + throw new InvalidContractAddressError(address, invalidDetail(addressValidation)); + } + } + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HASH, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBlockHash({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_LIVE_BLOCKS, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getLiveBlocks({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance + */ + async getBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALANCE, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBalance(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param address contract address from which we want to retrieve the storage + * @param options contains generic configuration for rpc calls + * @throws {@link InvalidContractAddressError} + * @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( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateContract(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getStorage(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param address contract address from which we want to retrieve the script + * @param options contains generic configuration for rpc calls + * @throws {@link InvalidContractAddressError} + * @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( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateContract(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SCRIPT, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getScript(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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} + * @description Access the script of the contract and normalize it using the requested unparsing mode. + * + */ + async getNormalizedScript( + address: string, + unparsingMode: UnparsingMode = { unparsing_mode: 'Readable' }, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateContract(address); + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_NORMALIZED_SCRIPT, + [block, address], + unparsingMode + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param address contract address from which we want to retrieve + * @param options contains generic configuration for rpc calls + * + * @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( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONTRACT, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getContract(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-manager-key + */ + async getManagerKey( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_MANAGER_KEY, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getManagerKey(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-delegate + */ + async getDelegate( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DELEGATE, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getDelegate(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param address contract address from which we want to retrieve the big map key + * @param options contains generic configuration for rpc calls + * + * @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( + address: string, + key: BigMapKey, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const keyUrl = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_BIG_MAP_KEY, + [block, address], + key + ); + if (this.has(keyUrl)) { + return this.get(keyUrl); + } else { + const response = this.rpcClient.getBigMapKey(address, key, { block }); + this.put(keyUrl, response); + return response; + } + } + + /** + * + * @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 + * + * @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( + id: string, + expr: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BIG_MAP_EXPR, [ + block, + id, + expr, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBigMapExpr(id, expr, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh + */ + async getDelegates( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DELEGATES, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getDelegates(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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 + */ + + async getVotingInfo( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_VOTING_INFO, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getVotingInfo(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description All constants + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants + */ + async getConstants({ block }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONSTANTS, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getConstants({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls. See examples for various available sytaxes. + * + * @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.. + */ + async getBlock({ block }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK, [block]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBlock({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description The whole block header + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-header + */ + async getBlockHeader({ block }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HEADER, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBlockHeader({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_METADATA, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBlockMetadata({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param args contains optional query arguments + * @param options contains generic configuration for rpc calls + * + * @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( + args: BakingRightsQueryArguments = {}, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BAKING_RIGHTS, [ + block, + args, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBakingRights(args, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param args contains optional query arguments + * @param options contains generic configuration for rpc calls + * + * @description Retrieves the list of delegates allowed to bake a block. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights + */ + async getEndorsingRights( + args: EndorsingRightsQueryArguments = {}, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_ENDORSING_RIGHTS, + [block, args] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getEndorsingRights(args, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param options contains generic configuration for rpc calls + * + * @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 { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOT_LIST, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBallotList({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOTS, [block]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBallots({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description Current proposal under evaluation. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal + */ + async getCurrentProposal({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_CURRENT_PROPOSAL, + [block] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getCurrentProposal({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description Current expected quorum. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum + */ + async getCurrentQuorum({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_QUORUM, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getCurrentQuorum({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description List of delegates with their voting weight, in number of rolls. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings + */ + async getVotesListings({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_VOTES_LISTINGS, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getVotesListings({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROPOSALS, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getProposals({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param data operation contents to forge + * @param options contains generic configuration for rpc calls + * + * @description Forge an operation returning the unsigned bytes + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations + */ + async forgeOperations( + data: ForgeOperationsParams, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.forgeOperations(data, { block }); + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#post-injection-operation + */ + async injectOperation(signedOpBytes: string): Promise { + return this.rpcClient.injectOperation(signedOpBytes); + } + + /** + * + * @param ops Operations to apply + * @param options contains generic configuration for rpc calls + * + * @description Simulate the validation of an operation + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations + */ + async preapplyOperations( + ops: PreapplyParams, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.preapplyOperations(ops, { block }); + } + + /** + * + * @param contract address of the contract we want to get the entrypoints of + * + * @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( + contract: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateContract(contract); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ENTRYPOINTS, [ + block, + contract, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getEntrypoints(contract, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param op Operation to run + * @param options contains generic configuration for rpc calls + * + * @description Run an operation without signature checks + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-operation + */ + async runOperation( + op: RPCRunOperationParam, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.runOperation(op, { block }); + } + + /** + * @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 + */ + async simulateOperation( + op: RPCSimulateOperationParam, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.simulateOperation(op, { block }); + } + + /** + * @param code Code to run + * @param options contains generic configuration for rpc calls + * + * @description Run a piece of code in the current context + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-code + */ + async runCode( + code: RPCRunCodeParam, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.runCode(code, { block }); + } + + /** + * @param viewScriptParams Parameters of the script view to run + * @param options contains generic configuration for rpc calls + * + * @description Simulate a call to a michelson view + * + */ + async runScriptView( + { unparsing_mode = 'Readable', ...rest }: RPCRunScriptViewParam, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.runScriptView( + { + unparsing_mode, + ...rest, + }, + { block } + ); + } + + /** + * @param viewParams Parameters of the view to run + * @param options contains generic configuration for rpc calls + * + * @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, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpcClient.runView( + { + unparsing_mode, + ...rest, + }, + { block } + ); + } + + async getChainId() { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CHAIN_ID, []); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getChainId(); + this.put(key, response); + return response; + } + } + + /** + * + * @param data Data to pack + * @param options contains generic configuration for rpc calls + * + * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK + * + * @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 + ): Promise<{ packed: string; gas: BigNumber | 'unaccounted' | undefined }> { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.PACK_DATA, + [block], + data + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.packData(data, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @description Return rpc root url + */ + getRpcUrl() { + return this.rpcClient.getRpcUrl(); + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period + */ + async getCurrentPeriod({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_PERIOD, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getCurrentPeriod({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description Voting period of 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({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_SUCCESSOR_PERIOD, + [block] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getSuccessorPeriod({ block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param id Sapling state ID + * @param options contains generic configuration for rpc calls + * + * @description Access the value associated with a sapling state ID. + * + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff + */ + async getSaplingDiffById( + id: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_SAPLING_DIFF_BY_ID, + [block, id] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getSaplingDiffById(id, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff + */ + async getSaplingDiffByContract( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_SAPLING_DIFF_BY_CONTRACT, + [block, contract] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getSaplingDiffByContract(contract, { block }); + this.put(key, response); + return response; + } + } + + async getProtocols({ block }: { block: string } = defaultRPCOptions): Promise { + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROTOCOLS, [ + block, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getProtocols({ block }); + this.put(key, response); + return response; + } + } + + 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 + * + * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + */ + async getStorageUsedSpace( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_STORAGE_USED_SPACE, + [block, contract] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getStorageUsedSpace(contract, { 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 paid space in a contract's storage + * + * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + */ + async getStoragePaidSpace( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_STORAGE_PAID_SPACE, + [block, contract] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getStoragePaidSpace(contract, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @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 + * @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 + */ + async getTicketBalance( + contract: string, + ticket: TicketTokenParams, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_TICKET_BALANCE, + [block, contract], + ticket + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getTicketBalance(contract, ticket, { block }); + this.put(key, response); + return response; + } + } + + /** + * + * @param contract address of the contract to retrieve all ticket balances from + * @param options contains generic configuration for rpc calls + * @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 + */ + async getAllTicketBalances( + contract: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_ALL_TICKET_BALANCES, + [block, contract] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getAllTicketBalances(contract, { block }); + this.put(key, response); + return response; + } + } + + /** + * @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 + * @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 { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_PENDING_OPERATIONS, + [args] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getPendingOperations(args); + this.put(key, response); + 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/contrib/taquito-rpc-bin/src/taquito-rpc-bin.ts b/contrib/taquito-rpc-bin/src/taquito-rpc-bin.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ba4414cbb1095ee9f35fb2a6429156068482de9 --- /dev/null +++ b/contrib/taquito-rpc-bin/src/taquito-rpc-bin.ts @@ -0,0 +1,1244 @@ +/** + * @packageDocumentation + * @module @taquito/rpc + */ +import { HttpBackend, HttpResponseError, STATUS_CODE } from '@taquito/http-utils'; +import BigNumber from 'bignumber.js'; +import { + defaultChain, + defaultRPCOptions, + RpcClientInterface, + RPCOptions, +} from './rpc-client-interface'; +import { + BakingRightsQueryArguments, + BakingRightsResponse, + BalanceResponse, + BallotListResponse, + BallotsResponse, + BigMapGetResponse, + BigMapKey, + BigMapResponse, + BlockHeaderResponse, + BlockMetadata, + BlockResponse, + ConstantsResponse, + ContractResponse, + CurrentProposalResponse, + CurrentQuorumResponse, + DelegateResponse, + DelegatesResponse, + VotingInfoResponse, + EndorsingRightsQueryArguments, + EndorsingRightsResponse, + EntrypointsResponse, + ForgeOperationsParams, + ManagerKeyResponse, + MichelsonV1ExpressionExtended, + OperationHash, + PackDataParams, + PackDataResponse, + PreapplyParams, + PreapplyResponse, + ProposalsResponse, + ProtocolsResponse, + RPCRunCodeParam, + RPCRunOperationParam, + RPCRunViewParam, + RPCRunScriptViewParam, + RunCodeResult, + RunViewResult, + RunScriptViewResult, + SaplingDiffResponse, + ScriptResponse, + StorageResponse, + UnparsingMode, + VotesListingsResponse, + VotingPeriodBlockResult, + TxRollupStateResponse, + TxRollupInboxResponse, + TicketTokenParams, + AllTicketBalances, + PendingOperationsQueryArguments, + PendingOperations, + OriginationProofParams, + RPCSimulateOperationParam, +} from './types'; +import { castToBigNumber } from './utils/utils'; +import { + validateAddress, + validateContractAddress, + ValidationResult, + invalidDetail, +} from '@taquito/utils'; +import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core'; + +export { castToBigNumber } from './utils/utils'; + +export { + RPCOptions, + defaultChain, + defaultRPCOptions, + RpcClientInterface, +} from './rpc-client-interface'; + +export { RpcClientCache } from './rpc-client-modules/rpc-cache'; + +export * from './types'; + +export { OpKind } from './opkind'; + +export { VERSION } from './version'; + +/*** + * @description RpcClient allows interaction with Tezos network through an rpc node + */ +export class RpcClient implements RpcClientInterface { + /** + * + * @param url rpc root url + * @param chain chain (default main) + * @param httpBackend Http backend that issue http request. + * You can override it by providing your own if you which to hook in the request/response + * + * @example new RpcClient('https://mainnet.api.tez.ie/', 'main') this will use https://mainnet.api.tez.ie//chains/main + */ + constructor( + protected url: string, + protected chain: string = defaultChain, + protected httpBackend: HttpBackend = new HttpBackend() + ) {} + + protected createURL(path: string) { + // Trim trailing slashes because it is assumed to be included in path + return `${this.url.replace(/\/+$/g, '')}${path}`; + } + + private validateAddress(address: string) { + const addressValidation = validateAddress(address); + if (addressValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(address, invalidDetail(addressValidation)); + } + } + + private validateContract(address: string) { + const addressValidation = validateContractAddress(address); + if (addressValidation !== ValidationResult.VALID) { + throw new InvalidContractAddressError(address, invalidDetail(addressValidation)); + } + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const hash = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/hash`), + method: 'GET', + }); + return hash; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const blocks = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/live_blocks`), + method: 'GET', + }); + return blocks; + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance + */ + async getBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const balance = await this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + + /** + * + * @param address contract address from which we want to retrieve the storage + * @param options contains generic configuration for rpc calls + * + * @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( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateContract(address); + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/storage` + ), + method: 'GET', + }); + } + + /** + * + * @param address contract address from which we want to retrieve the script + * @param options contains generic configuration for rpc calls + * + * @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( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateContract(address); + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script` + ), + method: 'GET', + }); + } + + /** + * + * @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 + * + * @description Access the script of the contract and normalize it using the requested unparsing mode. + * + */ + async getNormalizedScript( + address: string, + unparsingMode: UnparsingMode = { unparsing_mode: 'Readable' }, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateContract(address); + return this.httpBackend.createRequest( + { + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script/normalized` + ), + method: 'POST', + }, + unparsingMode + ); + } + + /** + * + * @param address contract address from which we want to retrieve + * @param options contains generic configuration for rpc calls + * + * @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( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const contractResponse = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}`), + method: 'GET', + }); + return { + ...contractResponse, + balance: new BigNumber(contractResponse.balance), + }; + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-manager-key + */ + async getManagerKey( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/manager_key` + ), + method: 'GET', + }); + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-delegate + */ + async getDelegate( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + let delegate: DelegateResponse; + try { + delegate = await this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/delegate` + ), + method: 'GET', + }); + } catch (ex) { + if (ex instanceof HttpResponseError && ex.status === STATUS_CODE.NOT_FOUND) { + delegate = null; + } else { + throw ex; + } + } + return delegate; + } + + /** + * + * @param address contract address from which we want to retrieve the big map key + * @param options contains generic configuration for rpc calls + * + * @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( + address: string, + key: BigMapKey, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + return this.httpBackend.createRequest( + { + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/big_map_get` + ), + method: 'POST', + }, + key + ); + } + + /** + * + * @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 + * + * @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( + id: string, + expr: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/big_maps/${id}/${expr}`), + method: 'GET', + }); + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh + */ + async getDelegates( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}`), + method: 'GET', + }); + + const castedResponse: any = castToBigNumber(response, [ + 'balance', + 'full_balance', + 'current_frozen_deposits', + 'frozen_deposits', + 'frozen_balance', + 'frozen_deposits_limit', + 'staking_balance', + 'delegated_balance', + 'voting_power', + ]); + + return { + ...response, + ...castedResponse, + frozen_balance_by_cycle: response.frozen_balance_by_cycle + ? response.frozen_balance_by_cycle.map(({ deposit, deposits, fees, rewards, ...rest }) => { + const castedToBigNumber: any = castToBigNumber({ deposit, deposits, fees, rewards }, [ + 'deposit', + 'deposits', + 'fees', + 'rewards', + ]); + return { + ...rest, + deposit: castedToBigNumber.deposit, + deposits: castedToBigNumber.deposits, + fees: castedToBigNumber.fees, + rewards: castedToBigNumber.rewards, + }; + }) + : undefined, + }; + } + + /** + * + * @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 + */ + + async getVotingInfo( + address: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + this.validateAddress(address); + return await this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/delegates/${address}/voting_info` + ), + method: 'GET', + }); + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description All constants + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants + */ + async getConstants({ block }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/constants`), + method: 'GET', + }); + + const castedResponse: any = castToBigNumber(response, [ + 'time_between_blocks', + 'hard_gas_limit_per_operation', + 'hard_gas_limit_per_block', + 'proof_of_work_threshold', + 'tokens_per_roll', + 'seed_nonce_revelation_tip', + 'block_security_deposit', + 'endorsement_security_deposit', + 'block_reward', + 'endorsement_reward', + 'cost_per_byte', + 'hard_storage_limit_per_operation', + 'test_chain_duration', + 'baking_reward_per_endorsement', + 'delay_per_missing_endorsement', + 'minimal_block_delay', + 'liquidity_baking_subsidy', + 'cache_layout', + 'baking_reward_fixed_portion', + 'baking_reward_bonus_per_slot', + 'endorsing_reward_per_slot', + 'double_baking_punishment', + 'delay_increment_per_round', + 'tx_rollup_commitment_bond', + 'vdf_difficulty', + 'sc_rollup_stake_amount', + 'minimal_stake', + ]); + + return { + ...response, + ...(castedResponse as ConstantsResponse), + }; + } + + /** + * + * @param options contains generic configuration for rpc calls. See examples for various available sytaxes. + * + * @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.. + */ + async getBlock({ block }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description The whole block header + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-header + */ + async getBlockHeader({ block }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/header`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/metadata`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param args contains optional query arguments + * @param options contains generic configuration for rpc calls + * + * @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( + args: BakingRightsQueryArguments = {}, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/baking_rights`), + method: 'GET', + query: args, + }); + + return response; + } + + /** + * + * @param args contains optional query arguments + * @param options contains generic configuration for rpc calls + * + * @description Retrieves the list of delegates allowed to bake a block. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights + */ + async getEndorsingRights( + args: EndorsingRightsQueryArguments = {}, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/endorsing_rights`), + method: 'GET', + query: args, + }); + + return response; + } + + /** + * @param options contains generic configuration for rpc calls + * + * @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 { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballot_list`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballots`), + method: 'GET', + }); + + const casted: any = castToBigNumber(response, ['yay', 'nay', 'pass']); + return casted; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description Current proposal under evaluation. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal + */ + async getCurrentProposal({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_proposal`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description Current expected quorum. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum + */ + async getCurrentQuorum({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_quorum`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description List of delegates with their voting weight, in number of rolls. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings + */ + async getVotesListings({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/listings`), + method: 'GET', + }); + + response.map((item) => { + if (item.voting_power) { + item.voting_power = new BigNumber(item.voting_power); + } + return item; + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @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 { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/proposals`), + method: 'GET', + }); + + response.map((item) => { + return (item[1] = new BigNumber(item[1])); + }); + + return response; + } + + /** + * + * @param data operation contents to forge + * @param options contains generic configuration for rpc calls + * + * @description Forge an operation returning the unsigned bytes + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations + */ + async forgeOperations( + data: ForgeOperationsParams, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest( + { + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/forge/operations`), + method: 'POST', + }, + data + ); + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#post-injection-operation + */ + async injectOperation(signedOpBytes: string): Promise { + return this.httpBackend.createRequest( + { + url: this.createURL(`/injection/operation`), + method: 'POST', + }, + signedOpBytes + ); + } + + /** + * + * @param ops Operations to apply + * @param options contains generic configuration for rpc calls + * + * @description Simulate the validation of an operation + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations + */ + async preapplyOperations( + ops: PreapplyParams, + { block }: 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; + } + + /** + * + * @param contract address of the contract we want to get the entrypoints of + * + * @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( + contract: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateContract(contract); + const contractResponse = await this.httpBackend.createRequest<{ + entrypoints: { [key: string]: MichelsonV1ExpressionExtended }; + }>({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/entrypoints` + ), + method: 'GET', + }); + + return contractResponse; + } + + /** + * @param op Operation to run + * @param options contains generic configuration for rpc calls + * + * @description Run an operation without signature checks + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-operation + */ + async runOperation( + op: RPCRunOperationParam, + { block }: 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; + } + + /** + * @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 + */ + async simulateOperation( + op: RPCSimulateOperationParam, + { block }: 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; + } + + /** + * @param code Code to run + * @param options contains generic configuration for rpc calls + * + * @description Run a piece of code in the current context + * + * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-code + */ + async runCode( + code: RPCRunCodeParam, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + const response = await this.httpBackend.createRequest( + { + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_code`), + method: 'POST', + }, + code + ); + + return response; + } + + /** + * @param viewScriptParams Parameters of the script view to run + * @param options contains generic configuration for rpc calls + * + * @description Simulate a call to a michelson view + * + */ + async runScriptView( + { unparsing_mode = 'Readable', ...rest }: RPCRunScriptViewParam, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest( + { + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/helpers/scripts/run_script_view` + ), + method: 'POST', + }, + { + unparsing_mode, + ...rest, + } + ); + } + + /** + * @param viewParams Parameters of the view to run + * @param options contains generic configuration for rpc calls + * + * @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, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest( + { + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_view`), + method: 'POST', + }, + { + unparsing_mode, + ...rest, + } + ); + } + + async getChainId() { + return this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/chain_id`), + method: 'GET', + }); + } + + /** + * + * @param data Data to pack + * @param options contains generic configuration for rpc calls + * + * @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) { + const { gas, ...rest } = await this.httpBackend.createRequest( + { + url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/pack_data`), + method: 'POST', + }, + data + ); + + let formattedGas = gas; + const tryBigNumber = new BigNumber(gas || ''); + if (!tryBigNumber.isNaN()) { + formattedGas = tryBigNumber; + } + + return { gas: formattedGas, ...rest }; + } + + /** + * + * @description Return rpc root url + */ + + getRpcUrl() { + return this.url; + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period + */ + async getCurrentPeriod({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_period`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param options contains generic configuration for rpc calls + * + * @description Voting period of 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({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const response = await this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/successor_period`), + method: 'GET', + }); + + return response; + } + + /** + * + * @param id Sapling state ID + * @param options contains generic configuration for rpc calls + * + * @description Access the value associated with a sapling state ID. + * + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff + */ + async getSaplingDiffById( + id: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/sapling/${id}/get_diff`), + method: 'GET', + }); + } + + /** + * + * @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. + * + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff + */ + async getSaplingDiffByContract( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/single_sapling_get_diff` + ), + method: 'GET', + }); + } + + async getProtocols({ block }: { block: string } = defaultRPCOptions): Promise { + return this.httpBackend.createRequest({ + url: this.createURL(`/chains/${this.chain}/blocks/${block}/protocols`), + method: 'GET', + }); + } + + /** + * + * @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 + * + * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + */ + async getStorageUsedSpace( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/used_space` + ), + 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 paid space in a contract's storage + * + * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + */ + async getStoragePaidSpace( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/paid_space` + ), + method: 'GET', + }); + } + + /** + * + * @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 + * @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 + */ + async getTicketBalance( + contract: string, + ticket: TicketTokenParams, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest( + { + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/ticket_balance` + ), + method: 'POST', + }, + ticket + ); + } + + /** + * + * @param contract originated address we want to retrieve ticket balances of + * @param options contains generic configuration for rpc calls + * @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 + */ + async getAllTicketBalances( + contract: string, + { block }: { block: string } = defaultRPCOptions + ): Promise { + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/all_ticket_balances` + ), + method: 'GET', + }); + } + + /** + * @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 + * @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({ + 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/contrib/taquito-rpc-bin/src/types.ts b/contrib/taquito-rpc-bin/src/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..c459fb0b6943d7cabf0f932faac95d4a1b397c4f --- /dev/null +++ b/contrib/taquito-rpc-bin/src/types.ts @@ -0,0 +1,2540 @@ +import BigNumber from 'bignumber.js'; +import { OpKind } from './opkind'; + +export type BalanceResponse = BigNumber; +export type StorageResponse = ScriptedContracts['storage']; +export type ScriptResponse = ScriptedContracts; +export type BigMapGetResponse = MichelsonV1Expression; +export type ManagerResponse = { manager: string }; +export type ManagerKeyResponse = string | { key: string }; +export type DelegateResponse = string | null; + +export type OperationHash = string; + +interface INodeExtender { + length: string; + segment: string; + proof: string; +} + +type OtherEltsInner = + | { + value: any; + } + | { + inode_extender: INodeExtender; + }; + +export type OtherElts = + | { + node: [string, { value: string } | { node: string }][]; + } + | { + 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; + delegated_contracts: string[]; + delegated_balance: BigNumber; + deactivated: boolean; + grace_period: number; + voting_power?: BigNumber; + current_ballot?: BallotVote; + current_proposals?: string[]; + remaining_proposals?: number; + active_consensus_key?: string; + pending_consensus_keys?: PendingConsensusKey[]; +} + +export type PendingConsensusKey = { + cycle: number; + pkh: string; +}; + +export type VotingInfoResponse = { + voting_power?: string; + current_ballot?: BallotListResponseEnum; + current_proposals?: string[]; + remaining_proposals?: number; +}; + +interface Frozenbalancebycycle { + cycle: number; + deposit?: BigNumber; + deposits?: BigNumber; // Since Granada, "deposit" is replaced by "deposits" + fees: BigNumber; + rewards: BigNumber; +} + +export type BigMapKey = { + key: { [key: string]: string | object[] }; + type: { prim: string; args?: object[] }; +}; + +export type LiquidityBakingToggleVotes = 'on' | 'off' | 'pass'; + +export interface BlockFullHeader { + level: number; + proto: number; + predecessor: string; + timestamp: TimeStampMixed; + validation_pass: number; + operations_hash: string; + fitness: string[]; + context: string; + payload_hash?: string; + payload_round?: number; + priority?: number; + proof_of_work_nonce: string; + seed_nonce_hash?: string; + liquidity_baking_escape_vote?: boolean | LiquidityBakingToggleVotes; + liquidity_baking_toggle_vote?: LiquidityBakingToggleVotes; + signature: string; +} + +export type InlinedEndorsementKindEnum = OpKind.ENDORSEMENT; + +export interface InlinedEndorsementContents { + kind: InlinedEndorsementKindEnum; + slot?: number; + round?: number; + block_payload_hash?: string; + level: number; +} + +export interface InlinedPreEndorsementContents { + kind: OpKind.PREENDORSEMENT; + slot: number; + level: number; + round: number; + block_payload_hash: string; +} + +export interface InlinedEndorsement { + branch: string; + operations: InlinedEndorsementContents; + signature?: string; +} + +export interface InlinedPreEndorsement { + branch: string; + operations: InlinedPreEndorsementContents; + signature?: string; +} + +export type BallotVote = 'nay' | 'yay' | 'pass'; + +export interface OperationContentsEndorsement { + kind: OpKind.ENDORSEMENT; + level: number; + slot?: number; + round?: number; + block_payload_hash?: string; +} + +export interface OperationContentsPreEndorsement { + kind: OpKind.PREENDORSEMENT; + slot: number; + level: number; + round: number; + block_payload_hash: string; +} + +export interface OperationContentsDoublePreEndorsement { + kind: OpKind.DOUBLE_PREENDORSEMENT_EVIDENCE; + op1: InlinedPreEndorsement; + op2: InlinedPreEndorsement; +} + +export interface OperationContentsSetDepositsLimit { + kind: OpKind.SET_DEPOSITS_LIMIT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + limit?: string; +} + +export interface OperationContentsEndorsementWithSlot { + kind: OpKind.ENDORSEMENT_WITH_SLOT; + endorsement: InlinedEndorsement; + slot: number; +} + +export interface OperationContentsRevelation { + kind: OpKind.SEED_NONCE_REVELATION; + level: number; + nonce: string; +} + +export interface OperationContentsVdfRevelation { + kind: OpKind.VDF_REVELATION; + solution: string[]; +} + +export interface OperationContentsDoubleEndorsement { + kind: OpKind.DOUBLE_ENDORSEMENT_EVIDENCE; + op1: InlinedEndorsement; + op2: InlinedEndorsement; + slot?: number; +} + +export interface OperationContentsDoubleBaking { + kind: OpKind.DOUBLE_BAKING_EVIDENCE; + bh1: BlockFullHeader; + bh2: BlockFullHeader; +} + +export interface OperationContentsActivateAccount { + kind: OpKind.ACTIVATION; + pkh: string; + secret: string; +} + +export interface OperationContentsFailingNoop { + kind: OpKind.FAILING_NOOP; + arbitrary: string; +} + +export interface OperationContentsProposals { + kind: OpKind.PROPOSALS; + source: string; + period: number; + proposals: string[]; +} + +export interface OperationContentsBallot { + kind: OpKind.BALLOT; + source: string; + period: number; + proposal: string; + ballot: BallotVote; +} + +export interface OperationContentsReveal { + kind: OpKind.REVEAL; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + public_key: string; +} + +export interface OperationContentsTransaction { + kind: OpKind.TRANSACTION; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + amount: string; + destination: string; + parameters?: TransactionOperationParameter; +} + +export interface OperationContentsOrigination { + kind: OpKind.ORIGINATION; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + balance: string; + delegate?: string; + script?: ScriptedContracts; +} + +export interface OperationContentsDelegation { + kind: OpKind.DELEGATION; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + delegate?: string; +} + +export interface OperationContentsRegisterGlobalConstant { + kind: OpKind.REGISTER_GLOBAL_CONSTANT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + 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; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + ticket_contents: MichelsonV1Expression; + ticket_ty: MichelsonV1Expression; + ticket_ticketer: string; + ticket_amount: string; + destination: string; + entrypoint: string; +} + +export interface OperationContentsUpdateConsensusKey { + kind: OpKind.UPDATE_CONSENSUS_KEY; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + pk: string; +} + +export interface OperationContentsDrainDelegate { + kind: OpKind.DRAIN_DELEGATE; + consensus_key: string; + delegate: string; + destination: string; +} + +export interface OperationContentsIncreasePaidStorage { + kind: OpKind.INCREASE_PAID_STORAGE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + amount: string; + destination: string; +} + +export interface OperationContentsSmartRollupOriginate { + kind: OpKind.SMART_ROLLUP_ORIGINATE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + pvm_kind: PvmKind; + kernel: string; + origination_proof: string; + parameters_ty: MichelsonV1Expression; +} + +export interface OperationContentsSmartRollupAddMessages { + kind: OpKind.SMART_ROLLUP_ADD_MESSAGES; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + message: string[]; +} + +export interface OperationContentsSmartRollupExecuteOutboxMessage { + kind: OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + cemented_commitment: string; + output_proof: string; +} + +export interface OperationContentsSmartRollupPublish { + kind: OpKind.SMART_ROLLUP_PUBLISH; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + commitment: SmartRollupPublishCommitment; +} + +export interface OperationContentsSmartRollupCement { + kind: OpKind.SMART_ROLLUP_CEMENT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + commitment: string; +} + +export interface OperationContentsSmartRollupRefute { + kind: OpKind.SMART_ROLLUP_REFUTE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + opponent: string; + refutation: SmartRollupRefutation; +} + +export interface OperationContentsSmartRollupRecoverBond { + kind: OpKind.SMART_ROLLUP_RECOVER_BOND; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + staker: string; +} + +export interface OperationContentsSmartRollupTimeout { + kind: OpKind.SMART_ROLLUP_TIMEOUT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + stakers: SmartRollupTimeoutStakers; +} + +export type OperationContents = + | OperationContentsEndorsement + | OperationContentsPreEndorsement + | OperationContentsDoublePreEndorsement + | OperationContentsRevelation + | OperationContentsVdfRevelation + | OperationContentsDoubleEndorsement + | OperationContentsDoubleBaking + | OperationContentsActivateAccount + | OperationContentsProposals + | OperationContentsBallot + | OperationContentsReveal + | OperationContentsTransaction + | OperationContentsOrigination + | OperationContentsDelegation + | OperationContentsEndorsementWithSlot + | OperationContentsFailingNoop + | OperationContentsRegisterGlobalConstant + | OperationContentsSetDepositsLimit + | OperationContentsTxRollupOrigination + | OperationContentsTxRollupSubmitBatch + | OperationContentsTxRollupCommit + | OperationContentsTxRollupReturnBond + | OperationContentsTxRollupFinalizeCommitment + | OperationContentsTxRollupRemoveCommitment + | OperationContentsTxRollupRejection + | OperationContentsTransferTicket + | OperationContentsUpdateConsensusKey + | OperationContentsDrainDelegate + | OperationContentsIncreasePaidStorage + | OperationContentsSmartRollupOriginate + | OperationContentsSmartRollupAddMessages + | OperationContentsSmartRollupExecuteOutboxMessage + | OperationContentsSmartRollupPublish + | OperationContentsSmartRollupCement + | OperationContentsSmartRollupRefute + | OperationContentsSmartRollupRecoverBond + | OperationContentsSmartRollupTimeout; + +export interface OperationContentsAndResultMetadataExtended { + balance_updates?: OperationMetadataBalanceUpdates[]; + delegate: string; + slots?: number[]; + endorsement_power?: number; + consensus_key?: string; +} + +export interface OperationContentsAndResultMetadataPreEndorsement { + balance_updates?: OperationMetadataBalanceUpdates[]; + delegate: string; + preendorsement_power: number; + consensus_key?: string; +} + +export interface OperationContentsAndResultMetadataReveal { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultReveal; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataTransaction { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultTransaction; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataDelegation { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultDelegation; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataRegisterGlobalConstant { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultRegisterGlobalConstant; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSetDepositsLimit { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSetDepositsLimit; + internal_operation_results?: InternalOperationResult[]; +} + +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; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataUpdateConsensusKey { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultUpdateConsensusKey; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataDrainDelegate { + balance_updates?: OperationMetadataBalanceUpdates[]; + allocated_destination_contract?: boolean; +} + +export interface OperationContentsAndResultMetadataSmartRollupOriginate { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupOriginate; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupAddMessages { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupAddMessages; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupExecuteOutboxMessage { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupExecuteOutboxMessage; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupPublish { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupPublish; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupCement { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupCement; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupRefute { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupRefute; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupRecoverBond { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupRecoverBond; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultMetadataSmartRollupTimeout { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultSmartRollupTimeout; + internal_operation_results?: InternalOperationResult[]; +} + +export interface OperationContentsAndResultEndorsement { + kind: OpKind.ENDORSEMENT; + block_payload_hash?: string; + level: number; + round?: number; + slot?: number; + metadata: OperationContentsAndResultMetadataExtended; +} + +export interface OperationContentsAndResultPreEndorsement { + kind: OpKind.PREENDORSEMENT; + slot: number; + level: number; + round: number; + block_payload_hash: string; + metadata: OperationContentsAndResultMetadataPreEndorsement; +} + +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; +} + +export interface OperationContentsAndResultRevelation { + kind: OpKind.SEED_NONCE_REVELATION; + level: number; + nonce: string; + metadata: OperationContentsAndResultMetadata; +} + +export interface OperationContentsAndResultDoubleEndorsement { + kind: OpKind.DOUBLE_ENDORSEMENT_EVIDENCE; + op1: InlinedEndorsement; + op2: InlinedEndorsement; + slot?: number; + metadata: OperationContentsAndResultMetadata; +} + +export interface OperationContentsAndResultDoubleBaking { + kind: OpKind.DOUBLE_BAKING_EVIDENCE; + bh1: BlockFullHeader; + bh2: BlockFullHeader; + metadata: OperationContentsAndResultMetadata; +} + +export interface OperationContentsAndResultActivateAccount { + kind: OpKind.ACTIVATION; + pkh: string; + secret: string; + metadata: OperationContentsAndResultMetadata; +} + +export interface OperationContentsAndResultProposals { + kind: OpKind.PROPOSALS; + source: string; + period: number; + proposals: string[]; +} + +export interface OperationContentsAndResultBallot { + kind: OpKind.BALLOT; + source: string; + period: number; + proposal: string; + ballot: BallotVote; +} + +export interface OperationContentsAndResultReveal { + kind: OpKind.REVEAL; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + public_key: string; + metadata: OperationContentsAndResultMetadataReveal; +} + +export interface OperationContentsAndResultTransaction { + kind: OpKind.TRANSACTION; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + amount: string; + destination: string; + parameters?: TransactionOperationParameter; + metadata: OperationContentsAndResultMetadataTransaction; +} + +export interface OperationContentsAndResultDelegation { + kind: OpKind.DELEGATION; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + delegate?: string; + metadata: OperationContentsAndResultMetadataDelegation; +} + +export interface OperationContentsAndResultRegisterGlobalConstant { + kind: OpKind.REGISTER_GLOBAL_CONSTANT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + value: MichelsonV1Expression; + metadata: OperationContentsAndResultMetadataRegisterGlobalConstant; +} + +export interface OperationContentsAndResultSetDepositsLimit { + kind: OpKind.SET_DEPOSITS_LIMIT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + limit?: string; + 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; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + ticket_contents: MichelsonV1Expression; + ticket_ty: MichelsonV1Expression; + ticket_ticketer: string; + ticket_amount: string; + destination: string; + entrypoint: string; + 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; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + pk: string; + metadata: OperationContentsAndResultMetadataUpdateConsensusKey; +} + +export interface OperationContentsAndResultDrainDelegate { + kind: OpKind.DRAIN_DELEGATE; + consensus_key: string; + delegate: string; + destination: string; + metadata: OperationContentsAndResultMetadataDrainDelegate; +} + +export interface OperationContentsAndResultIncreasePaidStorage { + kind: OpKind.INCREASE_PAID_STORAGE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + amount: string; + destination: string; + metadata: OperationContentsAndResultMetadataIncreasePaidStorage; +} + +export interface OperationContentsAndResultVdfRevelation { + kind: OpKind.VDF_REVELATION; + solution: string[]; + metadata: OperationContentsAndResultMetadata; +} + +export interface OperationContentsAndResultSmartRollupOriginate { + kind: OpKind.SMART_ROLLUP_ORIGINATE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + pvm_kind: PvmKind; + kernel: string; + origination_proof: string; + parameters_ty: MichelsonV1Expression; + metadata: OperationContentsAndResultMetadataSmartRollupOriginate; +} + +export interface OperationContentsAndResultSmartRollupAddMessages { + kind: OpKind.SMART_ROLLUP_ADD_MESSAGES; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + message: string[]; + metadata: OperationContentsAndResultMetadataSmartRollupAddMessages; +} + +export interface OperationContentsAndResultSmartRollupExecuteOutboxMessage { + kind: OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + cemented_commitment: string; + output_proof: string; + metadata: OperationContentsAndResultMetadataSmartRollupExecuteOutboxMessage; +} + +export interface OperationContentsAndResultSmartRollupPublish { + kind: OpKind.SMART_ROLLUP_PUBLISH; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + commitment: SmartRollupPublishCommitment; + metadata: OperationContentsAndResultMetadataSmartRollupPublish; +} + +export interface OperationContentsAndResultSmartRollupCement { + kind: OpKind.SMART_ROLLUP_CEMENT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + commitment: string; + metadata: OperationContentsAndResultMetadataSmartRollupCement; +} + +export interface OperationContentsAndResultSmartRollupRefute { + kind: OpKind.SMART_ROLLUP_REFUTE; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + opponent: string; + refutation: SmartRollupRefutation; + metadata: OperationContentsAndResultMetadataSmartRollupRefute; +} + +export interface OperationContentsAndResultSmartRollupRecoverBond { + kind: OpKind.SMART_ROLLUP_RECOVER_BOND; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + staker: string; + metadata: OperationContentsAndResultMetadataSmartRollupRecoverBond; +} + +export interface OperationContentsAndResultSmartRollupTimeout { + kind: OpKind.SMART_ROLLUP_TIMEOUT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + rollup: string; + stakers: SmartRollupTimeoutStakers; + metadata: OperationContentsAndResultMetadataSmartRollupTimeout; +} + +export type OperationContentsAndResult = + | OperationContentsAndResultEndorsement + | OperationContentsAndResultPreEndorsement + | OperationContentsAndResultDoublePreEndorsement + | OperationContentsAndResultRevelation + | OperationContentsAndResultDoubleEndorsement + | OperationContentsAndResultDoubleBaking + | OperationContentsAndResultActivateAccount + | OperationContentsAndResultProposals + | OperationContentsAndResultBallot + | OperationContentsAndResultReveal + | OperationContentsAndResultTransaction + | OperationContentsAndResultOrigination + | OperationContentsAndResultDelegation + | OperationContentsAndResultEndorsementWithSlot + | OperationContentsAndResultRegisterGlobalConstant + | OperationContentsAndResultSetDepositsLimit + | OperationContentsAndResultTxRollupOrigination + | OperationContentsAndResultTxRollupSubmitBatch + | OperationContentsAndResultTxRollupCommit + | OperationContentsAndResultTxRollupDispatchTickets + | OperationContentsAndResultTxRollupReturnBond + | OperationContentsAndResultTxRollupFinalizeCommitment + | OperationContentsAndResultTxRollupRemoveCommitment + | OperationContentsAndResultTxRollupRejection + | OperationContentsAndResultTransferTicket + | OperationContentsAndResultIncreasePaidStorage + | OperationContentsAndResultUpdateConsensusKey + | OperationContentsAndResultDrainDelegate + | OperationContentsAndResultVdfRevelation + | OperationContentsAndResultSmartRollupOriginate + | OperationContentsAndResultSmartRollupAddMessages + | OperationContentsAndResultSmartRollupExecuteOutboxMessage + | OperationContentsAndResultSmartRollupPublish + | OperationContentsAndResultSmartRollupCement + | OperationContentsAndResultSmartRollupRefute + | OperationContentsAndResultSmartRollupRecoverBond + | OperationContentsAndResultSmartRollupTimeout; + +export type OperationContentsAndResultWithFee = + | OperationContentsAndResultTransaction + | OperationContentsAndResultOrigination + | OperationContentsAndResultDelegation + | OperationContentsAndResultReveal + | OperationContentsAndResultRegisterGlobalConstant + | OperationContentsAndResultSetDepositsLimit + | OperationContentsAndResultUpdateConsensusKey + | OperationContentsAndResultIncreasePaidStorage + | OperationContentsAndResultSmartRollupAddMessages + | OperationContentsAndResultSmartRollupOriginate; + +export enum OPERATION_METADATA { + TOO_LARGE = 'too large', +} + +export interface OperationEntry { + protocol: string; + chain_id: string; + hash: string; + branch: string; + contents: (OperationContents | OperationContentsAndResult)[]; + signature?: string; + metadata?: OPERATION_METADATA; +} + +export interface BlockResponse { + protocol: string; + chain_id: string; + hash: string; + header: BlockFullHeader; + metadata: BlockMetadata; + operations: OperationEntry[][]; +} + +export type BakingRightsArgumentsDelegate = string | string[]; +export type BakingRightsArgumentsCycle = number | number[]; +export type BakingRightsArgumentsLevel = number | number[]; + +export type BakingRightsQueryArguments = BakingRightsQueryArgumentsBase; + +export interface BakingRightsQueryArgumentsBase { + level?: BakingRightsArgumentsLevel; + cycle?: BakingRightsArgumentsCycle; + delegate?: BakingRightsArgumentsDelegate; + consensus_key?: string; + max_priority?: number; + max_round?: string; + all?: null; +} + +export interface BakingRightsResponseItem { + level: number; + delegate: string; + priority?: number; + round?: number; + estimated_time?: Date; + consensus_key?: string; +} + +export type BakingRightsResponse = BakingRightsResponseItem[]; + +export type EndorsingRightsArgumentsDelegate = string | string[]; +export type EndorsingRightsArgumentsCycle = number | number[]; +export type EndorsingRightsArgumentsLevel = number | number[]; + +export interface EndorsingRightsQueryArguments { + level?: EndorsingRightsArgumentsLevel; + cycle?: EndorsingRightsArgumentsCycle; + delegate?: EndorsingRightsArgumentsDelegate; + consensus_key?: string; +} + +export interface EndorsingRightsResponseItemDelegates { + delegate: string; + first_slot: number; + endorsing_power: number; + consensus_key?: string; +} +export interface EndorsingRightsResponseItem { + level: number; + delegate?: string; + delegates?: EndorsingRightsResponseItemDelegates[]; + slots?: number[]; + estimated_time?: Date; +} + +export type EndorsingRightsResponse = EndorsingRightsResponseItem[]; + +export type BallotListResponseEnum = 'nay' | 'yay' | 'pass'; + +export interface BallotListResponseItem { + pkh: string; + ballot: BallotListResponseEnum; +} + +export type BallotListResponse = BallotListResponseItem[]; + +export interface BallotsResponse { + yay: BigNumber; + nay: BigNumber; + pass: BigNumber; +} + +export type PeriodKindResponse = 'proposal' | 'exploration' | 'cooldown' | 'promotion' | 'adoption'; + +export type CurrentProposalResponse = string | null; + +export type CurrentQuorumResponse = number; + +export interface VotesListingsResponseItem { + pkh: string; + rolls?: number; + voting_power?: BigNumber; +} + +export type VotesListingsResponse = VotesListingsResponseItem[]; + +export type ProposalsResponseItem = [string, BigNumber]; + +export type ProposalsResponse = ProposalsResponseItem[]; + +export interface BlockHeaderResponse { + protocol: string; + chain_id: string; + hash: string; + level: number; + proto: number; + predecessor: string; + timestamp: string; + validation_pass: number; + operations_hash: string; + fitness: string[]; + context: string; + payload_hash?: string; + payload_round?: number; + priority?: number; + proof_of_work_nonce: string; + liquidity_baking_escape_vote?: boolean | LiquidityBakingToggleVotes; + signature: string; +} + +export interface PackDataParams { + data: MichelsonV1Expression; + type: MichelsonV1Expression; + gas?: BigNumber; +} + +export interface TicketTokenParams { + ticketer: string; + content_type: MichelsonV1Expression; + content: MichelsonV1Expression; +} + +export interface TicketBalance { + ticketer: string; + content_type: MichelsonV1Expression; + content: MichelsonV1Expression; + amount: string; +} + +export type AllTicketBalances = TicketBalance[]; + +export type HexString = string; + +export interface PackDataResponse { + packed: HexString; + gas?: BigNumber | 'unaccounted'; +} + +export type BigMapResponse = MichelsonV1Expression | MichelsonV1Expression[]; + +export type SaplingDiffResponse = { + root: SaplingTransactionCommitmentHash; + commitments_and_ciphertexts: CommitmentsAndCiphertexts[]; + nullifiers: string[]; +}; + +export type SaplingTransactionCommitmentHash = string; + +export type PreapplyParams = OperationObject[]; +export type PreapplyResponse = { + contents: OperationContentsAndResult[]; +}; + +export type ForgeOperationsParams = Pick; + +export type TimeStampMixed = Date | string; + +export type BalanceUpdateKindEnum = MetadataBalanceUpdatesKindEnum; +export type BalanceUpdateCategoryEnum = MetadataBalanceUpdatesCategoryEnum; + +export interface MichelsonV1ExpressionBase { + int?: string; + string?: string; + bytes?: string; +} + +export interface MichelsonV1ExpressionExtended { + prim: string; + args?: MichelsonV1Expression[]; + annots?: string[]; +} + +export type MichelsonV1Expression = + | MichelsonV1ExpressionBase + | MichelsonV1ExpressionExtended + | MichelsonV1Expression[]; + +export interface ScriptedContracts { + code: MichelsonV1Expression[]; + storage: MichelsonV1Expression; +} + +export type BondId = + | { + smart_rollup?: never; + tx_rollup: string; + } + | { + smart_rollup: string; + tx_rollup?: never; + }; + +export interface OperationBalanceUpdatesItem { + kind: BalanceUpdateKindEnum; + category?: BalanceUpdateCategoryEnum; + delegate?: string; + cycle?: number; + contract?: string; + change: string; + origin?: MetadataBalanceUpdatesOriginEnum; + participation?: boolean; + revelation?: boolean; + committer?: string; + bond_id?: BondId; +} + +export type OperationBalanceUpdates = OperationBalanceUpdatesItem[]; + +export interface OperationObject { + branch?: string; + contents?: OperationContents[]; + protocol?: string; + signature?: string; +} + +export type InternalOperationResultKindEnum = + | OpKind.REVEAL + | OpKind.TRANSACTION + | OpKind.ORIGINATION + | OpKind.DELEGATION + | OpKind.EVENT; + +export type SuccessfulManagerOperationResultKindEnum = + | OpKind.REVEAL + | OpKind.TRANSACTION + | OpKind.ORIGINATION + | OpKind.DELEGATION; + +export type InternalOperationResultEnum = + | OperationResultReveal + | OperationResultTransaction + | OperationResultDelegation + | 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; + ticket_updates?: TicketUpdates[]; + consumed_milligas?: string; + paid_storage_size_diff?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultIncreasePaidStorage { + status: OperationResultStatusEnum; + balance_updates?: OperationBalanceUpdates; + consumed_milligas?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultUpdateConsensusKey { + status: OperationResultStatusEnum; + consumed_milligas?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultDelegation { + status: OperationResultStatusEnum; + consumed_gas?: string; + errors?: TezosGenericOperationError[]; + consumed_milligas?: string; +} + +export interface OperationResultSetDepositsLimit { + status: OperationResultStatusEnum; + consumed_gas?: string; + errors?: TezosGenericOperationError[]; + consumed_milligas?: string; +} + +export interface OperationResultRegisterGlobalConstant { + status: OperationResultStatusEnum; + balance_updates?: OperationBalanceUpdates; + consumed_gas?: string; + storage_size?: string; + global_address?: string; + errors?: TezosGenericOperationError[]; + consumed_milligas?: string; +} + +export interface OperationResultSmartRollupOriginate { + status: OperationResultStatusEnum; + balance_updates?: OperationBalanceUpdates; + address?: string; + genesis_commitment_hash?: string; + consumed_milligas?: string; + size: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupAddMessages { + status: OperationResultStatusEnum; + consumed_milligas?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupExecuteOutboxMessage { + status: OperationResultStatusEnum; + balance_updates?: OperationBalanceUpdates; + ticket_updates?: TicketUpdates[]; + consumed_milligas?: string; + paid_storage_size_diff?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupPublish { + status: OperationResultStatusEnum; + consumed_milligas?: string; + staked_hash?: string; + published_at_level?: number; + balance_updates?: OperationBalanceUpdates; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupCement { + status: OperationResultStatusEnum; + consumed_milligas?: string; + inbox_level?: number; + commitment_hash?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupRefute { + status: OperationResultStatusEnum; + consumed_milligas?: string; + game_status?: SmartRollupGameStatus; + balance_updates?: OperationBalanceUpdates; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupRecoverBond { + status: OperationResultStatusEnum; + balance_updates?: OperationBalanceUpdates; + consumed_milligas?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationResultSmartRollupTimeout { + status: OperationResultStatusEnum; + consumed_milligas?: string; + game_status?: SmartRollupGameStatus; + balance_updates?: OperationBalanceUpdates; + errors?: TezosGenericOperationError[]; +} + +export interface ContractBigMapDiffItem { + key_hash?: string; + key?: MichelsonV1Expression; + value?: MichelsonV1Expression; + action?: DiffActionEnum; + big_map?: string; + source_big_map?: string; + destination_big_map?: string; + key_type?: MichelsonV1Expression; + value_type?: MichelsonV1Expression; +} + +export type ContractBigMapDiff = ContractBigMapDiffItem[]; + +export interface TezosGenericOperationError { + kind: string; + id: string; + delegate?: string; +} + +export interface TicketUpdates { + ticket_token: { + ticketer: string; + content_type: MichelsonV1Expression; + content: MichelsonV1Expression; + }; + updates: { + account: string; + amount: string; + }[]; +} +export type TicketReceipt = TicketUpdates; + +export type BatchOperationResult = + | OperationResultTransaction + | OperationResultReveal + | OperationResultDelegation + | OperationResultOrigination + | OperationResultIncreasePaidStorage + | OperationResultRegisterGlobalConstant + | OperationResultTransferTicket + | OperationResultSmartRollupAddMessages + | OperationResultSmartRollupOriginate + | OperationResultUpdateConsensusKey; + +export type OperationResult = + | OperationResultOrigination + | OperationResultTransaction + | OperationResultReveal + | OperationResultDelegation + | OperationResultIncreasePaidStorage + | OperationResultRegisterGlobalConstant + | OperationResultTransferTicket + | OperationResultUpdateConsensusKey + | OperationResultSmartRollupOriginate + | OperationResultSmartRollupAddMessages + | OperationResultSetDepositsLimit + | OperationResultSmartRollupPublish + | OperationResultSmartRollupCement + | OperationResultSmartRollupRefute + | OperationResultSmartRollupRecoverBond + | OperationResultSmartRollupTimeout + | OperationResultSmartRollupExecuteOutboxMessage + | OperationResultTxRollupOrigination + | OperationResultTxRollupSubmitBatch + | OperationResultTxRollupDispatchTickets + | OperationResultTxRollupCommit + | OperationResultTxRollupReturnBond + | OperationResultTxRollupFinalizeCommitment + | OperationResultTxRollupRemoveCommitment + | OperationResultTxRollupRejection; + +export interface OperationResultTransaction { + status: OperationResultStatusEnum; + storage?: MichelsonV1Expression; + big_map_diff?: ContractBigMapDiff; + balance_updates?: OperationBalanceUpdates; + ticket_updates?: TicketUpdates[]; + ticket_receipt?: TicketReceipt[]; + originated_contracts?: string[]; + consumed_gas?: string; + storage_size?: string; + paid_storage_size_diff?: string; + allocated_destination_contract?: boolean; + errors?: TezosGenericOperationError[]; + consumed_milligas?: string; + lazy_storage_diff?: LazyStorageDiff[]; + ticket_hash?: string; +} + +export interface OperationResultReveal { + status: OperationResultStatusEnum; + consumed_gas?: string; + errors?: TezosGenericOperationError[]; + consumed_milligas?: string; +} + +export interface TransactionOperationParameter { + entrypoint: string; + value: MichelsonV1Expression; +} + +export interface InternalOperationResult { + kind: InternalOperationResultKindEnum; + source: string; + nonce: number; + amount?: string; + destination?: string; + parameters?: TransactionOperationParameter; + public_key?: string; + balance?: string; + delegate?: string; + script?: ScriptedContracts; + value?: MichelsonV1Expression; + limit?: string; + result: InternalOperationResultEnum; + type?: MichelsonV1Expression; + tag?: string; + payload?: MichelsonV1Expression; +} + +export interface SuccessfulManagerOperationResult { + kind: SuccessfulManagerOperationResultKindEnum; + consumed_gas?: string; + consumed_milligas?: string; + storage?: MichelsonV1Expression; + big_map_diff?: ContractBigMapDiff; + balance_updates?: OperationBalanceUpdates; + originated_contracts?: string[]; + storage_size?: string; + paid_storage_size_diff?: string; + lazy_storage_diff?: LazyStorageDiff[]; +} + +export type MetadataBalanceUpdatesKindEnum = + | 'contract' + | 'freezer' + | 'accumulator' + | 'burned' + | 'commitment' + | 'minted'; + +export enum METADATA_BALANCE_UPDATES_CATEGORY { + 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', + BURNED = 'burned', + COMMITMENT = 'commitment', + BOOTSTRAP = 'bootstrap', + INVOICE = 'invoice', + MINTED = 'minted', + TX_ROLLUP_REJECTION_REWARDS = 'tx_rollup_rejection_rewards', + TX_ROLLUP_REJECTION_PUNISHMENTS = 'tx_rollup_rejection_punishments', + BONDS = 'bonds', +} +export type MetadataBalanceUpdatesCategoryEnum = METADATA_BALANCE_UPDATES_CATEGORY; + +export type MetadataBalanceUpdatesOriginEnum = 'block' | 'migration' | 'subsidy' | 'simulation'; + +export interface OperationMetadataBalanceUpdates { + kind: MetadataBalanceUpdatesKindEnum; + category?: MetadataBalanceUpdatesCategoryEnum; + contract?: string; + delegate?: string; + participation?: boolean; + revelation?: boolean; + committer?: string; + cycle?: number; + change: string; + origin?: MetadataBalanceUpdatesOriginEnum; +} + +export type OperationResultStatusEnum = 'applied' | 'failed' | 'skipped' | 'backtracked'; + +export type DiffActionEnum = 'update' | 'remove' | 'copy' | 'alloc'; + +export type LazyStorageDiff = LazyStorageDiffBigMap | LazyStorageDiffSaplingState; + +export interface LazyStorageDiffBigMap { + kind: 'big_map'; + id: string; + diff: LazyStorageDiffBigMapItems; +} + +export interface LazyStorageDiffSaplingState { + kind: 'sapling_state'; + id: string; + diff: LazyStorageDiffSaplingStateItems; +} + +export interface LazyStorageDiffBigMapItems { + action: DiffActionEnum; + updates?: LazyStorageDiffUpdatesBigMap[]; + source?: string; + key_type?: MichelsonV1Expression; + value_type?: MichelsonV1Expression; +} + +export interface LazyStorageDiffSaplingStateItems { + action: DiffActionEnum; + updates?: LazyStorageDiffUpdatesSaplingState; + source?: string; + memo_size?: number; +} + +export interface LazyStorageDiffUpdatesBigMap { + key_hash: string; + key: MichelsonV1Expression; + value?: MichelsonV1Expression; +} + +export type CommitmentsAndCiphertexts = [ + SaplingTransactionCommitment, + SaplingTransactionCiphertext +]; + +export type SaplingTransactionCommitment = string; + +export interface LazyStorageDiffUpdatesSaplingState { + commitments_and_ciphertexts: CommitmentsAndCiphertexts[]; + nullifiers: string[]; +} + +export interface SaplingTransactionCiphertext { + cv: string; + epk: string; + payload_enc: string; + nonce_enc: string; + payload_out: string; + nonce_out: string; +} + +export interface OperationResultOrigination { + status: OperationResultStatusEnum; + big_map_diff?: ContractBigMapDiff; + balance_updates?: OperationBalanceUpdates; + originated_contracts?: string[]; + consumed_gas?: string; + storage_size?: string; + paid_storage_size_diff?: string; + errors?: TezosGenericOperationError[]; + consumed_milligas?: string; + lazy_storage_diff?: LazyStorageDiff[]; +} + +export interface OperationResultEvent { + status: OperationResultStatusEnum; + consumed_milligas?: string; + errors?: TezosGenericOperationError[]; +} + +export interface OperationContentsAndResultMetadataOrigination { + balance_updates: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultOrigination; + internal_operation_results?: InternalOperationResult[]; +} + +export type ConstantsResponse = ConstantsResponseCommon & + ConstantsResponseProto017 & + ConstantsResponseProto016 & + ConstantsResponseProto015 & + ConstantsResponseProto014 & + ConstantsResponseProto013 & + ConstantsResponseProto012 & + ConstantsResponseProto011 & + ConstantsResponseProto010 & + ConstantsResponseProto009 & + ConstantsResponseProto008 & + ConstantsResponseProto007 & + ConstantsResponseProto006 & + ConstantsResponseProto005 & + ConstantsResponseProto004 & + ConstantsResponseProto003 & + ConstantsResponseProto001And002; + +export interface ConstantsResponseCommon { + proof_of_work_nonce_size: number; + nonce_length: number; + max_operation_data_length: number; + preserved_cycles: number; + blocks_per_cycle: number; + blocks_per_commitment: number; + blocks_per_roll_snapshot: number; + blocks_per_voting_period: number; + time_between_blocks: BigNumber[]; + endorsers_per_block: number; + hard_gas_limit_per_operation: BigNumber; + hard_gas_limit_per_block: BigNumber; + proof_of_work_threshold: BigNumber; + tokens_per_roll: BigNumber; + michelson_maximum_type_size: number; + seed_nonce_revelation_tip: BigNumber; + block_security_deposit: BigNumber; + endorsement_security_deposit: BigNumber; + endorsement_reward: BigNumber | BigNumber[]; // BigNumber[] since proto 006, BigNumber before + cost_per_byte: BigNumber; + hard_storage_limit_per_operation: BigNumber; +} + +export type Ratio = { numerator: number; denominator: number }; + +export type ConstantsResponseProto017 = ConstantsResponseProto016; + +export interface ConstantsResponseProto016 + extends Omit< + ConstantsResponseProto015, + | 'sc_max_wrapped_proof_binary_size' + | 'sc_rollup_challenge_window_in_blocks' + | 'sc_rollup_commitment_period_in_blocks' + | 'sc_rollup_enable' + | 'sc_rollup_max_active_outbox_levels' + | 'sc_rollup_max_lookahead_in_blocks' + | 'sc_rollup_max_number_of_cemented_commitments' + | 'sc_rollup_max_number_of_messages_per_commitment_period' + | 'sc_rollup_max_outbox_messages_per_level' + | 'sc_rollup_message_size_limit' + | 'sc_rollup_number_of_sections_in_dissection' + | 'sc_rollup_origination_size' + | 'sc_rollup_stake_amount' + | 'sc_rollup_timeout_period_in_blocks' + > { + smart_rollup_arith_pvm_enable: boolean; + smart_rollup_challenge_window_in_blocks: number; + smart_rollup_commitment_period_in_blocks: number; + smart_rollup_enable: boolean; + smart_rollup_max_active_outbox_levels: number; + smart_rollup_max_lookahead_in_blocks: number; + smart_rollup_max_number_of_cemented_commitments: number; + smart_rollup_max_number_of_messages_per_level: string; + smart_rollup_max_number_of_parallel_games: number; + smart_rollup_max_outbox_messages_per_level: number; + smart_rollup_max_wrapped_proof_binary_size: number; + smart_rollup_message_size_limit: number; + smart_rollup_number_of_sections_in_dissection: number; + smart_rollup_origination_size: number; + smart_rollup_stake_amount: string; + smart_rollup_timeout_period_in_blocks: number; +} + +export interface ConstantsResponseProto015 + extends Omit< + ConstantsResponseProto014, + | 'max_wrapped_proof_binary_size' + | 'tokens_per_roll' + | 'liquidity_baking_sunset_level' + | 'sc_rollup_max_available_messages' + > { + minimal_stake: BigNumber; + sc_max_wrapped_proof_binary_size: number; + sc_rollup_message_size_limit: number; + sc_rollup_max_number_of_messages_per_commitment_period: number; + sc_rollup_number_of_sections_in_dissection: number; + sc_rollup_timeout_period_in_blocks: number; + sc_rollup_max_number_of_cemented_commitments: number; + zk_rollup_enable: number; + zk_rollup_origination_size: number; + zk_rollup_min_pending_to_process: number; +} + +export interface DalParametric { + feature_enable: boolean; + number_of_slots: 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 { + max_wrapped_proof_binary_size?: number; + nonce_revelation_threshold?: number; + vdf_difficulty?: BigNumber; + testnet_dictator?: string; + dal_parametric?: DalParametric; + sc_rollup_stake_amount?: BigNumber; + sc_rollup_commitment_period_in_blocks?: number; + sc_rollup_max_lookahead_in_blocks?: number; + sc_rollup_max_active_outbox_levels?: number; + sc_rollup_max_outbox_messages_per_level?: number; +} + +export interface ConstantsResponseProto013 + extends Omit< + ConstantsResponseProto012, + | 'blocks_per_voting_period' + | 'cache_layout' + | 'delegate_selection' + | 'liquidity_baking_escape_ema_threshold' + > { + cache_layout_size?: number; + cache_sampler_state_cycles?: number; + cache_script_size?: number; + cache_stake_distribution_cycles?: number; + cycles_per_voting_period?: number; + liquidity_baking_toggle_ema_threshold?: number; + initial_seed?: string; + tx_rollup_enable?: boolean; + tx_rollup_origination_size?: number; + tx_rollup_hard_size_limit_per_inbox?: number; + tx_rollup_hard_size_limit_per_message?: number; + tx_rollup_max_withdrawals_per_batch?: number; + tx_rollup_commitment_bond?: BigNumber; + tx_rollup_finality_period?: number; + tx_rollup_withdraw_period?: number; + tx_rollup_max_inboxes_count?: number; + tx_rollup_max_messages_per_inbox?: number; + tx_rollup_max_commitments_count?: number; + tx_rollup_cost_per_byte_ema_factor?: number; + tx_rollup_max_ticket_payload_size?: number; + tx_rollup_rejection_max_proof_size?: number; + tx_rollup_sunset_level?: number; + sc_rollup_enable?: boolean; + sc_rollup_origination_size?: number; + sc_rollup_challenge_window_in_blocks?: number; + sc_rollup_max_available_messages?: number; +} + +export interface ConstantsResponseProto012 + extends Omit< + ConstantsResponseProto011, + | 'baking_reward_per_endorsement' + | 'initial_endorsers' + | 'delay_per_missing_endorsement' + | 'test_chain_duration' + | 'blocks_per_roll_snapshot' + | 'time_between_blocks' + | 'endorsers_per_block' + | 'block_security_deposit' + | 'endorsement_security_deposit' + | 'endorsement_reward' + > { + blocks_per_stake_snapshot?: number; + baking_reward_fixed_portion?: BigNumber; + baking_reward_bonus_per_slot?: BigNumber; + endorsing_reward_per_slot?: BigNumber; + max_operations_time_to_live?: number; + consensus_committee_size?: number; + consensus_threshold?: number; + minimal_participation_ratio?: Ratio; + max_slashing_period?: number; + frozen_deposits_percentage?: number; + double_baking_punishment?: BigNumber; + ratio_of_frozen_deposits_slashed_per_double_endorsement?: Ratio; + delegate_selection?: 'random' | string[][]; + delay_increment_per_round?: BigNumber; +} + +export interface ConstantsResponseProto011 extends ConstantsResponseProto010 { + max_micheline_node_count?: number; + max_allowed_global_constants_depth?: number; + max_micheline_bytes_limit?: number; + cache_layout?: BigNumber[]; +} +export interface ConstantsResponseProto010 extends ConstantsResponseProto009 { + minimal_block_delay?: BigNumber; + liquidity_baking_subsidy?: BigNumber; + liquidity_baking_sunset_level?: number; + liquidity_baking_escape_ema_threshold?: number; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ConstantsResponseProto009 extends ConstantsResponseProto008 {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ConstantsResponseProto008 extends ConstantsResponseProto007 {} + +export interface ConstantsResponseProto007 + extends Omit { + max_anon_ops_per_block?: number; +} + +export interface ConstantsResponseProto006 extends Omit { + baking_reward_per_endorsement?: BigNumber[]; +} + +export interface ConstantsResponseProto005 extends ConstantsResponseProto004 { + quorum_min?: number; + quorum_max?: number; + min_proposal_quorum?: number; + initial_endorsers?: number; + delay_per_missing_endorsement?: BigNumber; +} + +export interface ConstantsResponseProto004 extends ConstantsResponseProto003 { + test_chain_duration?: BigNumber; +} + +export interface ConstantsResponseProto003 + extends Omit { + origination_size?: number; + max_proposals_per_delegate?: number; +} + +export interface ConstantsResponseProto001And002 extends ConstantsResponseCommon { + max_revelations_per_block?: number; + origination_burn?: string; + block_reward?: BigNumber; +} + +export interface ContractResponse { + balance: BigNumber; + script: ScriptedContracts; + counter?: string; + delegate?: string; +} + +export interface TestChainStatus { + status: 'not_running' | 'forking' | 'running'; + protocol?: string; + expiration?: TimeStampMixed; + chain_id?: string; + genesis?: string; +} + +export interface MaxOperationListLength { + max_size: number; + max_op?: number; +} + +export interface Level { + level: number; + level_position: number; + cycle: number; + cycle_position: number; + voting_period: number; + voting_period_position: number; + expected_commitment: boolean; +} + +export interface LevelInfo { + level: number; + level_position: number; + cycle: number; + cycle_position: number; + expected_commitment: boolean; +} + +export interface BlockMetadata { + protocol: string; + next_protocol: string; + test_chain_status: TestChainStatus; + max_operations_ttl: number; + max_operation_data_length: number; + max_block_header_length: number; + max_operation_list_length: MaxOperationListLength[]; + proposer?: string; + baker: string; + level?: Level; + level_info?: LevelInfo; + voting_period_kind?: string; + voting_period_info?: VotingPeriodBlockResult; + nonce_hash?: string; + consumed_gas: string; + deactivated: string[]; + balance_updates: OperationBalanceUpdates; + liquidity_baking_escape_ema?: number; + liquidity_baking_toggle_ema?: number; + implicit_operations_results?: SuccessfulManagerOperationResult[]; + consumed_milligas?: string; + proposer_consensus_key?: string; + baker_consensus_key?: string; +} + +export type RPCRunOperationParam = { + operation: OperationObject; + chain_id: string; +}; + +export interface RPCSimulateOperationParam extends RPCRunOperationParam { + blocks_before_activation?: number; + latency?: number; +} + +export type RPCRunCodeParam = { + script: MichelsonV1ExpressionExtended[]; + storage: MichelsonV1Expression; + input: MichelsonV1Expression; + amount: string; + chain_id: string; + source?: string; + payer?: string; + gas?: string; + self?: string; + entrypoint?: string; + balance?: string; + unparsing_mode?: UnparsingMode; + now?: string; + level?: string; +}; + +export type RunCodeResult = { + storage: MichelsonV1Expression; + operations: InternalOperationResult[]; + big_map_diff?: ContractBigMapDiff; + lazy_storage_diff?: LazyStorageDiff; +}; + +export type RPCRunScriptViewParam = { + contract: string; + view: string; + input: MichelsonV1Expression; + unlimited_gas?: boolean; + chain_id: string; + source?: string; + payer?: string; + gas?: string; + unparsing_mode?: UnparsingModeEnum; + now?: string; + level?: string; +}; + +export type RunScriptViewResult = { + data: MichelsonV1Expression; +}; + +export type RPCRunViewParam = { + contract: string; + entrypoint: string; + input: MichelsonV1Expression; + chain_id: string; + source?: string; + payer?: string; + gas?: BigNumber; + unparsing_mode?: UnparsingModeEnum; +}; + +export type RunViewResult = { + data: MichelsonV1Expression; +}; + +export type EntrypointsResponse = { + entrypoints: { [key: string]: MichelsonV1ExpressionExtended }; + unreachable?: { path: ('Left' | 'Right')[] }; +}; + +export interface OperationContentsAndResultOrigination { + kind: OpKind.ORIGINATION; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + balance: string; + delegate?: string; + script?: ScriptedContracts; + metadata: OperationContentsAndResultMetadataOrigination; +} + +export interface VotingPeriodResult { + index: number; + kind: PeriodKindResponse; + start_position: number; +} + +export interface VotingPeriodBlockResult { + voting_period: VotingPeriodResult; + position: number; + remaining: number; +} + +export type UnparsingModeEnum = 'Readable' | 'Optimized' | 'Optimized_legacy'; +export type UnparsingMode = { + unparsing_mode: UnparsingModeEnum; +}; + +export type ProtocolsResponse = { + protocol: string; + next_protocol: string; +}; + +export type Next = + | { + next: number; + } + | { + newest: number; + oldest: number; + }; + +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'; + applied?: boolean; + refused?: boolean; + outdated?: boolean; + branchRefused?: boolean; + branchDelayed?: boolean; + validationPass?: '0' | '1' | '2' | '3'; +} + +type FailedProcessedOperation = Pick< + OperationEntry, + 'hash' | 'protocol' | 'branch' | 'contents' | 'signature' +> & { + error: TezosGenericOperationError[]; +}; + +export interface PendingOperations { + applied: 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; +} + +export interface SmartRollupPublishCommitment { + compressed_state: string; + inbox_level: number; + predecessor: string; + number_of_ticks: string; +} + +export enum SmartRollupRefutationOptions { + START = 'start', + MOVE = 'move', +} + +export type SmartRollupRefutation = SmartRollupRefutationStart | SmartRollupRefutationMove; + +export interface SmartRollupRefutationStart { + refutation_kind: SmartRollupRefutationOptions.START; + player_commitment_hash: string; + opponent_commitment_hash: string; +} + +export interface SmartRollupRefutationMove { + refutation_kind: SmartRollupRefutationOptions.MOVE; + choice: string; + step: SmartRollupRefutationMoveStep; +} + +export type SmartRollupRefutationMoveStep = + | SmartRollupRefutationMoveStepDissection[] + | SmartRollupRefutationMoveStepProof; + +export interface SmartRollupRefutationMoveStepDissection { + state?: string; + tick: number; +} + +export interface SmartRollupRefutationMoveStepProof { + pvm_step: string; + input_proof?: SmartRollupRefutationMoveInputProof; +} + +export enum SmartRollupInputProofKind { + INBOX_PROOF = 'inbox_proof', + REVEAL_PROOF = 'reveal_proof', + FIRST_INPUT = 'first_input', +} + +export interface SmartRollupRefutationMoveInputProofInbox { + input_proof_kind: SmartRollupInputProofKind.INBOX_PROOF; + level: number; + message_counter: string; + serialized_proof: string; +} + +export interface SmartRollupRefutationMoveInputProofReveal { + input_proof_kind: SmartRollupInputProofKind.REVEAL_PROOF; + reveal_proof: SmartRollupRefuteRevealProofOptions; +} + +export interface SmartRollupRefutationMoveInputProofFirstInput { + input_proof_kind: SmartRollupInputProofKind.FIRST_INPUT; +} + +export type SmartRollupRefutationMoveInputProof = + | SmartRollupRefutationMoveInputProofInbox + | SmartRollupRefutationMoveInputProofReveal + | SmartRollupRefutationMoveInputProofFirstInput; + +export enum SmartRollupRefuteRevealProofKind { + RAW_DATA_PROOF = 'raw_data_proof', + METADATA_PROOF = 'metadata_proof', + DAL_PAGE_PROOF = 'dal_page_proof', +} + +export interface SmartRollupRefuteRevealProofRaw { + reveal_proof_kind: SmartRollupRefuteRevealProofKind.RAW_DATA_PROOF; + raw_data: string; +} +export interface SmartRollupRefuteRevealProofMetadata { + reveal_proof_kind: SmartRollupRefuteRevealProofKind.METADATA_PROOF; +} +export interface SmartRollupRefuteRevealProofDalPage { + reveal_proof_kind: SmartRollupRefuteRevealProofKind.DAL_PAGE_PROOF; + dal_page_id: { + published_level: number; + slot_index: number; + page_index: number; + }; + dal_proof: string; +} + +export type SmartRollupRefuteRevealProofOptions = + | SmartRollupRefuteRevealProofRaw + | SmartRollupRefuteRevealProofMetadata + | SmartRollupRefuteRevealProofDalPage; + +export type SmartRollupGameStatus = + | SmartRollupRefuteGameStatusOptions.ONGOING + | SmartRollupRefuteGameStatusEnded; + +export enum SmartRollupRefuteGameStatusOptions { + ONGOING = 'ongoing', + ENDED = 'ended', +} + +export interface SmartRollupRefuteGameStatusEnded { + result: SmartRollupRefuteGameStatusResult; +} + +export type SmartRollupRefuteGameStatusResult = + | SmartRollupRefuteGameEndedResultLoser + | SmartRollupRefuteGameEndedResultDraw; + +export interface SmartRollupRefuteGameEndedResultLoser { + kind: SmartRollupRefuteGameEndedPlayerOutcomes.LOSER; + reason: SmartRollupRefuteGameEndedReason; + player: string; +} + +export interface SmartRollupRefuteGameEndedResultDraw { + kind: SmartRollupRefuteGameEndedPlayerOutcomes.DRAW; +} + +export enum SmartRollupRefuteGameEndedPlayerOutcomes { + LOSER = 'loser', + DRAW = 'draw', +} + +export enum SmartRollupRefuteGameEndedReason { + CONFLICT_RESOLVED = 'conflict_resolved', + TIMEOUT = 'timeout', +} + +export interface SmartRollupTimeoutStakers { + alice: string; + bob: string; +} diff --git a/contrib/taquito-rpc-bin/src/utils/utils.ts b/contrib/taquito-rpc-bin/src/utils/utils.ts new file mode 100644 index 0000000000000000000000000000000000000000..b87fdf154e6ef0a57dc49761d04c455fe7436335 --- /dev/null +++ b/contrib/taquito-rpc-bin/src/utils/utils.ts @@ -0,0 +1,70 @@ +import BigNumber from 'bignumber.js'; + +/** + * Casts object/array items to BigNumber + * @param data input object or array + * @param keys keys for processing or all items if not defined + * + */ +export function castToBigNumber(data: any, keys?: any): object { + const returnArray: boolean = Array.isArray(data); + if (typeof keys === 'undefined') { + keys = Object.keys(data); + } + const response: any = returnArray ? [] : {}; + + keys.forEach((key: any) => { + const item = data[key]; + let res: any; + if (typeof item === 'undefined') { + return; + } + + if (Array.isArray(item)) { + res = castToBigNumber(item); + response[key] = res; + return; + } + + res = new BigNumber(item); + response[key] = res; + }); + + return response; +} + +/** + * Casts object/array BigNumber items to strings for readability + * @param data input object or array + * @param keys keys for processing or all items if not defined + * + */ +export function castToString(data: any, keys?: any): object { + const returnArray: boolean = Array.isArray(data); + if (typeof keys === 'undefined') { + keys = Object.keys(data); + } + const response: any = returnArray ? [] : {}; + + keys.forEach((key: any) => { + const item = data[key]; + + if (typeof item === 'undefined') { + return; + } + + if (Array.isArray(item)) { + response[key] = castToString(item); + return; + } + + if (!BigNumber.isBigNumber(item)) { + response[key] = item; + return; + } + + response[key] = item.toString(); + }); + + return response; +} diff --git a/contrib/taquito-rpc-bin/src/version.ts b/contrib/taquito-rpc-bin/src/version.ts new file mode 100644 index 0000000000000000000000000000000000000000..4144ddca2be0adef7809129a8703d94d838049d3 --- /dev/null +++ b/contrib/taquito-rpc-bin/src/version.ts @@ -0,0 +1,6 @@ + +// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! +export const VERSION = { + "commitHash": "b85fc404e34545a518215e449b3f1253f4520eec", + "version": "17.2.0" +}; diff --git a/contrib/taquito-rpc-bin/test/data/rpc-responses.ts b/contrib/taquito-rpc-bin/test/data/rpc-responses.ts new file mode 100644 index 0000000000000000000000000000000000000000..c0b01d97cbebd1f49b8ea7fedbd68fd4faaa4db6 --- /dev/null +++ b/contrib/taquito-rpc-bin/test/data/rpc-responses.ts @@ -0,0 +1,6282 @@ +import BigNumber from 'bignumber.js'; + +export const rpcUrl = 'rpcTest'; +export const blockResponse = { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'BMUMMDZRvvTfLrpmtYMUtYgk498WssaSfNnpkWwEiL7GNTwUYus', + header: { + level: 536085, + proto: 2, + predecessor: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + timestamp: '2021-10-04T18:11:32Z', + validation_pass: 4, + operations_hash: 'LLoZRH5DQMZiuE5eZ588fFC9JkL7qN8QjMdTUWQAHcAut2BmoUGZM', + fitness: ['01', '0000000000082e14'], + context: 'CoWCv7EjSWa6naU4fonnAcSSDDRjq9ddgdC13nuBdfR5x9xnR1sR', + priority: 0, + proof_of_work_nonce: 'bc2cc86f726c0000', + liquidity_baking_escape_vote: false, + signature: + 'sigPoYZryqKDksRqXpfby9eDfx6SbaLAq2vwLVnWJNrv73JrfAwAgiM1mCZrR7UaqEwvuR48QRJfj2FW6dCFAPynmJbgjysg', + }, + metadata: { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + next_protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + test_chain_status: { status: 'not_running' }, + max_operations_ttl: 120, + max_operation_data_length: 32768, + max_block_header_length: 239, + max_operation_list_length: [ + { max_size: 4194304, max_op: 2048 }, + { max_size: 32768 }, + { max_size: 135168, max_op: 132 }, + { max_size: 524288 }, + ], + baker: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + level_info: { + level: 536085, + level_position: 536084, + cycle: 131, + cycle_position: 3604, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { index: 26, kind: 'proposal', start_position: 532481 }, + position: 3603, + remaining: 16876, + }, + nonce_hash: null, + consumed_gas: '108015000', + deactivated: [], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + change: '-640000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + cycle: 131, + change: '640000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + cycle: 131, + change: '16093750', + origin: 'block', + }, + ], + liquidity_baking_escape_ema: 281925, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [ + { int: '81141010' }, + { int: '1004154556389' }, + { int: '87443' }, + { bytes: '01e927f00ef734dfc85919635e9afc9166c83ef9fc00' }, + { bytes: '0115eb0104481a6d7921160bc982c5e0a561cd8a3a00' }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5', + change: '2500000', + origin: 'subsidy', + }, + ], + consumed_gas: '2118', + consumed_milligas: '2117300', + storage_size: '4636', + }, + ], + }, + operations: [ + [ + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooK6Fj6pPV8LMfuuo9CTTyDzd28CRiRzC1UFzwxrvuWCtfiuBHA', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigQigTJyznbECHxo3sokWyvsMX3GdUWhfND76bhpdQgrmj8MLcVpTQTudg8T7dswKAm4wVq9dXx3sdGiwnz1tWwatJJ2JGP', + }, + slot: 7, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope', + change: '-62500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope', + cycle: 131, + change: '62500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope', + cycle: 131, + change: '1953125', + origin: 'block', + }, + ], + delegate: 'tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope', + slots: [ + 7, 26, 28, 31, 52, 55, 56, 57, 73, 81, 90, 100, 116, 137, 139, 141, 150, 155, 194, + 204, 209, 219, 226, 240, 255, + ], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'opVPpVtkcwWYW3AaKCLYgLXDLVteewJxv1mqvRKJxiBVx4hR3Ld', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigucwWZSCHugH3w3g8Mm9k8C2vLQfCU2CixgRTLSQF2xDg5Xf6VqEDB2snUJQjZHFD4EFejrAuQhcGFJ2j729ABYAxgQdZV', + }, + slot: 25, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', + change: '-12500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', + cycle: 131, + change: '12500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', + cycle: 131, + change: '390625', + origin: 'block', + }, + ], + delegate: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', + slots: [25, 49, 59, 143, 241], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooV7jeBXUjeAXb7sB6UbiPrFeadyUWAQjyVbiezYV4dQ2jh7nXZ', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigjgqeWJXQGxt7nuUJy9ZfJQrUyoMVgi34YKsCmvuKczKc198x6izoCgMGRVb7iTqDgqzEKcPFeLJpW6jxzFJ5AGXgCDPAK', + }, + slot: 1, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + change: '-37500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + cycle: 131, + change: '37500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + cycle: 131, + change: '1171875', + origin: 'block', + }, + ], + delegate: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + slots: [1, 12, 19, 20, 32, 46, 66, 93, 129, 146, 174, 176, 185, 187, 236], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooAcSPWvGdxWHs9axWkkUv8auevgo5S65y6BGuqKUyzxmQtAkkw', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigshnJHvMozfhProNP2iBV1baiUoUGoZC9yc7XyKk3TKBHZ6pJyLb8vWUcGpvqPPv732HzB5px7QsBm9KVm2n9TgERgCDmB', + }, + slot: 62, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1Qr3aFcxjRGu84PfDEtqQSM2PQutSn635P', + change: '-5000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1Qr3aFcxjRGu84PfDEtqQSM2PQutSn635P', + cycle: 131, + change: '5000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1Qr3aFcxjRGu84PfDEtqQSM2PQutSn635P', + cycle: 131, + change: '156250', + origin: 'block', + }, + ], + delegate: 'tz1Qr3aFcxjRGu84PfDEtqQSM2PQutSn635P', + slots: [62, 102], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'onrL2x7aon3qi1p3wsroWnRfx8KigzYNQg5S2EYyB3k7N72Nqcy', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigWwT3mRjCzfvxy65Nd76yHDH6MBwDw1RhhMf4miDp6MvtBjCvcgXhL7z4WM1vZrGEB74UiAbnJzNCSJ3KDwNFwBbU2kpU4', + }, + slot: 3, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', + change: '-62500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', + cycle: 131, + change: '62500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', + cycle: 131, + change: '1953125', + origin: 'block', + }, + ], + delegate: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', + slots: [ + 3, 6, 13, 21, 37, 63, 68, 86, 94, 110, 123, 133, 134, 152, 169, 170, 208, 212, 213, + 215, 218, 221, 223, 232, 254, + ], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'onseUqV43jrnEQDWV6S7pNEWAQ1W1jVwDrtjXLXUMMYqLJUaCKo', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigeeqviP7cPW2SdBNx53trnr9zCDTJKZd2ixZGTg5qz17CcEJaHZgQZjcEcFcy2EnEDusA4m9yeT9JK24fipu9XyiprZ6pH', + }, + slot: 184, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', + change: '-2500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', + cycle: 131, + change: '2500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', + cycle: 131, + change: '78125', + origin: 'block', + }, + ], + delegate: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', + slots: [184], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooFD5AWihGns7RaZHKqyiJPFDAYuCpXJGT72p6CCig4EQsYm9tT', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigiDTLARKGSKx1KnhxMdhxV7h4NnChw3gzYy8fJv9C58vPD9mCuKsvCrRGUk79mCqaxudyUu5T3qxWkuJqugJysSeg45KBT', + }, + slot: 5, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + change: '-80000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + cycle: 131, + change: '80000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + cycle: 131, + change: '2500000', + origin: 'block', + }, + ], + delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + slots: [ + 5, 18, 22, 24, 51, 77, 79, 95, 98, 115, 140, 145, 151, 157, 162, 163, 167, 171, 181, + 188, 189, 195, 196, 198, 202, 205, 207, 227, 231, 238, 242, 252, + ], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooqKhCA49xFX9wwyU3LmgwJZu8qwfgRQNHHjaoA45QkmAR8rxmW', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigkD1y57jWwdGyzwgHXZoEFsNuJCcWsC4SRpMeMiAzFbgf5G3ATQoZF2pCtCdfxvXYu1nDixosqJvqttiX7hNNWWw7H5H3o', + }, + slot: 16, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '-45000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 131, + change: '45000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 131, + change: '1406250', + origin: 'block', + }, + ], + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + slots: [ + 16, 35, 42, 53, 76, 80, 85, 87, 91, 125, 126, 127, 179, 186, 214, 225, 239, 245, + ], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooiBEZGpe15vBVEJBD7f42NhtXUVyMgZFJ6Kq6Rz9x59acRjfqC', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigo63PyYEcmFmGoWiLoY7aChpqq4AzE3u6EyeMbX5dfmSyFPqrbKJgTrH4Pg9ELZJfFWW9DmurYw77nqmH529wLYxVq43ec', + }, + slot: 201, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1PUv7oRg5xpMf4nFewZrtRtnmCizW2ETtU', + change: '-2500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1PUv7oRg5xpMf4nFewZrtRtnmCizW2ETtU', + cycle: 131, + change: '2500000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1PUv7oRg5xpMf4nFewZrtRtnmCizW2ETtU', + cycle: 131, + change: '78125', + origin: 'block', + }, + ], + delegate: 'tz1PUv7oRg5xpMf4nFewZrtRtnmCizW2ETtU', + slots: [201], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'oogyZfDdZPWFxuyRAQs1J53CxmxUbnd6Q1WixifHKpnicphrEbb', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigpznVMjV53auoAPqxYxkYANxbrYaMmuq242ueQqo1NijaQvZRUEZP5sFwMLVpLGRUzHEkrYkX6NGFm1RfKKb4yBmBjrHr5', + }, + slot: 15, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1T8UYSbVuRm6CdhjvwCfXsKXb4yL9ai9Q3', + change: '-75000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1T8UYSbVuRm6CdhjvwCfXsKXb4yL9ai9Q3', + cycle: 131, + change: '75000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1T8UYSbVuRm6CdhjvwCfXsKXb4yL9ai9Q3', + cycle: 131, + change: '2343750', + origin: 'block', + }, + ], + delegate: 'tz1T8UYSbVuRm6CdhjvwCfXsKXb4yL9ai9Q3', + slots: [ + 15, 23, 30, 34, 38, 45, 60, 61, 64, 67, 70, 75, 78, 89, 92, 104, 112, 114, 122, 124, + 138, 149, 160, 175, 191, 197, 199, 230, 233, 234, + ], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'oozpKKz7XcaihZhSsEMiLcUPvGxjZe74yz1hrNzvYg9W1NNCjTx', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigqhueAmzzAArEiHLnwQUpLEVcz8wWcn2qxfMKmRrGRg2cn6k4q17eBaU9bHDepsf1jnGN3cDHrTfbas58BW7pbUoCJgHUh', + }, + slot: 120, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1VpvtSaSxKvykrqajFJTZqCXgoVJ5cKaM1', + change: '-5000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1VpvtSaSxKvykrqajFJTZqCXgoVJ5cKaM1', + cycle: 131, + change: '5000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1VpvtSaSxKvykrqajFJTZqCXgoVJ5cKaM1', + cycle: 131, + change: '156250', + origin: 'block', + }, + ], + delegate: 'tz1VpvtSaSxKvykrqajFJTZqCXgoVJ5cKaM1', + slots: [120, 131], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'onwE9jGH8LXetQmPTHekChAnecpcmV92md8WMSgTcjok6DUDtJ9', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigfTpvZPXMb2ur3PhQ2w6N93auNHft7swUHdf4QsizPMgbKHxNFV4TU8MmHXQ5ZivMkeCAbwBEdDApAw25uf9vzzPuAFoAK', + }, + slot: 8, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + change: '-65000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + cycle: 131, + change: '65000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + cycle: 131, + change: '2031250', + origin: 'block', + }, + ], + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + slots: [ + 8, 10, 11, 33, 41, 58, 99, 107, 108, 111, 118, 128, 147, 148, 154, 156, 158, 168, + 172, 183, 192, 228, 237, 244, 250, 253, + ], + }, + }, + ], + }, + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'oo7qUvuxaxUthTzfbTYk56TPBQ1V59iycoTmbTpPYGPENyuR7Fi', + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + operations: { kind: 'endorsement', level: 536084 }, + signature: + 'sigeiWyjufSMaWBEHqotERDGUSFtTLimnFhTH4gm1Pi8qB7hrz41czWXquqHGcVAdt8a3Z96o6Ktg5SkMJ9cyr6qFq8ccmTM', + }, + slot: 9, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1SwJwrKe8H1yi6KnYKCYkVHPApJRnZcHsa', + change: '-60000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1SwJwrKe8H1yi6KnYKCYkVHPApJRnZcHsa', + cycle: 131, + change: '60000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1SwJwrKe8H1yi6KnYKCYkVHPApJRnZcHsa', + cycle: 131, + change: '1875000', + origin: 'block', + }, + ], + delegate: 'tz1SwJwrKe8H1yi6KnYKCYkVHPApJRnZcHsa', + slots: [ + 9, 14, 27, 43, 54, 83, 84, 96, 101, 105, 113, 136, 144, 153, 159, 164, 180, 182, + 203, 211, 224, 247, 249, 251, + ], + }, + }, + ], + }, + ], + [], + [], + [ + { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'ooybqGUDKq3QUbZVe4qZ1oLx2GhTqZ6VdVTuA7SZDfE5B2jbHRd', + branch: 'BLEzWSy1Aze5Enuv3KimDvqZbAXbzSHxQeRDztN6tvXknfTCAus', + contents: [ + { + kind: 'transaction', + source: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59', + fee: '0', + counter: '703827', + gas_limit: '3422', + storage_limit: '67', + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'update_operators', + value: [ + { + prim: 'Left', + args: [ + { + prim: 'Pair', + args: [ + { string: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59' }, + { + prim: 'Pair', + args: [{ string: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm' }, { int: '1' }], + }, + ], + }, + ], + }, + ], + }, + metadata: { + balance_updates: [], + operation_result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [ + { + action: 'update', + big_map: '20442', + key_hash: 'exprtpmtn8bL4jrTW2AfMZJ9p2yx1k9xMkN5f7EWhxtUVPtvutxqNL', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { + prim: 'Pair', + args: [ + { bytes: '01a783b18821ce1f502c8a1c2fd9761ad21c1391d600' }, + { int: '1' }, + ], + }, + ], + }, + value: { prim: 'Unit' }, + }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59', + change: '-16750', + origin: 'block', + }, + ], + consumed_gas: '3322', + consumed_milligas: '3321239', + storage_size: '48520', + paid_storage_size_diff: '67', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { + kind: 'big_map', + id: '20442', + diff: { + action: 'update', + updates: [ + { + key_hash: 'exprtpmtn8bL4jrTW2AfMZJ9p2yx1k9xMkN5f7EWhxtUVPtvutxqNL', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { + prim: 'Pair', + args: [ + { bytes: '01a783b18821ce1f502c8a1c2fd9761ad21c1391d600' }, + { int: '1' }, + ], + }, + ], + }, + value: { prim: 'Unit' }, + }, + ], + }, + }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20440', diff: { action: 'update', updates: [] } }, + ], + }, + }, + }, + { + kind: 'transaction', + source: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59', + fee: '0', + counter: '703828', + gas_limit: '101201', + storage_limit: '70', + amount: '0', + destination: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + parameters: { + entrypoint: 'swap_exact_for_tokens', + value: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { string: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59' }, + { int: '5000000000' }, + ], + }, + { + prim: 'Pair', + args: [{ int: '14146908' }, { string: '2022-01-28T11:57:44.601Z' }], + }, + ], + }, + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { string: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { + prim: 'Pair', + args: [ + { string: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + }, + ], + }, + ], + }, + }, + metadata: { + balance_updates: [], + operation_result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Some', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { prim: 'None' }, + ], + }, + { + prim: 'Pair', + args: [ + { prim: 'None' }, + { prim: 'Right', args: [{ prim: 'Unit' }] }, + ], + }, + ], + }, + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600', + }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { + prim: 'Pair', + args: [ + { + bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600', + }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + }, + ], + }, + { prim: 'None' }, + ], + }, + ], + }, + ], + }, + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + { prim: 'Pair', args: [{ int: '20669' }, { int: '20670' }] }, + ], + }, + big_map_diff: [], + consumed_gas: '12665', + consumed_milligas: '12664013', + storage_size: '32990', + lazy_storage_diff: [ + { kind: 'big_map', id: '20670', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20669', diff: { action: 'update', updates: [] } }, + ], + }, + internal_operation_results: [ + { + kind: 'transaction', + source: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + nonce: 0, + amount: '0', + destination: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + parameters: { + entrypoint: 'get_reserves', + value: { + bytes: + '01a783b18821ce1f502c8a1c2fd9761ad21c1391d60072657365727665735f63616c6c6261636b', + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20832' }, { int: '20833' }] }, + { prim: 'Pair', args: [{ int: '20834' }, { int: '20835' }] }, + ], + }, + { int: '20836' }, + ], + }, + { prim: 'Pair', args: [{ prim: 'None' }, { int: '20837' }] }, + ], + }, + { prim: 'Pair', args: [{ int: '2369921' }, { int: '976068754' }] }, + { int: '1633368712' }, + { int: '3520039054386878' }, + ], + { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { int: '9999515636866' }, + { int: '35198685566720594775323444348' }, + ], + }, + { + prim: 'Pair', + args: [ + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + ], + }, + big_map_diff: [], + consumed_gas: '9288', + consumed_milligas: '9287559', + storage_size: '19227', + lazy_storage_diff: [ + { kind: 'big_map', id: '20837', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20836', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20835', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20834', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20833', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20832', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + nonce: 2, + amount: '0', + destination: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + parameters: { + entrypoint: 'reserves_callback', + value: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [{ int: '3520039054386878' }, { int: '9999515636866' }], + }, + { int: '188166353164099' }, + ], + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Some', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f', + }, + { prim: 'Some', args: [{ int: '3520039054386878' }] }, + ], + }, + { + prim: 'Pair', + args: [ + { prim: 'Some', args: [{ int: '9999515636866' }] }, + { prim: 'Left', args: [{ prim: 'Unit' }] }, + ], + }, + ], + }, + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: + '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600', + }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { + prim: 'Pair', + args: [ + { + bytes: + '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600', + }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + }, + ], + }, + { prim: 'Some', args: [{ int: '188166353164099' }] }, + ], + }, + ], + }, + ], + }, + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + { prim: 'Pair', args: [{ int: '20669' }, { int: '20670' }] }, + ], + }, + big_map_diff: [], + consumed_gas: '9479', + consumed_milligas: '9478157', + storage_size: '33015', + lazy_storage_diff: [ + { kind: 'big_map', id: '20670', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20669', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + nonce: 1, + amount: '0', + destination: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + parameters: { + entrypoint: 'main_entry', + value: { + prim: 'Left', + args: [ + { + prim: 'Left', + args: [ + { + prim: 'Left', + args: [ + { + prim: 'Right', + args: [ + [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: + '0000bc82eedf570c81349226f937bed3d3485a2b080f', + }, + { int: '5000000000' }, + ], + }, + { + prim: 'Pair', + args: [{ int: '14146908' }, { int: '1643371064' }], + }, + ], + }, + { + prim: 'Pair', + args: [ + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + ], + }, + ], + }, + ], + }, + ], + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { prim: 'None' }, + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + { prim: 'Pair', args: [{ int: '20669' }, { int: '20670' }] }, + ], + }, + big_map_diff: [], + consumed_gas: '11667', + consumed_milligas: '11666798', + storage_size: '32875', + lazy_storage_diff: [ + { kind: 'big_map', id: '20670', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20669', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + nonce: 3, + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'transfer', + value: [ + { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { prim: 'Pair', args: [{ int: '1' }, { int: '5000000000' }] }, + ], + }, + ], + ], + }, + ], + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [ + { + action: 'update', + big_map: '20440', + key_hash: 'exprtqGiP8vxvoGE35foNVciCmRtuofNsZVinQfSE2SKdQdAvSTcBS', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '1' }, + ], + }, + value: { int: '5000000000' }, + }, + { + action: 'update', + big_map: '20440', + key_hash: 'exprv6HH2WDmykE9AQ5kmXbsZAbEHzr2Wy6Bkt5CCS9U9CEgiNdRJr', + key: { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '1' }, + ], + }, + value: { int: '3520044054386878' }, + }, + ], + consumed_gas: '5018', + consumed_milligas: '5017728', + storage_size: '48520', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20442', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { + kind: 'big_map', + id: '20440', + diff: { + action: 'update', + updates: [ + { + key_hash: 'exprv6HH2WDmykE9AQ5kmXbsZAbEHzr2Wy6Bkt5CCS9U9CEgiNdRJr', + key: { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '1' }, + ], + }, + value: { int: '3520044054386878' }, + }, + { + key_hash: 'exprtqGiP8vxvoGE35foNVciCmRtuofNsZVinQfSE2SKdQdAvSTcBS', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '1' }, + ], + }, + value: { int: '5000000000' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm', + nonce: 4, + amount: '0', + destination: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + parameters: { + entrypoint: 'start_swap', + value: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '0' }, + ], + }, + { prim: 'Pair', args: [{ int: '14161068' }, { prim: 'None' }] }, + ], + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20832' }, { int: '20833' }] }, + { prim: 'Pair', args: [{ int: '20834' }, { int: '20835' }] }, + ], + }, + { int: '20836' }, + ], + }, + { + prim: 'Pair', + args: [ + { + prim: 'Some', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: + '0000bc82eedf570c81349226f937bed3d3485a2b080f', + }, + { int: '0' }, + ], + }, + { + prim: 'Pair', + args: [{ int: '14161068' }, { prim: 'None' }], + }, + ], + }, + { + prim: 'Pair', + args: [ + { prim: 'None' }, + { prim: 'Right', args: [{ prim: 'Unit' }] }, + ], + }, + ], + }, + ], + }, + { int: '20837' }, + ], + }, + ], + }, + { prim: 'Pair', args: [{ int: '2369921' }, { int: '976068754' }] }, + { int: '1633368712' }, + { int: '3520039054386878' }, + ], + { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { int: '9999515636866' }, + { int: '35198685566720594775323444348' }, + ], + }, + { + prim: 'Pair', + args: [ + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + ], + }, + big_map_diff: [], + consumed_gas: '12571', + consumed_milligas: '12570775', + storage_size: '19279', + lazy_storage_diff: [ + { kind: 'big_map', id: '20837', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20836', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20835', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20834', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20833', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20832', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + nonce: 5, + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'transfer', + value: [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + [ + { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { prim: 'Pair', args: [{ int: '1' }, { int: '0' }] }, + ], + }, + ], + ], + }, + ], + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [ + { + action: 'update', + big_map: '20440', + key_hash: 'exprtqGiP8vxvoGE35foNVciCmRtuofNsZVinQfSE2SKdQdAvSTcBS', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '1' }, + ], + }, + value: { int: '5000000000' }, + }, + { + action: 'update', + big_map: '20440', + key_hash: 'exprv6HH2WDmykE9AQ5kmXbsZAbEHzr2Wy6Bkt5CCS9U9CEgiNdRJr', + key: { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '1' }, + ], + }, + value: { int: '3520044054386878' }, + }, + ], + consumed_gas: '4759', + consumed_milligas: '4758619', + storage_size: '48520', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20442', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { + kind: 'big_map', + id: '20440', + diff: { + action: 'update', + updates: [ + { + key_hash: 'exprv6HH2WDmykE9AQ5kmXbsZAbEHzr2Wy6Bkt5CCS9U9CEgiNdRJr', + key: { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '1' }, + ], + }, + value: { int: '3520044054386878' }, + }, + { + key_hash: 'exprtqGiP8vxvoGE35foNVciCmRtuofNsZVinQfSE2SKdQdAvSTcBS', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '1' }, + ], + }, + value: { int: '5000000000' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + nonce: 6, + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'transfer', + value: [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + [ + { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { prim: 'Pair', args: [{ int: '0' }, { int: '14161068' }] }, + ], + }, + ], + ], + }, + ], + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [ + { + action: 'update', + big_map: '20440', + key_hash: 'exprtsTQSSJpAVrr1qEA9LRMaNz7zpBH4bpmGGBM8N6JztetYSREov', + key: { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '0' }, + ], + }, + value: { int: '9999501475798' }, + }, + { + action: 'update', + big_map: '20440', + key_hash: 'expruhP7hUgjQpeNgzkjxgBt8Bz3bncenkYmC383MS2UYEsTMYXYaU', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '0' }, + ], + }, + value: { int: '14161068' }, + }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59', + change: '-17500', + origin: 'block', + }, + ], + consumed_gas: '4522', + consumed_milligas: '4521387', + storage_size: '48590', + paid_storage_size_diff: '70', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20442', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { + kind: 'big_map', + id: '20440', + diff: { + action: 'update', + updates: [ + { + key_hash: 'expruhP7hUgjQpeNgzkjxgBt8Bz3bncenkYmC383MS2UYEsTMYXYaU', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { int: '0' }, + ], + }, + value: { int: '14161068' }, + }, + { + key_hash: 'exprtsTQSSJpAVrr1qEA9LRMaNz7zpBH4bpmGGBM8N6JztetYSREov', + key: { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '0' }, + ], + }, + value: { int: '9999501475798' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + nonce: 7, + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'balance_of', + value: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '1' }, + ], + }, + ], + { + bytes: + '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc40062616c616e63655f63616c6c6261636b', + }, + ], + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [], + consumed_gas: '5064', + consumed_milligas: '5063541', + storage_size: '48590', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20442', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20440', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + nonce: 10, + amount: '0', + destination: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + parameters: { + entrypoint: 'balance_callback', + value: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '1' }, + ], + }, + { int: '3520044054386878' }, + ], + }, + ], + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20832' }, { int: '20833' }] }, + { prim: 'Pair', args: [{ int: '20834' }, { int: '20835' }] }, + ], + }, + { int: '20836' }, + ], + }, + { + prim: 'Pair', + args: [ + { + prim: 'Some', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: + '0000bc82eedf570c81349226f937bed3d3485a2b080f', + }, + { int: '0' }, + ], + }, + { + prim: 'Pair', + args: [ + { int: '14161068' }, + { + prim: 'Some', + args: [{ int: '3520044054386878' }], + }, + ], + }, + ], + }, + { + prim: 'Pair', + args: [ + { prim: 'None' }, + { + prim: 'Left', + args: [{ prim: 'Left', args: [{ prim: 'Unit' }] }], + }, + ], + }, + ], + }, + ], + }, + { int: '20837' }, + ], + }, + ], + }, + { prim: 'Pair', args: [{ int: '2369921' }, { int: '976068754' }] }, + { int: '1633368712' }, + { int: '3520039054386878' }, + ], + { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { int: '9999515636866' }, + { int: '35198685566720594775323444348' }, + ], + }, + { + prim: 'Pair', + args: [ + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + ], + }, + big_map_diff: [], + consumed_gas: '7023', + consumed_milligas: '7022609', + storage_size: '19290', + lazy_storage_diff: [ + { kind: 'big_map', id: '20837', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20836', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20835', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20834', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20833', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20832', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + nonce: 8, + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'balance_of', + value: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '0' }, + ], + }, + ], + { + bytes: + '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc40062616c616e63655f63616c6c6261636b', + }, + ], + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [], + consumed_gas: '5064', + consumed_milligas: '5063529', + storage_size: '48590', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20442', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20440', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + nonce: 11, + amount: '0', + destination: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + parameters: { + entrypoint: 'balance_callback', + value: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { bytes: '01728d89975f2119d0bcc6dee11eb7d627b0fe5dc400' }, + { int: '0' }, + ], + }, + { int: '9999501475798' }, + ], + }, + ], + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20832' }, { int: '20833' }] }, + { prim: 'Pair', args: [{ int: '20834' }, { int: '20835' }] }, + ], + }, + { int: '20836' }, + ], + }, + { + prim: 'Pair', + args: [ + { + prim: 'Some', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: + '0000bc82eedf570c81349226f937bed3d3485a2b080f', + }, + { int: '0' }, + ], + }, + { + prim: 'Pair', + args: [ + { int: '14161068' }, + { + prim: 'Some', + args: [{ int: '3520044054386878' }], + }, + ], + }, + ], + }, + { + prim: 'Pair', + args: [ + { prim: 'Some', args: [{ int: '9999501475798' }] }, + { + prim: 'Left', + args: [{ prim: 'Right', args: [{ prim: 'Unit' }] }], + }, + ], + }, + ], + }, + ], + }, + { int: '20837' }, + ], + }, + ], + }, + { prim: 'Pair', args: [{ int: '2369921' }, { int: '976068754' }] }, + { int: '1633368712' }, + { int: '3520039054386878' }, + ], + { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { int: '9999515636866' }, + { int: '35198685566720594775323444348' }, + ], + }, + { + prim: 'Pair', + args: [ + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + ], + }, + big_map_diff: [], + consumed_gas: '7025', + consumed_milligas: '7024325', + storage_size: '19298', + lazy_storage_diff: [ + { kind: 'big_map', id: '20837', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20836', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20835', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20834', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20833', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20832', diff: { action: 'update', updates: [] } }, + ], + }, + }, + { + kind: 'transaction', + source: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + nonce: 9, + amount: '0', + destination: 'KT1K2U9q55iPwGJEFyEqfbL3AKhHX4f6UThT', + parameters: { + entrypoint: 'finalize_action', + value: { prim: 'Right', args: [{ prim: 'Unit' }] }, + }, + result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20832' }, { int: '20833' }] }, + { prim: 'Pair', args: [{ int: '20834' }, { int: '20835' }] }, + ], + }, + { int: '20836' }, + ], + }, + { prim: 'Pair', args: [{ prim: 'None' }, { int: '20837' }] }, + ], + }, + { prim: 'Pair', args: [{ int: '2369927' }, { int: '976906563' }] }, + { int: '1633371092' }, + { int: '3520044054386878' }, + ], + { + prim: 'Pair', + args: [ + [ + { + prim: 'Pair', + args: [ + { int: '9999501475798' }, + { int: '35198685566720594775323444348' }, + ], + }, + { + prim: 'Pair', + args: [ + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '1' }] }, + ], + }, + { bytes: '01be8be8d6aa8aa77b26fcdfb58b2d3abc097ba74600' }, + { prim: 'Some', args: [{ int: '0' }] }, + ], + { bytes: '012582f9db72407f07e78f065db7965ff42c46248700' }, + ], + }, + ], + }, + big_map_diff: [], + consumed_gas: '6962', + consumed_milligas: '6961817', + storage_size: '19227', + lazy_storage_diff: [ + { kind: 'big_map', id: '20837', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20836', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20835', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20834', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20833', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20832', diff: { action: 'update', updates: [] } }, + ], + }, + }, + ], + }, + }, + { + kind: 'transaction', + source: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59', + fee: '12049', + counter: '703829', + gas_limit: '3392', + storage_limit: '0', + amount: '0', + destination: 'KT1RxHZJCrFVuPQJWqhVLBZeZxm7SawHdHGL', + parameters: { + entrypoint: 'update_operators', + value: [ + { + prim: 'Right', + args: [ + { + prim: 'Pair', + args: [ + { string: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59' }, + { + prim: 'Pair', + args: [{ string: 'KT1PrWB2PSwWNzbfpA9SJbUaHXxCzbLSJspm' }, { int: '1' }], + }, + ], + }, + ], + }, + ], + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1cpnaaG6FkPAUcrsj45zhYYSPMvJnxyc59', + change: '-12049', + origin: 'block', + }, + { + kind: 'freezer', + category: 'fees', + delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + cycle: 131, + change: '12049', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { prim: 'Pair', args: [{ int: '20440' }, { int: '20441' }] }, + { prim: 'Pair', args: [{ int: '20442' }, { int: '20443' }] }, + ], + }, + big_map_diff: [ + { + action: 'update', + big_map: '20442', + key_hash: 'exprtpmtn8bL4jrTW2AfMZJ9p2yx1k9xMkN5f7EWhxtUVPtvutxqNL', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { + prim: 'Pair', + args: [ + { bytes: '01a783b18821ce1f502c8a1c2fd9761ad21c1391d600' }, + { int: '1' }, + ], + }, + ], + }, + }, + ], + consumed_gas: '3292', + consumed_milligas: '3291138', + storage_size: '48523', + lazy_storage_diff: [ + { kind: 'big_map', id: '20443', diff: { action: 'update', updates: [] } }, + { + kind: 'big_map', + id: '20442', + diff: { + action: 'update', + updates: [ + { + key_hash: 'exprtpmtn8bL4jrTW2AfMZJ9p2yx1k9xMkN5f7EWhxtUVPtvutxqNL', + key: { + prim: 'Pair', + args: [ + { bytes: '0000bc82eedf570c81349226f937bed3d3485a2b080f' }, + { + prim: 'Pair', + args: [ + { bytes: '01a783b18821ce1f502c8a1c2fd9761ad21c1391d600' }, + { int: '1' }, + ], + }, + ], + }, + }, + ], + }, + }, + { kind: 'big_map', id: '20441', diff: { action: 'update', updates: [] } }, + { kind: 'big_map', id: '20440', diff: { action: 'update', updates: [] } }, + ], + }, + }, + }, + ], + signature: + 'siggVH9Kh81y4UraZqdPvH2zdP3RgjUSt2XvM2VDD9N5mGptMrF31GRhaKAxtk6xErHsxLqohMvudwvLkjsMg7TkfGrbwMdC', + }, + ], + ], +}; +export const blockHash = 'BlockHash'; +export const liveBlocks = [ + 'BKiHeQzuKM5quBsgVL25UDFXKcZyaTt26AQUtUkbA4Vh3dAQY21', + 'BKiboc2xTLtbCXt6AWX2BpR4km41onVrLmhFSTjYUA2iWKBwSTH', +]; +export const balance = new BigNumber(4138876344398); +export const storage = { prim: 'Pair', args: [{ int: '0' }, { int: '1' }] }; +export const script = { + code: [ + { prim: 'parameter', args: [] }, + { prim: 'storage', args: [] }, + { prim: 'code', args: [] }, + ], + storage: { prim: 'Pair', args: [] }, +}; +export const contract = { + balance: new BigNumber(765), + script: { + code: [], + storage: { prim: 'Pair', args: [] }, + }, +}; + +export const managerKey = 'edpkvP1NXoo8vhYbPSvXdy466EHoYWBpf6zmjghB2p3DwJPjbB5nsf'; +export const delegate = 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'; +export const bigmapValue = { prim: 'Pair', args: [[], { int: '100' }] }; +export const delegates = { + deactivated: false, + balance: new BigNumber('5821087107868'), + frozen_balance: new BigNumber('1682643263470'), + staking_balance: new BigNumber('5792534034676'), + delegated_contracts: ['tz2ApgXezUaJKaY49nxEYbMjsjnkAz2mTiFC'], + delegated_balance: new BigNumber('12714439280'), + grace_period: 131, + voting_power: 747, +}; +export const votingInfo = { + voting_power: '1005169895965', + remaining_proposals: 20, +}; +export const constants = { + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + blocks_per_roll_snapshot: 256, + blocks_per_voting_period: 20480, + time_between_blocks: [new BigNumber(30), new BigNumber(20)], + endorsers_per_block: 256, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(70368744177663), + minimal_stake: new BigNumber(8000000000), + michelson_maximum_type_size: 1000, + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + block_security_deposit: new BigNumber(640000000), + endorsement_security_deposit: new BigNumber(2500000), + baking_reward_per_endorsement: [new BigNumber(78125), new BigNumber(11719)], + endorsement_reward: [new BigNumber(78125), new BigNumber(52083)], + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 192, + delay_per_missing_endorsement: new BigNumber(4), + minimal_block_delay: new BigNumber(15), + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 2032928, + liquidity_baking_escape_ema_threshold: 1000000, +}; +export const blockHeader = { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'BMZXDPn8kKMCSXX1ZfpkCHBuSeXkwqbEp3MJtEwNB21TNVC3Gsp', + level: 516500, + proto: 2, + predecessor: 'BM4FhgGT16ikghoVoz1WoG5z2pmo24GC9sTrfMk5UB4KEnzjNTu', + timestamp: '2021-09-27T20:41:55Z', + validation_pass: 4, + operations_hash: 'LLoZRW4irfmyGwY5ufakDd52aA1P6bVhn3zpjBbQxdjPvwjeEaDkK', + fitness: ['01', '000000000007e193'], + context: 'CoWX5BdtfTGKmmwpwhF9cpU6SqBmP5MqostAPP6b3oZp94PG9V2S', + priority: 0, + proof_of_work_nonce: '36055190bec80200', + liquidity_baking_escape_vote: false, + signature: + 'sigXwcYckn43nA9uqFKKTqFbkiyhBdKfRd8mbCWHnk4kFqis7unT4VJozBrT7f1pVZNUnTPwHYBqarCdVTRajj5bhWg4qGSF', +}; + +export const bakingRights = [ + { + level: 516501, + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + priority: 0, + estimated_time: '2021-09-27T20:42:10Z', + }, +]; + +export const blockMetadata = { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + next_protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + test_chain_status: { status: 'not_running' }, + max_operations_ttl: 120, + max_operation_data_length: 32768, + max_block_header_length: 239, + max_operation_list_length: [ + { max_size: 4194304, max_op: 2048 }, + { max_size: 32768 }, + { max_size: 135168, max_op: 132 }, + { max_size: 524288 }, + ], + baker: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + level_info: { + level: 516500, + level_position: 516499, + cycle: 127, + cycle_position: 403, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { index: 25, kind: 'proposal', start_position: 512001 }, + position: 4498, + remaining: 15981, + }, + nonce_hash: null, + consumed_gas: '0', + deactivated: [], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '-640000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 127, + change: '640000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 127, + change: '16484375', + origin: 'block', + }, + ], + liquidity_baking_escape_ema: 243180, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [Array], + balance_updates: [Array], + consumed_gas: '2118', + consumed_milligas: '2117300', + storage_size: '4636', + }, + ], +}; +export const endorsingRights = [ + { + level: 516500, + delegate: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + slots: [12, 37, 80, 120, 130, 206, 209, 219, 229], + estimated_time: '2021-09-27T20:41:55Z', + }, +]; +export const ballotList = []; +export const ballots = { yay: 0, nay: 0, pass: 0 }; +export const currentPeriodKind = { + voting_period: { index: 25, kind: 'proposal', start_position: 512001 }, + position: 4498, + remaining: 15981, +}; +export const currentProposal = null; +export const currentQuorum = 5500; +export const votesListing = [{ pkh: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', rolls: 399 }]; +export const porposals = []; +export const entryPoints = { + entrypoints: { main: { prim: 'pair', args: [] }, default: { prim: 'unit' } }, +}; +export const chainId = 'NetXz969SFaFn8k'; +export const packData = { + gas: 'unaccounted', + packed: '050a000000160000b24ac1e1759565d5c9b69af8450ce7ea3d1ee64c', +}; +export const currentPeriod = { + voting_period: { index: 25, kind: 'proposal', start_position: 512001 }, + position: 4498, + remaining: 15981, +}; +export const successorPeriod = { + voting_period: { index: 25, kind: 'proposal', start_position: 512001 }, + position: 4539, + remaining: 15940, +}; + +export const protocols = { + protocol: 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx', + next_protocol: 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx', +}; + +export const delegatesIthacanetResponse = { + full_balance: '1198951292321', + current_frozen_deposits: '120167343864', + frozen_deposits: '120167343864', + staking_balance: '1203308804406', + delegated_contracts: ['tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'], + delegated_balance: '4357512085', + deactivated: false, + grace_period: 37, + voting_power: 199, +}; + +export const delegatesKathmandunetResponse = { + full_balance: '965532868030', + current_frozen_deposits: '96350095609', + frozen_deposits: '96350095609', + staking_balance: '970221941952', + delegated_contracts: ['tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'], + delegated_balance: '4689073922', + deactivated: false, + grace_period: 42, + voting_power: '968128693450', + remaining_proposals: 20, +}; + +export const votingInfoKathmandunetResponse = { + voting_power: '1054404383333', + remaining_proposals: 20, +}; + +export const blockIthacanetResponse = { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'BMGdK16iMkm4YmgAneYuvd7B4R5S8nYQKFfKzXCKMHP1FqS5hXQ', + header: { + level: 135596, + proto: 2, + predecessor: 'BLgx6Cr7DYwXEexuz828mBUqCKotCXo8PRAN55A9wovUrYWvao8', + timestamp: '2022-02-24T01:09:20Z', + validation_pass: 4, + operations_hash: 'LLoaKP1SEeTE1ziKFRHipDYihitAoTHhEZbiartSvehqMPvu7v661', + fitness: ['02', '000211ac', '', 'ffffffff', '00000000'], + context: 'CoVkVfBsmMSCeTLcBesUe4TdhDhvZxhm8SN48Rky5B3aD8U92hY9', + payload_hash: 'vh28CE8X2KKMvt5S4aGzPdMq5FpcfVRSoeyU3D3TUdVyk9zucR31', + payload_round: 0, + proof_of_work_nonce: '409a3f3f250d0100', + liquidity_baking_escape_vote: false, + signature: + 'sigtWPWubCNXDfaH7NZQcei2hzBbHKQtw56z2WRvrmyPNBLRYP2cNAycFob1Dr8MBbbCGtCUny2BaEbzBa4kVEadMNrGp6Mk', + }, + metadata: { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + next_protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + 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: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + baker: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + level_info: { + level: 135596, + level_position: 135595, + cycle: 33, + cycle_position: 427, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { + index: 6, + kind: 'proposal', + start_position: 122880, + }, + position: 12715, + remaining: 7764, + }, + nonce_hash: null, + consumed_gas: '1000000', + deactivated: [], + balance_updates: [ + { + kind: 'accumulator', + category: 'block fees', + change: '-1500', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking rewards', + change: '-5000000', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '5001500', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-4217424', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '4217424', + origin: 'block', + }, + ], + liquidity_baking_escape_ema: 119624, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [ + { + int: '1', + }, + { + int: '338987500100', + }, + { + 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_gas: '225', + consumed_milligas: '224023', + storage_size: '4632', + }, + ], + }, + operations: [ + [ + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooqwt58nxiSHAsmwaBDux3LoEkNE9p14v1TXtnB4CfEaobgHuZ2', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 0, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1iZ9LkpAhN8X1L6RpBtfy3wxpEWzFrXz8j', + endorsement_power: 206, + }, + }, + ], + signature: + 'sigT3AuNgusteshSqt2J5aha7iSsYAXsYVGAr62RNZkrd1Gp6JjY59CtD33a4zyv57ZwV7J5JvWRD7uZrwaE6NSzmP61SGkb', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opZP7VfVcdqY5ivF5tyFYr48SR4wj74wrc4hQHyQWLv5azBZtiN', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 1, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1RuHDSj9P7mNNhfKxsyLGRDahTX5QD1DdP', + endorsement_power: 121, + }, + }, + ], + signature: + 'sigdipDBAxcvLShbKRHNkBoSxxFUr2bTnoVsaM3df8zZhmNex1SefwfNmBJQPePvXSyePWMHSxQiDxpCDkzppEEade6eaSjh', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onxcESouatMhSqYxmtQPtM99df28TYavNR2izyJtULDG29eq5FY', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 2, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1RJ74UepJA9tigjoEeUEFajowzVB3QQaVx', + endorsement_power: 257, + }, + }, + ], + signature: + 'sigeNkH2F3rFUha9Qr1kunmoTHMsWcDKtjh6owGkmBu1xJW7VWfFvgGJtz3qvi2a7npnTfLzVPKroAQwTc8XjY3rMNwDZuUr', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'op2gAd6kzpWPViXxC5QhH62HhtRjjthf2QT78C9vC7epL9V5sxo', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 3, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + endorsement_power: 1227, + }, + }, + ], + signature: + 'sigVwJmrALwEdqetE3Z6EDJyGpett54p4A68xKSpvZMnS2aJZa6Dqr6hiQFroEaV97VsZdVoBZZK1pn7o5CvwZ6BuHG89v7j', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'oorGPbxDrdFc8aZfa7BSLm2v2x3DEWdnThvvq6sxwv2Xbra74A9', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 4, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1XMiZwHpHZ8a1AfwRWKfzLskJgZNyV8PHs', + endorsement_power: 139, + }, + }, + ], + signature: + 'sigRz9Ev7mwTiRtVdBegKCGHLqWz3JSt8HwwmmPoTNYEHyijovj62MRHQBAuaKVi6c7rwoP2451v1ejKB1diHYvgQ2L9iVBj', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opLpk7KV13f8ZkjZrf15PW6gjaiBAeJeWgz3xsgcHv538afebPR', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 5, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1XGwK6kkiJaq2ZEJYcWEj5Tc8bcV6pNHqV', + endorsement_power: 48, + }, + }, + ], + signature: + 'sigXSUhDQmNG4PuQR6Eaz5ffDsL3upXZ1QwsSd7Q4LTTkkucbsYTqorgpY9dh28XtcTFkxi6cGYN2cUUPvDaMXZxX4nJ4Zg2', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'op55vJPHBNdwmAztCGSEezNgUBMLrLa19F7FXGt4mXmYBJ2rz6i', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 7, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1cg5EqC3WdZgRSvGJeW328S4KQNrT4jvyv', + endorsement_power: 264, + }, + }, + ], + signature: + 'sigWtL6YhYswrxoBxACy7P8dwrcWW4syiTeeggTL5sLyS1PdQUYaTMVgvTzWmdX5LdpC4JSB5o3xxF941ac3nbnFtzXgwMYc', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onxq8YLBdsL8AJy81MXrsSMKdBKFnLk7GVqAUxjjoCLFt6D8HMN', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 8, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1NGS7FEGGfEFp5XRVkHBqVqSQ8VuumF9j3', + endorsement_power: 33, + }, + }, + ], + signature: + 'sigpDY5wQs7Rxo7sFTcJUkxzXeBMvbnseLZaLAT5JB95iGS9ndwdQF1WYLSdAYDhwiXKuZpcGDFLHipHYizpQh8qQFg8xrYU', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onqHgJw1HWxoHucpim35NQ2t4V4sPzJmPTPhru4cxuBJuMjQzwh', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 10, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', + endorsement_power: 164, + }, + }, + ], + signature: + 'sigUfJLBuU6HnaCVRDvFG6YELjMy3YmoMwj8ohgaYt9mTQUbK28AkfxjDcck72e3LsL6KGBZZjmSWDwwU6DtJanM5orRTubY', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooCYNg4ZMQWt3yzfyrDbmK6dtyMuwYr6spj2eCCoJf76iZeP3mP', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 12, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1MeT8NACB8Q4uV9dPQ3YxXBmYgapbxQxQ5', + endorsement_power: 782, + }, + }, + ], + signature: + 'sigWwS6Cqc32rrngX136d2KKfp9SgBDdosgA2HoALEk62tRMjU6LJSa6m6SDnrKitAZrXTtD9VguMCc61X8oUuYyYt5nT1CF', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opDt75d4MTscbTgXzcJVrKD25QPofMpkTzofCAeRZgskLYwbJX5', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 13, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1dqPQn5HXNJ7yjcqBx2w6sozjPXTV1kpfh', + endorsement_power: 156, + }, + }, + ], + signature: + 'sigijCvAxjub2QdmhNT4wQkppQDYrKAxt7MN1v9iwRszcR3bMkKK6VfACHpy7RkQ4VvN3caPMJf6rhnLRdgpAqpQrAwj6KBT', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'oohJgzphmFhuqPzhhSgMThmeuUQNmpqbwUMjc2tPCGryQTFDCQ8', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 17, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + endorsement_power: 237, + }, + }, + ], + signature: + 'sigQkUSHt6izTh7TNn3GTtELiL6rypCYUYHFPU65FXWojV6xhsL7jDkJipxSLvpPhshK8d7EebWSe2PhFrtqgUWBbuGibNtm', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooQnVunqu4u6KVD65kKfruyh4fUDLD8ahqmvg3tWQbo1WX6yreK', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 18, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1NiaviJwtMbpEcNqSP6neeoBYj8Brb3QPv', + endorsement_power: 240, + }, + }, + ], + signature: + 'sigqVDESVHH7tkjtyuM63TsL28C3HSjmesdGJn7ALFKVQHn1Ciw23PhAXeeR3iS9LtVihM7LQy4hqjZhZqCWnP5BmoPgXSFr', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooUzJx1JK2uMnSxzwTzN7VCaaGropVm32w1CMXc25fLwBvNoSiF', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 20, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1LQ32syCNyGj6FdAuJfko42Wep87iYZk8k', + endorsement_power: 159, + }, + }, + ], + signature: + 'sigTcHdNzSGKd3WoKTcwFYvZXseN3oya2eNnRWvnh3yjDoqjB4mJedUrvVPHb3XphnejGhmqscWQeqo8qz5SMJGFvSLsaU5R', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onfyPPCxtU937rMKNtkXV978ckQSnTqgM9VMEsB18ha9QXHZbyw', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 28, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1funU3PjPsuXvmtXMgnAckY1s4pNT6V7WJ', + endorsement_power: 152, + }, + }, + ], + signature: + 'sigfiyUP39iz8GGq6opn5eMiUqGCJ1vRWF8r92ByyeL7zhGe7b21WEKREYNmAPfhcWFWHm9rFRB5uav4LMFd2V6NCwkQtsaF', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooosvu7cCgZZG9E8SYgrNBFBJcVtTnrhhuoEuckNGzsEi5ug8uk', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 29, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc', + endorsement_power: 158, + }, + }, + ], + signature: + 'sigqFLE4Q2uZ6yMo8QWjrsbzVKV4bWNWbppP5ZhLDsvL83HbzJQG2ABHbCALrqXNrZR1znRcvAaB7JYEHDScw9tqWVN2VpKt', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooT5Fy1ZkamhGPBKSE6uFhQicoaZJNBC4AsoWo9F9v7W6AVRvpv', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 33, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1cXeGHP8Urj2pQRwpAkCdPGbCdqFUPsQwU', + endorsement_power: 163, + }, + }, + ], + signature: + 'sigvGuQyTgdreAChYGAjUYR76pQSKKTq7ed4vFuzSGe6sZyiSa1uXS8wRDqH5nXTugTKs6S7sSDps4UsT6SRuTXQFN5iDekk', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onway6W9qLwef1ejbEFPtKiU6wzjubKfj6YorREHtiaZhNQuRuD', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 35, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1ituzNz9MGaMSL9dVDN7jE5SArCEWNmZbS', + endorsement_power: 161, + }, + }, + ], + signature: + 'sigN9vEVaZerpXewKGoDUhXqDoyw69jawRuewDAf55z839E4JSaW3KDGX3AZHN5vRxPxiQLTUmvnUCTxK73fQL63aJ8CMiLF', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'op2tvcwvEN8vDoBQdHinKCpJpq5xr8uhXjESfNpQg4dUYKXv3RC', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 43, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1hm7NuCGNSKZQLQSawjUnehJcX8yCBcCAq', + endorsement_power: 162, + }, + }, + ], + signature: + 'sigmCvUw4dFVcru7Vpa4yiQKh8M5zX4EPXNwg5VTggXDiQmxTeZdwsKggZJwh3CDyiBWvLL7gnnbCK644Kwy59xXpZvQi19h', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onr9HZHYKAgRxrZKgvQWraBGaGAoWGqtEaT8bArT9JzfxisgWTw', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 44, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1Q7YBzLJkw87c2FdwaWuGKyacSDc4QghzQ', + endorsement_power: 137, + }, + }, + ], + signature: + 'sigwKZiwNPK4mw5eEBBGh8TNNGuhuQ2snncTLWuQhMxs9GFxMFRD8GrkLUwsPQV84Qcr6pwbFFPFQx5U6TUBT7ZXU9jovyLY', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opUPRQxsDU1XsppujmWr66YwQLD135vApq6EbVz7mtY58EKCSGq', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 46, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope', + endorsement_power: 117, + }, + }, + ], + signature: + 'siggYsKR7C7hMFfUXNv4KvUx9t2djbZxVHeSJQvd5Zcmz8tg5bCZLmXV8rwAeB5bFahuVn5z6iAp8SMXT35peAPc37256pEE', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooM4BoirczR6W8hXEVsYQ8cHerbHbE9in4z5wMS2AhxvP2Ufad4', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 47, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1KkJtLB9pMdLKNpVRNZw9zmysrxKmYcRGU', + endorsement_power: 158, + }, + }, + ], + signature: + 'sigpDri9hyWVNm6VrnS8Kr4yY3bdNXEWwXPmUEMbvJSM6nLEgzHczAN9QQ73WiHv6xJdjdhgUjitkHkyU8tsmEHSpJMGLrTt', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooLKxLjcVBoeB2GJ2QNg6afi4HwUQ2upCfaxWsjT4k1nrtxmL8h', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 48, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1V9CRVyKP3roXsnjcFJP3p9DSXX63KL7iP', + endorsement_power: 166, + }, + }, + ], + signature: + 'sigVjebUbAjkjvw1wyvQ73FyEn9GJfnytuqN9Xd3ghEzaFyacaWEiD7c1ANv67XYDgrquV3GsHF29booHXinSjGjP4cAgcRU', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'oo36GYoDhvBuhb4wqFRRZ2ugLJNkKfHGmcaHhjLCg9SgdiQPJSY', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 54, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', + endorsement_power: 153, + }, + }, + ], + signature: + 'sigV2Cfek4NvEY5CvN91nJLfAG2xG7r8hAt3nZQFPNYu5Qtz3TEQbYLxfwbs8UozKvv8bwAzVk35L9VKgcMUkaEZ3NHsYYg1', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'oopWQdrwuxWCBkw7qaVesBLCsGExxuhRuU7FJqQuA9pQcr7nPzw', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 59, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1e841Z7k7XHSoTSyHyBHG2Gijv7DzzjEBb', + endorsement_power: 170, + }, + }, + ], + signature: + 'signyax1oDM1SxWoQir1aMRNXnm1zDnSvLyZnGdPZzh8kqYiK7GqiNb9tP3DUxcLnZeYtiQbWNuBCf6eZzXnXtc7mUhYXAHV', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'oo4t2WvJgwZhAsf5CwcDtKCfSkiaKp9wTNYL7LuAbJ9k3sJvTEg', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 61, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', + endorsement_power: 74, + }, + }, + ], + signature: + 'signNkorAErY1hBzFRkzeMTqUy6inFFTd9EmpYPKfFyUGX139DyHtsfUHfumPFHeomLtXZMmGQ5g2vi4R1tveaS9yQvz7aba', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opUy2TmnHxDqjUt3Ht7dCsWyLLNz9sRpA1eC5qZqkhyvHND67pu', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 64, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1QXAAasy8TciwfvDC4a7MWo1tm3K37uN9Y', + endorsement_power: 153, + }, + }, + ], + signature: + 'sigtoch1ijiGuNGW3qHtAngiEDhEqL5T4acdNEGKt4ew2NoPNkxScgshoxttV45NYxKpLNw6J3FQHPRyaT22fGgwbd9ySu3k', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ooArbFfPVgM6mc3RUroxf2qsimXProumPK6XuidgfjosoT2VN34', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 70, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1MvCE9dczhoij2bd4sLL2AfVuMtWfFAoCN', + endorsement_power: 137, + }, + }, + ], + signature: + 'sigb2eh47AatunkNSZPVpsZg9nqGqu8GG2C24Hx4D6SoRJ1sz4jgFPjAhP1rk9BkRJ8GfM3AYyY7PGdFqzod3a6q1Wk4ZRVK', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'ood93Z7NmwMeLSo2dW8tBUBst3p3ogcEmkUrDR9T8coHrVApZzF', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 71, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + endorsement_power: 119, + }, + }, + ], + signature: + 'sigiSzxJ1dSeHujvRtv1VKCAc5V1mu5ftRfyutfgKyjjCLGRrNG73k8jb5nqjiTu9T79L4oKdf1g7AEQMCK6eENWPcaMwfFN', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'onjvGqyScQLdGb5cMPwHbnd9UVmh3MhcUze3P1wGHSXRarfxAwY', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 75, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1edUYGqBtteStneTGDBrQWTFmq9cnEELiW', + endorsement_power: 135, + }, + }, + ], + signature: + 'siggwc4K8yWEU8ttzA8HhQh15zV2fYcyK6nfbuVGVs3G2TbM1nVrJxLiC6sHKqBtBuofiC8pYzDLJxVY9zdCzGqBhyMPCw4M', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opBqy3cLQugeT2xVvKoJUn3yLp79hzuXHc7r5BqSa5HHHFddYgB', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 85, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', + endorsement_power: 139, + }, + }, + ], + signature: + 'sigoZ5bh1XPA8kHFkBCs4U9Dq6nT9Ng3i9LENKKCHg8k96TP4KVcFmh1iyVTpxSSiM8V21bnZ7W91KsDL2vekru1ACXsU8Yp', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'opCRv7Ewfh3s96PDiVKPC2c4A9oT6nf8FVeQYB2EUEJFT81UTET', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 90, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1SFbdg2jjkixHNU1Jm9f8JA4pYnMXsgATC', + endorsement_power: 5, + }, + }, + ], + signature: + 'sigcmrbc6rZnDpEkR268Pvzz2GPSRi8nWnTthYXt8L6Tg9pB4vzdh4uy8gKYrMQFbJTwRSsyPa31xR5u8FMH9xMAfrWn9r48', + }, + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'op9TeE362FGyayWVRghVrRxm2FdezqPdqJRM4VTeq5C6ievFDkd', + branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', + contents: [ + { + kind: 'endorsement', + slot: 116, + level: 135595, + round: 0, + block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', + metadata: { + balance_updates: [], + delegate: 'tz1RBECWBXv4tKcuDbxYmBguvdn8wzjrejHg', + endorsement_power: 143, + }, + }, + ], + signature: + 'sigQ5nhdCPRiddmNUYLXCeBk5qs3T6fxMiitKgFJQg5Nuo8sqJTamyJctbF5Gt7MrDZEdiCcmZBj4dEHa9fjDLyCSdgHsL3x', + }, + ], + [], + [], + [ + { + protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + chain_id: 'NetXnHfVqm9iesp', + hash: 'oowvQuTHNxiG8x1TzewhUHtKGLhFPbhiaaHJFKpUnvkv2h3RDsz', + branch: 'BLZNxWPKB9CGGZ8bCYvkq7NwHZNHLuCHnueiJz7QFEzUztT4TjP', + contents: [ + { + kind: 'set_deposits_limit', + source: 'tz2FViF6XzJ4PqD5TTuaAtZScmiwpJBGBpSh', + fee: '1500', + counter: '146662', + gas_limit: '1000', + storage_limit: '10000', + limit: '3', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz2FViF6XzJ4PqD5TTuaAtZScmiwpJBGBpSh', + change: '-1500', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '1500', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_gas: '1000', + consumed_milligas: '1000000', + }, + }, + }, + ], + signature: + 'sigegUy94SxjpBw2MwKMsqFjEjbeoQu8VdcXciXRryv4KA1hMT2gGKRCKnDFinKHaaWGCZskHzo2Hb6XB1iV6gonUdhBuCuN', + }, + ], + ], +}; + +export const blockJakartanetResponse = { + protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + chain_id: 'NetXLH1uAxK7CCh', + hash: 'BLivfHQoHCtixrwXCNnsMQj33F3mLukQBBh4KoJ9AT6ADvLz7Ev', + header: { + level: 63401, + proto: 2, + predecessor: 'BLzrD8thayxjzCxQAy2y3WYg7Rqvh59V3FX2UpDZdNkoeutt935', + timestamp: '2022-05-09T22:46:29Z', + 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', + signature: + 'sigcRoFAEPYkmtMRGReeSd5tjnSNfgAntG3H5aHyTk4WSKc42QVzj5xHf9RsDvkyGSgLsm7hvYVoQ27p8pd9QYSmNUWdS11t', + }, + metadata: { + protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + next_protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + 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: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + baker: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + level_info: { + level: 63401, + level_position: 63400, + cycle: 15, + cycle_position: 1960, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { + index: 15, + kind: 'proposal', + start_position: 61440, + }, + position: 1960, + remaining: 2135, + }, + nonce_hash: null, + consumed_gas: '1521000', + deactivated: [], + balance_updates: [ + { + kind: 'accumulator', + category: 'block fees', + change: '-380', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking rewards', + change: '-10000000', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + change: '10000380', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-8533426', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + change: '8533426', + origin: 'block', + }, + ], + liquidity_baking_toggle_ema: 521773279, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [ + { + int: '1', + }, + { + int: '158500000100', + }, + { + 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_gas: '205', + consumed_milligas: '204975', + storage_size: '4632', + }, + ], + consumed_milligas: '1521000', + }, + 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', + contents: [ + { + kind: 'endorsement', + slot: 3, + level: 63400, + round: 0, + block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', + metadata: { + delegate: 'tz1MvCE9dczhoij2bd4sLL2AfVuMtWfFAoCN', + endorsement_power: 220, + }, + }, + ], + signature: + 'sigf34YLEzjWP3iF5KPzBTAgv4942SgvwRje4dByVEVMVKGWSb48ygUdXtg7umiEfKVrNx5zoq6xTCXXb1T9wCFkGDQyCSHA', + }, + { + protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + chain_id: 'NetXLH1uAxK7CCh', + hash: 'op5xBzwaZ3xkSMLgpnUrJAR4baCjKAgNQjQCzDAo5hFZShe33or', + branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', + contents: [ + { + kind: 'endorsement', + slot: 4, + level: 63400, + round: 0, + block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', + metadata: { + delegate: 'tz1iTzWpFhURP5EnWqAc9hUkuVe2b2tSAGXC', + endorsement_power: 317, + }, + }, + ], + signature: + 'sigbCpffpWqNLYY8ehNZHwVGEt2RCT46zHjNZxM5YuUVg9tYRA6Kt99PMwMQCy8Y7HfVP54LnoH3xyDXi339Up5hMYP2VLQi', + }, + { + protocol: 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + chain_id: 'NetXLH1uAxK7CCh', + hash: 'op4Z6oKBNLpm43LZp3NyKFujNcPd891neF5LouVewHDd13Yg33o', + branch: 'BLWjScATovLPaC9CC2WTTcQLPtSeDsvi3KYQv9sdADCUckuKqAG', + contents: [ + { + kind: 'endorsement', + slot: 5, + level: 63400, + round: 0, + block_payload_hash: 'vh2rPXnC3mDgAQ5CR15VF91QfHtAzP5aEyR1VBV6NL3bJbck4th1', + metadata: { + delegate: 'tz1XGwK6kkiJaq2ZEJYcWEj5Tc8bcV6pNHqV', + endorsement_power: 226, + }, + }, + ], + 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', + }, + ], + ], +}; + +export const blockLimanetResponse = { + protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + chain_id: 'NetXizpkH94bocH', + hash: 'BM5sGpbt1rEiNmfbbo8jcQHJaUZQYwKUXe4MK6B8hcxHDeEfuJx', + header: { + level: 104428, + proto: 2, + predecessor: 'BLoSHvgQ6i64fxa2cWV2PW77FB2apjFpuMgGT9CN9YTCkLHYUEu', + timestamp: '2022-11-02T02:02:55Z', + validation_pass: 4, + operations_hash: 'LLob51uyaK2Kn61U7LPTwPDGe7bEsAifAGjHaAXb5QvfwWv1nBwCC', + fitness: ['02', '000197ec', '', 'ffffffff', '00000000'], + context: 'CoVH2RtM1HHzLZmdbM86EkfwLEg42hmcdr4UGVmUezUDjyUEqYyj', + payload_hash: 'vh2keAERJ5aCT7EagCysfCYcxshQiDKmX1nVPw5mMxB1C6QVZ4eP', + payload_round: 0, + proof_of_work_nonce: 'e45ea3f000000000', + liquidity_baking_toggle_vote: 'off', + signature: + 'sigPXDyg4aUDxaCQKFvsX1Bttek8M9LxSinKCfNnoFEKYBKRL2V7of9vRJUPVckdaA8GYaTcW5W3MXpvASNQX4PeHEkMSrM3', + }, + metadata: { + protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + next_protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + 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: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + baker: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + level_info: { + level: 104428, + level_position: 104427, + cycle: 25, + cycle_position: 2027, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { index: 5, kind: 'proposal', start_position: 102400 }, + position: 2027, + remaining: 2068, + }, + nonce_hash: null, + deactivated: [], + balance_updates: [ + { + kind: 'minted', + category: 'baking rewards', + change: '-5000000', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1MeT8NACB8Q4uV9dPQ3YxXBmYgapbxQxQ5', + change: '5000000', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-4073843', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1MeT8NACB8Q4uV9dPQ3YxXBmYgapbxQxQ5', + change: '4073843', + origin: 'block', + }, + ], + liquidity_baking_toggle_ema: 583905253, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [ + { int: '1' }, + { int: '261067500100' }, + { 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_gas: '225', + consumed_milligas: '224023', + storage_size: '4632', + }, + ], + proposer_consensus_key: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + baker_consensus_key: 'tz1PirbogVqfmBT9XCuYJ1KnDx4bnMSYfGru', + consumed_milligas: '1100000', + }, + operations: [ + [ + { + protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + chain_id: 'NetXizpkH94bocH', + hash: 'opT8tdDhEafJu7qrzsdtwSqP1LcD9rKCNG7DoVT59vQV1JdxUu3', + branch: 'BKtKnh7dkSaZyRbAhRL8vF4ZT1SDKRvXptBQ4pKEh6pbmKE7yf4', + contents: [ + { + kind: 'endorsement', + slot: 0, + level: 104427, + round: 0, + block_payload_hash: 'vh2zfP3jrzMXxabzESqDmMvSf6iStm9gW6TwsQHscCa423YbrULT', + metadata: { + delegate: 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc', + endorsement_power: 316, + consensus_key: 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc', + }, + }, + ], + signature: + 'sigRk4JF7pC3BcfqqPYqdPvv3yAuxJBfUkTMqnx6oDDm6WZZggH7DLkyJMFennY1AaXtprhHBgFtnVptfxPYGRLYLYutqggG', + }, + ], + [], + [], + [ + { + protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + chain_id: 'NetXizpkH94bocH', + hash: 'opNzjyNGHBAgvsVMyezUAPSZKbFcXZmTh6GTjcTjAGtGMpVG3Eh', + branch: 'BM6qkBbRP17B4UeQAFJBzWyPuy2bxEbKHGbUiP97xihMeeRywzW', + contents: [ + { + kind: 'update_consensus_key', + source: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', + fee: '369', + counter: '19043', + gas_limit: '1100', + storage_limit: '0', + pk: 'edpkti5K5JbdLpp2dCqiTLoLQqs5wqzeVhfHVnNhsSCuoU8zdHYoY7', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', + change: '-369', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '369', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_gas: '1000', + consumed_milligas: '1000000', + }, + }, + }, + { + kind: 'drain_delegate', + consensus_key: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj', + delegate: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', + destination: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', + change: '-15525772494', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj', + change: '15525772494', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv', + change: '-156825984', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1hoyMUiJYYr4FRPMU8Z7WJzYkqgjygjaTy', + change: '156825984', + origin: 'block', + }, + ], + }, + }, + ], + signature: + 'sigrsWF7LpFpUBrTdvLnKm8DMuijk1LcZovZdKZDgsaafTPZhKsvLzPFHDzZYKCy4kobkgxVL7YPGnU5qzJJBcP2cAu5HW1C', + }, + ], + ], +}; + +export const blockMondaynetResponse = { + protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', + chain_id: 'NetXrxsLyu6hTHx', + hash: 'BLxSQZzbnjL8yWqo8fJDE6cy2ATPmqQSaLKtheFBzAz4QVTcm5h', + header: { + level: 8215, + proto: 2, + predecessor: 'BL9zTL6ejYpVwLLDNvZayft5PADYZMit3GPV3u3huQtYLgfnHFb', + timestamp: '2022-09-14T21:08:52Z', + validation_pass: 4, + operations_hash: 'LLob52r9i4cfn4uarsAfQhMAQrHrTgho8snr4kAaiP3tjMptaQ5Vg', + fitness: ['02', '00002017', '', 'ffffffff', '00000000'], + context: 'CoWA7xHEpEUv7eLhNHQ7eq6kYQU2J87e9CiMDxHimZ7g9J8aTNCh', + payload_hash: 'vh2abve8bjZpFr1FEEH4ySWtXV4svNb7vZ7spty8RGEAQuAPzowv', + payload_round: 0, + proof_of_work_nonce: 'd84ec51000000000', + liquidity_baking_toggle_vote: 'pass', + signature: + 'sigYFwK4Y6br6JKypqywernuthHE8oJmVBno7c9n2aM4VN5buviZFu7ABU84C3Lo2bBtrhh563k9Licq2WGoGLgqnpR7vYku', + }, + metadata: { + protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', + next_protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', + 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: 8215, + level_position: 8214, + cycle: 64, + cycle_position: 22, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { + index: 64, + kind: 'proposal', + start_position: 8192, + }, + position: 22, + remaining: 105, + }, + nonce_hash: null, + deactivated: [], + balance_updates: [ + { + kind: 'accumulator', + category: 'block fees', + change: '-1066', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking rewards', + change: '-10000000', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + change: '10001066', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-9999238', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + change: '9999238', + origin: 'block', + }, + ], + liquidity_baking_toggle_ema: 0, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [ + { + int: '1', + }, + { + int: '20535000100', + }, + { + 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: '204995', + storage_size: '4632', + }, + ], + proposer_consensus_key: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + baker_consensus_key: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + consumed_milligas: '6009000', + }, + operations: [ + [], + [], + [], + [ + { + protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', + chain_id: 'NetXrxsLyu6hTHx', + hash: 'oohBkdej63Xf68KKAi9KfBUKzzX9NDQ6uqUa99bgWUCjL5JBAF1', + branch: 'BMHnqNtChbedSiBp9XPMmsMHKDmFVkHN64CP1ohyeA2imwLc3W9', + contents: [ + { + kind: 'reveal', + source: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + fee: '358', + counter: '1825', + gas_limit: '1000', + storage_limit: '0', + public_key: 'edpkuyMNjhh4w8S7iwuKh6bJgE4cjfSEvRRAXC9qHQUE1u9avfZykW', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + change: '-358', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '358', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '1000000', + }, + }, + }, + { + kind: 'transfer_ticket', + source: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + fee: '708', + counter: '1826', + gas_limit: '5009', + storage_limit: '130', + ticket_contents: { + string: 'foobar', + }, + ticket_ty: { + prim: 'string', + }, + ticket_ticketer: 'KT1P57aaa5RgxqMdgoUoerWg8HVwXjbP2vxS', + ticket_amount: '2', + destination: 'KT1BnDCAv62hqTQ3kDnMxWGKVpEgdQgX3TPm', + entrypoint: 'default', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + change: '-708', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '708', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + change: '-16500', + origin: 'block', + }, + { + kind: 'burned', + category: 'storage fees', + change: '16500', + origin: 'block', + }, + ], + consumed_milligas: '2122881', + paid_storage_size_diff: '66', + }, + internal_operation_results: [ + { + kind: 'transaction', + source: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + nonce: 0, + amount: '0', + destination: 'KT1BnDCAv62hqTQ3kDnMxWGKVpEgdQgX3TPm', + parameters: { + entrypoint: 'default', + value: { + prim: 'Pair', + args: [ + { + bytes: '019eee1d62435cc1a5248d89bade87b9760bd7644300', + }, + { + prim: 'Pair', + args: [ + { + string: 'foobar', + }, + { + int: '2', + }, + ], + }, + ], + }, + }, + result: { + status: 'applied', + storage: { + prim: 'Some', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: '019eee1d62435cc1a5248d89bade87b9760bd7644300', + }, + { + prim: 'Pair', + args: [ + { + string: 'foobar', + }, + { + int: '2', + }, + ], + }, + ], + }, + ], + }, + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa', + change: '-11000', + origin: 'block', + }, + { + kind: 'burned', + category: 'storage fees', + change: '11000', + origin: 'block', + }, + ], + consumed_milligas: '2785855', + storage_size: '90', + paid_storage_size_diff: '44', + }, + }, + ], + }, + }, + ], + signature: + 'sigcwwEnrdbzVXzm2hiiU8KoDK8rxgDzU5GaDj4YGounA53n2kNKQYunVeV5jfqo5hVdzcjskKW8P5WzQLPpDeAJNKB2wHmh', + }, + ], + ], +}; + +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', + content_type: { + prim: 'string', + }, + content: { + string: 'ticket1', + }, + amount: '1', + }, +]; + +export const pendingOperationsResponse = { + applied: [ + { + hash: 'onjTGvtnaudo1o5sfTe51XEumhsENAhM7oMzhvsSXzZFXNcj1LE', + branch: 'BLvb5tzmepwJkxhRYCnnQeYXqRWhUvdmx4NbpVK9w4nkM6tdXEr', + contents: [ + { + kind: 'preendorsement', + slot: 14, + level: 128135, + round: 0, + block_payload_hash: 'vh3Tk5KEy88s4scEbJM1n6vzYdYSn3PNmsH5uSP4zoLccNVyXAZd', + }, + ], + signature: + 'sigNWXUeYUraaGi1GrxjrqKTfk7KF8xRG4pABA1qeZi8bQWRmcSmDWD6BehCNC1qNDMgQkf3JdEFHKuomToBza2iGucg9SuC', + }, + ], + refused: [ + { + hash: 'ongFJ3rNnTwratXX2mTHN8MLww2rG11BeJwiPGxr2z2KdESZKKG', + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + branch: 'BLf8hVJk9kK539kTKQ9PHFjtet3nJuAKYGqCqvFuHTZQWavrP7u', + contents: [ + { + kind: 'reveal', + source: 'tz2GeK37F1ThiGwamtxUykBuWqamWc7UcmHN', + fee: '374', + counter: '54971', + gas_limit: '1100', + storage_limit: '0', + public_key: 'sppk7c9pb7WyLmaw2JwHyH2PYeXcmALCnGwHzVCTfzx33XMV8bW3aT7', + }, + { + kind: 'origination', + source: 'tz2GeK37F1ThiGwamtxUykBuWqamWc7UcmHN', + fee: '544', + counter: '54972', + gas_limit: '600000', + storage_limit: '319', + balance: '0', + script: { + code: [ + { prim: 'parameter', args: [{ prim: 'string' }] }, + { prim: 'storage', args: [{ prim: 'string' }] }, + { + prim: 'code', + args: [ + [ + { prim: 'CAR' }, + { prim: 'PUSH', args: [{ prim: 'string' }, { string: 'Hello ' }] }, + { prim: 'CONCAT' }, + { prim: 'NIL', args: [{ prim: 'operation' }] }, + { prim: 'PAIR' }, + ], + ], + }, + ], + storage: { string: 'test' }, + }, + }, + ], + signature: + 'sigaD9KjwZXtfhUEpxGirsvNWyScLKQVFQM9kkFB4sTgixfwnJD2D9wt2Km1CM5o2ExGGRTZGLxAr1dZDESurwJusiuHKQvZ', + error: [ + { + kind: 'permanent', + id: 'proto.016-PtMumbai.prefilter.fees_too_low', + }, + ], + }, + ], + outdated: [ + { + hash: 'oneJE697j4ZNCnhoEsbyPyj4Y5MmyQh4xX6FU3HEGzKnaJkdL5B', + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + branch: 'BLf4UgJixDsXcRnirtBzfst8uzzkcpbBjXQuMmzwwJwD75gh3GU', + contents: [ + { + kind: 'preendorsement', + slot: 15, + level: 128095, + round: 0, + block_payload_hash: 'vh3Xu8Y1EQDMGFYaLXiau3sLukEWGjs3zHW7jynH1m7RaLTqXJpw', + }, + ], + signature: + 'sigsVPdVAmQZrCeucDX5QNjz3H4jNWGfVEZRhjXBGg8ZSxWRK2cGdgUCdyDF47DctaJXqAbMwMHB24En9qWj4mEaTwWMC4SN', + error: [ + { + kind: 'Preendorsement', + id: 'proto.016-PtMumbai.validate.consensus_operation_for_old_level', + expected: 128096, + provided: 128095, + }, + ], + }, + ], + branch_refused: [], + branch_delayed: [], + unprocessed: [], +}; + +export const ticketUpdatesResponse = { + protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + chain_id: 'NetXizpkH94bocH', + hash: 'BLAoXLidLrRnUQaUNPanuiaGTS3Ce2azZQysz2mMTCUnFg2799j', + header: {}, + metadata: {}, + operations: [ + [ + { + protocol: 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + chain_id: 'NetXizpkH94bocH', + hash: 'onrYwrpBkF54XTGkxQBUhEcVhgqoava49oWMo5DmGgrh3yqodYN', + branch: 'BKmKts5CAQ2oLv3UvB3jWTMNHKsbxSofMeaNGLWA8WAavY9jqWb', + contents: [ + { + kind: 'transaction', + source: 'tz1PVMKUxmFBB2c3NqKTRi7K7TKgfNYP97Ly', + fee: '2122', + counter: '76', + gas_limit: '18472', + storage_limit: '929', + amount: '0', + destination: 'KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj', + parameters: { + entrypoint: 'exchange_tickets', + value: { + int: '2', + }, + }, + metadata: { + operation_result: { + status: 'applied', + storage: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + prim: 'None', + }, + [], + ], + }, + { + prim: 'Pair', + args: [ + { + bytes: '00002a3c4ef8b90e40d0a0f3d793e78da4d40ff7ab05', + }, + { + bytes: '016a41f23d91041e57a4cf22d0ebf27bba7bc67b2c00', + }, + ], + }, + ], + }, + ticket_updates: [ + { + ticket_token: { + ticketer: 'KT1JGcC8DuWHcShu6XvtfgKVnV2zcYsZ4TVH', + content_type: { + prim: 'unit', + }, + content: { + prim: 'Unit', + }, + }, + updates: [ + { + account: 'KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj', + amount: '-2', + }, + ], + }, + ], + consumed_milligas: '4077693', + storage_size: '5600', + }, + internal_operation_results: [ + { + kind: 'transaction', + source: 'KT1JGcC8DuWHcShu6XvtfgKVnV2zcYsZ4TVH', + nonce: 1, + amount: '0', + destination: 'KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj', + parameters: { + entrypoint: 'receive_cards', + value: [], + }, + result: { + status: 'applied', + ticket_receipt: [ + { + ticket_token: { + ticketer: 'KT1JGcC8DuWHcShu6XvtfgKVnV2zcYsZ4TVH', + content_type: { + prim: 'string', + }, + content: { + string: 'Ferosinge', + }, + }, + updates: [ + { + account: 'KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj', + amount: '1', + }, + ], + }, + ], + consumed_milligas: '7372756', + storage_size: '6015', + paid_storage_size_diff: '380', + }, + }, + ], + }, + }, + ], + signature: + 'sigXx1HE97LT5dFaBDGyRZJQvGes8zgTwrcbHidn93VjCAoULiGiqFA2ArzMW89Pt81TuEP5SZoqKpSGfg6qhjhEgQ5Tza9H', + }, + ], + ], +}; + +export const smartRollupOriginateResponse = { + protocol: 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', + chain_id: 'NetXQw6nWSnrJ5t', + hash: 'BLFkxJtgGauWp3PXUiX2PuFfEj96WdP94Mtv2nyHcGkEFtvKr6Q', + header: {}, + metadata: {}, + operations: [ + [], + [ + { + protocol: 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', + chain_id: 'NetXQw6nWSnrJ5t', + hash: 'ooMhfCwjiBzaCcYSxo1kyk4tQMgeDwu22NwPdjU8Yvaybyn26z5', + branch: 'BLsmwYwwt1GsoQ2ZSzqYncwbpyhVS52UzsQpEMgbpgzuKCYYw9s', + contents: [ + { + kind: 'smart_rollup_originate', + source: 'tz1NyHPL2CidRquW3a9zPGde59YYtMDyyzCg', + fee: '1497', + counter: '19783', + gas_limit: '2849', + storage_limit: '6572', + pvm_kind: 'wasm_2_0_0', + kernel: + '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', + origination_proof: + '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', + parameters_ty: { + prim: 'bytes', + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1NyHPL2CidRquW3a9zPGde59YYtMDyyzCg', + change: '-1497', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '1497', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1NyHPL2CidRquW3a9zPGde59YYtMDyyzCg', + change: '-1638000', + origin: 'block', + }, + { + kind: 'burned', + category: 'storage fees', + change: '1638000', + origin: 'block', + }, + ], + address: 'sr1K3AUoYanTUup53MCb8DkbvLsiAmFuXfFm', + genesis_commitment_hash: 'src14Khe1dnFbwrtTSEi4XWxxM7ej7L29YmduJhQY7U24Y523dmMtw', + consumed_milligas: '2748269', + size: '6552', + }, + }, + }, + ], + signature: + 'sigiKU2RGwT94sQBn4EFFy4SSVgYSGbULKzUneRyi8rURMg94uAJyYPgCpEfcjR8mkaSAoYnRCxqmit8XzVoHdbxGKoNfXRB', + }, + ], + ], +}; + +export const smartRollupAddMessagesResponse = { + protocol: 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', + chain_id: 'NetXQw6nWSnrJ5t', + hash: 'BLFkxJtgGauWp3PXUiX2PuFfEj96WdP94Mtv2nyHcGkEFtvKr6Q', + header: {}, + metadata: {}, + operations: [ + [], + [ + { + protocol: 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', + chain_id: 'NetXQw6nWSnrJ5t', + hash: 'op3GFxBQArsgC3eHjEiw4Qp31jHrprKfftcgwibKAwnANpzWncG', + branch: 'BL7USLDrUeuMzDUX6PdxuCbhngMYCcnmy9WFuotiVRmdBftZeDv', + contents: [ + { + kind: 'smart_rollup_add_messages', + source: 'tz2Q3yRaczTqZVf3ZQvwiiTqKjhJFyDzeRSz', + fee: '398', + counter: '12191', + gas_limit: '1103', + storage_limit: '0', + message: [ + '0000000031010000000b48656c6c6f20776f726c6401cc9e352a850d7475bf9b6cf103aa17ca404bc9dd000000000764656661756c74', + ], + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz2Q3yRaczTqZVf3ZQvwiiTqKjhJFyDzeRSz', + change: '-398', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '398', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '1002777', + }, + }, + }, + ], + signature: + 'sigSUjvKxjAZ4dBWbo4idKKwFDVfLtYscMMqHoQY8KgyghtyaswECPaBhjK921vj2uEsdKD7WJTeVVT1ZDcvwp8rkRuEW9kv', + }, + ], + ], +}; + +export const smartRollupExecuteOutboxMessageResponse = { + protocol: 'PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc', + chain_id: 'NetXQw6nWSnrJ5t', + hash: 'BLFkxJtgGauWp3PXUiX2PuFfEj96WdP94Mtv2nyHcGkEFtvKr6Q', + header: {}, + metadata: {}, + operations: [ + [], + [ + { + protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', + chain_id: 'NetXxkAx4woPLyu', + hash: 'opKmyxpe2XWDbynt3YPSouVpf55ChKZxwCradz6AYJ6rMFFEsRZ', + branch: 'BKqyTFKbU7bMrnN393YCBJ28quXG9zMwuPq61Z5ce4gVjsAgZmk', + contents: [ + { + kind: 'smart_rollup_execute_outbox_message', + source: 'tz1adKm6kWEkiejZ9WYpuHvBCgUewtCxpqRF', + fee: '1618', + counter: '13', + gas_limit: '6485', + storage_limit: '36', + rollup: 'sr1J4MBaQqTGNwUqfcUusy3xUmH6HbMK7kYy', + cemented_commitment: 'src13aUmJ5fEVJJM1qH1n9spuppXVAWc8wmHpTaC81pz5rrZN5e628', + output_proof: + '030002268259c7843df9a14e2cd5b4d187d3d603a535c64f0cc3ce3c9a3bdd5ecb3d95268259c7843df9a14e2cd5b4d187d3d603a535c64f0cc3ce3c9a3bdd5ecb3d950005820764757261626c65d07eb5216be3fcfd8317136e559c80d1a5eeb8f7b684c2101e92efb2b1b9c5324603746167c00800000004536f6d650003c004a99c0224241978be1e088cf42eaca4bc53a6266842bcbf0ecad4400abeb2e5820576616c7565810370766d8107627566666572738205696e707574820468656164c00100066c656e677468c00100066f75747075740004820132810a6c6173745f6c6576656cc0040000087a0133810f76616c69646974795f706572696f64c00400013b0082013181086f7574626f7865730028001700090006820432313337820468656164c00100066c656e677468c0010004323133380003810468656164c001008208636f6e74656e7473810130c03a000000360000000031010000000b48656c6c6f20776f726c6401bdb6f61e4f12c952f807ae7d3341af5367887dac000000000764656661756c74066c656e677468c00101c0c619e3af574a846a44f61eb98ae7a0007d1e76039f6729e3e113c2f993dad600c0b7b6d5ebea80e0e4b148815c768de7570b7a5ad617a2bf3a3f989df81be9a224c055b19953c4aa26132da57ef8205c8ab61b518fb6e4c87c5853298042d17c98bbc08bac9f033f9d823c04b4de152892edc0767d0634c51c5d311f46a127f730f6950134810d6d6573736167655f6c696d6974c002a401047761736dd04822a3ddd2900dcb30a958d10818ea3d90407a79f88eab967063bac2452e99c7268259c7843df9a14e2cd5b4d187d3d603a535c64f0cc3ce3c9a3bdd5ecb3d950000085a000000000031010000000b48656c6c6f20776f726c6401bdb6f61e4f12c952f807ae7d3341af5367887dac000000000764656661756c74', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1adKm6kWEkiejZ9WYpuHvBCgUewtCxpqRF', + change: '-1618', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '1618', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1adKm6kWEkiejZ9WYpuHvBCgUewtCxpqRF', + change: '-1250', + origin: 'block', + }, + { + kind: 'burned', + category: 'storage fees', + change: '1250', + origin: 'block', + }, + ], + ticket_updates: [], + consumed_milligas: '4731015', + paid_storage_size_diff: '5', + }, + internal_operation_results: [ + { + kind: 'transaction', + source: 'sr1J4MBaQqTGNwUqfcUusy3xUmH6HbMK7kYy', + nonce: 0, + amount: '0', + destination: 'KT1RstTQHYxjwHpN8jHaqBPgtxJdMSC4cc3w', + parameters: { + entrypoint: 'default', + value: { + string: 'Hello world', + }, + }, + result: { + status: 'applied', + storage: { + string: 'Hello world', + }, + balance_updates: [ + { + kind: 'contract', + contract: 'tz1adKm6kWEkiejZ9WYpuHvBCgUewtCxpqRF', + change: '-2750', + origin: 'block', + }, + { + kind: 'burned', + category: 'storage fees', + change: '2750', + origin: 'block', + }, + ], + consumed_milligas: '1653300', + storage_size: '52', + paid_storage_size_diff: '11', + }, + }, + ], + }, + }, + ], + signature: + 'sigs8LVwSkqcMLzTVZWa1yS8aNz26A8bzR6QUHws5uVELh6kcmH7dWz5aKPqW3RXoFfynf5kVCvLJcsP3ucB5P6DEbD2YcQR', + }, + ], + ], +}; + +export const smartRollupCementResponse = { + protocol: 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', + chain_id: 'NetXyuzvDo2Ugzb', + hash: 'BM2HKHuf7cx6d5Uq6MG4P6czUepc5Tw9d71M7h8E4MdmPHTuvMN', + header: {}, + metadata: {}, + operations: [ + [ + { + protocol: 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', + chain_id: 'NetXyuzvDo2Ugzb', + hash: 'ooty1P68jMrhZ3HXRWrpnvzaWS4Rdcvxbu6LdwgQYcpXwvfqG9U', + branch: 'BKs1WHe13yyEHu68UEJ7Yk7YrM7axhxuofjJYeW9YbY3sAYjx7Z', + contents: [ + { + kind: 'smart_rollup_cement', + source: 'tz1d5inEKUnAChSgScYuaJrtVmAZ9L5cKGSW', + fee: '977', + counter: '150010', + gas_limit: '6986', + storage_limit: '0', + rollup: 'sr1CCHLfB1jjz4ikB2bm4XGPvTjafVgUzhLB', + commitment: 'src12mERNVEb3N1EVmbUbudctzajiezmd3q6EsgLexkgxNCHK8PNBi', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1d5inEKUnAChSgScYuaJrtVmAZ9L5cKGSW', + change: '-977', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '977', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '6884964', + inbox_level: 337913, + commitment_hash: 'src12wj4nwXiEkwYacLfkLR8X8Md76LNuMzwUgTwgLA9Y3DANaeRay', + }, + }, + }, + ], + signature: + 'sigPnRSud9gGtNAcAcZkv6kYoa5Nsp1u8388DBjRgUeuefZHRQxkXdVZxZy3QqVesBasDHQmAhp8yySYH5YMbzzbNz2JLZRw', + }, + ], + ], +}; + +export const smartRollupPublishResponse = { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'BL9UBPLykShAAvAebxCiZxELFjSJBxhbQXC12pfZb2ddwtCa1XU', + header: {}, + metadata: {}, + operations: [ + [ + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'opaTRLSsdqtd8APeDHqU3BxvqYDg4Lor3roR2cdh3V3Hv1VXucm', + branch: 'BM8ZBBpLnURFuRB1Wd6s7Z6iN3LiddUkKM4vsTS3LgqSmFMtCLE', + contents: [ + { + kind: 'smart_rollup_publish', + source: 'tz1gCe1sFpppbGGVwCt5jLRqDS9FD1W4Qca4', + fee: '964', + counter: '41266', + gas_limit: '6418', + storage_limit: '0', + rollup: 'sr1AE6U3GNzE8iKzj6sKS5wh1U32ogeULCoN', + commitment: { + compressed_state: 'srs13FywcbcZV9VvHxdVkYK83Ch4477cqHMgM8d5oT955yf4XXMvKS', + inbox_level: 197151, + predecessor: 'src12i7dL2z9VbgshFDdGFP5TPBoJu6WnZNWJXGa1QQgPTErVPPtd8', + number_of_ticks: '880000000000', + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1gCe1sFpppbGGVwCt5jLRqDS9FD1W4Qca4', + change: '-964', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '964', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '6317837', + staked_hash: 'src13TanyZ7RvSULqVb2tjx1zRVw2jyJC2ToHLz1ZKg38sZ4HBYdSN', + published_at_level: 197154, + balance_updates: [], + }, + }, + }, + ], + signature: + 'sigiYrQFjQLnYe94Vc9VH1jGEkfSAsBGkZzBVL8jLgBK88vhbLM6fBD2x24wBhBdN718WRRTSMBqCGR7Zp9Z5eDmDotgGaTu', + }, + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'onjnz6RP5FPXafHfWupSb9Hv3uJZt5BGpVHPTisJkLsYEjP114H', + branch: 'BKyGmNai1eFrUv3BBMz1ZNhtmMVW7KQH9x8DEj2egDZEH86ajno', + contents: [ + { + kind: 'smart_rollup_publish', + source: 'tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC', + fee: '956', + counter: '32544', + gas_limit: '7298', + storage_limit: '0', + rollup: 'sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x', + commitment: { + compressed_state: 'srs12r6jebz4VTuP1C58mHGzezqFQdV6n5pdaqEamDo4FvD9omn9YJ', + inbox_level: 41806, + predecessor: 'src12rCbiTAvYntPQXcMoqdNh6ZXXBmfxzhaxZsxsbRKGC7bE3L1mD', + number_of_ticks: '880000000000', + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC', + change: '-956', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '956', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '7197891', + staked_hash: 'src14ErSMhBhf3Hi6isN3cEdR4RgxT5egSjQYtgHEc5NP9qVFgmcpE', + published_at_level: 41809, + balance_updates: [ + { + kind: 'contract', + contract: 'tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC', + change: '-10000000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'bonds', + contract: 'tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC', + bond_id: { + smart_rollup: 'sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x', + }, + change: '10000000000', + origin: 'block', + }, + ], + }, + }, + }, + ], + signature: + 'sigosbVhqFLPBoXUhtjwZ7UBDq4veP1pGECDm2nc7iviBE8gqmzGFgh9tPMviTDhETd4rjCwcRCCMwEL5hBu3tfgNJcydnrS', + }, + ], + ], +}; + +export const smartRollupRefuteResponse = { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'BMRMq4e7QgU2xw5hHyFtDgv4rZCGCRbF9Z8FhWoAwmprSsJKPGx', + header: {}, + operations: [ + [ + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'oofTxRxHWQCYo9B4vmpLY7FZfQXrH9s1n7rRU7wHjazhrqVu2oJ', + branch: 'BLDgHuXsD2qtEPy8SYcYCk1Wt2uDdDXUYXYmbfX6g1s1an8L5u6', + contents: [ + { + kind: 'smart_rollup_refute', + source: 'tz1ZpuBypK6G754crXDZyoMPaVPoBmBsPda2', + fee: '2096', + counter: '32553', + gas_limit: '6299', + storage_limit: '0', + rollup: 'sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x', + opponent: 'tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC', + refutation: { + refutation_kind: 'move', + choice: '176000000003', + step: { + pvm_step: + '03000298e4e3d5c88da366e885edf675ffd7a5087c8e0a2fcd508e7951113fe4c1491810067c06a78b88cb7c3e60c56b47ba9e14c922dbdbd4811ac6fee80a309620630005820764757261626c6582066b65726e656cd07d20c53bdd5b536a6be9c4cdad16e69a9af40b93a6564655fffd88bba050519008726561646f6e6c7982066b65726e656cd0a645771d9d5228a31312b282119c596699ccb6b60b93d759c2072a493ddbb5740c7761736d5f76657273696f6e8101408208636f6e74656e7473810130c10200322e302e30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066c656e677468c008000000000000000503746167c00800000004536f6d650003810370766d00050004000381166f7574626f785f76616c69646974795f706572696f64c00400013b0082136c6173745f746f705f6c6576656c5f63616c6cc00680c0abd38f05196d6178696d756d5f7265626f6f74735f7065725f696e707574c002e80781146f7574626f785f6d6573736167655f6c696d6974c002a401810c6d61785f6e625f7469636b73c00580dc9afd28820576616c7565810370766d8107627566666572738205696e7075740003810468656164c001008208636f6e74656e7473d06e2c0a5b371a53e76a9b7f221a5baa67170b3f9f43205fb06c0649123cec2358066c656e677468c00103066f75747075740004820132810a6c6173745f6c6576656cc0040000a33f0133810f76616c69646974795f706572696f64c00400013b0082013181086f7574626f786573d0ccbff4c181451166adb153f7a1631e9f036832f8e5c82acd8e8c12876eeeda870134810d6d6573736167655f6c696d6974c002a401047761736d00048205696e707574c0050000a33f0203746167c00b0000000770616464696e67820c63757272656e745f7469636bc00683c0abd38f050e7265626f6f745f636f756e746572c002e907', + }, + }, + }, + ], + signature: + 'sigQYS3D4Ppabx7MhsmJyHkQUo9cmAfieSykZXWnGmvVbn6W4cQvVvxbRXDPSnaNVn72N2ih9QwovsPw7Cv1eoELapdNjLTB', + }, + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'opUUHJwTXLDe2jMwvTWtC3bwoEQukhBjdPiYa5Ri1qBo7TiYJpq', + branch: 'BMJcT8gh5PgoTvjWi6SQSUGn7gbx3Bb2rSKcdJQKB9PbzpS7FvH', + contents: [ + { + kind: 'smart_rollup_refute', + source: 'tz1Qn5AXWB5vYPgzDXsunDbZ7tTUp9cFDaRp', + fee: '943', + counter: '25002', + gas_limit: '6109', + storage_limit: '0', + rollup: 'sr1Ce7znpA1ea2YZca3v1CefxqXMhqYgDEXR', + opponent: 'tz1VN3J6DyH712W1y13Uu1N8fxkt8RvMyqzm', + refutation: { + refutation_kind: 'start', + player_commitment_hash: 'src14Liog4xxPoZ55AgpBpeDweFSxHK6b3zbybhp7ChsWbM9g1Jsrd', + opponent_commitment_hash: 'src12q2zZyxuK5UeYPQYSutA6RPMv7sZDtJ7oAWxAytuJC3rjvWct6', + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1Qn5AXWB5vYPgzDXsunDbZ7tTUp9cFDaRp', + change: '-943', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '943', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '6008940', + game_status: 'ongoing', + balance_updates: [], + }, + }, + }, + ], + signature: + 'sigg9W1bDVuvKgs7WDq9Q4wKp2oTtMwWsm1tt7khCYYCa4PZ3fvsWUWktuAR8SyTzmywKmBWX752VcDb28JzHUmYJ7De94Kt', + }, + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'onqrLmUkjEowxhiS3t2CmxBCKQAEUf3PA4d8RD3zja9v2PtU11a', + branch: 'BMbQxrYG4uUmjqy2Dht5FUeskoiQcebXqN46H9kt26hSzZ5W3Qs', + contents: [ + { + kind: 'smart_rollup_refute', + source: 'tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC', + fee: '1989', + counter: '32546', + gas_limit: '4333', + storage_limit: '0', + rollup: 'sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x', + opponent: 'tz1ZpuBypK6G754crXDZyoMPaVPoBmBsPda2', + refutation: { + refutation_kind: 'move', + choice: '0', + step: [ + { + state: 'srs11y1ZCJfeWnHzoX3rAjcTXiphwg8NvqQhvishP3PU68jgSREuk6', + tick: '0', + }, + { + state: 'srs12ti4nRqiqahBZedqjgnFx9ZK88KkSgpYD8ns5Q41UMEXGg9w3b', + tick: '22000000000', + }, + { + state: 'srs12zdMUHiLiqTAuN81f1NS3rgD1M7fqUtMq4RpWq3wf3QDvsPCxa', + tick: '44000000000', + }, + ], + }, + }, + ], + signature: + 'sigojctsjFdB6nv51JNAyRdANvbnSB5NyrfNq5KBnov58Hcqi9d1CHPWYwEJeQgBjjJv5vgQJC37tKMSUJZZoY4pPQj6A2X5', + }, + ], + ], +}; + +export const smartRollupRecoverBondResponse = { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'BLxusPoX4vzCKAc9qmfS4myFs8KKEJpvwgAuMrccqqPXcn8Rxon', + header: {}, + metadata: {}, + operations: [ + [ + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'opWkyTZEwh5929VqXC4BZgrBSRQ7JvomNTv71rdkx1QAiRLpYAu', + branch: 'BL5EYnuHPXMTq9s1HR8CcFWkgNHCvoZyVQCU2H2DjSudr6GXgXf', + contents: [ + { + kind: 'smart_rollup_recover_bond', + source: 'tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw', + fee: '1000000', + counter: '25156', + gas_limit: '4016', + storage_limit: '0', + rollup: 'sr1EYxm4fQjr15TASs2Q7PgZ1LqS6unkZhHL', + staker: 'tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw', + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw', + change: '-1000000', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '1000000', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'freezer', + category: 'bonds', + contract: 'tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw', + bond_id: { + smart_rollup: 'sr1EYxm4fQjr15TASs2Q7PgZ1LqS6unkZhHL', + }, + change: '-10000000000', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw', + change: '10000000000', + origin: 'block', + }, + ], + consumed_milligas: '3915240', + }, + }, + }, + ], + signature: + 'sigPbtnebwMZD1CZUEfFnhcjGuhyLhX2WPEFvQEFKaD6DKeYjMSBD6pc4UkR4zkAw5KdifSH7QdJ7wg9CmsruSi9cUGvqEap', + }, + ], + ], +}; + +export const smartRollupTimeoutResponse = { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'BM5txTKWoRptQ7k8M4hF2SjLQjz7ezriNfaHZQZxNjHsqzESjMu', + header: {}, + metadata: {}, + operations: [ + [ + { + protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + chain_id: 'NetXgbcrNtXD2yA', + hash: 'opZMSbsYYSL1tMKYxgPoDvtaehAt24PSbwuNeQo8ry52KpWwzqa', + branch: 'BLpiGot997JRMKyrYoP8MmjVMWHHXMiLj17gue86uNaRnip8jux', + contents: [ + { + kind: 'smart_rollup_timeout', + source: 'tz1TecRhYLVV9bTKRKU9g1Hhpb1Ymw3ynzWS', + fee: '753', + counter: '23077', + gas_limit: '4647', + storage_limit: '0', + rollup: 'sr1QZkk1swognQW3dmiXvga3wVkEgBq7QFjE', + stakers: { + alice: 'tz1TecRhYLVV9bTKRKU9g1Hhpb1Ymw3ynzWS', + bob: 'tz1iFnSQ6V2d8piVMPMjtDNdkYNMaUfKwsoy', + }, + }, + ], + signature: + 'sigN53ibLsMQAnkeE7EQZY9ZFkiBgtdsLKtsPdswdvGHU4kPAMh3Arz2fFDGKT3EyKHuYy5G9T6pJtTdfkRuWpN2fgvmH1Pr', + }, + ], + ], +}; diff --git a/contrib/taquito-rpc-bin/test/taquito-rpc.spec.ts b/contrib/taquito-rpc-bin/test/taquito-rpc.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3fb212c9f83c06bf2dc289375e61d58a5f69f2c --- /dev/null +++ b/contrib/taquito-rpc-bin/test/taquito-rpc.spec.ts @@ -0,0 +1,4732 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +import { OpKind, RpcClient } from '../src/taquito-rpc'; +import BigNumber from 'bignumber.js'; +import { + LazyStorageDiffBigMap, + OperationContentsAndResultEndorsement, + OperationContentsAndResultEndorsementWithSlot, + OperationContentsAndResultOrigination, + OperationResultTransaction, + OperationContentsAndResultTransaction, + LazyStorageDiffSaplingState, + OperationContentsAndResultRegisterGlobalConstant, + RPCRunViewParam, + 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, + OperationContentsAndResultSmartRollupCement, + OperationContentsAndResultSmartRollupPublish, + OperationContentsAndResultSmartRollupRefute, + SmartRollupRefutationMove, + OperationContentsAndResultSmartRollupRecoverBond, + OperationContentsAndResultSmartRollupTimeout, + SmartRollupRefutationStart, + SmartRollupRefutationOptions, + RPCSimulateOperationParam, +} from '../src/types'; +import { + blockIthacanetResponse, + blockJakartanetResponse, + blockKathmandunetResponse, + blockLimanetResponse, + blockMondaynetResponse, + delegatesIthacanetResponse, + delegatesKathmandunetResponse, + votingInfoKathmandunetResponse, + ticketUpdatesResponse, + ticketBalancesResponse, + smartRollupOriginateResponse, + smartRollupAddMessagesResponse, + smartRollupExecuteOutboxMessageResponse, + pendingOperationsResponse, + smartRollupCementResponse, + smartRollupPublishResponse, + smartRollupRefuteResponse, + smartRollupRecoverBondResponse, + smartRollupTimeoutResponse, +} from './data/rpc-responses'; + +/** + * RpcClient test + */ +describe('RpcClient test', () => { + let client: RpcClient; + let httpBackend: { + createRequest: jest.Mock; + }; + + const contractAddress = 'KT1Fe71jyjrxFg9ZrYqtvaX7uQjcLo7svE4D'; + + beforeEach(() => { + httpBackend = { + createRequest: jest.fn(), + }; + client = new RpcClient('root', 'test', httpBackend as any); + }); + + it('RpcClient is instantiable', () => { + const rpcUrl = 'test'; + expect(new RpcClient(rpcUrl)).toBeInstanceOf(RpcClient); + }); + + describe('Concat url properly', () => { + it('Should prevent double slashes given multiple trailing slashes', async (done) => { + const client = new RpcClient('root.com/test///', 'test', httpBackend as any); + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + await client.getBalance(contractAddress); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root.com/test/chains/test/blocks/head/context/contracts/${contractAddress}/balance`, + }); + done(); + }); + + it('Should prevent double slashes given one trailing slash', async (done) => { + const client = new RpcClient('root.com/test/', 'test', httpBackend as any); + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + await client.getBalance(contractAddress); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root.com/test/chains/test/blocks/head/context/contracts/${contractAddress}/balance`, + }); + done(); + }); + + it('Should prevent double slashes given no trailing slash', async (done) => { + const client = new RpcClient('root.com/test', 'test', httpBackend as any); + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + await client.getBalance(contractAddress); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root.com/test/chains/test/blocks/head/context/contracts/${contractAddress}/balance`, + }); + done(); + }); + }); + + describe('getBalance', () => { + it('should query the right url and return a string', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getBalance(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/balance`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + + done(); + }); + }); + + describe('getStorage', () => { + it('should query the right url', async (done) => { + await client.getStorage(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/storage`, + }); + + done(); + }); + + it('should query used_space url correctly', async (done) => { + await client.getStorageUsedSpace(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/storage/used_space`, + }); + + done(); + }); + + it('should query used_paid url correctly', async (done) => { + await client.getStoragePaidSpace(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/storage/paid_space`, + }); + + done(); + }); + }); + + describe('getScript', () => { + it('should query the right url', async (done) => { + await client.getScript(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/script`, + }); + + done(); + }); + }); + + describe('getNormalizedScript', () => { + it('should query the right url', async (done) => { + await client.getNormalizedScript(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/script/normalized`, + }); + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({ unparsing_mode: 'Readable' }); + + done(); + }); + }); + + describe('getContract', () => { + it('should query the right url', async (done) => { + httpBackend.createRequest.mockResolvedValue({ balance: '10000' }); + const response = await client.getContract(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}`, + }); + + expect(response.balance).toBeInstanceOf(BigNumber); + expect(response.balance.toString()).toEqual('10000'); + + done(); + }); + }); + + describe('getManagerKey', () => { + it('should query the right url', async (done) => { + await client.getManagerKey(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/manager_key`, + }); + + done(); + }); + }); + + describe('getDelegate', () => { + it('should query the right url', async (done) => { + await client.getDelegate(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/delegate`, + }); + + done(); + }); + }); + + describe('getBlockHash', () => { + it('should query the right url', async (done) => { + await client.getBlockHash(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/hash', + }); + + done(); + }); + }); + + describe('getDelegates', () => { + const sampleResponse = { + balance: '5092341810457', + frozen_balance: '2155290163074', + frozen_balance_by_cycle: [ + { cycle: 135, deposit: '381760000000', fees: '971071', rewards: '11843833332' }, + { cycle: 136, deposit: '394368000000', fees: '1433657', rewards: '12200333332' }, + ], + staking_balance: '20936607331513', + delegated_contracts: [ + 'KT1VvXEpeBpreAVpfp4V8ZujqWu2gVykwXBJ', + 'KT1VsSxSXUkgw6zkBGgUuDXXuJs9ToPqkrCg', + ], + delegated_balance: '15908924646030', + deactivated: false, + grace_period: 146, + }; + + it('should query the right url', async (done) => { + httpBackend.createRequest.mockResolvedValue(sampleResponse); + await client.getDelegates(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/delegates/${contractAddress}`, + }); + + done(); + }); + + it('should parse the response properly', async (done) => { + httpBackend.createRequest.mockResolvedValue(sampleResponse); + const response = await client.getDelegates(contractAddress); + + expect(response).toEqual({ + balance: new BigNumber('5092341810457'), + frozen_balance: new BigNumber('2155290163074'), + frozen_balance_by_cycle: [ + { + cycle: 135, + deposit: new BigNumber('381760000000'), + fees: new BigNumber('971071'), + rewards: new BigNumber('11843833332'), + }, + { + cycle: 136, + deposit: new BigNumber('394368000000'), + fees: new BigNumber('1433657'), + rewards: new BigNumber('12200333332'), + }, + ], + staking_balance: new BigNumber('20936607331513'), + delegated_contracts: [ + 'KT1VvXEpeBpreAVpfp4V8ZujqWu2gVykwXBJ', + 'KT1VsSxSXUkgw6zkBGgUuDXXuJs9ToPqkrCg', + ], + delegated_balance: new BigNumber('15908924646030'), + deactivated: false, + grace_period: 146, + }); + + done(); + }); + + it('should parse the response properly, proto10', async (done) => { + // deposit replaced by deposits + httpBackend.createRequest.mockResolvedValue({ + balance: '5976016544884', + frozen_balance: '2436709362932', + frozen_balance_by_cycle: [ + { cycle: 52, deposits: '463410000000', fees: '143599', rewards: '13998796117' }, + { cycle: 53, deposits: '770072500000', fees: '784655', rewards: '23952869735' }, + ], + staking_balance: '5902972035162', + delegated_contracts: ['tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope'], + delegated_balance: '0', + deactivated: false, + grace_period: 59, + voting_power: 729, + }); + const response = await client.getDelegates(contractAddress); + + expect(response).toEqual({ + balance: new BigNumber('5976016544884'), + frozen_balance: new BigNumber('2436709362932'), + frozen_balance_by_cycle: [ + { + cycle: 52, + deposits: new BigNumber('463410000000'), + fees: new BigNumber('143599'), + rewards: new BigNumber('13998796117'), + }, + { + cycle: 53, + deposits: new BigNumber('770072500000'), + fees: new BigNumber('784655'), + rewards: new BigNumber('23952869735'), + }, + ], + staking_balance: new BigNumber('5902972035162'), + delegated_contracts: ['tz1NFs6yP2sXd5vAAbR43bbDRpV2nahDZope'], + delegated_balance: new BigNumber('0'), + deactivated: false, + grace_period: 59, + voting_power: new BigNumber(729), + }); + + done(); + }); + + it('should parse the response properly, proto12', async (done) => { + httpBackend.createRequest.mockResolvedValue(delegatesIthacanetResponse); + const response = await client.getDelegates(contractAddress); + + expect(response).toEqual({ + full_balance: new BigNumber('1198951292321'), + current_frozen_deposits: new BigNumber('120167343864'), + frozen_deposits: new BigNumber('120167343864'), + staking_balance: new BigNumber('1203308804406'), + delegated_contracts: ['tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'], + delegated_balance: new BigNumber('4357512085'), + deactivated: false, + grace_period: 37, + voting_power: new BigNumber(199), + }); + + done(); + }); + + it('should parse the response properly, proto14', async (done) => { + httpBackend.createRequest.mockResolvedValue(delegatesKathmandunetResponse); + const response = await client.getDelegates(contractAddress); + + expect(response).toEqual({ + full_balance: new BigNumber('965532868030'), + current_frozen_deposits: new BigNumber('96350095609'), + frozen_deposits: new BigNumber('96350095609'), + staking_balance: new BigNumber('970221941952'), + delegated_contracts: ['tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'], + delegated_balance: new BigNumber('4689073922'), + deactivated: false, + grace_period: 42, + voting_power: new BigNumber(968128693450), + remaining_proposals: 20, + }); + + done(); + }); + }); + + describe('getVotingInfo', () => { + it('should query the right url', async (done) => { + httpBackend.createRequest.mockResolvedValue(votingInfoKathmandunetResponse); + await client.getVotingInfo(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/delegates/${contractAddress}/voting_info`, + }); + + done(); + }); + + it('should parse the response properly', async (done) => { + httpBackend.createRequest.mockResolvedValue(votingInfoKathmandunetResponse); + const response = await client.getVotingInfo(contractAddress); + + expect(response).toEqual({ + voting_power: '1054404383333', + remaining_proposals: 20, + }); + + done(); + }); + }); + + describe('getBigMapKey', () => { + it('should query the right url', async (done) => { + await client.getBigMapKey(contractAddress, { key: 'test', type: 'string' } as any); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/big_map_get`, + }); + + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({ key: 'test', type: 'string' }); + + done(); + }); + }); + + describe('forgeOperation', () => { + it('should query the right url', async (done) => { + await client.forgeOperations({} as any); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/forge/operations', + }); + + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({}); + + done(); + }); + }); + + describe('injectOperations', () => { + it('should query the right url', async (done) => { + await client.injectOperation({} as any); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/injection/operation', + }); + + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({}); + + done(); + }); + }); + + describe('preapplyOperations', () => { + it('should query the right url', async (done) => { + httpBackend.createRequest.mockResolvedValue({}); + await client.preapplyOperations({} as any); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/preapply/operations', + }); + + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({}); + + done(); + }); + }); + + describe('getBlockHeader', () => { + it('should query the right url', async (done) => { + const sampleResponse = { + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + chain_id: 'NetXdQprcVkpaWU', + hash: 'BLjs6BSiYpwV5u6YpNHNSAqr1iuJRGDHXK3Qb6DH1ZkN8QbAitW', + level: 596467, + proto: 4, + predecessor: 'BMYidfFK1tfryqoTRnAPLMonagy3f2goaw2QBpGsHF8YySQe8tU', + timestamp: '2019-09-06T15:08:29Z', + validation_pass: 4, + operations_hash: 'LLoaq9gTDXXLgKZGd6af1iwnfmmQXkJJnGn6WS6XhE7kh5AsdmFER', + fitness: ['00', '00000000011f6a7c'], + context: 'CoWNJGqDcKWeQaiRZoo5akYwXrQBGtWAncgV9QnF16yUpAM47T5F', + priority: 0, + proof_of_work_nonce: '000000036e2c8c91', + signature: + 'siguGHqTYQjaDMjZgDQjAXG9Fc8HnqCJceVJMUCHRbSFoJJCx3Lz9VpBy53nat4W4T1CvbzPJKKgq2YfFAGXeaXcQLbN4CFz', + }; + + httpBackend.createRequest.mockResolvedValue(sampleResponse); + const result = await client.getBlockHeader(); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/header', + }); + + expect(result).toEqual({ + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + chain_id: 'NetXdQprcVkpaWU', + hash: 'BLjs6BSiYpwV5u6YpNHNSAqr1iuJRGDHXK3Qb6DH1ZkN8QbAitW', + level: 596467, + proto: 4, + predecessor: 'BMYidfFK1tfryqoTRnAPLMonagy3f2goaw2QBpGsHF8YySQe8tU', + timestamp: '2019-09-06T15:08:29Z', + validation_pass: 4, + operations_hash: 'LLoaq9gTDXXLgKZGd6af1iwnfmmQXkJJnGn6WS6XhE7kh5AsdmFER', + fitness: ['00', '00000000011f6a7c'], + context: 'CoWNJGqDcKWeQaiRZoo5akYwXrQBGtWAncgV9QnF16yUpAM47T5F', + priority: 0, + proof_of_work_nonce: '000000036e2c8c91', + signature: + 'siguGHqTYQjaDMjZgDQjAXG9Fc8HnqCJceVJMUCHRbSFoJJCx3Lz9VpBy53nat4W4T1CvbzPJKKgq2YfFAGXeaXcQLbN4CFz', + }); + + done(); + }); + }); + + describe('getBlockMetadata', () => { + it('should query the right url', async (done) => { + const sampleResponse = { + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + next_protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + test_chain_status: { + status: 'running', + chain_id: 'NetXpqTM3MbtXCx', + genesis: 'BMRaLy3WBWJTdWVjosVGyYi2z4rnGxZfxqPt1RW1QMZuKUnkBuJ', + protocol: 'PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU', + expiration: '2019-09-24T12:01:51Z', + }, + max_operations_ttl: 60, + max_operation_data_length: 16384, + max_block_header_length: 238, + max_operation_list_length: [ + { max_size: 32768, max_op: 32 }, + { max_size: 32768 }, + { max_size: 135168, max_op: 132 }, + { max_size: 524288 }, + ], + baker: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + level: { + level: 596469, + level_position: 596468, + cycle: 145, + cycle_position: 2548, + voting_period: 18, + voting_period_position: 6644, + expected_commitment: false, + }, + voting_period_kind: 'testing', + nonce_hash: null, + consumed_gas: '10200', + deactivated: [], + proposer_consensus_key: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + baker_consensus_key: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + change: '-512000000', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + cycle: 145, + change: '512000000', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + cycle: 145, + change: '16000000', + }, + ], + }; + + httpBackend.createRequest.mockResolvedValue(sampleResponse); + const result = await client.getBlockMetadata(); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/metadata', + }); + + expect(result).toEqual({ + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + next_protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + test_chain_status: { + status: 'running', + chain_id: 'NetXpqTM3MbtXCx', + genesis: 'BMRaLy3WBWJTdWVjosVGyYi2z4rnGxZfxqPt1RW1QMZuKUnkBuJ', + protocol: 'PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU', + expiration: '2019-09-24T12:01:51Z', + }, + max_operations_ttl: 60, + max_operation_data_length: 16384, + max_block_header_length: 238, + max_operation_list_length: [ + { max_size: 32768, max_op: 32 }, + { max_size: 32768 }, + { max_size: 135168, max_op: 132 }, + { max_size: 524288 }, + ], + baker: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + level: { + level: 596469, + level_position: 596468, + cycle: 145, + cycle_position: 2548, + voting_period: 18, + voting_period_position: 6644, + expected_commitment: false, + }, + voting_period_kind: 'testing', + nonce_hash: null, + consumed_gas: '10200', + deactivated: [], + proposer_consensus_key: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + baker_consensus_key: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + change: '-512000000', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + cycle: 145, + change: '512000000', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', + cycle: 145, + change: '16000000', + }, + ], + }); + + done(); + }); + }); + + describe('getConstants Proto015', () => { + it('should query the right url and casts relevant properties to BigNumber', async (done) => { + httpBackend.createRequest.mockResolvedValue({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout_size: 3, + michelson_maximum_type_size: 2001, + sc_max_wrapped_proof_binary_size: 30000, + sc_rollup_message_size_limit: 4096, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + nonce_revelation_threshold: 256, + blocks_per_stake_snapshot: 256, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: '1040000', + hard_gas_limit_per_block: '5200000', + proof_of_work_threshold: '-1', + minimal_stake: '6000000000', + vdf_difficulty: '2000000000', + seed_nonce_revelation_tip: '125000', + origination_size: 257, + baking_reward_fixed_portion: '10000000', + baking_reward_bonus_per_slot: '4286', + endorsing_reward_per_slot: '2857', + cost_per_byte: '250', + hard_storage_limit_per_operation: '60000', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: '2500000', + liquidity_baking_toggle_ema_threshold: 1000000000, + max_operations_time_to_live: 120, + minimal_block_delay: '15', + delay_increment_per_round: '5', + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + numerator: 2, + denominator: 3, + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: '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: true, + 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: '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, + number_of_shards: 2048, + endorsement_lag: 1, + availability_threshold: 50, + slot_size: 1048576, + redundancy_factor: 16, + page_size: 4096, + }, + sc_rollup_enable: false, + sc_rollup_origination_size: 6314, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_max_number_of_messages_per_commitment_period: 300000000, + sc_rollup_stake_amount: '10000000000', + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_max_outbox_messages_per_level: 100, + sc_rollup_number_of_sections_in_dissection: 32, + sc_rollup_timeout_period_in_blocks: 20160, + sc_rollup_max_number_of_cemented_commitments: 5, + zk_rollup_enable: false, + zk_rollup_origination_size: 4000, + zk_rollup_min_pending_to_process: 10, + }); + + const response: ConstantsResponseProto015 = await client.getConstants(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/constants', + }); + expect(response).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout_size: 3, + michelson_maximum_type_size: 2001, + sc_max_wrapped_proof_binary_size: 30000, + sc_rollup_message_size_limit: 4096, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + nonce_revelation_threshold: 256, + blocks_per_stake_snapshot: 256, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(-1), + minimal_stake: new BigNumber(6000000000), + vdf_difficulty: new BigNumber(2000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + baking_reward_fixed_portion: new BigNumber(10000000), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_toggle_ema_threshold: 1000000000, + max_operations_time_to_live: 120, + minimal_block_delay: new BigNumber(15), + delay_increment_per_round: new BigNumber(5), + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + numerator: 2, + 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: true, + 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, + number_of_shards: 2048, + endorsement_lag: 1, + availability_threshold: 50, + slot_size: 1048576, + redundancy_factor: 16, + page_size: 4096, + }, + sc_rollup_enable: false, + sc_rollup_origination_size: 6314, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_max_number_of_messages_per_commitment_period: 300000000, + sc_rollup_stake_amount: new BigNumber(10000000000), + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_max_outbox_messages_per_level: 100, + sc_rollup_number_of_sections_in_dissection: 32, + sc_rollup_timeout_period_in_blocks: 20160, + sc_rollup_max_number_of_cemented_commitments: 5, + zk_rollup_enable: false, + zk_rollup_origination_size: 4000, + zk_rollup_min_pending_to_process: 10, + }); + done(); + }); + }); + describe('getConstants Proto014', () => { + it('should query the right url and casts relevant properties to BigNumber', async (done) => { + httpBackend.createRequest.mockResolvedValue({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout_size: 3, + michelson_maximum_type_size: 2001, + max_wrapped_proof_binary_size: 30000, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + nonce_revelation_threshold: 256, + blocks_per_stake_snapshot: 256, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: '1040000', + hard_gas_limit_per_block: '5200000', + proof_of_work_threshold: '-1', + tokens_per_roll: '6000000000', + vdf_difficulty: '8000000000', + seed_nonce_revelation_tip: '125000', + origination_size: 257, + baking_reward_fixed_portion: '10000000', + baking_reward_bonus_per_slot: '4286', + endorsing_reward_per_slot: '2857', + cost_per_byte: '250', + hard_storage_limit_per_operation: '60000', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: '2500000', + liquidity_baking_sunset_level: 10000000, + liquidity_baking_toggle_ema_threshold: 1000000000, + max_operations_time_to_live: 120, + minimal_block_delay: '15', + delay_increment_per_round: '15', + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + numerator: 2, + denominator: 3, + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: '640000000', + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + numerator: 1, + denominator: 2, + }, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cache_sampler_state_cycles: 8, + tx_rollup_enable: true, + 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: '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, + number_of_shards: 2048, + endorsement_lag: 1, + availability_threshold: 50, + }, + sc_rollup_enable: false, + sc_rollup_origination_size: 6314, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_max_available_messages: 1000000, + sc_rollup_stake_amount: '32000000', + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_max_outbox_messages_per_level: 100, + }); + + const response = await client.getConstants(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/constants', + }); + expect(response).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout_size: 3, + michelson_maximum_type_size: 2001, + max_wrapped_proof_binary_size: 30000, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + nonce_revelation_threshold: 256, + blocks_per_stake_snapshot: 256, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(-1), + tokens_per_roll: new BigNumber(6000000000), + vdf_difficulty: new BigNumber(8000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + baking_reward_fixed_portion: new BigNumber(10000000), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 10000000, + liquidity_baking_toggle_ema_threshold: 1000000000, + max_operations_time_to_live: 120, + minimal_block_delay: new BigNumber(15), + delay_increment_per_round: new BigNumber(15), + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + numerator: 2, + 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, + }, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cache_sampler_state_cycles: 8, + tx_rollup_enable: true, + 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, + number_of_shards: 2048, + endorsement_lag: 1, + availability_threshold: 50, + }, + sc_rollup_enable: false, + sc_rollup_origination_size: 6314, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_max_available_messages: 1000000, + sc_rollup_stake_amount: new BigNumber(32000000), + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_max_outbox_messages_per_level: 100, + }); + done(); + }); + }); + + describe('getConstants Proto012', () => { + it('should query the right url and casts property to BigNumber', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout: ['100000000', '240000', '2560'], + michelson_maximum_type_size: 2001, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + blocks_per_stake_snapshot: 256, + blocks_per_voting_period: 20480, + hard_gas_limit_per_operation: '1040000', + hard_gas_limit_per_block: '5200000', + proof_of_work_threshold: '70368744177663', + tokens_per_roll: '6000000000', + seed_nonce_revelation_tip: '125000', + origination_size: 257, + baking_reward_fixed_portion: '5000000', + baking_reward_bonus_per_slot: '2143', + endorsing_reward_per_slot: '1428', + cost_per_byte: '250', + hard_storage_limit_per_operation: '60000', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: '2500000', + liquidity_baking_sunset_level: 10000000, + liquidity_baking_escape_ema_threshold: 666667, + max_operations_time_to_live: 120, + minimal_block_delay: '15', + delay_increment_per_round: '5', + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { numerator: 2, denominator: 3 }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: '640000000', + ratio_of_frozen_deposits_slashed_per_double_endorsement: { numerator: 1, denominator: 2 }, + }) + ); + const response = await client.getConstants(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/constants', + }); + expect(response).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + blocks_per_voting_period: 20480, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(70368744177663), + tokens_per_roll: new BigNumber(6000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 10000000, + liquidity_baking_escape_ema_threshold: 666667, + max_allowed_global_constants_depth: 10000, + max_micheline_bytes_limit: 50000, + max_micheline_node_count: 50000, + michelson_maximum_type_size: 2001, + cache_layout: [new BigNumber(100000000), new BigNumber(240000), new BigNumber(2560)], + blocks_per_stake_snapshot: 256, + baking_reward_fixed_portion: new BigNumber(5000000), + baking_reward_bonus_per_slot: new BigNumber(2143), + endorsing_reward_per_slot: new BigNumber(1428), + max_operations_time_to_live: 120, + minimal_block_delay: new BigNumber(15), + delay_increment_per_round: new BigNumber(5), + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + denominator: 3, + numerator: 2, + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: new BigNumber(640000000), + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + denominator: 2, + numerator: 1, + }, + }); + done(); + }); + }); + + describe('getConstants Proto007', () => { + it('should query the right url and casts property to BigNumber', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 16384, + max_proposals_per_delegate: 20, + preserved_cycles: 3, + blocks_per_cycle: 2048, + blocks_per_commitment: 16, + blocks_per_roll_snapshot: 128, + blocks_per_voting_period: 2048, + time_between_blocks: ['30', '20'], + endorsers_per_block: 32, + hard_gas_limit_per_operation: '1040000', + hard_gas_limit_per_block: '10400000', + proof_of_work_threshold: '70368744177663', + tokens_per_roll: '8000000000', + michelson_maximum_type_size: 1000, + seed_nonce_revelation_tip: '125000', + origination_size: 257, + block_security_deposit: '512000000', + endorsement_security_deposit: '64000000', + baking_reward_per_endorsement: ['1250000', '187500'], + endorsement_reward: ['1250000', '833333'], + cost_per_byte: '250', + hard_storage_limit_per_operation: '60000', + test_chain_duration: '61440', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 24, + delay_per_missing_endorsement: '4', + }) + ); + const response = await client.getConstants(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/constants', + }); + expect(response.block_security_deposit).toBeInstanceOf(BigNumber); + expect(response.block_security_deposit.toString()).toEqual('512000000'); + + expect(response.endorsement_reward).toBeDefined(); + if (response.endorsement_reward instanceof Array) { + expect(response.endorsement_reward[0]).toBeInstanceOf(BigNumber); + expect(response.endorsement_reward[0].toString()).toEqual('1250000'); + expect(response.endorsement_reward[1]).toBeInstanceOf(BigNumber); + expect(response.endorsement_reward[1].toString()).toEqual('833333'); + } + + expect(response.baking_reward_per_endorsement).toBeDefined(); + expect(response.baking_reward_per_endorsement![0]).toBeInstanceOf(BigNumber); + expect(response.baking_reward_per_endorsement![0].toString()).toEqual('1250000'); + expect(response.baking_reward_per_endorsement![1]).toBeInstanceOf(BigNumber); + expect(response.baking_reward_per_endorsement![1].toString()).toEqual('187500'); + + expect(response.delay_per_missing_endorsement).toBeDefined(); + expect(response.delay_per_missing_endorsement!).toBeInstanceOf(BigNumber); + expect(response.delay_per_missing_endorsement!.toString()).toEqual('4'); + + expect(response.max_anon_ops_per_block).toBeDefined(); + expect(response.max_anon_ops_per_block!).toEqual(132); + + expect(response.max_revelations_per_block).toBeUndefined(); + expect(response.block_reward).toBeUndefined(); + expect(response.origination_burn).toBeUndefined(); + + done(); + }); + }); + + describe('getConstants Proto006', () => { + it('should properties return by the RPC are accessible and the ones that do not belong to proto6 are undefined', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_revelations_per_block: 32, + max_operation_data_length: 16384, + max_proposals_per_delegate: 20, + preserved_cycles: 5, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + blocks_per_roll_snapshot: 256, + blocks_per_voting_period: 32768, + time_between_blocks: ['60', '40'], + endorsers_per_block: 32, + hard_gas_limit_per_operation: '1040000', + hard_gas_limit_per_block: '10400000', + proof_of_work_threshold: '70368744177663', + tokens_per_roll: '8000000000', + michelson_maximum_type_size: 1000, + seed_nonce_revelation_tip: '125000', + origination_size: 257, + block_security_deposit: '512000000', + endorsement_security_deposit: '64000000', + baking_reward_per_endorsement: ['1250000', '187500'], + endorsement_reward: ['1250000', '833333'], + cost_per_byte: '1000', + hard_storage_limit_per_operation: '60000', + test_chain_duration: '1966080', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 24, + delay_per_missing_endorsement: '8', + }) + ); + const response = await client.getConstants(); + + expect(response.hard_gas_limit_per_operation).toBeInstanceOf(BigNumber); + expect(response.hard_gas_limit_per_operation.toString()).toEqual('1040000'); + + expect(response.max_revelations_per_block).toBeDefined(); + expect(response.max_revelations_per_block!).toEqual(32); + + expect(response.origination_size).toBeDefined(); + expect(response.origination_size!).toEqual(257); + + expect(response.max_anon_ops_per_block).toBeUndefined(); + expect(response.block_reward).toBeUndefined(); + expect(response.origination_burn).toBeUndefined(); + + done(); + }); + }); + + describe('getConstants Proto005', () => { + it('should properties return by the RPC are accessible and the ones that do not belong to proto5 are undefined', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_revelations_per_block: 32, + max_operation_data_length: 16384, + max_proposals_per_delegate: 20, + preserved_cycles: 5, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + blocks_per_roll_snapshot: 256, + blocks_per_voting_period: 32768, + time_between_blocks: ['60', '40'], + endorsers_per_block: 32, + hard_gas_limit_per_operation: '800000', + hard_gas_limit_per_block: '8000000', + proof_of_work_threshold: '70368744177663', + tokens_per_roll: '8000000000', + michelson_maximum_type_size: 1000, + seed_nonce_revelation_tip: '125000', + origination_size: 257, + block_security_deposit: '512000000', + endorsement_security_deposit: '64000000', + block_reward: '16000000', + baking_reward_per_endorsement: ['1250000', '187500'], + endorsement_reward: '2000000', + cost_per_byte: '1000', + hard_storage_limit_per_operation: '60000', + test_chain_duration: '1966080', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 24, + delay_per_missing_endorsement: '8', + }) + ); + const response = await client.getConstants(); + + expect(response.endorsement_reward).toBeInstanceOf(BigNumber); + expect(response.endorsement_reward.toString()).toEqual('2000000'); + + expect(response.block_reward).toBeDefined(); + if (response.block_reward) { + expect(response.block_reward).toBeInstanceOf(BigNumber); + expect(response.block_reward.toString()).toEqual('16000000'); + } + expect(response.quorum_max).toBeDefined(); + if (response.quorum_max) { + expect(response.quorum_max).toEqual(7000); + } + + expect(response.test_chain_duration).toBeDefined(); + if (response.test_chain_duration) { + expect(response.block_reward).toBeInstanceOf(BigNumber); + expect(response.test_chain_duration.toString()).toEqual('1966080'); + } + + expect(response.max_anon_ops_per_block).toBeUndefined(); + expect(response.origination_burn).toBeUndefined(); + + done(); + }); + }); + + describe('getBlock', () => { + it('should query the right url and property for endorsement', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + chain_id: 'NetXdQprcVkpaWU', + hash: 'BMJZyYF1aYafqFs7HE6i32XFy9raoye4z93dDi68jiB6swgGztx', + header: { + level: 578756, + proto: 4, + predecessor: 'BMAAqpF8w3qPSDUaGAsJXA3QQTgzeBJbRWerSvnpGjpR9ERGNEX', + timestamp: '2019-08-24T21:37:32Z', + validation_pass: 4, + operations_hash: 'LLoa7BV7nk6eVGiTsoMtgYegmnFrn5A1rZFPUQKzUgKHLTnc44hVu', + fitness: ['00', '000000000116a295'], + context: 'CoUqeHHzXBuizWXjsxcFHQ385ETgSyWth5CxJJt2mVpjkkDYo2W1', + priority: 0, + proof_of_work_nonce: '00000003a8df54b7', + signature: + 'sigcqr3u5kY8sB8iY3CFo6FWEFb97trx92JjLnJpwQSibqwRUW3sQoHFH22E1FfpGYfgmZYxmhxrghNV5zSRqsvCSRBfmMzk', + }, + metadata: { + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + next_protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + test_chain_status: { + status: 'not_running', + }, + max_operations_ttl: 60, + max_operation_data_length: 16384, + max_block_header_length: 238, + max_operation_list_length: [ + { + max_size: 32768, + max_op: 32, + }, + { + max_size: 32768, + }, + { + max_size: 135168, + max_op: 132, + }, + { + max_size: 524288, + }, + ], + baker: 'tz1NpWrAyDL9k2Lmnyxcgr9xuJakbBxdq7FB', + level: { + level: 578756, + level_position: 578755, + cycle: 141, + cycle_position: 1219, + voting_period: 17, + voting_period_position: 21699, + expected_commitment: false, + }, + voting_period_kind: 'testing_vote', + nonce_hash: null, + consumed_gas: '112200', + deactivated: [], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1NpWrAyDL9k2Lmnyxcgr9xuJakbBxdq7FB', + change: '-512000000', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1NpWrAyDL9k2Lmnyxcgr9xuJakbBxdq7FB', + cycle: 141, + change: '512000000', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1NpWrAyDL9k2Lmnyxcgr9xuJakbBxdq7FB', + cycle: 141, + change: '16000000', + }, + ], + }, + operations: [ + [ + { + protocol: 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd', + chain_id: 'NetXdQprcVkpaWU', + hash: 'oondRNZutoyWCZtXvvxKXcw8Us7ms8vhN8VUet32PopSREiMF1a', + branch: 'BMAAqpF8w3qPSDUaGAsJXA3QQTgzeBJbRWerSvnpGjpR9ERGNEX', + contents: [ + { + kind: 'endorsement', + level: 578755, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1iZEKy4LaAjnTmn2RuGDf2iqdAQKnRi8kY', + change: '-64000000', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1iZEKy4LaAjnTmn2RuGDf2iqdAQKnRi8kY', + cycle: 141, + change: '64000000', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1iZEKy4LaAjnTmn2RuGDf2iqdAQKnRi8kY', + cycle: 141, + change: '2000000', + }, + ], + delegate: 'tz1iZEKy4LaAjnTmn2RuGDf2iqdAQKnRi8kY', + slots: [16], + }, + }, + ], + signature: + 'sigWXsVEVYZFkNVuJJR6PCjt4kX89jrRSxjNqcRdPPe1Bsawvjr7BeuuFjMfAhgqB84R8HmHuLKyoAhU5vngC82xjuuQuWH6', + }, + ], + ], + }) + ); + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + const endorsement = response.operations[0][0] + .contents[0] as OperationContentsAndResultEndorsement; + expect(endorsement.metadata.balance_updates![0].kind).toEqual('contract'); + + done(); + }); + }); + + describe('getBlock', () => { + it('should query the right url and property for operation', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + chain_id: 'NetXSgo1ZT2DRUG', + hash: 'BKjqpGqKggVrYbkBmBUYjLx8QdCUxBLaVGr1GWKho4ziBo1KQFX', + header: { + level: 90973, + proto: 1, + predecessor: 'BMF7j462upRKLRWEdmFYTCMK3kuEfbQdR2Apo7noc1ZwzPZi2ji', + timestamp: '2021-03-16T17:49:35Z', + validation_pass: 4, + operations_hash: 'LLoZv71M2tWPD8mMjDhf7QcE5ZaHrtYCu4wFRhmPkBWvwCEMxacei', + fitness: ['01', '000000000001635c'], + context: 'CoV8F9ro52txU4rGRGNXfQZgbE3pZVMygNV4UGjf6foKhBMb8MJC', + priority: 0, + proof_of_work_nonce: '6102c8089c360500', + signature: + 'sigkj5nVVW6Zq7F9dEstPs5o2s1vTnUfwhsWi3UnmwrjYVwN9gfmXUBArzSLeXEUNQBM4KUYSg385i1ajR9TugSkM2swFzQp', + }, + metadata: { + protocol: 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + next_protocol: 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + test_chain_status: { + status: 'not_running', + }, + max_operations_ttl: 60, + max_operation_data_length: 16384, + max_block_header_length: 238, + max_operation_list_length: [ + { + max_size: 32768, + max_op: 32, + }, + { + max_size: 32768, + }, + { + max_size: 135168, + max_op: 132, + }, + { + max_size: 524288, + }, + ], + baker: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + level: { + level: 90973, + level_position: 90972, + cycle: 44, + cycle_position: 860, + voting_period: 22, + voting_period_position: 860, + expected_commitment: false, + }, + level_info: { + level: 90973, + level_position: 90972, + cycle: 44, + cycle_position: 860, + expected_commitment: false, + }, + voting_period_kind: 'proposal', + voting_period_info: { + voting_period: { + index: 22, + kind: 'proposal', + start_position: 90112, + }, + position: 860, + remaining: 3235, + }, + nonce_hash: null, + consumed_gas: '73225095', + deactivated: [], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '-512000000', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 44, + change: '512000000', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 44, + change: '38750000', + }, + ], + }, + operations: [ + [ + { + protocol: 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + chain_id: 'NetXSgo1ZT2DRUG', + hash: 'onefqcSYA5FNfNW68ghLqQajxnM9cZ3vvdNaTDR1Mhv34LBAhaG', + branch: 'BMF7j462upRKLRWEdmFYTCMK3kuEfbQdR2Apo7noc1ZwzPZi2ji', + contents: [ + { + kind: 'transaction', + source: 'tz3beCZmQhd5Q1KNMZbiLCarXVo9aqpPHYe8', + fee: '2820', + counter: '184578', + gas_limit: '24760', + storage_limit: '1', + amount: '0', + destination: 'KT1LSuT4NgCQyZK1CWpss7FcJTTw68NDgPyR', + parameters: { + entrypoint: 'mint', + value: { + prim: 'Pair', + args: [ + { + string: 'tz3beCZmQhd5Q1KNMZbiLCarXVo9aqpPHYe8', + }, + { + int: '100', + }, + ], + }, + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz3beCZmQhd5Q1KNMZbiLCarXVo9aqpPHYe8', + change: '-2820', + }, + { + kind: 'freezer', + category: 'fees', + delegate: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + cycle: 44, + change: '2820', + }, + ], + operation_result: { + status: 'applied', + storage: [ + { + int: '33681', + }, + { + bytes: '0002a7f8d8600737ff279e4b9a4b1518157b653a314d', + }, + { + prim: 'False', + }, + { + int: '300', + }, + ], + big_map_diff: [ + { + action: 'update', + big_map: '33681', + key_hash: 'expruAQuDQJ9ojnpqipCAbR23gBSSff7AxaMT9UBRjpZpiDHfJ6b6L', + key: { + bytes: '0002a7f8d8600737ff279e4b9a4b1518157b653a314d', + }, + value: { + prim: 'Pair', + args: [ + { + int: '102', + }, + [], + ], + }, + }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'tz3beCZmQhd5Q1KNMZbiLCarXVo9aqpPHYe8', + change: '-250', + }, + ], + consumed_gas: '24660', + consumed_milligas: '24659284', + storage_size: '5335', + paid_storage_size_diff: '1', + lazy_storage_diff: [ + { + kind: 'big_map', + id: '33681', + diff: { + action: 'update', + updates: [ + { + key_hash: + 'expruAQuDQJ9ojnpqipCAbR23gBSSff7AxaMT9UBRjpZpiDHfJ6b6L', + key: { + bytes: '0002a7f8d8600737ff279e4b9a4b1518157b653a314d', + }, + value: { + prim: 'Pair', + args: [ + { + int: '102', + }, + [], + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + ], + signature: + 'sigmCS2nZquXi3vXX8p7iwc6TVYC87FsGYkxSgEMiQESbM5dnnP4SGe4YHLRFXuRwcs1VaNLsiFWzVQVnpbNDfAhYhPgRnCG', + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + const transaction = response.operations[0][0] + .contents[0] as OperationContentsAndResultTransaction; + expect(transaction.metadata.balance_updates![0].kind).toEqual('contract'); + expect(transaction.metadata.balance_updates![0].change).toEqual('-2820'); + expect(transaction.metadata.operation_result.status).toEqual('applied'); + expect(transaction.metadata.operation_result.consumed_gas).toEqual('24660'); + done(); + }); + + it('should query the right url and property for operation, proto 9, endorsement_with_slot', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + chain_id: 'NetXxkAx4woPLyu', + hash: 'BLRWVvWTrqgUt1JL76RnUguKhkqfbHnXVrznXpuCrhxemSuCrb3', + header: { + level: 174209, + proto: 1, + predecessor: 'BMarN3hiEmCrSrfeo6qndubHe9FXpPy4qcj3Xr2NBGGfG4Tfcaj', + timestamp: '2021-05-07T18:37:59Z', + validation_pass: 4, + operations_hash: 'LLoaFb5cQjcr2pzKbLsmhPN2NgLY5gGs9ePimjRsNyCtgAQejfbXg', + fitness: ['01', '000000000002a880'], + context: 'CoWMJU1LmpfMn92zz4Ah1TrwXaSHnRWcy8dcso32AH7miULKad1d', + priority: 0, + proof_of_work_nonce: '08351e3d59170e00', + signature: + 'sigg9pz9Q5i17nDZpZ3mbbMQsLHNuHX3SxTxHguLwgR9xYL2x17TmH7QfVFsadQTa61QCnq5vuFXkFtymeQKNh74VsWnMu9D', + }, + metadata: {}, + operations: [ + [ + { + protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + chain_id: 'NetXxkAx4woPLyu', + hash: 'ooYSSxYcgreJQtrzxqyBpBdCntVbnbvHdtqA7RZsFcSDz4XFZJY', + branch: 'BMarN3hiEmCrSrfeo6qndubHe9FXpPy4qcj3Xr2NBGGfG4Tfcaj', + contents: [ + { + kind: 'endorsement_with_slot', + endorsement: { + branch: 'BMarN3hiEmCrSrfeo6qndubHe9FXpPy4qcj3Xr2NBGGfG4Tfcaj', + operations: { kind: 'endorsement', level: 174208 }, + signature: + 'signiPFVn2gFXvu7dKxEnifWQgbzan9ca6z7XSS5PyNBin2BufNBTFz9hgM7imvWf2HSj6NY3ECtEvb5xmwiYnUDbpSTUQC6', + }, + slot: 4, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + change: '-320000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + cycle: 85, + change: '320000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + cycle: 85, + change: '6250000', + origin: 'block', + }, + ], + delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', + slots: [4, 11, 18, 21, 24], + }, + }, + ], + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + const endorsementWithSlot = response.operations[0][0] + .contents[0] as OperationContentsAndResultEndorsementWithSlot; + expect(endorsementWithSlot.kind).toEqual('endorsement_with_slot'); + expect(endorsementWithSlot.metadata.slots).toEqual([4, 11, 18, 21, 24]); + expect(endorsementWithSlot.slot).toEqual(4); + done(); + }); + + it('should query the right url and properties (big_map_diff and lazy_storage_diff) in transaction operation result, proto 9', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + chain_id: 'NetXdQprcVkpaWU', + hash: 'BLQFAtBgdUtRHoceLfvfVEL6ick7JvZrNoyvAdvqJGD1HWuJ7fV', + header: { + level: 1470478, + proto: 9, + predecessor: 'BKqxeSBXxYZhjjuFc8At4vEtYjZQJKEPxb83iJqetYDU3CGYQ42', + timestamp: '2021-05-14T00:13:58Z', + validation_pass: 4, + operations_hash: 'LLoaX8tJAJqhkhXhc2cy7yzwjQbikUYmQxQKYqQvYm9Tfq9E9tML7', + fitness: ['01', '00000000000c700e'], + context: 'CoWFaDTwc3TnXws8hfdzE8QNUA3WCvH64XBR2ZaC9EBKePBwpkSy', + priority: 0, + proof_of_work_nonce: '31e6641dd3560300', + signature: + 'sigw8azwmbdkJjMNoGD6Ls2idXAdxuexUZZV5VMTpJnx1PADBqhFgDma42PGyVLEfd4FybianKrEJcTVMBb6GMgdZtSDYbYL', + }, + metadata: { + protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + next_protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + test_chain_status: { + status: 'not_running', + }, + max_operations_ttl: 60, + max_operation_data_length: 32768, + max_block_header_length: 238, + max_operation_list_length: [ + { + max_size: 4194304, + max_op: 2048, + }, + { + max_size: 32768, + }, + { + max_size: 135168, + max_op: 132, + }, + { + max_size: 524288, + }, + ], + baker: 'tz1W5VkdB5s7ENMESVBtwyt9kyvLqPcUczRT', + level: { + level: 1470478, + level_position: 1470477, + cycle: 359, + cycle_position: 13, + voting_period: 47, + voting_period_position: 4110, + expected_commitment: false, + }, + level_info: { + level: 1470478, + level_position: 1470477, + cycle: 359, + cycle_position: 13, + expected_commitment: false, + }, + voting_period_kind: 'proposal', + voting_period_info: { + voting_period: { + index: 47, + kind: 'proposal', + start_position: 1466367, + }, + position: 4110, + remaining: 16369, + }, + nonce_hash: null, + consumed_gas: '1644308817', + deactivated: [], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1W5VkdB5s7ENMESVBtwyt9kyvLqPcUczRT', + change: '-512000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + delegate: 'tz1W5VkdB5s7ENMESVBtwyt9kyvLqPcUczRT', + cycle: 359, + change: '512000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'rewards', + delegate: 'tz1W5VkdB5s7ENMESVBtwyt9kyvLqPcUczRT', + cycle: 359, + change: '33750000', + origin: 'block', + }, + ], + }, + operations: [ + [ + { + protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + chain_id: 'NetXdQprcVkpaWU', + hash: 'oo4ZXrmij79uZfWKPzxQHsyVS3TLecHDVx8ZrLv6qpeijLLzP3b', + branch: 'BKqxeSBXxYZhjjuFc8At4vEtYjZQJKEPxb83iJqetYDU3CGYQ42', + contents: [ + { + kind: 'transaction', + source: 'tz1PaJwmmL2nrRt5K6HvwFEc6fUfxNe6Dyp5', + fee: '12543', + counter: '12961179', + gas_limit: '122564', + storage_limit: '212', + amount: '500000', + destination: 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9', + parameters: { + entrypoint: 'collect', + value: { + prim: 'Pair', + args: [ + { + int: '1', + }, + { + int: '140470', + }, + ], + }, + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1PaJwmmL2nrRt5K6HvwFEc6fUfxNe6Dyp5', + change: '-12543', + origin: 'block', + }, + { + kind: 'freezer', + category: 'fees', + delegate: 'tz1W5VkdB5s7ENMESVBtwyt9kyvLqPcUczRT', + cycle: 359, + change: '12543', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + storage: [ + [ + { + prim: 'Pair', + args: [ + { + bytes: '01d4bbb83486df92642008e9ce812481f4d564611100', + }, + { + prim: 'Pair', + args: [ + { + int: '1618452581', + }, + { + bytes: '01123aaf8d2c25e0ddafa6d98e16582de7478f092500', + }, + ], + }, + ], + }, + { + prim: 'True', + }, + { + bytes: '00005db799bf9b0dc319ba1cf21ab01461a9639043ca', + }, + { + int: '521', + }, + ], + { + prim: 'Pair', + args: [ + { + bytes: '01b752c7f3de31759bce246416a6823e86b9756c6c00', + }, + { + prim: 'Pair', + args: [ + { + int: '78796', + }, + { + int: '522', + }, + ], + }, + ], + }, + { + int: '0', + }, + { + int: '142549', + }, + { + int: '523', + }, + ], + big_map_diff: [ + { + action: 'update', + big_map: '523', + key_hash: 'exprttR8DRSn1Ry4mfsAUQTnEqNrHGppnGdyk7hz3hTinLEWsX3HQg', + key: { + int: '140470', + }, + value: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: '0000c7e376baa5650223728c95963f77119148e4f5f4', + }, + { + int: '14', + }, + ], + }, + { + prim: 'Pair', + args: [ + { + int: '77582', + }, + { + int: '500000', + }, + ], + }, + ], + }, + }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1PaJwmmL2nrRt5K6HvwFEc6fUfxNe6Dyp5', + change: '-500000', + origin: 'block', + }, + { + kind: 'contract', + contract: 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9', + change: '500000', + origin: 'block', + }, + ], + consumed_gas: '91530', + consumed_milligas: '91529556', + storage_size: '16397849', + lazy_storage_diff: [ + { + kind: 'big_map', + id: '523', + diff: { + action: 'update', + updates: [ + { + key_hash: + 'exprttR8DRSn1Ry4mfsAUQTnEqNrHGppnGdyk7hz3hTinLEWsX3HQg', + key: { + int: '140470', + }, + value: { + prim: 'Pair', + args: [ + { + prim: 'Pair', + args: [ + { + bytes: '0000c7e376baa5650223728c95963f77119148e4f5f4', + }, + { + int: '14', + }, + ], + }, + { + prim: 'Pair', + args: [ + { + int: '77582', + }, + { + int: '500000', + }, + ], + }, + ], + }, + }, + ], + }, + }, + { + kind: 'big_map', + id: '522', + diff: { + action: 'update', + updates: [], + }, + }, + { + kind: 'big_map', + id: '521', + diff: { + action: 'update', + updates: [], + }, + }, + ], + }, + internal_operation_results: [ + { + kind: 'transaction', + source: 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9', + nonce: 26, + amount: '0', + destination: 'KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton', + parameters: { + entrypoint: 'transfer', + value: [ + { + prim: 'Pair', + args: [ + { + bytes: '016498b7494a18a572c1d24484038545662c0454ed00', + }, + [ + { + prim: 'Pair', + args: [ + { + bytes: '00002b2c68041fe4a6d3219220a12d64a7cc06288e7a', + }, + { + prim: 'Pair', + args: [ + { + int: '77582', + }, + { + int: '1', + }, + ], + }, + ], + }, + ], + ], + }, + ], + }, + result: { + status: 'applied', + storage: [ + { + prim: 'Pair', + args: [ + { + bytes: '016498b7494a18a572c1d24484038545662c0454ed00', + }, + { + prim: 'Pair', + args: [ + { + int: '78796', + }, + { + int: '511', + }, + ], + }, + ], + }, + { + prim: 'Pair', + args: [ + { + int: '512', + }, + { + int: '513', + }, + ], + }, + { + prim: 'False', + }, + { + int: '514', + }, + ], + big_map_diff: [ + { + action: 'update', + big_map: '511', + key_hash: 'exprtjwzEHJr4evsEBcd8va7d8fyb6aA8LRkfsGdVhXGxM9Unjgk3i', + key: { + prim: 'Pair', + args: [ + { + bytes: '016498b7494a18a572c1d24484038545662c0454ed00', + }, + { + int: '77582', + }, + ], + }, + value: { + int: '14', + }, + }, + { + action: 'update', + big_map: '511', + key_hash: 'exprtw5AgJ5izrup4msD2ovuwgoVciojz4fGz6YoknvHvjo7xEMzcm', + key: { + prim: 'Pair', + args: [ + { + bytes: '00002b2c68041fe4a6d3219220a12d64a7cc06288e7a', + }, + { + int: '77582', + }, + ], + }, + value: { + int: '1', + }, + }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'tz1PaJwmmL2nrRt5K6HvwFEc6fUfxNe6Dyp5', + change: '-16750', + origin: 'block', + }, + ], + consumed_gas: '26673', + consumed_milligas: '26672257', + storage_size: '47030669', + paid_storage_size_diff: '67', + lazy_storage_diff: [ + { + kind: 'big_map', + id: '514', + diff: { + action: 'update', + updates: [], + }, + }, + { + kind: 'big_map', + id: '513', + diff: { + action: 'update', + updates: [], + }, + }, + { + kind: 'big_map', + id: '512', + diff: { + action: 'update', + updates: [], + }, + }, + { + kind: 'big_map', + id: '511', + diff: { + action: 'update', + updates: [ + { + key_hash: + 'exprtw5AgJ5izrup4msD2ovuwgoVciojz4fGz6YoknvHvjo7xEMzcm', + key: { + prim: 'Pair', + args: [ + { + bytes: '00002b2c68041fe4a6d3219220a12d64a7cc06288e7a', + }, + { + int: '77582', + }, + ], + }, + value: { + int: '1', + }, + }, + { + key_hash: + 'exprtjwzEHJr4evsEBcd8va7d8fyb6aA8LRkfsGdVhXGxM9Unjgk3i', + key: { + prim: 'Pair', + args: [ + { + bytes: '016498b7494a18a572c1d24484038545662c0454ed00', + }, + { + int: '77582', + }, + ], + }, + value: { + int: '14', + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + signature: + 'sigvCzuirg8Dgwe37iXHEhBxD4NJ9aUUTn6679jzSF9Uwq2yJ3GbK4rnVEuKS935CateN8L4fHDD13RtRWomBUE4M92QqEvN', + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + + const transaction = response.operations[0][0] + .contents[0] as OperationContentsAndResultTransaction; + expect(transaction.kind).toEqual('transaction'); + expect(transaction.metadata.operation_result.lazy_storage_diff).toBeDefined(); + + expect(transaction.metadata.operation_result.lazy_storage_diff![0].kind).toEqual('big_map'); + expect(transaction.metadata.operation_result.lazy_storage_diff![0].id).toEqual('523'); + expect(transaction.metadata.operation_result.lazy_storage_diff![0].diff.action).toEqual( + 'update' + ); + + expect( + transaction.metadata.operation_result.lazy_storage_diff![0].diff.updates + ).toBeDefined(); + const update0 = transaction.metadata.operation_result + .lazy_storage_diff![0] as LazyStorageDiffBigMap; + expect(update0.diff.updates).toBeDefined(); + expect(update0.diff.updates![0].key_hash).toEqual( + 'exprttR8DRSn1Ry4mfsAUQTnEqNrHGppnGdyk7hz3hTinLEWsX3HQg' + ); + + expect(transaction.metadata.operation_result.big_map_diff).toBeDefined(); + expect(transaction.metadata.operation_result.big_map_diff![0].action).toEqual('update'); + expect(transaction.metadata.operation_result.big_map_diff![0].big_map!.toString()).toEqual( + '523' + ); + + expect(transaction.metadata.internal_operation_results).toBeDefined(); + expect(transaction.metadata.internal_operation_results![0].kind).toEqual('transaction'); + expect(transaction.metadata.internal_operation_results![0].source).toEqual( + 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9' + ); + expect(transaction.metadata.internal_operation_results![0].nonce).toEqual(26); + + const result = transaction.metadata.internal_operation_results![0] + .result as OperationResultTransaction; + expect(result.status).toEqual('applied'); + expect(result.big_map_diff).toBeDefined(); + expect(result.big_map_diff![0].action).toEqual('update'); + expect(result.big_map_diff![0].key_hash).toEqual( + 'exprtjwzEHJr4evsEBcd8va7d8fyb6aA8LRkfsGdVhXGxM9Unjgk3i' + ); + expect(result.balance_updates).toBeDefined(); + expect(result.balance_updates![0].kind).toEqual('contract'); + expect(result.balance_updates![0].origin).toEqual('block'); + expect(result.lazy_storage_diff).toBeDefined(); + expect(result.lazy_storage_diff![0].kind).toEqual('big_map'); + expect(result.lazy_storage_diff![0].id).toEqual('514'); + done(); + }); + + it('should query the right url and properties (lazy_storage_diff of kind sapling_state) in transaction operation result, proto 8', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + chain_id: 'NetXSgo1ZT2DRUG', + hash: 'BL463rWSReHJRLkwUPdGSS6fDqvJwAVPeaZGTBhEkFbYecAR9Ks', + header: {}, + metadata: {}, + operations: [ + [], + [], + [], + [ + { + protocol: 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + chain_id: 'NetXSgo1ZT2DRUG', + hash: 'onhF4PVPmPDJjrRfiFf1Tg1wBM4SjQuk5h2Ucx84f42CfAeQtVe', + branch: 'BKkgRGNt4kw7EDZvWXQjYVzCQvMsZYkpUSweepc9HZumQ3qSdnv', + contents: [ + { + kind: 'origination', + source: 'tz2BG2915vryjQF4kTnqUWC7hQ6Bc4YKZQC4', + fee: '2138', + counter: '1000052', + gas_limit: '8849', + storage_limit: '1302', + balance: '0', + script: {}, + metadata: { + balance_updates: [], + operation_result: { + status: 'applied', + big_map_diff: [], + balance_updates: [ + { + kind: 'contract', + contract: 'tz2BG2915vryjQF4kTnqUWC7hQ6Bc4YKZQC4', + change: '-261250', + }, + { + kind: 'contract', + contract: 'tz2BG2915vryjQF4kTnqUWC7hQ6Bc4YKZQC4', + change: '-64250', + }, + ], + originated_contracts: ['KT1RqdcabssqPDfKoBvVNZjPVPBpmuUW4UVe'], + consumed_gas: '8749', + consumed_milligas: '8748162', + storage_size: '1045', + paid_storage_size_diff: '1045', + lazy_storage_diff: [ + { + kind: 'sapling_state', + id: '12515', + diff: { + action: 'alloc', + updates: { + commitments_and_ciphertexts: [], + nullifiers: [], + }, + memo_size: 8, + }, + }, + { + kind: 'sapling_state', + id: '12514', + diff: { + action: 'alloc', + updates: { + commitments_and_ciphertexts: [], + nullifiers: [], + }, + memo_size: 8, + }, + }, + ], + }, + }, + }, + ], + signature: + 'sigs45ddgjWHNHRNTFxirJahw6ZBFnMTFgNNXvuKAxS7nrgBrVG31TPnwjF9Rma48rf9iuFT7hqJg69MWR5ZsnQkqa3Ekaoj', + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + + const origination = response.operations[3][0] + .contents[0] as OperationContentsAndResultOrigination; + expect(origination.kind).toEqual('origination'); + expect(origination.metadata.operation_result.lazy_storage_diff).toBeDefined(); + const lazy_storage_diff_0 = origination.metadata.operation_result + .lazy_storage_diff![0] as LazyStorageDiffSaplingState; + expect(lazy_storage_diff_0.kind).toEqual('sapling_state'); + expect(lazy_storage_diff_0.id).toEqual('12515'); + expect(lazy_storage_diff_0.diff.action).toEqual('alloc'); + expect(lazy_storage_diff_0.diff.updates).toBeDefined(); + expect(lazy_storage_diff_0.diff.updates!.commitments_and_ciphertexts).toBeInstanceOf(Array); + expect(lazy_storage_diff_0.diff.updates!.nullifiers).toBeInstanceOf(Array); + expect(lazy_storage_diff_0.diff.memo_size).toBeDefined(); + expect(lazy_storage_diff_0.diff.memo_size).toEqual(8); + done(); + }); + + it('should access new properties "liquidity_baking_escape_ema", "implicit_operations_results" and "subsidy" in block metadata, proto 10', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + chain_id: 'NetXz969SFaFn8k', + hash: 'BMUN7Jt6hv7pVwnVSULxujYXy6qVaFLVoUbd6sQXsagjXpH4iWw', + header: { + level: 218022, + proto: 2, + predecessor: 'BKovSSUyqB2dfs5RtrVfFLDugyYavpQ4ULi5KexV8r6HPXA6QL3', + timestamp: '2021-07-19T23:41:07Z', + validation_pass: 4, + operations_hash: 'LLoasnx73KY1xekuqN6qnG7GQUrdr6MsuRxJB5S6rqphsR2oX7sDc', + fitness: ['01', '00000000000353a5'], + context: 'CoWYkYRZg8KswUR8eq9CcXNUuUiqjnck1enWRXmtPRocSg4kPXo4', + priority: 0, + proof_of_work_nonce: 'bc2cc86f02c40200', + liquidity_baking_escape_vote: false, + signature: + 'sigiHpzCAzTLxdSmuD8c3Tn4yHxfhbKErnZwrW8VGr2Q4Y848RNWfLhRrmp9FQExZtXc9ESQab3trtckRdukrvXd7ruBsL4n', + }, + metadata: { + protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + next_protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + test_chain_status: { status: 'not_running' }, + max_operations_ttl: 120, + max_operation_data_length: 32768, + max_block_header_length: 239, + max_operation_list_length: [ + { max_size: 4194304, max_op: 2048 }, + { max_size: 32768 }, + { max_size: 135168, max_op: 132 }, + { max_size: 524288 }, + ], + baker: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + level_info: { + level: 218022, + level_position: 218021, + cycle: 54, + cycle_position: 933, + expected_commitment: false, + }, + voting_period_info: { + voting_period: { index: 10, kind: 'proposal', start_position: 204801 }, + position: 13220, + remaining: 7259, + }, + nonce_hash: null, + consumed_gas: '0', + deactivated: [], + balance_updates: [], + liquidity_baking_escape_ema: 283204, + implicit_operations_results: [ + { + kind: 'transaction', + storage: [ + { int: '104' }, + { int: '177311484916' }, + { int: '118' }, + { bytes: '01e927f00ef734dfc85919635e9afc9166c83ef9fc00' }, + { bytes: '0115eb0104481a6d7921160bc982c5e0a561cd8a3a00' }, + ], + balance_updates: [ + { + kind: 'contract', + contract: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5', + change: '2500000', + origin: 'subsidy', + }, + ], + consumed_gas: '2118', + consumed_milligas: '2117037', + storage_size: '4633', + }, + ], + }, + operations: [], + }) + ); + + const response = await client.getBlock(); + + expect(response.metadata.liquidity_baking_escape_ema).toEqual(283204); + expect(typeof response.metadata.liquidity_baking_escape_ema).toBe('number'); + + expect(response.metadata.implicit_operations_results).toBeDefined(); + expect(response.metadata.implicit_operations_results!).toBeInstanceOf(Array); + expect(response.metadata.implicit_operations_results!.length).toEqual(1); + + expect(response.metadata.implicit_operations_results![0].kind).toEqual('transaction'); + + expect(response.metadata.implicit_operations_results![0].consumed_gas).toBeDefined(); + expect(response.metadata.implicit_operations_results![0].consumed_gas).toEqual('2118'); + + expect(response.metadata.implicit_operations_results![0].consumed_milligas).toBeDefined(); + expect(response.metadata.implicit_operations_results![0].consumed_milligas).toEqual( + '2117037' + ); + + expect(response.metadata.implicit_operations_results![0].storage).toBeDefined(); + expect(response.metadata.implicit_operations_results![0].big_map_diff).toBeUndefined(); + + expect(response.metadata.implicit_operations_results![0].balance_updates).toBeDefined(); + expect( + response.metadata.implicit_operations_results![0].balance_updates![0].origin + ).toBeDefined(); + expect(response.metadata.implicit_operations_results![0].balance_updates![0].origin).toEqual( + 'subsidy' + ); + + expect( + response.metadata.implicit_operations_results![0].originated_contracts + ).toBeUndefined(); + + expect(response.metadata.implicit_operations_results![0].storage_size).toBeDefined(); + expect(response.metadata.implicit_operations_results![0].storage_size).toEqual('4633'); + + expect( + response.metadata.implicit_operations_results![0].paid_storage_size_diff + ).toBeUndefined(); + expect(response.metadata.implicit_operations_results![0].lazy_storage_diff).toBeUndefined(); + + done(); + }); + + it('should fetch a block having a RegisterGlobalConstant operation and it validates its properties, proto 11', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r', + chain_id: 'NetXuXoGoLxNK6o', + hash: 'BLGJTp5epczxcqaKkDdpPSKStBQ9FbLDR8qjprW1LE5SbkzmyCJ', + header: {}, + metadata: {}, + operations: [ + [], + [], + [], + [ + { + protocol: 'PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r', + chain_id: 'NetXuXoGoLxNK6o', + hash: 'ooG5DTHDKCeJTSaJhmQqxc2K4CVt5qYJaCXCupaMxAMAabcAJkc', + branch: 'BLU4Led8FWFT9WiYgSLbFb9AJ6eTi4LxfwshHpvZwsupuKzLeLN', + contents: [ + { + kind: 'register_global_constant', + source: 'tz1TJGsZxvr6aBGUqfQVxufesTtA7QGi696D', + fee: '372', + counter: '7423375', + gas_limit: '1330', + storage_limit: '93', + value: { + prim: 'Pair', + args: [ + { + int: '999', + }, + { + int: '999', + }, + ], + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TJGsZxvr6aBGUqfQVxufesTtA7QGi696D', + change: '-372', + origin: 'block', + }, + { + kind: 'freezer', + category: 'fees', + delegate: 'tz1foXHgRzdYdaLgX6XhpZGxbBv42LZ6ubvE', + cycle: 17, + change: '372', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1TJGsZxvr6aBGUqfQVxufesTtA7QGi696D', + change: '-18250', + origin: 'block', + }, + ], + consumed_gas: '1230', + storage_size: '73', + global_address: 'exprvNeeFGy8M7xhmaq7bkQcd3RsXc7ogv2HwL1dciubXdgPHEMRH2', + }, + }, + }, + ], + signature: + 'sigVW23SZBAnGLYQSDxN8y4YvMLUkZ13bBRHSoQSBpLASZvKgXZWWmp1q1iaqqV4hr3xRN9neYong8jHqxak2Y5vRYK8LaBY', + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(response.operations[3][0].contents[0].kind).toEqual('register_global_constant'); + const content = response.operations[3][0] + .contents[0] as OperationContentsAndResultRegisterGlobalConstant; + expect(content.source).toEqual('tz1TJGsZxvr6aBGUqfQVxufesTtA7QGi696D'); + expect(content.fee).toEqual('372'); + expect(content.counter).toEqual('7423375'); + expect(content.gas_limit).toEqual('1330'); + expect(content.storage_limit).toEqual('93'); + expect(content.value).toEqual({ + prim: 'Pair', + args: [ + { + int: '999', + }, + { + int: '999', + }, + ], + }); + expect(content.metadata.balance_updates![0].kind).toEqual('contract'); + expect(content.metadata.balance_updates![0].contract).toBeDefined(); + expect(content.metadata.balance_updates![0].contract).toEqual( + 'tz1TJGsZxvr6aBGUqfQVxufesTtA7QGi696D' + ); + expect(content.metadata.balance_updates![0].change).toBeDefined(); + expect(content.metadata.balance_updates![0].change).toEqual('-372'); + expect(content.metadata.balance_updates![0].origin).toBeDefined(); + expect(content.metadata.balance_updates![0].origin).toEqual('block'); + expect(content.metadata.balance_updates![0].category).toBeUndefined(); + expect(content.metadata.balance_updates![0].delegate).toBeUndefined(); + expect(content.metadata.balance_updates![0].cycle).toBeUndefined(); + + expect(content.metadata.operation_result.global_address).toBeDefined(); + expect(content.metadata.operation_result.status).toEqual('applied'); + expect(content.metadata.operation_result.balance_updates).toBeDefined(); + expect(content.metadata.operation_result.global_address).toEqual( + 'exprvNeeFGy8M7xhmaq7bkQcd3RsXc7ogv2HwL1dciubXdgPHEMRH2' + ); + expect(content.metadata.operation_result.consumed_gas).toBeDefined(); + expect(content.metadata.operation_result.storage_size).toBeDefined(); + expect(content.metadata.operation_result.errors).toBeUndefined(); + + expect(content.metadata.internal_operation_results).toBeUndefined(); + + done(); + }); + + it('should use enum to represent property category in balance_updates, proto 12', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockIthacanetResponse)); + + const response = await client.getBlock(); + + // To avoid dealing with the space in the property name returned by the RPC + expect(response.metadata.balance_updates![0].category).toBeDefined(); + expect(response.metadata.balance_updates![0].category).toEqual( + METADATA_BALANCE_UPDATES_CATEGORY.BLOCK_FEES + ); + expect(response.metadata.balance_updates![1].category).toBeDefined(); + expect(response.metadata.balance_updates![1].category).toEqual( + METADATA_BALANCE_UPDATES_CATEGORY.BAKING_REWARDS + ); + expect(response.metadata.balance_updates![3].category).toBeDefined(); + expect(response.metadata.balance_updates![3].category).toEqual( + METADATA_BALANCE_UPDATES_CATEGORY.BAKING_BONUSES + ); + + done(); + }); + + it('should fetch a block and access new properties in header, proto 12', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockIthacanetResponse)); + + const response = await client.getBlock(); + + expect(response.header.payload_hash).toBeDefined(); + expect(response.header.payload_hash).toEqual( + 'vh28CE8X2KKMvt5S4aGzPdMq5FpcfVRSoeyU3D3TUdVyk9zucR31' + ); + expect(response.header.payload_round).toBeDefined(); + expect(response.header.payload_round).toEqual(0); + expect(response.header.liquidity_baking_escape_vote).toBeDefined(); + expect(response.header.liquidity_baking_escape_vote).toBeFalsy(); + + done(); + }); + + it('should fetch a block and access new properties in metadata, proto 12', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockIthacanetResponse)); + + const response = await client.getBlock(); + + expect(response.metadata.proposer).toBeDefined(); + expect(response.metadata.proposer).toEqual('tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9'); + expect(response.metadata.balance_updates![0].category).toBeDefined(); + + done(); + }); + + it('should access new properties of the operation type endorsement, proto 12', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockIthacanetResponse)); + + const response = await client.getBlock(); + + expect(response.operations[0][0].contents[0].kind).toEqual(OpKind.ENDORSEMENT); + const contentEndorsement = response.operations[0][0] + .contents[0] as OperationContentsAndResultEndorsement; + expect(contentEndorsement.slot).toBeDefined(); + expect(contentEndorsement.slot).toEqual(0); + expect(contentEndorsement.round).toBeDefined(); + expect(contentEndorsement.round).toEqual(0); + expect(contentEndorsement.block_payload_hash).toBeDefined(); + expect(contentEndorsement.block_payload_hash).toEqual( + 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6' + ); + + expect(contentEndorsement.metadata.balance_updates).toEqual([]); + expect(contentEndorsement.metadata.endorsement_power).toBeDefined(); + expect(contentEndorsement.metadata.endorsement_power).toEqual(206); + + done(); + }); + + it('should access new properties of the operation type set_deposits_limit, proto 12', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockIthacanetResponse)); + + const response = await client.getBlock(); + + expect(response.operations[3][0].contents[0].kind).toEqual(OpKind.SET_DEPOSITS_LIMIT); + const content = response.operations[3][0] + .contents[0] as OperationContentsAndResultSetDepositsLimit; + expect(content.source).toEqual('tz2FViF6XzJ4PqD5TTuaAtZScmiwpJBGBpSh'); + expect(content.fee).toEqual('1500'); + expect(content.counter).toEqual('146662'); + expect(content.gas_limit).toEqual('1000'); + expect(content.storage_limit).toEqual('10000'); + expect(content.limit).toBeDefined(); + expect(content.limit).toEqual('3'); + expect(content.metadata.balance_updates![0].kind).toEqual('contract'); + expect(content.metadata.balance_updates![0].contract).toBeDefined(); + expect(content.metadata.balance_updates![0].contract).toEqual( + 'tz2FViF6XzJ4PqD5TTuaAtZScmiwpJBGBpSh' + ); + expect(content.metadata.balance_updates![0].change).toBeDefined(); + expect(content.metadata.balance_updates![0].change).toEqual('-1500'); + expect(content.metadata.balance_updates![0].origin).toBeDefined(); + expect(content.metadata.balance_updates![0].origin).toEqual('block'); + expect(content.metadata.balance_updates![0].category).toBeUndefined(); + expect(content.metadata.balance_updates![0].delegate).toBeUndefined(); + expect(content.metadata.balance_updates![0].cycle).toBeUndefined(); + + expect(content.metadata.operation_result.status).toEqual('applied'); + expect(content.metadata.operation_result.consumed_gas).toBeDefined(); + expect(content.metadata.operation_result.consumed_gas).toEqual('1000'); + expect(content.metadata.operation_result.consumed_milligas).toBeDefined(); + expect(content.metadata.operation_result.consumed_milligas).toEqual('1000000'); + + done(); + }); + + it('should access the properties of the operation type tx_rollup_origination, proto 13', async (done) => { + 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'); + done(); + }); + + it('should access the properties of the operation type tx_rollup_submit_batch, proto13', async (done) => { + 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'); + done(); + }); + + it('should access the properties of the operation type tx_rollup_commit, proto13', async (done) => { + 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'); + done(); + }); + + it('should access the properties of the operation type tx_rollup_finalize_commitment, proto13', async (done) => { + 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); + done(); + }); + + it('should access the properties of the operation type tx_rollup_dispatch_tickets, proto13', async (done) => { + 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'); + + done(); + }); + + it('should access the properties of the operation type tx_rollup_remove_commitment, proto13', async (done) => { + 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); + done(); + }); + + it('should access the properties of the operation type tx_rollup_rejection, proto13', async (done) => { + 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'); + + done(); + }); + + it('should access the properties of operation type tx_rollup_return_bond, proto13', async (done) => { + 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'); + + done(); + }); + + it('should be able to access the properties of operation type transfer_ticket, proto14', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockMondaynetResponse)); + const response = await client.getBlock(); + const content = response.operations[3][0] + .contents[1] as OperationContentsAndResultTransferTicket; + + expect(content.kind).toEqual(OpKind.TRANSFER_TICKET); + expect(content.source).toEqual('tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa'); + expect(content.fee).toEqual('708'); + expect(content.counter).toEqual('1826'); + expect(content.gas_limit).toEqual('5009'); + expect(content.storage_limit).toEqual('130'); + expect(content.ticket_amount).toEqual('2'); + expect(content.destination).toEqual('KT1BnDCAv62hqTQ3kDnMxWGKVpEgdQgX3TPm'); + expect(content.entrypoint).toEqual('default'); + expect(content.ticket_contents).toEqual({ string: 'foobar' }); + expect(content.ticket_ty).toEqual({ prim: 'string' }); + expect(content.ticket_ticketer).toEqual('KT1P57aaa5RgxqMdgoUoerWg8HVwXjbP2vxS'); + + expect(content.metadata.balance_updates).toBeDefined(); + + expect(content.metadata.balance_updates![0].kind).toEqual('contract'); + expect(content.metadata.balance_updates![0].contract).toEqual( + 'tz1TNiFHBzrJjVkXXzigJLxGaNrcgREe7Hwa' + ); + expect(content.metadata.balance_updates![0].change).toEqual('-708'); + 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('708'); + 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_milligas).toEqual('2122881'); + expect(content.metadata.operation_result.paid_storage_size_diff).toEqual('66'); + done(); + }); + + it('should be able to access the properties of operation type increase_paid_storage, proto14', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockKathmandunetResponse)); + + const response = await client.getBlock(); + const content = response.operations[3][0] + .contents[0] as OperationContentsAndResultIncreasePaidStorage; + + expect(content.kind).toEqual(OpKind.INCREASE_PAID_STORAGE); + expect(content.source).toEqual('tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG'); + expect(content.fee).toEqual('349'); + expect(content.counter).toEqual('108123'); + expect(content.gas_limit).toEqual('1000'); + expect(content.storage_limit).toEqual('0'); + expect(content.amount).toEqual('2'); + expect(content.destination).toEqual('KT1Vjr5PFC2Qm5XbSQZ8MdFZLgYMzwG5WZNh'); + + expect(content.metadata.balance_updates).toBeDefined(); + + expect(content.metadata.balance_updates![0].kind).toEqual('contract'); + expect(content.metadata.balance_updates![0].contract).toEqual( + 'tz2RVendfy3AQGEBwrhXF4kwyRiJUpa7qLnG' + ); + expect(content.metadata.balance_updates![0].change).toEqual('-349'); + expect(content.metadata.balance_updates![1].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('349'); + 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_milligas).toEqual('1000000'); + done(); + }); + + it('should be able to access the properties of internal operation type event, proto14', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockKathmandunetResponse)); + + const response = await client.getBlock(); + const content = response.operations[3][1] + .contents[0] as OperationContentsAndResultTransaction; + + expect(content.metadata.internal_operation_results).toBeDefined(); + expect(content.metadata.internal_operation_results![0].kind).toEqual(OpKind.EVENT); + expect(content.metadata.internal_operation_results![0].source).toEqual( + 'KT1D7mKRckD2ZoWGcGtUvBpDxb48WxpnLu1Q' + ); + expect(content.metadata.internal_operation_results![0].nonce).toEqual(0); + + expect(content.metadata.internal_operation_results![0].amount).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].destination).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].parameters).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].public_key).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].balance).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].delegate).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].value).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].limit).toBeUndefined(); + expect(content.metadata.internal_operation_results![0].script).toBeUndefined(); + + expect(content.metadata.internal_operation_results![0].type).toBeDefined(); + expect(content.metadata.internal_operation_results![0].type).toEqual({ + prim: 'or', + args: [{ prim: 'nat' }, { prim: 'string' }], + }); + expect(content.metadata.internal_operation_results![0].tag).toBeDefined(); + expect(content.metadata.internal_operation_results![0].tag).toEqual('event'); + expect(content.metadata.internal_operation_results![0].payload).toBeDefined(); + expect(content.metadata.internal_operation_results![0].payload).toEqual({ + prim: 'Left', + args: [{ int: '10' }], + }); + expect(content.metadata.internal_operation_results![0].result).toBeDefined(); + + const internalResult = content.metadata.internal_operation_results![0] + .result as OperationResultEvent; + expect(internalResult.status).toEqual('applied'); + expect(internalResult.consumed_milligas).toBeDefined(); + expect(internalResult.consumed_milligas).toEqual('1000000'); + expect(internalResult.errors).toBeUndefined(); + + done(); + }); + + it('should be able to access the properties of operation type drain_delegate, proto15', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockLimanetResponse)); + + const response = await client.getBlock(); + const content = response.operations[3][0] + .contents[1] as OperationContentsAndResultDrainDelegate; + + expect(content.kind).toEqual(OpKind.DRAIN_DELEGATE); + expect(content.consensus_key).toEqual('tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj'); + expect(content.delegate).toEqual('tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv'); + expect(content.destination).toEqual('tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj'); + + expect(content.metadata.balance_updates).toBeDefined(); + + expect(content.metadata.balance_updates![0].kind).toEqual('contract'); + expect(content.metadata.balance_updates![0].contract).toEqual( + 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv' + ); + expect(content.metadata.balance_updates![0].change).toEqual('-15525772494'); + expect(content.metadata.balance_updates![0].origin).toEqual('block'); + + expect(content.metadata.balance_updates![1].kind).toEqual('contract'); + expect(content.metadata.balance_updates![1].contract).toEqual( + 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj' + ); + expect(content.metadata.balance_updates![1].change).toEqual('15525772494'); + expect(content.metadata.balance_updates![1].origin).toEqual('block'); + + expect(content.metadata.balance_updates![2].kind).toEqual('contract'); + expect(content.metadata.balance_updates![2].contract).toEqual( + 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv' + ); + expect(content.metadata.balance_updates![2].change).toEqual('-156825984'); + expect(content.metadata.balance_updates![2].origin).toEqual('block'); + + expect(content.metadata.balance_updates![3].kind).toEqual('contract'); + expect(content.metadata.balance_updates![3].contract).toEqual( + 'tz1hoyMUiJYYr4FRPMU8Z7WJzYkqgjygjaTy' + ); + expect(content.metadata.balance_updates![3].change).toEqual('156825984'); + expect(content.metadata.balance_updates![3].origin).toEqual('block'); + + done(); + }); + + it('should be able to access the properties of operation type update_consensus_key, proto15', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(blockLimanetResponse)); + + const response = await client.getBlock(); + const content = response.operations[3][0] + .contents[0] as OperationContentsAndResultUpdateConsensusKey; + + expect(content.kind).toEqual(OpKind.UPDATE_CONSENSUS_KEY); + expect(content.source).toEqual('tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv'); + expect(content.fee).toEqual('369'); + expect(content.counter).toEqual('19043'); + expect(content.gas_limit).toEqual('1100'); + expect(content.storage_limit).toEqual('0'); + expect(content.pk).toEqual('edpkti5K5JbdLpp2dCqiTLoLQqs5wqzeVhfHVnNhsSCuoU8zdHYoY7'); + + expect(content.metadata.balance_updates).toBeDefined(); + + expect(content.metadata.balance_updates![0].kind).toEqual('contract'); + expect(content.metadata.balance_updates![0].contract).toEqual( + 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv' + ); + expect(content.metadata.balance_updates![0].change).toEqual('-369'); + 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('369'); + expect(content.metadata.balance_updates![1].origin).toEqual('block'); + + expect(content.metadata.operation_result.status).toEqual('applied'); + expect(content.metadata.operation_result.consumed_milligas).toEqual('1000000'); + done(); + }); + it('should contain ticket_updates for transactions updating ticket storage', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(ticketUpdatesResponse)); + + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultTransaction; + const ticketUpdates = + content.metadata.operation_result.ticket_updates && + content.metadata.operation_result.ticket_updates[0]; + + expect(ticketUpdates).toBeDefined(); + expect(ticketUpdates?.ticket_token.ticketer).toEqual('KT1JGcC8DuWHcShu6XvtfgKVnV2zcYsZ4TVH'); + expect(ticketUpdates?.updates[0].account).toEqual('KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj'); + expect(ticketUpdates?.updates[0].amount).toEqual('-2'); + done(); + }); + // may be removed + it('should contain ticket_receipt for transactions updating ticket storage', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(ticketUpdatesResponse)); + + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultTransaction; + const internalContent = + content.metadata.internal_operation_results && + (content.metadata.internal_operation_results[0].result as OperationResultTransaction); + const ticketReceipt = internalContent?.ticket_receipt && internalContent.ticket_receipt[0]; + + expect(ticketReceipt).toBeDefined(); + expect(ticketReceipt?.ticket_token.ticketer).toEqual('KT1JGcC8DuWHcShu6XvtfgKVnV2zcYsZ4TVH'); + expect(ticketReceipt?.updates[0].account).toEqual('KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj'); + expect(ticketReceipt?.updates[0].amount).toEqual('1'); + done(); + }); + }); + + describe('getBakingRights', () => { + it('query the right url and data', async (done) => { + httpBackend.createRequest.mockResolvedValue([ + { + level: 547387, + delegate: 'tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN', + priority: 4, + estimated_time: '2019-08-02T09:48:56Z', + consensus_key: 'tz1asyQFDgjv2muoaiZ5x5U5RPpaNz33Z2F6', + }, + { + level: 547387, + delegate: 'tz1NMdMmWZN8QPB8pY4ddncACDg1cHi1xD2e', + priority: 8, + estimated_time: '2019-08-02T09:53:56Z', + consensus_key: 'tz1N4GvBKsfdBdtgbNeQQLv52L7YB4FBZtVf', + }, + ]); + const result = await client.getBakingRights({ + delegate: ['tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN', 'tz1NMdMmWZN8QPB8pY4ddncACDg1cHi1xD2e'], + }); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + query: { + delegate: [ + 'tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN', + 'tz1NMdMmWZN8QPB8pY4ddncACDg1cHi1xD2e', + ], + }, + url: 'root/chains/test/blocks/head/helpers/baking_rights', + }); + + expect(result[0].delegate).toEqual('tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN'); + expect(result[0].estimated_time).toEqual('2019-08-02T09:48:56Z'); + expect(result[0].consensus_key).toEqual('tz1asyQFDgjv2muoaiZ5x5U5RPpaNz33Z2F6'); + done(); + }); + }); + + describe('getEndorsingRights', () => { + it('query the right url and data', async (done) => { + httpBackend.createRequest.mockResolvedValue([ + { + level: 547386, + delegate: 'tz3WMqdzXqRWXwyvj5Hp2H7QEepaUuS7vd9K', + slots: [27], + estimated_time: '2019-08-02T09:42:56Z', + }, + { + level: 547386, + delegate: 'tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN', + slots: [23, 12, 0], + estimated_time: '2019-08-02T09:42:56Z', + }, + { + level: 547386, + delegate: 'tz3RB4aoyjov4KEVRbuhvQ1CKJgBJMWhaeB8', + slots: [31, 17, 13], + estimated_time: '2019-08-02T09:42:56Z', + }, + { + level: 547386, + delegate: 'tz3NExpXn9aPNZPorRE4SdjJ2RGrfbJgMAaV', + slots: [24, 9, 1], + estimated_time: '2019-08-02T09:42:56Z', + }, + ]); + const result = await client.getEndorsingRights(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + query: {}, + url: 'root/chains/test/blocks/head/helpers/endorsing_rights', + }); + + expect(result[1].delegate).toEqual('tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN'); + expect(result[1].estimated_time).toEqual('2019-08-02T09:42:56Z'); + expect(result[1].slots!.length).toEqual(3); + done(); + }); + + it('query the right url and data (with consensus key in delegates)', async (done) => { + httpBackend.createRequest.mockResolvedValue([ + { + level: 547386, + delegates: [ + { + delegate: 'tz3WMqdzXqRWXwyvj5Hp2H7QEepaUuS7vd9K', + first_slot: 1, + endorsing_power: 1, + consensus_key: 'tz1asyQFDgjv2muoaiZ5x5U5RPpaNz33Z2F6', + }, + ], + slots: [27], + estimated_time: '2019-08-02T09:42:56Z', + }, + ]); + const result = await client.getEndorsingRights(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + query: {}, + url: 'root/chains/test/blocks/head/helpers/endorsing_rights', + }); + + expect(result[0].delegates).toBeDefined(); + expect(result[0].delegates![0].delegate).toEqual('tz3WMqdzXqRWXwyvj5Hp2H7QEepaUuS7vd9K'); + expect(result[0].delegates![0].first_slot).toEqual(1); + expect(result[0].delegates![0].endorsing_power).toEqual(1); + expect(result[0].delegates![0].consensus_key).toEqual('tz1asyQFDgjv2muoaiZ5x5U5RPpaNz33Z2F6'); + expect(result[0].estimated_time).toEqual('2019-08-02T09:42:56Z'); + expect(result[0].slots!.length).toEqual(1); + done(); + }); + }); + + describe('getBallotList', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve([ + { + pkh: 'tz3e75hU4EhDU3ukyJueh5v6UvEHzGwkg3yC', + ballot: 'yay', + }, + { + pkh: 'tz1iJ4qgGTzyhaYEzd1RnC6duEkLBd1nzexh', + ballot: 'yay', + }, + { + pkh: 'tz1hx8hMmmeyDBi6WJgpKwK4n5S2qAEpavx2', + ballot: 'yay', + }, + { + pkh: 'tz1gvrUnfTfEcRW6qcgB6FJdZnAxv4HG1rj9', + ballot: 'yay', + }, + { + pkh: 'tz1go7f6mEQfT2xX2LuHAqgnRGN6c2zHPf5c', + ballot: 'yay', + }, + { + pkh: 'tz1gCx1V63bSaQnPZoQreqNgVLuFMzyMcqry', + ballot: 'yay', + }, + ]) + ); + const response = await client.getBallotList(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/ballot_list', + }); + expect(response[2].pkh).toEqual('tz1hx8hMmmeyDBi6WJgpKwK4n5S2qAEpavx2'); + + done(); + }); + }); + + describe('getBallots', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve({ yay: 5943, nay: 0, pass: 0 })); + const response = await client.getBallots(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/ballots', + }); + expect(response.yay).toEqual(new BigNumber(5943)); + + done(); + }); + }); + + describe('getCurrentProposal', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve('PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU') + ); + const response = await client.getCurrentProposal(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/current_proposal', + }); + expect(response).toEqual('PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU'); + + done(); + }); + }); + + describe('getCurrentQuorum', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(7291)); + const response = await client.getCurrentQuorum(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/current_quorum', + }); + expect(response).toEqual(7291); + + done(); + }); + }); + + describe('getVotesListings', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve([ + { + pkh: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m', + voting_power: 3726, + }, + { + pkh: 'tz2Q7Km98GPzV1JLNpkrQrSo5YUhPfDp6LmA', + rolls: 2, + }, + { + pkh: 'tz2PdGc7U5tiyqPgTSgqCDct94qd6ovQwP6u', + rolls: 73, + }, + { + pkh: 'tz2KrmHRWu7b7Vr3GYQ3SJ41xaW64PiqWBYm', + rolls: 17, + }, + { + pkh: 'tz2JMPu9yVKuX2Au8UUbp7YrKBZJSdYhgwwu', + rolls: 2, + }, + { + pkh: 'tz2FCNBrERXtaTtNX6iimR1UJ5JSDxvdHM93', + rolls: 233, + }, + { + pkh: 'tz2E3BvcMiGvFEgNVdsAiwVvPHcwJDTA8wLt', + rolls: 14, + }, + { + pkh: 'tz3eQFJL9Pw7EXkuEVSYTVtuwtfjhUU3xqi1', + rolls: 1, + }, + { + pkh: 'tz3e7LbZvUtoXhpUD1yb6wuFodZpfYRb9nWJ', + rolls: 25, + }, + { + pkh: 'tz3e75hU4EhDU3ukyJueh5v6UvEHzGwkg3yC', + rolls: 334, + }, + ]) + ); + const response = await client.getVotesListings(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/listings', + }); + expect(response[0].voting_power).toEqual(new BigNumber(3726)); + expect(response[0].rolls).toBeUndefined(); + expect(response[4].pkh).toEqual('tz2JMPu9yVKuX2Au8UUbp7YrKBZJSdYhgwwu'); + expect(response[4].voting_power).toBeUndefined(); + + done(); + }); + }); + + describe('getProposals', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve([ + ['PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU', 2832], + ['PsBABY5nk4JhdEv1N1pZbt6m6ccB9BfNqa23iKZcHBh23jmRS9f', 9492], + ]) + ); + const response = await client.getProposals(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/proposals', + }); + expect(response[0][1]).toEqual(new BigNumber(2832)); + + done(); + }); + }); + + describe('getEntrypoints', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockReturnValue({ entrypoints: {} }); + const response = await client.getEntrypoints(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/entrypoints`, + }); + expect(response).toEqual({ entrypoints: {} }); + done(); + }); + }); + + describe('runOperation', () => { + it('should query the right url and data', async (done) => { + const testData = {}; + + httpBackend.createRequest.mockResolvedValue({ content: {} }); + await client.runOperation(testData as any); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/run_operation', + }); + + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual(testData); + + done(); + }); + + it('should use enum for property category to avoid space in name', async (done) => { + const testData = {}; + + httpBackend.createRequest.mockResolvedValue({ + contents: [ + { + metadata: { + balance_updates: [ + { + category: 'storage fees', + kind: 'burned', + origin: 'block', + }, + { + category: 'block fees', + change: '374', + kind: 'accumulator', + origin: 'block', + }, + { + category: 'legacy_rewards', + }, + ], + }, + }, + ], + }); + const response = await client.runOperation(testData as RPCRunOperationParam); + + const balanceUpdate = + 'metadata' in response.contents[0] + ? (response.contents[0]['metadata'][ + '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 + ); + + done(); + }); + }); + + describe('simulateOperation', () => { + it('should query the right url and data', async (done) => { + const testData = {}; + + httpBackend.createRequest.mockResolvedValue({ content: {} }); + await client.simulateOperation(testData as any); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/simulate_operation', + }); + + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual(testData); + done(); + }); + + it('should use enum for property category to avoid space in name', async (done) => { + const testData = {}; + + httpBackend.createRequest.mockResolvedValue({ + contents: [ + { + metadata: { + balance_updates: [ + { + category: 'storage fees', + kind: 'burned', + origin: 'block', + }, + { + category: 'block fees', + change: '374', + kind: 'accumulator', + origin: 'block', + }, + { + category: 'legacy_rewards', + }, + ], + }, + }, + ], + }); + const response = await client.simulateOperation(testData as RPCSimulateOperationParam); + + const balanceUpdate = + 'metadata' in response.contents[0] + ? (response.contents[0]['metadata'][ + '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 + ); + + done(); + }); + }); + + describe('runScriptView', () => { + it('query the right url and data', async (done) => { + const testData: RPCRunScriptViewParam = { + contract: 'test', + view: 'test', + chain_id: 'test', + input: { + int: '0', + }, + }; + + await client.runScriptView(testData); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/run_script_view', + }); + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({ + ...testData, + unparsing_mode: 'Readable', + }); + done(); + }); + + it('query the right url and data with unparsing_mode overriden', async (done) => { + const testData: RPCRunScriptViewParam = { + contract: 'test', + view: 'test', + chain_id: 'test', + input: { + int: '0', + }, + unparsing_mode: 'Optimized', + }; + + await client.runScriptView(testData); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/run_script_view', + }); + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual(testData); + done(); + }); + }); + + describe('runView', () => { + it('should query the right url and data', async (done) => { + const testData: RPCRunViewParam = { + contract: 'test', + entrypoint: 'test', + chain_id: 'test', + input: { + string: 'test', + }, + }; + + await client.runView(testData); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/run_view', + }); + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual({ + contract: 'test', + entrypoint: 'test', + chain_id: 'test', + input: { + string: 'test', + }, + unparsing_mode: 'Readable', + }); + done(); + }); + + it('should query the right url and data with unparsing_mode overriden', async (done) => { + const testData: RPCRunViewParam = { + contract: 'test', + entrypoint: 'test', + chain_id: 'test', + input: { + string: 'test', + }, + unparsing_mode: 'Optimized', + }; + + await client.runView(testData); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/run_view', + }); + expect(httpBackend.createRequest.mock.calls[0][1]).toEqual(testData); + done(); + }); + }); + + describe('packData', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockResolvedValue({ packed: 'cafe', gas: 'unaccounted' }); + const response = await client.packData({ + data: { string: 'test' }, + type: { prim: 'string' }, + }); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: 'root/chains/test/blocks/head/helpers/scripts/pack_data', + }); + expect(response).toEqual({ packed: 'cafe', gas: 'unaccounted' }); + + done(); + }); + + it('should return a big number for gas when it is a big number', async (done) => { + httpBackend.createRequest.mockResolvedValue({ packed: 'cafe', gas: '2' }); + const response = await client.packData({ + data: { string: 'test' }, + type: { prim: 'string' }, + }); + expect(response).toEqual({ packed: 'cafe', gas: new BigNumber(2) }); + expect(response.gas).toBeInstanceOf(BigNumber); + + done(); + }); + + it('should return undefined for gas when it is missing', async (done) => { + httpBackend.createRequest.mockResolvedValue({ packed: 'cafe' }); + const response = await client.packData({ + data: { string: 'test' }, + type: { prim: 'string' }, + }); + expect(response).toEqual({ packed: 'cafe' }); + expect(response.gas).toBeUndefined(); + done(); + }); + }); + + describe('getBigMapExpr', () => { + it('should query the right url and data', async (done) => { + await client.getBigMapExpr('1', '2'); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/big_maps/1/2', + }); + done(); + }); + }); + + describe('getRpcUrl', () => { + it('should return the RPC Url', () => { + const url = 'https://mainnet.api.tez.ie/'; + const rpcUrlMainnet = new RpcClient(url).getRpcUrl(); + expect(rpcUrlMainnet).toEqual('https://mainnet.api.tez.ie/'); + const rpcUrlCarthagenet = new RpcClient('https://api.tez.ie/rpc/carthagenet').getRpcUrl(); + expect(rpcUrlCarthagenet).toEqual('https://api.tez.ie/rpc/carthagenet'); + }); + }); + + describe('getCurrentPeriod', () => { + it('should query the right url and data', async (done) => { + const mockedResponse = { + voting_period: { + index: 87, + kind: 'proposal', + start_position: 89088, + }, + position: 902, + remaining: 121, + }; + + httpBackend.createRequest.mockReturnValue(Promise.resolve(mockedResponse)); + const response = await client.getCurrentPeriod(); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/current_period', + }); + expect(response).toEqual(mockedResponse); + + done(); + }); + }); + + describe('getSuccessorPeriod', () => { + it('should query the right url and data', async (done) => { + const mockedResponse = { + voting_period: { + index: 87, + kind: 'proposal', + start_position: 89088, + }, + position: 902, + remaining: 121, + }; + + httpBackend.createRequest.mockReturnValue(Promise.resolve(mockedResponse)); + const response = await client.getSuccessorPeriod(); + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/votes/successor_period', + }); + expect(response).toEqual(mockedResponse); + + done(); + }); + }); + + describe('getSaplingDiffById', () => { + it('should query the right url', async (done) => { + httpBackend.createRequest.mockResolvedValue({ + root: 'fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493e', + commitments_and_ciphertexts: [], + nullifiers: [], + }); + const response = await client.getSaplingDiffById('123'); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/sapling/123/get_diff', + }); + + expect(response.root).toEqual( + 'fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493e' + ); + expect(response.commitments_and_ciphertexts).toEqual([]); + expect(response.nullifiers).toEqual([]); + + done(); + }); + }); + + describe('getSaplingDiffByContract', () => { + it('should query the right url', async (done) => { + httpBackend.createRequest.mockResolvedValue({ + root: 'fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493e', + commitments_and_ciphertexts: [], + nullifiers: [], + }); + const response = await client.getSaplingDiffByContract( + 'KT18tv2siXNxfc3FkCoS4esPuLqvaYrcGV92' + ); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head/context/contracts/KT18tv2siXNxfc3FkCoS4esPuLqvaYrcGV92/single_sapling_get_diff', + }); + + expect(response.root).toEqual( + 'fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493e' + ); + expect(response.commitments_and_ciphertexts).toEqual([]); + expect(response.nullifiers).toEqual([]); + + done(); + }); + }); + + describe('getProtocols', () => { + it('should query the right url and return a ProtocolsResponse', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx', + next_protocol: 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx', + }) + ); + const protocols = await client.getProtocols(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/protocols`, + }); + expect(protocols.next_protocol).toEqual( + 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx' + ); + expect(protocols.protocol).toEqual('PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx'); + + done(); + }); + }); + + describe('getTxRollupState', () => { + it('should query the correct url and return a rollup state response', async (done) => { + 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); + + done(); + }); + }); + + describe('getTxRollupInbox', () => { + it('should query the correct url and return a rollup inbox response', async (done) => { + 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' + ); + + done(); + }); + }); + + describe('smartRollupOriginate', () => { + it('should have correct types to access smart_rollup_originate results', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupOriginateResponse)); + const response = await client.getBlock(); + const content = response.operations[1][0] + .contents[0] as OperationContentsAndResultSmartRollupOriginate; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_ORIGINATE); + expect(content.source).toEqual('tz1NyHPL2CidRquW3a9zPGde59YYtMDyyzCg'); + expect(content.fee).toEqual('1497'); + expect(content.counter).toEqual('19783'); + expect(content.gas_limit).toEqual('2849'); + expect(content.storage_limit).toEqual('6572'); + expect(content.pvm_kind).toEqual('wasm_2_0_0'); + expect(content.kernel).toEqual( + '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' + ); + expect(content.origination_proof).toEqual( + '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' + ); + expect(content.parameters_ty).toEqual({ prim: 'bytes' }); + + const soruResult = content.metadata.operation_result; + + expect(soruResult.status).toEqual('applied'); + expect(soruResult.address).toEqual('sr1K3AUoYanTUup53MCb8DkbvLsiAmFuXfFm'); + expect(soruResult.genesis_commitment_hash).toEqual( + 'src14Khe1dnFbwrtTSEi4XWxxM7ej7L29YmduJhQY7U24Y523dmMtw' + ); + expect(soruResult.consumed_milligas).toEqual('2748269'); + expect(soruResult.size).toEqual('6552'); + done(); + }); + }); + + describe('smartRollupAddMessages', () => { + it('should have correct types to access smart_rollup_add_messages results', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupAddMessagesResponse)); + const response = await client.getBlock(); + const content = response.operations[1][0] + .contents[0] as OperationContentsAndResultSmartRollupAddMessages; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_ADD_MESSAGES); + expect(content.source).toEqual('tz2Q3yRaczTqZVf3ZQvwiiTqKjhJFyDzeRSz'); + expect(content.fee).toEqual('398'); + expect(content.counter).toEqual('12191'); + expect(content.gas_limit).toEqual('1103'); + expect(content.storage_limit).toEqual('0'); + expect(content.message[0]).toEqual( + '0000000031010000000b48656c6c6f20776f726c6401cc9e352a850d7475bf9b6cf103aa17ca404bc9dd000000000764656661756c74' + ); + + const soruResult = content.metadata.operation_result; + + expect(soruResult.status).toEqual('applied'); + expect(soruResult.consumed_milligas).toEqual('1002777'); + done(); + }); + }); + + describe('smartRollupOutboxMessages', () => { + it('should have correct types to access smart_rollup_execute_outbox_message results', async (done) => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve(smartRollupExecuteOutboxMessageResponse) + ); + const response = await client.getBlock(); + const content = response.operations[1][0] + .contents[0] as OperationContentsAndResultSmartRollupExecuteOutboxMessage; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); + expect(content.source).toEqual('tz1adKm6kWEkiejZ9WYpuHvBCgUewtCxpqRF'); + expect(content.fee).toEqual('1618'); + expect(content.counter).toEqual('13'); + expect(content.gas_limit).toEqual('6485'); + expect(content.storage_limit).toEqual('36'); + expect(content.rollup).toEqual('sr1J4MBaQqTGNwUqfcUusy3xUmH6HbMK7kYy'); + expect(content.cemented_commitment).toEqual( + 'src13aUmJ5fEVJJM1qH1n9spuppXVAWc8wmHpTaC81pz5rrZN5e628' + ); + expect(content.output_proof).toEqual( + '030002268259c7843df9a14e2cd5b4d187d3d603a535c64f0cc3ce3c9a3bdd5ecb3d95268259c7843df9a14e2cd5b4d187d3d603a535c64f0cc3ce3c9a3bdd5ecb3d950005820764757261626c65d07eb5216be3fcfd8317136e559c80d1a5eeb8f7b684c2101e92efb2b1b9c5324603746167c00800000004536f6d650003c004a99c0224241978be1e088cf42eaca4bc53a6266842bcbf0ecad4400abeb2e5820576616c7565810370766d8107627566666572738205696e707574820468656164c00100066c656e677468c00100066f75747075740004820132810a6c6173745f6c6576656cc0040000087a0133810f76616c69646974795f706572696f64c00400013b0082013181086f7574626f7865730028001700090006820432313337820468656164c00100066c656e677468c0010004323133380003810468656164c001008208636f6e74656e7473810130c03a000000360000000031010000000b48656c6c6f20776f726c6401bdb6f61e4f12c952f807ae7d3341af5367887dac000000000764656661756c74066c656e677468c00101c0c619e3af574a846a44f61eb98ae7a0007d1e76039f6729e3e113c2f993dad600c0b7b6d5ebea80e0e4b148815c768de7570b7a5ad617a2bf3a3f989df81be9a224c055b19953c4aa26132da57ef8205c8ab61b518fb6e4c87c5853298042d17c98bbc08bac9f033f9d823c04b4de152892edc0767d0634c51c5d311f46a127f730f6950134810d6d6573736167655f6c696d6974c002a401047761736dd04822a3ddd2900dcb30a958d10818ea3d90407a79f88eab967063bac2452e99c7268259c7843df9a14e2cd5b4d187d3d603a535c64f0cc3ce3c9a3bdd5ecb3d950000085a000000000031010000000b48656c6c6f20776f726c6401bdb6f61e4f12c952f807ae7d3341af5367887dac000000000764656661756c74' + ); + + const soruResult = content.metadata.operation_result; + + expect(soruResult.status).toEqual('applied'); + expect(soruResult.consumed_milligas).toEqual('4731015'); + expect(soruResult.ticket_updates).toEqual([]); + expect(soruResult.paid_storage_size_diff).toEqual('5'); + done(); + }); + }); + + describe('smartRollupPublish', () => { + it('should have correct types to access smart_rollup_publish results', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupPublishResponse)); + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultSmartRollupPublish; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_PUBLISH); + expect(content.source).toEqual('tz1gCe1sFpppbGGVwCt5jLRqDS9FD1W4Qca4'); + expect(content.fee).toEqual('964'); + expect(content.counter).toEqual('41266'); + expect(content.gas_limit).toEqual('6418'); + expect(content.storage_limit).toEqual('0'); + expect(content.rollup).toEqual('sr1AE6U3GNzE8iKzj6sKS5wh1U32ogeULCoN'); + + const commitment = content.commitment; + expect(commitment.compressed_state).toEqual( + 'srs13FywcbcZV9VvHxdVkYK83Ch4477cqHMgM8d5oT955yf4XXMvKS' + ); + expect(commitment.inbox_level).toEqual(197151); + expect(commitment.predecessor).toEqual( + 'src12i7dL2z9VbgshFDdGFP5TPBoJu6WnZNWJXGa1QQgPTErVPPtd8' + ); + expect(commitment.number_of_ticks).toEqual('880000000000'); + + const soruResult = content.metadata.operation_result; + expect(soruResult.status).toEqual('applied'); + expect(soruResult.consumed_milligas).toEqual('6317837'); + expect(soruResult.staked_hash).toEqual( + 'src13TanyZ7RvSULqVb2tjx1zRVw2jyJC2ToHLz1ZKg38sZ4HBYdSN' + ); + expect(soruResult.published_at_level).toEqual(197154); + expect(soruResult.balance_updates).toEqual([]); + + done(); + }); + + it('should have correct access to metadata.operation_result.balanceUpdate in smart_rollup_publish', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupPublishResponse)); + const response = await client.getBlock(); + const contentWithDiffBalanceUpdate = response.operations[0][1] + .contents[0] as OperationContentsAndResultSmartRollupPublish; + + const balanceUpdates = + contentWithDiffBalanceUpdate.metadata.operation_result.balance_updates ?? []; + + const diffBalanceUpdate = balanceUpdates[1]; + expect(diffBalanceUpdate.bond_id?.smart_rollup).toEqual( + 'sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x' + ); + done(); + }); + }); + + describe('smartRollupCement', () => { + it('shoud have correct types to access smart_rollup_cement results', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupCementResponse)); + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultSmartRollupCement; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_CEMENT); + expect(content.source).toEqual('tz1d5inEKUnAChSgScYuaJrtVmAZ9L5cKGSW'); + expect(content.fee).toEqual('977'); + expect(content.counter).toEqual('150010'); + 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; + + expect(soruResult.status).toEqual('applied'); + expect(soruResult.consumed_milligas).toEqual('6884964'); + expect(soruResult.inbox_level).toEqual(337913); + expect(soruResult.commitment_hash).toEqual( + 'src12wj4nwXiEkwYacLfkLR8X8Md76LNuMzwUgTwgLA9Y3DANaeRay' + ); + done(); + }); + }); + + describe('smartRollupRefute', () => { + it('should have correct types to access smart_rollup_refute results move with pvm_step', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupRefuteResponse)); + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultSmartRollupRefute; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_REFUTE); + expect(content.source).toEqual('tz1ZpuBypK6G754crXDZyoMPaVPoBmBsPda2'); + expect(content.fee).toEqual('2096'); + expect(content.counter).toEqual('32553'); + expect(content.gas_limit).toEqual('6299'); + expect(content.storage_limit).toEqual('0'); + expect(content.rollup).toEqual('sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x'); + expect(content.opponent).toEqual('tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC'); + + const refutation = content.refutation as SmartRollupRefutationMove; + if (refutation.refutation_kind !== SmartRollupRefutationOptions.MOVE) { + fail('expected refutation_kind: "move"'); + } + + expect(refutation.refutation_kind).toEqual('move'); + expect(refutation.choice).toEqual('176000000003'); + + const step = refutation.step; + if (Array.isArray(step)) { + fail('expected an object not an array'); + } + + expect(step.pvm_step).toEqual( + '03000298e4e3d5c88da366e885edf675ffd7a5087c8e0a2fcd508e7951113fe4c1491810067c06a78b88cb7c3e60c56b47ba9e14c922dbdbd4811ac6fee80a309620630005820764757261626c6582066b65726e656cd07d20c53bdd5b536a6be9c4cdad16e69a9af40b93a6564655fffd88bba050519008726561646f6e6c7982066b65726e656cd0a645771d9d5228a31312b282119c596699ccb6b60b93d759c2072a493ddbb5740c7761736d5f76657273696f6e8101408208636f6e74656e7473810130c10200322e302e30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066c656e677468c008000000000000000503746167c00800000004536f6d650003810370766d00050004000381166f7574626f785f76616c69646974795f706572696f64c00400013b0082136c6173745f746f705f6c6576656c5f63616c6cc00680c0abd38f05196d6178696d756d5f7265626f6f74735f7065725f696e707574c002e80781146f7574626f785f6d6573736167655f6c696d6974c002a401810c6d61785f6e625f7469636b73c00580dc9afd28820576616c7565810370766d8107627566666572738205696e7075740003810468656164c001008208636f6e74656e7473d06e2c0a5b371a53e76a9b7f221a5baa67170b3f9f43205fb06c0649123cec2358066c656e677468c00103066f75747075740004820132810a6c6173745f6c6576656cc0040000a33f0133810f76616c69646974795f706572696f64c00400013b0082013181086f7574626f786573d0ccbff4c181451166adb153f7a1631e9f036832f8e5c82acd8e8c12876eeeda870134810d6d6573736167655f6c696d6974c002a401047761736d00048205696e707574c0050000a33f0203746167c00b0000000770616464696e67820c63757272656e745f7469636bc00683c0abd38f050e7265626f6f745f636f756e746572c002e907' + ); + done(); + }); + + it('should have correct types to access smart_rollup_refute results start', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupRefuteResponse)); + const response = await client.getBlock(); + const content = response.operations[0][1] + .contents[0] as OperationContentsAndResultSmartRollupRefute; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_REFUTE); + expect(content.source).toEqual('tz1Qn5AXWB5vYPgzDXsunDbZ7tTUp9cFDaRp'); + expect(content.fee).toEqual('943'); + expect(content.counter).toEqual('25002'); + expect(content.gas_limit).toEqual('6109'); + expect(content.storage_limit).toEqual('0'); + expect(content.rollup).toEqual('sr1Ce7znpA1ea2YZca3v1CefxqXMhqYgDEXR'); + expect(content.opponent).toEqual('tz1VN3J6DyH712W1y13Uu1N8fxkt8RvMyqzm'); + + const refutation = content.refutation as SmartRollupRefutationStart; + + expect(refutation.refutation_kind).toEqual('start'); + expect(refutation.player_commitment_hash).toEqual( + 'src14Liog4xxPoZ55AgpBpeDweFSxHK6b3zbybhp7ChsWbM9g1Jsrd' + ); + expect(refutation.opponent_commitment_hash).toEqual( + 'src12q2zZyxuK5UeYPQYSutA6RPMv7sZDtJ7oAWxAytuJC3rjvWct6' + ); + done(); + }); + it('should have correct types to access smart_rollup_refute results move with dissection', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupRefuteResponse)); + const response = await client.getBlock(); + const content = response.operations[0][2] + .contents[0] as OperationContentsAndResultSmartRollupRefute; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_REFUTE); + expect(content.source).toEqual('tz1QD39GBmSzccuDxWMevj2gudiTX1pZL5kC'); + expect(content.fee).toEqual('1989'); + expect(content.counter).toEqual('32546'); + expect(content.gas_limit).toEqual('4333'); + expect(content.storage_limit).toEqual('0'); + expect(content.rollup).toEqual('sr1LhGA2zC9VcYALSifpRBCgDiQfDSQ6bb4x'); + expect(content.opponent).toEqual('tz1ZpuBypK6G754crXDZyoMPaVPoBmBsPda2'); + + const refutation = content.refutation; + if (refutation.refutation_kind !== SmartRollupRefutationOptions.MOVE) { + fail('Expected Refutation kind: "move"'); + } + + expect(refutation.refutation_kind).toEqual('move'); + expect(refutation.choice).toEqual('0'); + + const step = refutation.step; + if (!Array.isArray(step)) { + fail('expected step to be an array'); + } + expect(step[0]).toEqual({ + state: 'srs11y1ZCJfeWnHzoX3rAjcTXiphwg8NvqQhvishP3PU68jgSREuk6', + tick: '0', + }); + expect(step[1]).toEqual({ + state: 'srs12ti4nRqiqahBZedqjgnFx9ZK88KkSgpYD8ns5Q41UMEXGg9w3b', + tick: '22000000000', + }); + done(); + }); + }); + + describe('smartRollupRecoverBond', () => { + it('should have correct types to access smart_rollup_recover_bond results', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(smartRollupRecoverBondResponse)); + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultSmartRollupRecoverBond; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_RECOVER_BOND); + expect(content.source).toEqual('tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw'); + expect(content.fee).toEqual('1000000'); + expect(content.counter).toEqual('25156'); + expect(content.gas_limit).toEqual('4016'); + expect(content.storage_limit).toEqual('0'); + expect(content.rollup).toEqual('sr1EYxm4fQjr15TASs2Q7PgZ1LqS6unkZhHL'); + expect(content.staker).toEqual('tz1bTS4QDBnpQPmMPNM3rn7jN1hevkWDHSKw'); + done(); + }); + }); + + describe('smartRollupTimeout', () => { + it('should have correct types to access smart_rollup_timeout', async (done) => { + httpBackend.createRequest.mockResolvedValue(Promise.resolve(smartRollupTimeoutResponse)); + const response = await client.getBlock(); + const content = response.operations[0][0] + .contents[0] as OperationContentsAndResultSmartRollupTimeout; + + expect(content.kind).toEqual(OpKind.SMART_ROLLUP_TIMEOUT); + expect(content.source).toEqual('tz1TecRhYLVV9bTKRKU9g1Hhpb1Ymw3ynzWS'); + expect(content.fee).toEqual('753'); + expect(content.counter).toEqual('23077'); + expect(content.gas_limit).toEqual('4647'); + expect(content.storage_limit).toEqual('0'); + expect(content.rollup).toEqual('sr1QZkk1swognQW3dmiXvga3wVkEgBq7QFjE'); + + const stakers = content.stakers; + + expect(stakers.alice).toEqual('tz1TecRhYLVV9bTKRKU9g1Hhpb1Ymw3ynzWS'); + expect(stakers.bob).toEqual('tz1iFnSQ6V2d8piVMPMjtDNdkYNMaUfKwsoy'); + done(); + }); + }); + + describe('ticketBalance', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockResolvedValue('3'); + const response = await client.getTicketBalance(contractAddress, { + ticketer: contractAddress, + content_type: { prim: 'string ' }, + content: { string: 'ticket1' }, + }); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'POST', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/ticket_balance`, + }); + + expect(response).toEqual('3'); + done(); + }); + }); + + describe('ticketAllBalance', () => { + it('should query the right url and data', async (done) => { + httpBackend.createRequest.mockResolvedValue(ticketBalancesResponse); + const response = await client.getAllTicketBalances('KT1X6mCNdfQZSpyU9zZw9sWckPVJyz2X8vwD'); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/KT1X6mCNdfQZSpyU9zZw9sWckPVJyz2X8vwD/all_ticket_balances`, + }); + + expect(response).toEqual(ticketBalancesResponse); + done(); + }); + }); + + describe('getPendingOperations', () => { + it('should query the correct url and retrun pending operations in mempool', async (done) => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(pendingOperationsResponse)); + const response: PendingOperations = await client.getPendingOperations(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/mempool/pending_operations`, + query: {}, + }); + + expect(response).toEqual(pendingOperationsResponse); + done(); + }); + }); +}); diff --git a/contrib/taquito-rpc-bin/tsconfig.json b/contrib/taquito-rpc-bin/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..7e482fb9cdde1e0efa709ef2aa5671db2c64dccb --- /dev/null +++ b/contrib/taquito-rpc-bin/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "declarationDir": "dist/types", + "outDir": "dist/lib", + "jsx": "react" + }, + "include": ["src"] +} diff --git a/contrib/taquito-rpc-bin/tsconfig.prod.json b/contrib/taquito-rpc-bin/tsconfig.prod.json new file mode 100644 index 0000000000000000000000000000000000000000..bc6f384454df8e2cb31f667da595ddcfeab4e213 --- /dev/null +++ b/contrib/taquito-rpc-bin/tsconfig.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.prod.json", + "compilerOptions": { + "declarationDir": "./dist/types", + "outDir": "./dist/lib", + "jsx": "react" + }, + "include": ["./src/**/*"] +}