From d158d52cdf47e7e82fcd25b91f1432e0c7342aa9 Mon Sep 17 00:00:00 2001 From: huianyang Date: Thu, 29 Aug 2024 16:23:19 -0700 Subject: [PATCH 01/17] add betanet0829 protocol hash and chainID --- packages/taquito-local-forging/src/protocols.ts | 4 +++- packages/taquito-michel-codec/src/michelson-types.ts | 4 +++- packages/taquito/src/constants.ts | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/taquito-local-forging/src/protocols.ts b/packages/taquito-local-forging/src/protocols.ts index db42478da9..b8243be065 100644 --- a/packages/taquito-local-forging/src/protocols.ts +++ b/packages/taquito-local-forging/src/protocols.ts @@ -18,6 +18,7 @@ export enum ProtocolsHash { ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ', PsParisCZ = 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + PtBetaaEZ = 'PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -41,7 +42,8 @@ const protoLevel: Record = { ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ: 20, PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi: 20, - ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 21, + PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT: 21, + ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 22, }; export function ProtoInferiorTo(a: ProtocolsHash, b: ProtocolsHash): boolean { diff --git a/packages/taquito-michel-codec/src/michelson-types.ts b/packages/taquito-michel-codec/src/michelson-types.ts index 86f87cdb02..c436fb92a8 100644 --- a/packages/taquito-michel-codec/src/michelson-types.ts +++ b/packages/taquito-michel-codec/src/michelson-types.ts @@ -406,6 +406,7 @@ export enum Protocol { ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ', PsParisCZ = 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + PtBetaaEZ = 'PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', // temporary protocol hash } @@ -441,7 +442,8 @@ const protoLevel: Record = { ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ: 20, PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi: 20, - ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 21, + PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT: 21, + ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 22, }; export function ProtoGreaterOrEqual(a: ProtocolID, b: ProtocolID): boolean { diff --git a/packages/taquito/src/constants.ts b/packages/taquito/src/constants.ts index ab25cdc4c2..57a79517af 100644 --- a/packages/taquito/src/constants.ts +++ b/packages/taquito/src/constants.ts @@ -70,6 +70,7 @@ export enum Protocols { ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ', PsParisCZ = 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + PtBetaaEZ = 'PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -90,7 +91,8 @@ export const protocols = { '017': [Protocols.PtNairobi], '019': [Protocols.ProxfordY], '020': [Protocols.PtParisBx, Protocols.PsParisCZ], - '021': [Protocols.ProtoALpha], + '021': [Protocols.PtBetaaEZ], + '022': [Protocols.ProtoALpha], }; export enum ChainIds { @@ -112,6 +114,7 @@ export enum ChainIds { OXFORDNET2 = 'NetXxWsskGahzQB', PARISBNET = 'NetXo8SqH1c38SS', PARISCNET = 'NetXXWAHLEvre9b', + BETANET = 'NetXsTfFgyGbHTz', } // A fixed fee reveal operation gasLimit accepted by both simulate and injection endpoint is between 1.2-5 times of actual gas consumption (3.5 fails occasionally with gas exhausted; 4 fails occasionally with fee too low) From 3af295e6c27fbee63eae0085f565b05864078c3b Mon Sep 17 00:00:00 2001 From: huianyang Date: Thu, 29 Aug 2024 16:25:11 -0700 Subject: [PATCH 02/17] test: configured integration test run on betanet0829 --- .github/workflows/main.yml | 28 +++++++++++++++++++ cspell.json | 1 + integration-tests/config.ts | 18 ++++++------ .../known-contracts-PtBetaaEZ.ts | 8 ++++++ .../known-contracts-PtNairobi.ts | 8 ------ integration-tests/package.json | 2 +- 6 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 integration-tests/known-contracts-PtBetaaEZ.ts delete mode 100644 integration-tests/known-contracts-PtNairobi.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfd18969e9..6b6f8eadf3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,3 +62,31 @@ jobs: env: # Ternary operator workaround TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && format('https://{0}.ecadinfra.com', matrix.testnet) || null }} + integration-tests-betanet-secret-key: + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + include: + - testnet: betanet + testnet_uppercase: BETANET + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/hydrogen + - run: npm ci + - run: npm run build + - if: ${{ !github.event.pull_request.head.repo.fork }} + name: Tailscale + uses: tailscale/github-action@v1 + with: + authkey: ${{ secrets.TAILSCALE_AUTHKEY }} + version: 1.32.2 + - run: npm -w integration-tests run originate-known-contracts + env: + RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true + TEZOS_RPC_${{ matrix.testnet_uppercase }}: https://rpc.betanet-2024-08-29.teztnets.com/ + - run: npm -w integration-tests run test:betanet-secret-key + env: + RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true \ No newline at end of file diff --git a/cspell.json b/cspell.json index 4d32d01c48..a076a11188 100644 --- a/cspell.json +++ b/cspell.json @@ -8,6 +8,7 @@ "b58cdecode", "b58cencode", "beaconwallet", + "BETANET", "bigmap", "BIGMAPCONTRACT", "bigmaps", diff --git a/integration-tests/config.ts b/integration-tests/config.ts index 85d05f6b79..c500878b7f 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -8,7 +8,7 @@ import { KnownContracts } from './known-contracts'; import { knownContractsProtoALph } from './known-contracts-ProtoALph'; import { knownContractsPtGhostnet } from './known-contracts-PtGhostnet'; import { knownContractsPsParisCZ } from './known-contracts-PsParisCZ'; -import { knownContractsPtNairobi } from './known-contracts-PtNairobi'; +import { knownContractsPtBetaaEZ } from './known-contracts-PtBetaaEZ'; const nodeCrypto = require('crypto'); @@ -117,7 +117,7 @@ const defaultConfig = ({ rpc: process.env[`TEZOS_RPC_${networkName}`] || defaultRpc, pollingIntervalMilliseconds: process.env[`POLLING_INTERVAL_MILLISECONDS`] || undefined, rpcCacheMilliseconds: process.env[`RPC_CACHE_MILLISECONDS`] || '1000', - knownBaker: process.env[`TEZOS_BAKER`] || (networkName === 'WEEKLYNET' ? 'tz1ck3EJwzFpbLVmXVuEn5Ptwzc6Aj14mHSH' : 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb'), // tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzbn(Germán - TT) is a placeholder for til tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD accepts external staking + knownBaker: process.env[`TEZOS_BAKER`] || (networkName === 'WEEKLYNET' ? 'tz1ck3EJwzFpbLVmXVuEn5Ptwzc6Aj14mHSH' : 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'), knownContract: process.env[`TEZOS_${networkName}_CONTRACT_ADDRESS`] || knownContracts.contract, knownBigMapContract: process.env[`TEZOS_${networkName}_BIGMAPCONTRACT_ADDRESS`] || knownContracts.bigMapContract, knownTzip1216Contract: process.env[`TEZOS_${networkName}_TZIP1216CONTRACT_ADDRESS`] || knownContracts.tzip12BigMapOffChainContract, @@ -141,12 +141,12 @@ const parisnetEphemeral: Config = const parisnetSecretKey: Config = { ...parisnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://rpc.pariscnet.teztnets.com/' } }; -const nairobinetSecretKey: Config = +const betanetSecretKey: Config = defaultConfig({ - networkName: 'NAIROBINET', - protocol: Protocols.PtNairobi, - defaultRpc: 'http://ecad-nairobinet-full:8732', - knownContracts: knownContractsPtNairobi, + networkName: 'BETANET', + protocol: Protocols.PtBetaaEZ, + defaultRpc: ' https://rpc.betanet-2024-08-29.teztnets.com', + knownContracts: knownContractsPtBetaaEZ, signerConfig: defaultSecretKey }) @@ -182,8 +182,8 @@ if (process.env['RUN_WITH_SECRET_KEY']) { providers.push(parisnetSecretKey); } else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) { providers.push(ghostnetSecretKey); -} else if (process.env['RUN_NAIROBINET_WITH_SECRET_KEY']) { - providers.push(nairobinetSecretKey); +} else if (process.env['RUN_BETANET_WITH_SECRET_KEY']) { + providers.push(betanetSecretKey); } else if (process.env['RUN_WEEKLYNET_WITH_SECRET_KEY']) { providers.push(weeklynetSecretKey); } else if (process.env['PARISNET']) { diff --git a/integration-tests/known-contracts-PtBetaaEZ.ts b/integration-tests/known-contracts-PtBetaaEZ.ts new file mode 100644 index 0000000000..217490e7eb --- /dev/null +++ b/integration-tests/known-contracts-PtBetaaEZ.ts @@ -0,0 +1,8 @@ +import { KnownContracts } from './known-contracts'; +export const knownContractsPtBetaaEZ: KnownContracts = { + contract: "KT1XKPeFgUEn2kt4Wg8cEL8DfopiHQQaPpBj", + bigMapContract: "KT1LBaTaYaKUQwDDhud7EG2CYvZjxwQghn81", + tzip12BigMapOffChainContract: "KT1GLrL9dVQQSi6bPv8pePKwcHYjcj8mMTa7", + saplingContract: "KT1ErqDowX2QE29KSp73dsg75oeXBu3fe9qD", + onChainViewContractAddress: "KT1QmK4ffXJRTvRj9ciAjBhFjX1uPSU97kEu", +}; diff --git a/integration-tests/known-contracts-PtNairobi.ts b/integration-tests/known-contracts-PtNairobi.ts deleted file mode 100644 index b830cd3f4b..0000000000 --- a/integration-tests/known-contracts-PtNairobi.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { KnownContracts } from './known-contracts'; -export const knownContractsPtNairobi: KnownContracts = { - contract: "", - bigMapContract: "", - tzip12BigMapOffChainContract: "", - saplingContract: "", - onChainViewContractAddress: "" -}; \ No newline at end of file diff --git a/integration-tests/package.json b/integration-tests/package.json index 81f1f1124e..ff88320deb 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -5,7 +5,7 @@ "test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand", "test:parisnet": "PARISNET=true jest", "test:parisnet-secret-key": "RUN_PARISNET_WITH_SECRET_KEY=true jest --runInBand", - "test:nairobinet-secret-key": "RUN_NAIROBINET_WITH_SECRET_KEY=true jest --runInBand", + "test:betanet-secret-key": "RUN_BETANET_WITH_SECRET_KEY=true jest --runInBand", "test:weeklynet": "WEEKLYNET=true jest", "test:weeklynet-secret-key": "RUN_WEEKLYNET_WITH_SECRET_KEY=true jest --runInBand", "test:ghostnet": "GHOSTNET=true jest", From eabe38d5b2a19dc2e4052b0b2b0b8c5481b62fc3 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 30 Aug 2024 11:23:22 -0700 Subject: [PATCH 03/17] test: update integration-test files for betanet --- .github/workflows/main.yml | 4 - docs/rpc_nodes_integration_test.md | 2 - .../contract/estimation-tests.spec.ts | 84 +++--- .../rpc/get-protocol-constants.spec.ts | 277 ++++++++++++++---- integration-tests/__tests__/rpc/nodes.spec.ts | 8 +- integration-tests/config.ts | 6 +- .../src/rpc-client-modules/rpc-cache.ts | 2 +- packages/taquito-rpc/src/taquito-rpc.ts | 2 +- 8 files changed, 276 insertions(+), 109 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b6f8eadf3..3e511aca85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,10 +83,6 @@ jobs: with: authkey: ${{ secrets.TAILSCALE_AUTHKEY }} version: 1.32.2 - - run: npm -w integration-tests run originate-known-contracts - env: - RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true - TEZOS_RPC_${{ matrix.testnet_uppercase }}: https://rpc.betanet-2024-08-29.teztnets.com/ - run: npm -w integration-tests run test:betanet-secret-key env: RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true \ No newline at end of file diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index 76416813ac..491f246b32 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -63,7 +63,6 @@ Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (28 ms) ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (39 ms) ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://parisnet.i.ecadinfra.com:8732/ (29 ms) - ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (397 ms) ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (470 ms) ○ skipped Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for http://parisnet.i.ecadinfra.com:8732/ ``` @@ -121,7 +120,6 @@ Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (7 ms) ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (10 ms) ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for http://localhost:20000 (6 ms) - ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (313 ms) ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (323 ms) ○ skipped Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://localhost:20000 ``` \ No newline at end of file diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index 05b06fcce7..dbfec8f639 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -41,11 +41,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 }); expect(estimate.gasLimit).toEqual(101); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(188); + expect(estimate.suggestedFeeMutez).toEqual(186); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(168); - expect(estimate.totalCost).toEqual(168); - expect(estimate.usingBaseFeeMutez).toEqual(168); + expect(estimate.minimalFeeMutez).toEqual(166); + expect(estimate.totalCost).toEqual(166); + expect(estimate.usingBaseFeeMutez).toEqual(166); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -53,11 +53,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 }); expect(estimate.gasLimit).toEqual(101); expect(estimate.storageLimit).toEqual(277); - expect(estimate.suggestedFeeMutez).toEqual(188); + expect(estimate.suggestedFeeMutez).toEqual(186); expect(estimate.burnFeeMutez).toEqual(69250); - expect(estimate.minimalFeeMutez).toEqual(168); - expect(estimate.totalCost).toEqual(69418); - expect(estimate.usingBaseFeeMutez).toEqual(168); + expect(estimate.minimalFeeMutez).toEqual(166); + expect(estimate.totalCost).toEqual(69416); + expect(estimate.usingBaseFeeMutez).toEqual(166); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -69,11 +69,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(677); expect(estimate.storageLimit).toEqual(591); - expect(estimate.suggestedFeeMutez).toEqual(537); + expect(estimate.suggestedFeeMutez).toEqual(535); expect(estimate.burnFeeMutez).toEqual(147750); - expect(estimate.minimalFeeMutez).toEqual(517); - expect(estimate.totalCost).toEqual(148267); - expect(estimate.usingBaseFeeMutez).toEqual(517); + expect(estimate.minimalFeeMutez).toEqual(515); + expect(estimate.totalCost).toEqual(148265); + expect(estimate.usingBaseFeeMutez).toEqual(515); expect(estimate.consumedMilligas).toEqual(676402); }); @@ -84,25 +84,25 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(100); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(183); + expect(estimate.suggestedFeeMutez).toEqual(181); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(163); - expect(estimate.totalCost).toEqual(163); - expect(estimate.usingBaseFeeMutez).toEqual(163); + expect(estimate.minimalFeeMutez).toEqual(161); + expect(estimate.totalCost).toEqual(161); + expect(estimate.usingBaseFeeMutez).toEqual(161); expect(estimate.consumedMilligas).toEqual(100000); }); it('Verify .estimate.transfer for internal transfer to allocated implicit', async () => { const tx = contract.methods.do(MANAGER_LAMBDA.transferImplicit(knownBaker, 5)).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(1457); + expect(estimate.gasLimit).toEqual(1456); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(396); + expect(estimate.suggestedFeeMutez).toEqual(394); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(376); - expect(estimate.totalCost).toEqual(376); - expect(estimate.usingBaseFeeMutez).toEqual(376); - expect(estimate.consumedMilligas).toEqual(1456228); + expect(estimate.minimalFeeMutez).toEqual(374); + expect(estimate.totalCost).toEqual(374); + expect(estimate.usingBaseFeeMutez).toEqual(374); + expect(estimate.consumedMilligas).toEqual(1455884); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -114,12 +114,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1571); expect(estimate.storageLimit).toEqual(534); - expect(estimate.suggestedFeeMutez).toEqual(467); + expect(estimate.suggestedFeeMutez).toEqual(465); expect(estimate.burnFeeMutez).toEqual(133500); - expect(estimate.minimalFeeMutez).toEqual(447); - expect(estimate.totalCost).toEqual(133947); - expect(estimate.usingBaseFeeMutez).toEqual(447); - expect(estimate.consumedMilligas).toEqual(1570757); + expect(estimate.minimalFeeMutez).toEqual(445); + expect(estimate.totalCost).toEqual(133945); + expect(estimate.usingBaseFeeMutez).toEqual(445); + expect(estimate.consumedMilligas).toEqual(1570413); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -127,25 +127,25 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1867); expect(estimate.storageLimit).toEqual(337); - expect(estimate.suggestedFeeMutez).toEqual(443); + expect(estimate.suggestedFeeMutez).toEqual(441); expect(estimate.burnFeeMutez).toEqual(84250); - expect(estimate.minimalFeeMutez).toEqual(423); - expect(estimate.totalCost).toEqual(84673); - expect(estimate.usingBaseFeeMutez).toEqual(423); - expect(estimate.consumedMilligas).toEqual(1866852); + expect(estimate.minimalFeeMutez).toEqual(421); + expect(estimate.totalCost).toEqual(84671); + expect(estimate.usingBaseFeeMutez).toEqual(421); + expect(estimate.consumedMilligas).toEqual(1866508); }); it('Verify .estimate.transfer for multiple internal originations', async () => { const tx = contract.methods.do(originate2()).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(2393); + expect(estimate.gasLimit).toEqual(2392); expect(estimate.storageLimit).toEqual(654); - expect(estimate.suggestedFeeMutez).toEqual(561); + expect(estimate.suggestedFeeMutez).toEqual(559); expect(estimate.burnFeeMutez).toEqual(163500); - expect(estimate.minimalFeeMutez).toEqual(541); - expect(estimate.totalCost).toEqual(164041); - expect(estimate.usingBaseFeeMutez).toEqual(541); - expect(estimate.consumedMilligas).toEqual(2392005); + expect(estimate.minimalFeeMutez).toEqual(539); + expect(estimate.totalCost).toEqual(164039); + expect(estimate.usingBaseFeeMutez).toEqual(539); + expect(estimate.consumedMilligas).toEqual(2391661); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); @@ -176,11 +176,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + getRevealFee(await LowAmountTez.signer.publicKeyHash())) }); expect(estimate.gasLimit).toEqual(101); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(187); + expect(estimate.suggestedFeeMutez).toEqual(185); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(167); - expect(estimate.totalCost).toEqual(167); - expect(estimate.usingBaseFeeMutez).toEqual(167); + expect(estimate.minimalFeeMutez).toEqual(165); + expect(estimate.totalCost).toEqual(165); + expect(estimate.usingBaseFeeMutez).toEqual(165); expect(estimate.consumedMilligas).toEqual(100040); }); diff --git a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts index 22be7ce02f..3a66934126 100644 --- a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts +++ b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts @@ -6,6 +6,7 @@ import { ConstantsResponseProto019, ConstantsResponseProto020 } from '@taquito/r CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { const Tezos = lib; const parisnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PsParisCZ) ? test : test.skip; + const betanet = (networkType == NetworkType.TESTNET && protocol === Protocols.PtBetaaEZ) ? test : test.skip; const weeklynet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProtoALpha) ? test : test.skip; describe('Test fetching constants for all protocols on Mainnet', () => { const rpcUrl = 'https://mainnet.ecadinfra.com/'; @@ -303,122 +304,294 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { }); }); + betanet(`should successfully fetch all constants for Betanet + using ${rpc}`, async () => { + Tezos.setRpcProvider(rpc); + const constants: ConstantsResponseProto020 = await Tezos.rpc.getConstants(); + expect(constants).toEqual({ + adaptive_issuance_activation_vote_enable: true, + adaptive_issuance_force_activation: false, + adaptive_issuance_launch_ema_threshold: 0, + adaptive_rewards_params: { + center_dz: { + denominator: "2", + numerator: "1", + }, + growth_rate: { + denominator: "100", + numerator: "1", + }, + issuance_ratio_final_max: { + denominator: "10", + numerator: "1", + }, + issuance_ratio_final_min: { + denominator: "400", + numerator: "1", + }, + issuance_ratio_initial_max: { + denominator: "200", + numerator: "11", + }, + issuance_ratio_initial_min: { + denominator: "200", + numerator: "9" + }, + max_bonus: "50000000000000", + radius_dz: { + denominator: "50", + numerator: "1", + }, + initial_period: 10, + transition_period: 50 + }, + autostaking_enable: true, + 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, + smart_rollup_max_wrapped_proof_binary_size: 30000, + smart_rollup_max_number_of_messages_per_level: '1000000', + blocks_per_commitment: 25, + blocks_per_cycle: 210, + blocks_preservation_cycles: 1, + nonce_revelation_threshold: 50, + ns_enable: true, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(3328000), + proof_of_work_threshold: new BigNumber(-1), + minimal_stake: new BigNumber(6000000000), + origination_size: 257, + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + percentage_of_frozen_deposits_slashed_per_double_attestation: 5000, + percentage_of_frozen_deposits_slashed_per_double_baking: 700, + minimal_frozen_stake: '600000000', + limit_of_delegation_over_baking: 9, + liquidity_baking_subsidy: new BigNumber(5000000), + issuance_weights: { + attesting_reward_weight: 10240, + baking_reward_bonus_weight: 5120, + baking_reward_fixed_portion_weight: 5120, + base_total_issued_per_minute: "85007812", + seed_nonce_revelation_tip_weight: 1, + vdf_revelation_tip_weight: 1, + }, + min_proposal_quorum: 500, + edge_of_staking_over_delegation: 2, + global_limit_of_staking_over_baking: 5, + liquidity_baking_toggle_ema_threshold: 100000, + max_operations_time_to_live: 187, + minimal_block_delay: new BigNumber(4), + delay_increment_per_round: new BigNumber(4), + delegate_parameters_activation_delay: 3, + direct_ticket_spending_enable: false, + consensus_committee_size: 7000, + consensus_threshold: 4667, + consensus_rights_delay: 2, + minimal_participation_ratio: { + numerator: 2, + denominator: 3 + }, + max_slashing_period: 2, + max_slashing_per_block: 10000, + max_slashing_threshold: 2334, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cache_sampler_state_cycles: 8, + dal_parametric: { + attestation_lag: 8, + attestation_threshold: 66, + feature_enable: true, + incentives_enable: false, + number_of_shards: 512, + number_of_slots: 32, + page_size: 3967, + redundancy_factor: 8, + slot_size: 126944, + }, + quorum_max: 7000, + quorum_min: 2000, + smart_rollup_arith_pvm_enable: true, + smart_rollup_challenge_window_in_blocks: 62, + smart_rollup_commitment_period_in_blocks: 31, + smart_rollup_max_active_outbox_levels: 31500, + smart_rollup_max_lookahead_in_blocks: 46875, + smart_rollup_max_outbox_messages_per_level: 100, + smart_rollup_max_number_of_cemented_commitments: 5, + smart_rollup_max_number_of_parallel_games: 32, + smart_rollup_message_size_limit: 4096, + smart_rollup_number_of_sections_in_dissection: 32, + smart_rollup_origination_size: 6314, + smart_rollup_private_enable: true, + smart_rollup_reveal_activation_level: { + dal_attested_slots_validity_lag: 241920, + dal_page: 1, + dal_parameters: 1, + metadata: 0, + raw_data: { + Blake2B: 0, + }, + }, + smart_rollup_riscv_pvm_enable: true, + smart_rollup_stake_amount: '32000000', + smart_rollup_timeout_period_in_blocks: 781, + testnet_dictator: 'tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8', + vdf_difficulty: new BigNumber(10000000), + zk_rollup_enable: true, + zk_rollup_max_ticket_payload_size: 2048, + zk_rollup_min_pending_to_process: 10, + zk_rollup_origination_size: 4000, + }); + }); + weeklynet(`should successfully fetch all constants for weeklynet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto019 = await Tezos.rpc.getConstants(); + const constants: ConstantsResponseProto020 = await Tezos.rpc.getConstants(); expect(constants).toEqual({ - adaptive_issuance_launch_ema_threshold: 10000000, + adaptive_issuance_activation_vote_enable: true, + adaptive_issuance_force_activation: true, + adaptive_issuance_launch_ema_threshold: 0, adaptive_rewards_params: { center_dz: { denominator: "2", numerator: "1", }, - growth_rate: "115740740", - issuance_ratio_max: { + growth_rate: { + denominator: "100", + numerator: "1", + }, + issuance_ratio_final_max: { denominator: "10", numerator: "1", }, - issuance_ratio_min: { - denominator: "200", + issuance_ratio_final_min: { + denominator: "400", numerator: "1", }, + issuance_ratio_initial_max: { + denominator: "200", + numerator: "11", + }, + issuance_ratio_initial_min: { + denominator: "200", + numerator: "9" + }, max_bonus: "50000000000000", radius_dz: { denominator: "50", numerator: "1", }, + initial_period: 10, + transition_period: 50 }, + autostaking_enable: true, proof_of_work_nonce_size: 8, nonce_length: 32, - nonce_revelation_threshold: 32, max_anon_ops_per_block: 132, max_operation_data_length: 32768, max_proposals_per_delegate: 20, - preserved_cycles: 3, - blocks_per_cycle: 128, - blocks_per_commitment: 16, + 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, + smart_rollup_max_wrapped_proof_binary_size: 30000, + smart_rollup_max_number_of_messages_per_level: '1000000', + blocks_per_commitment: 25, + blocks_per_cycle: 200, + blocks_preservation_cycles: 1, + nonce_revelation_threshold: 50, + ns_enable: true, + cycles_per_voting_period: 1, hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), + hard_gas_limit_per_block: new BigNumber(3328000), proof_of_work_threshold: new BigNumber(-1), + minimal_stake: new BigNumber(6000000000), origination_size: 257, - percentage_of_frozen_deposits_slashed_per_double_baking: 11, - percentage_of_frozen_deposits_slashed_per_double_attestation: 50, cost_per_byte: new BigNumber(250), hard_storage_limit_per_operation: new BigNumber(60000), + percentage_of_frozen_deposits_slashed_per_double_attestation: 5000, + percentage_of_frozen_deposits_slashed_per_double_baking: 700, + minimal_frozen_stake: '600000000', + limit_of_delegation_over_baking: 9, + liquidity_baking_subsidy: new BigNumber(5000000), issuance_weights: { attesting_reward_weight: 10240, baking_reward_bonus_weight: 5120, baking_reward_fixed_portion_weight: 5120, base_total_issued_per_minute: "85007812", - liquidity_baking_subsidy_weight: 1280, seed_nonce_revelation_tip_weight: 1, vdf_revelation_tip_weight: 1, }, - limit_of_delegation_over_baking: 9, - quorum_min: 2000, - quorum_max: 7000, min_proposal_quorum: 500, + edge_of_staking_over_delegation: 2, + global_limit_of_staking_over_baking: 5, liquidity_baking_toggle_ema_threshold: 100000, - max_allowed_global_constants_depth: 10000, - max_micheline_bytes_limit: 50000, - max_micheline_node_count: 50000, - michelson_maximum_type_size: 2001, - blocks_per_stake_snapshot: 64, max_operations_time_to_live: 120, + minimal_block_delay: new BigNumber(4), + delay_increment_per_round: new BigNumber(4), + delegate_parameters_activation_delay: 3, + direct_ticket_spending_enable: false, consensus_committee_size: 7000, consensus_threshold: 4667, + consensus_rights_delay: 2, minimal_participation_ratio: { - denominator: 3, numerator: 2, + denominator: 3 }, max_slashing_period: 2, - minimal_block_delay: new BigNumber(7), - minimal_frozen_stake: "600000000", - delay_increment_per_round: new BigNumber(7), - edge_of_staking_over_delegation: 2, - global_limit_of_staking_over_baking: 5, + max_slashing_per_block: 10000, + max_slashing_threshold: 2334, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cache_sampler_state_cycles: 8, dal_parametric: { - attestation_lag: 4, - attestation_threshold: 50, + attestation_lag: 8, + attestation_threshold: 66, feature_enable: true, - number_of_shards: 2048, + incentives_enable: false, + number_of_shards: 512, number_of_slots: 32, - page_size: 4096, - redundancy_factor: 16, - slot_size: 65536, - blocks_per_epoch: 32, + page_size: 3967, + redundancy_factor: 8, + slot_size: 126944, }, - minimal_stake: new BigNumber('6000000000'), - cache_layout_size: 3, - cache_sampler_state_cycles: 8, - cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cycles_per_voting_period: 1, + quorum_max: 7000, + quorum_min: 2000, smart_rollup_arith_pvm_enable: true, - smart_rollup_challenge_window_in_blocks: 40, - smart_rollup_commitment_period_in_blocks: 20, - smart_rollup_max_active_outbox_levels: 20160, - smart_rollup_max_lookahead_in_blocks: 30000, + smart_rollup_challenge_window_in_blocks: 62, + smart_rollup_commitment_period_in_blocks: 31, + smart_rollup_max_active_outbox_levels: 31500, + smart_rollup_max_lookahead_in_blocks: 346875, + smart_rollup_max_outbox_messages_per_level: 100, smart_rollup_max_number_of_cemented_commitments: 5, - smart_rollup_max_number_of_messages_per_level: "1000000", smart_rollup_max_number_of_parallel_games: 32, - smart_rollup_max_outbox_messages_per_level: 100, - smart_rollup_max_wrapped_proof_binary_size: 30000, smart_rollup_message_size_limit: 4096, smart_rollup_number_of_sections_in_dissection: 32, smart_rollup_origination_size: 6314, smart_rollup_private_enable: true, smart_rollup_reveal_activation_level: { - dal_page: 0, + dal_attested_slots_validity_lag: 80, + dal_page: 1, + dal_parameters: 1, metadata: 0, raw_data: { Blake2B: 0, }, }, - smart_rollup_stake_amount: "32000000", - smart_rollup_timeout_period_in_blocks: 500, - vdf_difficulty: new BigNumber('10000000'), + smart_rollup_riscv_pvm_enable: true, + smart_rollup_stake_amount: '32000000', + smart_rollup_timeout_period_in_blocks: 781, + vdf_difficulty: new BigNumber(10000000), zk_rollup_enable: true, zk_rollup_max_ticket_payload_size: 2048, zk_rollup_min_pending_to_process: 10, diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index 082d689a80..571f2fc327 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -1,6 +1,6 @@ import { CONFIGS } from '../../config'; -import { DefaultContractType } from "@taquito/taquito"; -import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperationsV1, PendingOperationsV2, PvmKind } from '@taquito/rpc'; +import { DefaultContractType, Protocols } from "@taquito/taquito"; +import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperationsV1, PendingOperationsV2 } from '@taquito/rpc'; import { encodeExpr } from '@taquito/utils'; import { Schema } from '@taquito/michelson-encoder'; import { tokenBigmapCode, tokenBigmapStorage } from '../../data/token_bigmap'; @@ -20,7 +20,7 @@ CONFIGS().forEach( }) => { const Tezos = lib; const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test; - + const parisnet = protocol === Protocols.PsParisCZ ? test : test.skip; let ticketContract: DefaultContractType; beforeAll(async () => { @@ -491,7 +491,7 @@ CONFIGS().forEach( } }) - it('Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied', async () => { + parisnet('Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied', async () => { const pendingOperations = await rpcClient.getPendingOperations({ version: '1' }) as PendingOperationsV1; expect(pendingOperations).toBeDefined(); expect(pendingOperations.applied).toBeInstanceOf(Array); diff --git a/integration-tests/config.ts b/integration-tests/config.ts index c500878b7f..249e37801d 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -154,19 +154,19 @@ const ghostnetEphemeral: Config = defaultConfig({ networkName: 'GHOSTNET', protocol: Protocols.PtParisBx, - defaultRpc: 'http://ecad-ghostnet-rolling-2.i.tez.ie:8732', + defaultRpc: 'https://ghostnet.ecadinfra.com', knownContracts: knownContractsPtGhostnet, signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/ghostnet') }); const ghostnetSecretKey: Config = - { ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-ghostnet-rolling-2.i.tez.ie:8732' } }; + { ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://rpc.ghostnet.teztnets.com' } }; const weeklynetEphemeral: Config = defaultConfig({ networkName: 'WEEKLYNET', protocol: Protocols.ProtoALpha, - defaultRpc: 'http://mondaynet.ecadinfra.com:8732', + defaultRpc: 'https://rpc.weeklynet-2024-08-28.teztnets.com/', knownContracts: knownContractsProtoALph, signerConfig: defaultEphemeralConfig('http://key-gen-1.i.tez.ie:3010/mondaynet') }); diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index fe28642e2e..16877277b0 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -1272,7 +1272,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) - * @param args has 5 optional properties. We support version 1 & 2 + * @param args has 5 optional properties. We support version 2 * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } */ async getPendingOperations( diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index fb862c0af1..3c9de0e535 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -1215,7 +1215,7 @@ export class RpcClient implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) - * @param args has 5 optional properties. We support version 1 & 2 + * @param args has 5 optional properties. We support version 2 * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-mempool-openapi-rc.json */ From b17eab1ce56b452a6b55664b9348f0cc4d84d2f3 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 6 Sep 2024 11:28:39 -0700 Subject: [PATCH 04/17] ci: update betanet script name --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e511aca85..b0f0dee994 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,7 +62,7 @@ jobs: env: # Ternary operator workaround TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && format('https://{0}.ecadinfra.com', matrix.testnet) || null }} - integration-tests-betanet-secret-key: + integration-tests-testnet-beta-secret-key: runs-on: ubuntu-latest continue-on-error: true strategy: From cd127ce6d32a53da929b04d360bf2debe755f710 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 6 Sep 2024 11:54:36 -0700 Subject: [PATCH 05/17] feat: add ConstantsResponseProto021 to ConstantsResponse fix #3037 --- .../__tests__/rpc/get-protocol-constants.spec.ts | 6 +++--- integration-tests/config.ts | 2 +- packages/taquito-rpc/src/types.ts | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts index 3a66934126..0c923b330f 100644 --- a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts +++ b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts @@ -1,7 +1,7 @@ import { Protocols } from "@taquito/taquito"; import { CONFIGS, NetworkType } from "../../config"; import BigNumber from 'bignumber.js'; -import { ConstantsResponseProto019, ConstantsResponseProto020 } from '@taquito/rpc'; +import { ConstantsResponseProto020, ConstantsResponseProto021 } from '@taquito/rpc'; CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { const Tezos = lib; @@ -307,7 +307,7 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { betanet(`should successfully fetch all constants for Betanet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto020 = await Tezos.rpc.getConstants(); + const constants: ConstantsResponseProto021 = await Tezos.rpc.getConstants(); expect(constants).toEqual({ adaptive_issuance_activation_vote_enable: true, adaptive_issuance_force_activation: false, @@ -454,7 +454,7 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { weeklynet(`should successfully fetch all constants for weeklynet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto020 = await Tezos.rpc.getConstants(); + const constants: ConstantsResponseProto021 = await Tezos.rpc.getConstants(); expect(constants).toEqual({ adaptive_issuance_activation_vote_enable: true, diff --git a/integration-tests/config.ts b/integration-tests/config.ts index 70590c1e36..d3543694a1 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -145,7 +145,7 @@ const betanetSecretKey: Config = defaultConfig({ networkName: 'BETANET', protocol: Protocols.PtBetaaEZ, - defaultRpc: ' https://rpc.betanet-2024-08-29.teztnets.com', + defaultRpc: 'https://rpc.betanet-2024-08-29.teztnets.com', knownContracts: knownContractsPtBetaaEZ, signerConfig: defaultSecretKey }) diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index e789e7363a..500125a70a 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -1783,6 +1783,7 @@ export interface OperationContentsAndResultMetadataOrigination { } export type ConstantsResponse = ConstantsResponseCommon & + ConstantsResponseProto021 & ConstantsResponseProto020 & ConstantsResponseProto019 & ConstantsResponseProto017 & @@ -1828,6 +1829,8 @@ export interface ConstantsResponseCommon { export type Ratio = { numerator: number; denominator: number }; +export type ConstantsResponseProto021 = ConstantsResponseProto020; + export interface ConstantsResponseProto020 extends Omit< ConstantsResponseProto019, From 2ccc4ee580cc7c9c8f061a74d92a6913a62204e4 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 6 Sep 2024 15:39:34 -0700 Subject: [PATCH 06/17] feat: removed endorsement compatiblity but kept rpc types and readProvider for user query old block BREAKING CHANGE: PollingSubscribeProvider doesn't filter endorsement anymore and removed rpc entrypoints using param version 0 re #3036 --- docs/consensus_key.md | 2 +- .../example-streamer-custom-retry-logic.ts | 6 +- example/example-streamer.ts | 6 +- .../taquito-rpc/src/rpc-client-interface.ts | 2 +- .../src/rpc-client-modules/rpc-cache.ts | 6 +- packages/taquito-rpc/src/taquito-rpc.ts | 6 +- .../taquito-rpc/test/data/rpc-responses.ts | 3987 +++-------------- packages/taquito-rpc/test/rpc-cache.spec.ts | 4 +- packages/taquito-rpc/test/taquito-rpc.spec.ts | 27 +- .../taquito-utils/src/verify-signature.ts | 2 +- packages/taquito/src/signer/interface.ts | 2 +- packages/taquito/src/subscribe/filters.ts | 2 - .../subscribe/polling-subcribe-provider.ts | 11 +- .../polling-subscribe-provider.spec.ts | 18 +- 14 files changed, 697 insertions(+), 3384 deletions(-) diff --git a/docs/consensus_key.md b/docs/consensus_key.md index bda600b95d..af9989bef8 100644 --- a/docs/consensus_key.md +++ b/docs/consensus_key.md @@ -3,7 +3,7 @@ title: Consensus Keys author: Davis Sawali & Hui-An Yang --- -The "consensus key" feature allows bakers to use a different key, called the consensus key. It will allow for baking and signing consensus operations (i.e. preattestation/preendorsements and attestation/endorsements). For more detailed information on consensus keys, refer to [this documentation](https://tezos.gitlab.io/protocols/015_lima.html?highlight=update%20consensus%20key#consensus-key) +The "consensus key" feature allows bakers to use a different key, called the consensus key. It will allow for baking and signing consensus operations (i.e. preattestation and attestation). For more detailed information on consensus keys, refer to [this documentation](https://tezos.gitlab.io/protocols/015_lima.html?highlight=update%20consensus%20key#consensus-key) Starting from Lima protocol, these 2 new operations will be available: diff --git a/example/example-streamer-custom-retry-logic.ts b/example/example-streamer-custom-retry-logic.ts index 4a5194bb0b..0c1c40c1b2 100644 --- a/example/example-streamer-custom-retry-logic.ts +++ b/example/example-streamer-custom-retry-logic.ts @@ -24,16 +24,12 @@ async function example() { and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'attestation' }] } - const bakerEndorsementFilter = { - and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'endorsement' }] - } - const bakerDelegation = { and: [{ destination: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'delegation' }] } tezos.stream.subscribeOperation({ - or: [bakerAttestationFilter, bakerEndorsementFilter, bakerDelegation] + or: [bakerAttestationFilter, bakerDelegation] }) } diff --git a/example/example-streamer.ts b/example/example-streamer.ts index 91d61bee55..823efdd694 100644 --- a/example/example-streamer.ts +++ b/example/example-streamer.ts @@ -10,16 +10,12 @@ async function example() { and: [{ source: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'attestation' }] } - const bakerEndorsementFilter = { - and: [{ source: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'endorsement' }] - } - const bakerDelegation = { and: [{ destination: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'delegation' }] } const sub = tezos.stream.subscribeOperation({ - or: [bakerAttestationFilter, bakerEndorsementFilter, bakerDelegation] + or: [bakerAttestationFilter, bakerDelegation] }) sub.on('data', console.log) diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index e0d58341c6..850b66081b 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -55,7 +55,7 @@ import { export interface RPCOptions { block: string; - version?: 0 | 1 | '0' | '1'; + version?: 1 | '1'; } export const defaultChain = 'main'; diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index 16877277b0..1cda10c31d 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -641,8 +641,8 @@ export class RpcClientCache implements RpcClientInterface { * @param options contains generic configuration for rpc calls to specified block (default to head) and version. * @description All the information about a block * @see https://tezos.gitlab.io/active/rpc.html#get-block-id - * @example getBlock() will default to `/main/chains/block/head?version=0` which shows { kind: endorsement } - * @example getBlock({ block: 'head~2', version: 1 }) will return an offset of 2 from head blocks and shows { kind: attestation } + * @example getBlock() will default to `/main/chains/block/head?version=1` + * @example getBlock({ block: 'head~2') will return an offset of 2 from head blocks * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. */ async getBlock({ block }: RPCOptions = defaultRPCOptions): Promise { @@ -1272,7 +1272,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) - * @param args has 5 optional properties. We support version 2 + * @param args has 5 optional properties * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } */ async getPendingOperations( diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index 3c9de0e535..f9ec7a08eb 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -619,8 +619,8 @@ export class RpcClient implements RpcClientInterface { * @param options contains generic configuration for rpc calls to specified block (default to head) and version. * @description All the information about a block * @see https://tezos.gitlab.io/active/rpc.html#get-block-id - * @example getBlock() will default to `/main/chains/block/head?version=1` which shows { kind: attestation } - * @example getBlock({ block: 'head~2', version: 0 }) will return an offset of 2 from head blocks and shows { kind: endorsement } + * @example getBlock() will default to `/main/chains/block/head?version=1` + * @example getBlock({ block: 'head~2' }) will return an offset of 2 from head blocks * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. */ async getBlock({ block, version }: RPCOptions = defaultRPCOptions): Promise { @@ -1215,7 +1215,7 @@ export class RpcClient implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) - * @param args has 5 optional properties. We support version 2 + * @param args has 5 optional properties * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-mempool-openapi-rc.json */ diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index d8af80159e..223d3f6964 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -2,3427 +2,771 @@ import BigNumber from 'bignumber.js'; export const rpcUrl = 'rpcTest'; export const blockResponse = { - protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', - chain_id: 'NetXz969SFaFn8k', - hash: 'BMUMMDZRvvTfLrpmtYMUtYgk498WssaSfNnpkWwEiL7GNTwUYus', + protocol: 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + chain_id: 'NetXXWAHLEvre9b', + hash: 'BLauzww5KwkaBTuPjxANENMHHR4BapJ2G9B86z2bsZHHi5oKanb', header: { - level: 536085, - proto: 2, - predecessor: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', - timestamp: '2021-10-04T18:11:32Z', + level: 989795, + proto: 1, + predecessor: 'BL2Ba8XNJYRTHUjapPQYNxuymQNA2u2PWhsuEXRrTT9pvEm9E65', + timestamp: '2024-09-06T20:47:46Z', validation_pass: 4, - operations_hash: 'LLoZRH5DQMZiuE5eZ588fFC9JkL7qN8QjMdTUWQAHcAut2BmoUGZM', - fitness: ['01', '0000000000082e14'], - context: 'CoWCv7EjSWa6naU4fonnAcSSDDRjq9ddgdC13nuBdfR5x9xnR1sR', - priority: 0, - proof_of_work_nonce: 'bc2cc86f726c0000', - liquidity_baking_escape_vote: false, + operations_hash: 'LLoaKUBDXGeocTaJiuyb3w4d7JzHs419R7B6HFpMqQTwMpkdfcRq8', + fitness: ['02', '000f1a63', '', 'ffffffff', '00000000'], + context: 'CoWHYezPfU43VGjBjEyxN4f2hdGq73ghasPgWHzhJN9aGYU2W8H6', + payload_hash: 'vh2ifehMZB2C7GFb2M4YycExTMWAY5PnDC4PoPtDmWh7yNNVbfLj', + payload_round: 0, + proof_of_work_nonce: '1a991a0300000000', + liquidity_baking_toggle_vote: 'on', + adaptive_issuance_vote: 'pass', signature: - 'sigPoYZryqKDksRqXpfby9eDfx6SbaLAq2vwLVnWJNrv73JrfAwAgiM1mCZrR7UaqEwvuR48QRJfj2FW6dCFAPynmJbgjysg', + 'sigWZtc4cGRxY7Fm1uPWFqHLyZYTgouUvAyTFfPLtE669VGezRNpfLXuxjUrU4DjviZjJcQe59RvNE4wLj1zEXpYsmwF6AXs', }, metadata: { - protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', - next_protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + protocol: 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + next_protocol: 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', test_chain_status: { status: 'not_running' }, max_operations_ttl: 120, max_operation_data_length: 32768, - max_block_header_length: 239, + 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 }, ], - baker: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', + proposer: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', + baker: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', level_info: { - level: 536085, - level_position: 536084, - cycle: 131, - cycle_position: 3604, + level: 989795, + level_position: 989794, + cycle: 7732, + cycle_position: 98, expected_commitment: false, }, voting_period_info: { - voting_period: { index: 26, kind: 'proposal', start_position: 532481 }, - position: 3603, - remaining: 16876, + voting_period: { index: 7732, kind: 'proposal', start_position: 989696 }, + position: 98, + remaining: 29, }, nonce_hash: null, - consumed_gas: '108015000', deactivated: [], balance_updates: [ + { + kind: 'accumulator', + category: 'block fees', + change: '-437', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', + change: '437', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking rewards', + change: '-156420503', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + staker: { baker_own_stake: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX' }, + change: '156420503', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking rewards', + change: '-156420503', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + staker: { delegate: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX' }, + change: '156420503', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking rewards', + change: '-244566', + origin: 'block', + }, { kind: 'contract', - contract: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', - change: '-640000000', + contract: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', + change: '244566', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-156325272', origin: 'block', }, { kind: 'freezer', category: 'deposits', - delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', - cycle: 131, - change: '640000000', + staker: { baker_own_stake: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX' }, + change: '156325272', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-156325272', origin: 'block', }, { kind: 'freezer', - category: 'rewards', - delegate: 'tz1RomaiWJV3NFDZWTMVR2aEeHknsn3iF5Gi', - cycle: 131, - change: '16093750', + category: 'deposits', + staker: { delegate: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX' }, + change: '156325272', + origin: 'block', + }, + { + kind: 'minted', + category: 'baking bonuses', + change: '-244417', + origin: 'block', + }, + { + kind: 'contract', + contract: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', + change: '244417', origin: 'block', }, ], - liquidity_baking_escape_ema: 281925, + liquidity_baking_toggle_ema: 2550, + adaptive_issuance_vote_ema: 2634186, + adaptive_issuance_activation_cycle: 0, implicit_operations_results: [ { kind: 'transaction', storage: [ - { int: '81141010' }, - { int: '1004154556389' }, - { int: '87443' }, + { int: '1' }, + { int: '116095517093' }, + { int: '100' }, { bytes: '01e927f00ef734dfc85919635e9afc9166c83ef9fc00' }, { bytes: '0115eb0104481a6d7921160bc982c5e0a561cd8a3a00' }, ], balance_updates: [ + { + kind: 'minted', + category: 'subsidy', + change: '-583333', + origin: 'subsidy', + }, { kind: 'contract', contract: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5', - change: '2500000', + change: '583333', origin: 'subsidy', }, ], - consumed_gas: '2118', - consumed_milligas: '2117300', - storage_size: '4636', + consumed_milligas: '206532', + storage_size: '4632', }, ], + proposer_consensus_key: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', + baker_consensus_key: 'tz1fLH7NNTTshW2zycQ3rFJ8ZPjcxp9mXboX', + consumed_milligas: '277000', + dal_attestation: '0', }, 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', + protocol: 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + chain_id: 'NetXXWAHLEvre9b', + hash: 'opNoTGfrSBj1k2deQvh5mZGXm6tBhBZz5YHRQsxStTFrjWjwV3q', + branch: 'BLQNVpuLN5vi7Js8QML9jPBr61X3QwW2h8dH9ptp33hxuBwzDpJ', contents: [ { - kind: 'endorsement_with_slot', - endorsement: { - branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', - operations: { kind: 'endorsement', level: 536084 }, - signature: - 'sigWwT3mRjCzfvxy65Nd76yHDH6MBwDw1RhhMf4miDp6MvtBjCvcgXhL7z4WM1vZrGEB74UiAbnJzNCSJ3KDwNFwBbU2kpU4', - }, - slot: 3, + kind: 'attestation', + slot: 0, + level: 989794, + round: 0, + block_payload_hash: 'vh3Y2ysro9mSgkGmB1uNmoGho98gCTF3ycSfSKGXGrYEowXbDraa', 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, - ], + delegate: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', + consensus_power: 2558, + consensus_key: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', }, }, ], + signature: + 'sigXErmHKcQpsTZ9tEc7MtLjPde16tZDwPtbvCdBJum5S55tRSQuoTQ88CRgYz1Yw1ap5F5PhjGTpqq5GdGp3MFZonkZLxUo', }, + ], + [], + [], + [ { - protocol: 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', - chain_id: 'NetXz969SFaFn8k', - hash: 'onseUqV43jrnEQDWV6S7pNEWAQ1W1jVwDrtjXLXUMMYqLJUaCKo', - branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', + protocol: 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi', + chain_id: 'NetXXWAHLEvre9b', + hash: 'opS8fwbeZEv9riec1GzYCSuxtBEVeuJzLhwtRV7DAsR3BurRRRV', + branch: 'BLQNVpuLN5vi7Js8QML9jPBr61X3QwW2h8dH9ptp33hxuBwzDpJ', contents: [ { - kind: 'endorsement_with_slot', - endorsement: { - branch: 'BM44sPfEofA59iibf5v5AC1wB1BH2kYi9YsKXHmQeDqZFkMSDD7', - operations: { kind: 'endorsement', level: 536084 }, - signature: - 'sigeeqviP7cPW2SdBNx53trnr9zCDTJKZd2ixZGTg5qz17CcEJaHZgQZjcEcFcy2EnEDusA4m9yeT9JK24fipu9XyiprZ6pH', - }, - slot: 184, + kind: 'smart_rollup_add_messages', + source: 'tz1NxvcLNywVH5jkZgqKnFbGyn9rjp5Rkkgi', + fee: '437', + counter: '740739', + gas_limit: '277', + storage_limit: '0', + message: [ + '006f3183e65b011f6c0f0bc9f5665aeca477e6ad8103f897adeca08a42b0140371b7d91998994355379608669f83503adfe3527153d485e0018dd4c0c088696adb6600000000a095ba080000000000000000000000000000000000000000000000000000000000820100820000b840d177389e13cbc219d847dfa13fe66762647f55a369c0f1af75331f7045ed05d2ee87f2d76699fcdbddbdd63fcce6e5a656e295c17848f24c7662eeee57e8d806', + ], metadata: { balance_updates: [ { kind: 'contract', - contract: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', - change: '-2500000', - origin: 'block', - }, - { - kind: 'freezer', - category: 'deposits', - delegate: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', - cycle: 131, - change: '2500000', + contract: 'tz1NxvcLNywVH5jkZgqKnFbGyn9rjp5Rkkgi', + change: '-437', origin: 'block', }, { - kind: 'freezer', - category: 'rewards', - delegate: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', - cycle: 131, - change: '78125', + kind: 'accumulator', + category: 'block fees', + change: '437', origin: 'block', }, ], - delegate: 'tz1LKV2Hb8XezQXFqCmsKXYDc8BWQkvFnzcP', - slots: [184], + operation_result: { status: 'applied', consumed_milligas: '176870' }, }, }, ], + signature: + 'sigoadYdMRfktcFDDMtKrhper43S4fSKF6MtkJDkTjtY2EPG9Wz7oGN5XqjqfBbLNMcpowsyYWirCYQKd28vcTxX55RC8zN2', }, + ], + ], +}; +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 unstakeRequestsResponse = { + finalizable: [ + { + delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', + cycle: 10, + amount: new BigNumber('500000000'), + }, + ], + unfinalizable: { + delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', + requests: [ { - 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, - ], - }, - }, - ], + cycle: 11, + amount: new BigNumber('200000000'), }, ], - [], - [], - [ - { - 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 unstakeRequestsResponse = { - finalizable: [ - { - delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', - cycle: 10, - amount: new BigNumber('500000000'), - }, - ], - unfinalizable: { - delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', - requests: [ - { - cycle: 11, - amount: new BigNumber('200000000'), - }, - ], - }, -}; -export const managerKey = 'edpkvP1NXoo8vhYbPSvXdy466EHoYWBpf6zmjghB2p3DwJPjbB5nsf'; -export const delegate = 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'; -export const bigmapValue = { prim: 'Pair', args: [[], { int: '100' }] }; -export const delegates = { - full_balance: new BigNumber('10289576365'), - current_frozen_deposits: new BigNumber('2028957741'), - frozen_deposits: new BigNumber('1028957741'), - staking_balance: new BigNumber('10289576365'), - delegated_contracts: ['tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb'], - delegated_balance: new BigNumber('0'), - min_delegated_in_current_cycle: { - amount: '8260618624', - level: { - level: 81924, - level_position: 81923, - cycle: 7, - cycle_position: 3, - expected_commitment: false, - }, - }, - deactivated: false, - grace_period: 7, - pending_denunciations: false, - total_delegated_stake: new BigNumber('0'), - staking_denominator: new BigNumber('0'), - voting_power: new BigNumber('10289577405'), - remaining_proposals: 20, - active_consensus_key: 'tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb', -}; -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 attestationRights = [ - { - level: 151187, - delegates: [ - { - delegate: 'tz3Q1fwk1vh3zm5LqyUV9e2wZBdaEXcovh2r', - first_slot: 79, - attestation_power: 326, - consensus_key: 'tz3Q1fwk1vh3zm5LqyUV9e2wZBdaEXcovh2r', - }, - ], - }, -]; -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', - }, + }, +}; +export const managerKey = 'edpkvP1NXoo8vhYbPSvXdy466EHoYWBpf6zmjghB2p3DwJPjbB5nsf'; +export const delegate = 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'; +export const bigmapValue = { prim: 'Pair', args: [[], { int: '100' }] }; +export const delegates = { + full_balance: new BigNumber('10289576365'), + current_frozen_deposits: new BigNumber('2028957741'), + frozen_deposits: new BigNumber('1028957741'), + staking_balance: new BigNumber('10289576365'), + delegated_contracts: ['tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb'], + delegated_balance: new BigNumber('0'), + min_delegated_in_current_cycle: { + amount: '8260618624', + level: { + level: 81924, + level_position: 81923, + cycle: 7, + cycle_position: 3, + expected_commitment: false, + }, + }, + deactivated: false, + grace_period: 7, + pending_denunciations: false, + total_delegated_stake: new BigNumber('0'), + staking_denominator: new BigNumber('0'), + voting_power: new BigNumber('10289577405'), + remaining_proposals: 20, + active_consensus_key: 'tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb', +}; +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, + 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_slashing_period: 2, + smart_rollup_max_wrapped_proof_binary_size: 30000, + smart_rollup_message_size_limit: 4096, + smart_rollup_max_number_of_messages_per_level: '1000000', + consensus_rights_delay: 2, + blocks_preservation_cycles: 1, + delegate_parameters_activation_delay: 3, + blocks_per_cycle: 128, + blocks_per_commitment: 16, + nonce_revelation_threshold: 32, + 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', + minimal_frozen_stake: '600000000', + vdf_difficulty: '10000000', + origination_size: 257, + issuance_weights: { + base_total_issued_per_minute: '85007812', + baking_reward_fixed_portion_weight: 5120, + baking_reward_bonus_weight: 5120, + attesting_reward_weight: 10240, + seed_nonce_revelation_tip_weight: 1, + vdf_revelation_tip_weight: 1, + }, + cost_per_byte: '250', + hard_storage_limit_per_operation: '60000', + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: '5000000', + liquidity_baking_toggle_ema_threshold: 100000, + max_operations_time_to_live: 120, + minimal_block_delay: '7', + delay_increment_per_round: '7', + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { numerator: 2, denominator: 3 }, + limit_of_delegation_over_baking: 9, + percentage_of_frozen_deposits_slashed_per_double_baking: 700, + percentage_of_frozen_deposits_slashed_per_double_attestation: 5000, + max_slashing_per_block: 10000, + max_slashing_threshold: 2334, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cache_sampler_state_cycles: 8, + dal_parametric: { + feature_enable: true, + incentives_enable: false, + number_of_slots: 32, + attestation_lag: 8, + attestation_threshold: 66, + redundancy_factor: 8, + page_size: 3967, + slot_size: 126944, + number_of_shards: 512, + }, + smart_rollup_arith_pvm_enable: true, + smart_rollup_origination_size: 6314, + smart_rollup_challenge_window_in_blocks: 40, + smart_rollup_stake_amount: '32000000', + smart_rollup_commitment_period_in_blocks: 20, + smart_rollup_max_lookahead_in_blocks: 30000, + smart_rollup_max_active_outbox_levels: 20160, + smart_rollup_max_outbox_messages_per_level: 100, + smart_rollup_number_of_sections_in_dissection: 32, + smart_rollup_timeout_period_in_blocks: 500, + smart_rollup_max_number_of_cemented_commitments: 5, + smart_rollup_max_number_of_parallel_games: 32, + smart_rollup_reveal_activation_level: { + raw_data: { Blake2B: 0 }, + metadata: 0, + dal_page: 1, + dal_parameters: 1, + dal_attested_slots_validity_lag: 241920, + }, + smart_rollup_private_enable: true, + smart_rollup_riscv_pvm_enable: true, + zk_rollup_enable: true, + zk_rollup_origination_size: 4000, + zk_rollup_min_pending_to_process: 10, + zk_rollup_max_ticket_payload_size: 2048, + global_limit_of_staking_over_baking: 5, + edge_of_staking_over_delegation: 2, + adaptive_issuance_launch_ema_threshold: 0, + adaptive_rewards_params: { + issuance_ratio_final_min: { numerator: '1', denominator: '400' }, + issuance_ratio_final_max: { numerator: '1', denominator: '10' }, + issuance_ratio_initial_min: { numerator: '9', denominator: '200' }, + issuance_ratio_initial_max: { numerator: '11', denominator: '200' }, + initial_period: 10, + transition_period: 50, + max_bonus: '50000000000000', + growth_rate: { numerator: '1', denominator: '100' }, + center_dz: { numerator: '1', denominator: '2' }, + radius_dz: { numerator: '1', denominator: '50' }, + }, + adaptive_issuance_activation_vote_enable: true, + autostaking_enable: true, + adaptive_issuance_force_activation: true, + ns_enable: true, + direct_ticket_spending_enable: false, +}; +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 attestationRights = [ + { + level: 151187, + delegates: [ { - 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', + delegate: 'tz3Q1fwk1vh3zm5LqyUV9e2wZBdaEXcovh2r', + first_slot: 79, + attestation_power: 326, + consensus_key: 'tz3Q1fwk1vh3zm5LqyUV9e2wZBdaEXcovh2r', }, + ], + }, +]; +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 proposals = []; +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: [ { - 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', + max_size: 4194304, + max_op: 2048, }, { - 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', + max_size: 32768, }, { - 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', + max_size: 135168, + max_op: 132, }, { - 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', + max_size: 524288, }, - { - 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', + ], + 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: [ { - 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', + kind: 'accumulator', + category: 'block fees', + change: '-1500', + origin: 'block', }, { - 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', + kind: 'minted', + category: 'baking rewards', + change: '-5000000', + origin: 'block', }, { - 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', + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '5001500', + origin: 'block', }, { - 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', + kind: 'minted', + category: 'baking bonuses', + change: '-4217424', + origin: 'block', }, { - 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', + kind: 'contract', + contract: 'tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9', + change: '4217424', + origin: 'block', }, + ], + liquidity_baking_escape_ema: 119624, + implicit_operations_results: [ { - protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', - chain_id: 'NetXnHfVqm9iesp', - hash: 'oo4t2WvJgwZhAsf5CwcDtKCfSkiaKp9wTNYL7LuAbJ9k3sJvTEg', - branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', - contents: [ + kind: 'transaction', + storage: [ { - kind: 'endorsement', - slot: 61, - level: 135595, - round: 0, - block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', - metadata: { - balance_updates: [], - delegate: 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', - endorsement_power: 74, - }, + int: '1', }, - ], - 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, - }, + int: '338987500100', }, - ], - 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, - }, + int: '100', }, - ], - 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, - }, + bytes: '01e927f00ef734dfc85919635e9afc9166c83ef9fc00', }, - ], - 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, - }, + bytes: '0115eb0104481a6d7921160bc982c5e0a561cd8a3a00', }, ], - signature: - 'siggwc4K8yWEU8ttzA8HhQh15zV2fYcyK6nfbuVGVs3G2TbM1nVrJxLiC6sHKqBtBuofiC8pYzDLJxVY9zdCzGqBhyMPCw4M', - }, - { - protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', - chain_id: 'NetXnHfVqm9iesp', - hash: 'opBqy3cLQugeT2xVvKoJUn3yLp79hzuXHc7r5BqSa5HHHFddYgB', - branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', - contents: [ + balance_updates: [ { - kind: 'endorsement', - slot: 85, - level: 135595, - round: 0, - block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', - metadata: { - balance_updates: [], - delegate: 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', - endorsement_power: 139, - }, + kind: 'minted', + category: 'subsidy', + change: '-2500000', + origin: 'subsidy', }, - ], - 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, - }, + kind: 'contract', + contract: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5', + change: '2500000', + origin: 'subsidy', }, ], - signature: - 'sigcmrbc6rZnDpEkR268Pvzz2GPSRi8nWnTthYXt8L6Tg9pB4vzdh4uy8gKYrMQFbJTwRSsyPa31xR5u8FMH9xMAfrWn9r48', + consumed_gas: '225', + consumed_milligas: '224023', + storage_size: '4632', }, + ], + }, + operations: [ + [ { protocol: 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', chain_id: 'NetXnHfVqm9iesp', - hash: 'op9TeE362FGyayWVRghVrRxm2FdezqPdqJRM4VTeq5C6ievFDkd', + hash: 'ooqwt58nxiSHAsmwaBDux3LoEkNE9p14v1TXtnB4CfEaobgHuZ2', branch: 'BLzJ1MtqtmWwnG6ZdX7LPygJGvaE51eDqX55KVQM4HNHcVbeDKs', contents: [ { kind: 'endorsement', - slot: 116, + slot: 0, level: 135595, round: 0, block_payload_hash: 'vh2SkkaBZp19oyMUmTTXy5Q33hKKWZSAzXa7Tz2F6mtyeAgXsHC6', metadata: { balance_updates: [], - delegate: 'tz1RBECWBXv4tKcuDbxYmBguvdn8wzjrejHg', - endorsement_power: 143, + delegate: 'tz1iZ9LkpAhN8X1L6RpBtfy3wxpEWzFrXz8j', + endorsement_power: 206, }, }, ], signature: - 'sigQ5nhdCPRiddmNUYLXCeBk5qs3T6fxMiitKgFJQg5Nuo8sqJTamyJctbF5Gt7MrDZEdiCcmZBj4dEHa9fjDLyCSdgHsL3x', + 'sigT3AuNgusteshSqt2J5aha7iSsYAXsYVGAr62RNZkrd1Gp6JjY59CtD33a4zyv57ZwV7J5JvWRD7uZrwaE6NSzmP61SGkb', }, ], [], @@ -4348,45 +1692,36 @@ export const ticketBalancesResponse = [ export const aiLaunchCycle = 6; export const pendingOperationsResponse = { - applied: [ + validated: [ { - hash: 'onjTGvtnaudo1o5sfTe51XEumhsENAhM7oMzhvsSXzZFXNcj1LE', - branch: 'BLvb5tzmepwJkxhRYCnnQeYXqRWhUvdmx4NbpVK9w4nkM6tdXEr', + hash: 'onwh9Z2SHQVDFq2FeuAfoQKC8PzCDkJbDr11ZJTZPCK6C51Gv8U', + branch: 'BLpiU9xW7CdwkodmSdpvEyi2yJ3ZehW5S7ke6sdf6Rd8zEknwdk', contents: [ { - kind: 'preendorsement', - slot: 14, - level: 128135, + kind: 'preattestation', + slot: 1, + level: 176131, round: 0, - block_payload_hash: 'vh3Tk5KEy88s4scEbJM1n6vzYdYSn3PNmsH5uSP4zoLccNVyXAZd', + block_payload_hash: 'vh1uUGEefGiif4iMAGaCiKNLccKArF8SoCsBiCPM788to6Z6DeXH', }, ], signature: - 'sigNWXUeYUraaGi1GrxjrqKTfk7KF8xRG4pABA1qeZi8bQWRmcSmDWD6BehCNC1qNDMgQkf3JdEFHKuomToBza2iGucg9SuC', + 'sigQ5EvfC4NNFVVZKoXoVgmK7oko4CUywnrqpRTroDqY8tzNcUib1bqvUA2fWdTb6qaW5k6s9AaEWoJ6553C4MF3FxcwPbxh', }, ], refused: [ { - hash: 'ongFJ3rNnTwratXX2mTHN8MLww2rG11BeJwiPGxr2z2KdESZKKG', - protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', - branch: 'BLf8hVJk9kK539kTKQ9PHFjtet3nJuAKYGqCqvFuHTZQWavrP7u', + hash: 'onyUMdZgVkjXoHCo4w7aA9mmRmuSDrdfgXTEVhm1774w64zVhVx', + protocol: 'PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT', + branch: 'BMXLrvc4bTFKRNohYgQ9Y1Xj4ztborPMczRQPMPiFsFF2TZkx4j', 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', + source: 'tz2RqxsYQyFuP9amsmrr25x9bUcBMWXGvjuD', + fee: '379', + counter: '1817', gas_limit: '600000', - storage_limit: '319', + storage_limit: '339', balance: '0', script: { code: [ @@ -4397,7 +1732,10 @@ export const pendingOperationsResponse = { args: [ [ { prim: 'CAR' }, - { prim: 'PUSH', args: [{ prim: 'string' }, { string: 'Hello ' }] }, + { + prim: 'PUSH', + args: [{ prim: 'string' }, { string: 'Hello ' }], + }, { prim: 'CONCAT' }, { prim: 'NIL', args: [{ prim: 'operation' }] }, { prim: 'PAIR' }, @@ -4410,37 +1748,32 @@ export const pendingOperationsResponse = { }, ], signature: - 'sigaD9KjwZXtfhUEpxGirsvNWyScLKQVFQM9kkFB4sTgixfwnJD2D9wt2Km1CM5o2ExGGRTZGLxAr1dZDESurwJusiuHKQvZ', - error: [ - { - kind: 'permanent', - id: 'proto.016-PtMumbai.prefilter.fees_too_low', - }, - ], + 'sigVW5CsvXPizGNvQR3P1A7jcZEB5jBFhkFvhTAbdY3DDzVdxgztG9JMDpV9kQYMx3CpUT1pNbZymwTLoNd6LCwHKhytgmJG', + error: [{ kind: 'permanent', id: 'proto.beta.prefilter.fees_too_low' }], }, ], outdated: [ { - hash: 'oneJE697j4ZNCnhoEsbyPyj4Y5MmyQh4xX6FU3HEGzKnaJkdL5B', - protocol: 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', - branch: 'BLf4UgJixDsXcRnirtBzfst8uzzkcpbBjXQuMmzwwJwD75gh3GU', + hash: 'oneF43sGDQHXMfXqJYnn8cf7nNwqWmxpG4SUVpomwLB6LXFU77a', + protocol: 'PtBetaaEZxGcn9JDpkpAZ6E92Kh7bQb5FDoTCeYhmkfcwNehZcT', + branch: 'BMSMobj7qdiDmE53TCVuPGLKHFYdHJYaYVoKrADxEV6P4q6DaHb', contents: [ { - kind: 'preendorsement', - slot: 15, - level: 128095, + kind: 'preattestation', + slot: 3, + level: 176013, round: 0, - block_payload_hash: 'vh3Xu8Y1EQDMGFYaLXiau3sLukEWGjs3zHW7jynH1m7RaLTqXJpw', + block_payload_hash: 'vh25hajrfSyZwJCu4YCNzxikdJiJQuH5wDu61XXjmsfFsrjnrrcN', }, ], signature: - 'sigsVPdVAmQZrCeucDX5QNjz3H4jNWGfVEZRhjXBGg8ZSxWRK2cGdgUCdyDF47DctaJXqAbMwMHB24En9qWj4mEaTwWMC4SN', + 'sigrrifWiv9pAuidW3tKv1syrb9fuwQCWj52PJ2LmmnsV1DXZd2fZmrEf5UoSxLpchsW5yG3fbfL1zCiPoD6719HpAMNZfDz', error: [ { - kind: 'Preendorsement', - id: 'proto.016-PtMumbai.validate.consensus_operation_for_old_level', - expected: 128096, - provided: 128095, + kind: 'Preattestation', + id: 'proto.beta.validate.consensus_operation_for_old_level', + expected: 176015, + provided: 176013, }, ], }, diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index d06ffc1d89..197a86d83c 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -22,7 +22,7 @@ import { currentProposal, currentQuorum, votesListing, - porposals, + proposals, entryPoints, chainId, packData, @@ -131,7 +131,7 @@ describe('RpcClientCache test', () => { mockRpcClient.getCurrentProposal.mockReturnValue(currentProposal); mockRpcClient.getCurrentQuorum.mockReturnValue(currentQuorum); mockRpcClient.getVotesListings.mockReturnValue(votesListing); - mockRpcClient.getProposals.mockReturnValue(porposals); + mockRpcClient.getProposals.mockReturnValue(proposals); mockRpcClient.getEntrypoints.mockReturnValue(entryPoints); mockRpcClient.getChainId.mockReturnValue(chainId); mockRpcClient.packData.mockReturnValue(packData); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index 1caf8f8b16..c7e337c289 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -4,7 +4,6 @@ import { OpKind, RpcClient } from '../src/taquito-rpc'; import BigNumber from 'bignumber.js'; import { LazyStorageDiffBigMap, - OperationContentsAndResultEndorsement, OperationContentsAndResultAttestationWithDal, OperationContentsAndResultOrigination, OperationResultTransaction, @@ -38,6 +37,8 @@ import { SmartRollupRefutationOptions, RPCSimulateOperationParam, OperationContentsAndResultDalPublishCommitment, + OperationContentsAndResultAttestation, + OperationContentsAndResultEndorsement, } from '../src/types'; import { blockIthacanetResponse, @@ -1555,9 +1556,9 @@ describe('RpcClient test', () => { 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'); + const attestation = response.operations[0][0] + .contents[0] as OperationContentsAndResultAttestation; + expect(attestation.metadata.balance_updates![0].kind).toEqual('contract'); }); }); @@ -3154,11 +3155,11 @@ describe('RpcClient test', () => { method: 'GET', url: 'root/chains/test/blocks/head', }); - const endorsementWithSlot = response.operations[0][0] + const AttestationWithDal = response.operations[0][0] .contents[0] as OperationContentsAndResultAttestationWithDal; - expect(endorsementWithSlot.kind).toEqual('attestation_with_dal'); - expect(endorsementWithSlot.slot).toEqual(19); - expect(endorsementWithSlot.dal_attestation).toEqual('0'); + expect(AttestationWithDal.kind).toEqual('attestation_with_dal'); + expect(AttestationWithDal.slot).toEqual(19); + expect(AttestationWithDal.dal_attestation).toEqual('0'); }); it('should query the right url and property for operation, proto 20, dal_publish_commitment', async () => { @@ -3250,14 +3251,14 @@ describe('RpcClient test', () => { method: 'GET', url: 'root/chains/test/blocks/head', }); - const endorsementWithSlot = response.operations[0][0] + const dalPublishCommitment = response.operations[0][0] .contents[0] as OperationContentsAndResultDalPublishCommitment; - expect(endorsementWithSlot.kind).toEqual('dal_publish_commitment'); - expect(endorsementWithSlot.slot_header.slot_index).toEqual(0); - expect(endorsementWithSlot.slot_header.commitment).toEqual( + expect(dalPublishCommitment.kind).toEqual('dal_publish_commitment'); + expect(dalPublishCommitment.slot_header.slot_index).toEqual(0); + expect(dalPublishCommitment.slot_header.commitment).toEqual( 'sh1vHbHrPSt7eWqYJmM9EUk5scjbvR5PKBckJxmmDJzYHHBkca8Lz4hxXX6zpW5wbhJhswJd4v' ); - expect(endorsementWithSlot.slot_header.commitment_proof).toEqual( + expect(dalPublishCommitment.slot_header.commitment_proof).toEqual( '90c6576ad09e11b14eb464cdd214fe061ba8e8e5a3175e29fe7ff40526f90c2f2f4e02fe9fe03f7adb0fe286d7828b970eb1979f0f65ca3637a51d5456b442377d20397eb1b02544c2e435d79e156881443179fe16b32ad9e9501622a647c2ce' ); }); diff --git a/packages/taquito-utils/src/verify-signature.ts b/packages/taquito-utils/src/verify-signature.ts index 3b8560aafb..0397901da3 100644 --- a/packages/taquito-utils/src/verify-signature.ts +++ b/packages/taquito-utils/src/verify-signature.ts @@ -23,7 +23,7 @@ type SigPrefix = Prefix.EDSIG | Prefix.SPSIG | Prefix.P2SIG | Prefix.SIG; * @description Verify signature of a payload * * @param messageBytes The forged message including the magic byte (11 for block, - * 12 for preattestation/preendorsement, 13 for attestation/endorsement, 3 for generic, 5 for the PACK format of michelson) + * 12 for preattestation, 13 for attestation, 3 for generic, 5 for the PACK format of michelson) * @param publicKey The public key to verify the signature against * @param signature The signature to verify * @returns A boolean indicating if the signature matches diff --git a/packages/taquito/src/signer/interface.ts b/packages/taquito/src/signer/interface.ts index 9416c4a7e4..9bdf7ec200 100644 --- a/packages/taquito/src/signer/interface.ts +++ b/packages/taquito/src/signer/interface.ts @@ -5,7 +5,7 @@ export interface Signer { /** * * @param op Operation to sign - * @param magicByte Magic bytes 11 for block, 12 for preattestation/preendorsement, 13 for attestation/endorsements, 3 for generic, 5 for the PACK format of michelson + * @param magicByte Magic bytes 11 for block, 12 for preattestation, 13 for attestation, 3 for generic, 5 for the PACK format of michelson */ sign( op: string, diff --git a/packages/taquito/src/subscribe/filters.ts b/packages/taquito/src/subscribe/filters.ts index b2c95baa60..3ce13eb24b 100644 --- a/packages/taquito/src/subscribe/filters.ts +++ b/packages/taquito/src/subscribe/filters.ts @@ -19,8 +19,6 @@ const sourceFilter = (x: OperationContent, filter: SourceFilter) => { switch (x.kind) { case 'attestation': return 'metadata' in x && x.metadata.delegate === filter.source; - case 'endorsement': - return 'metadata' in x && x.metadata.delegate === filter.source; case 'activate_account': return 'metadata' in x && x.pkh === filter.source; default: diff --git a/packages/taquito/src/subscribe/polling-subcribe-provider.ts b/packages/taquito/src/subscribe/polling-subcribe-provider.ts index 7315791fdc..f8860cf973 100644 --- a/packages/taquito/src/subscribe/polling-subcribe-provider.ts +++ b/packages/taquito/src/subscribe/polling-subcribe-provider.ts @@ -68,7 +68,9 @@ const applyEventFilter = (filter?: EventFilter) => const internalOpResults = tx.metadata.internal_operation_results; if (internalOpResults) { for (const event of internalOpResults) { - if (eventFilter(event, filter?.address, filter?.tag, filter?.excludeFailedOperations)) { + if ( + eventFilter(event, filter?.address, filter?.tag, filter?.excludeFailedOperations) + ) { sub.next({ opHash: op.hash, blockHash: block.hash, @@ -92,7 +94,10 @@ export class PollingSubscribeProvider implements SubscribeProvider { private newBlock$: Observable; - constructor(private context: Context, config: Partial = {}) { + constructor( + private context: Context, + config: Partial = {} + ) { this._config$ = new BehaviorSubject({ ...defaultConfigStreamer, ...config, @@ -131,8 +136,6 @@ export class PollingSubscribeProvider implements SubscribeProvider { const constants = await this.context.readProvider.getProtocolConstants('head'); const blockTime = constants.minimal_block_delay ? constants.minimal_block_delay.multipliedBy(1000) - : constants.time_between_blocks - ? constants.time_between_blocks[0].multipliedBy(1000) : new BigNumber(defaultIntervalTestnetsMainnet); const confirmationPollingInterval = blockTime.dividedBy(3); diff --git a/packages/taquito/test/subscribe/polling-subscribe-provider.spec.ts b/packages/taquito/test/subscribe/polling-subscribe-provider.spec.ts index 5ceb3fa25d..8ca8f3cb8a 100644 --- a/packages/taquito/test/subscribe/polling-subscribe-provider.spec.ts +++ b/packages/taquito/test/subscribe/polling-subscribe-provider.spec.ts @@ -52,7 +52,6 @@ describe('Configurations for the PollingSubscribeProvider', () => { it('should set the pollingIntervalMilliseconds property based on the minimal_block_delay constant', async () => { const pollingSubscribeProvider = new PollingSubscribeProvider(mockContext); mockReadProvider.getProtocolConstants.mockResolvedValue({ - time_between_blocks: [new BigNumber('30'), new BigNumber('20')], minimal_block_delay: new BigNumber(15), }); await pollingSubscribeProvider['getConfirmationPollingInterval'](); @@ -63,19 +62,6 @@ describe('Configurations for the PollingSubscribeProvider', () => { ); }); - it('should set the pollingIntervalMilliseconds property based on the time_between_blocks constant', async () => { - const pollingSubscribeProvider = new PollingSubscribeProvider(mockContext); - mockReadProvider.getProtocolConstants.mockResolvedValue({ - time_between_blocks: [new BigNumber('30'), new BigNumber('20')], - }); - await pollingSubscribeProvider['getConfirmationPollingInterval'](); - expect(pollingSubscribeProvider.config.pollingIntervalMilliseconds).toEqual(10000); - expect(pollingSubscribeProvider.config.shouldObservableSubscriptionRetry).toBeFalsy(); - expect(pollingSubscribeProvider.config.observableSubscriptionRetryFunction.prototype).toEqual( - retry().prototype - ); - }); - it('should use default polling interval on error fetching the constants', async () => { const pollingSubscribeProvider = new PollingSubscribeProvider(mockContext); mockReadProvider.getProtocolConstants.mockRejectedValue(new Error()); @@ -88,10 +74,10 @@ describe('Configurations for the PollingSubscribeProvider', () => { ); }); - it('should use default polling interval if time_between_blocks is 0 (sandbox)', async () => { + it('should use default polling interval if minimal_block_delay is 0 (sandbox)', async () => { const pollingSubscribeProvider = new PollingSubscribeProvider(mockContext); mockReadProvider.getProtocolConstants.mockResolvedValue({ - time_between_blocks: [new BigNumber('0'), new BigNumber('0')], + minimal_block_delay: new BigNumber('0'), }); await pollingSubscribeProvider['getConfirmationPollingInterval'](); expect(pollingSubscribeProvider.config.pollingIntervalMilliseconds).toEqual(1000); From 5eb8e6e1fb5535bd236f32d0517bdf9ceec495d4 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 6 Sep 2024 15:55:37 -0700 Subject: [PATCH 07/17] feat: getPendingOperations add param source and operationHash and removed type PendingOperationsV1 BREAKING CHANGE: PendingOperationsQueryArguments.version used to accept 1 is removed for protocol q re #3034 --- integration-tests/__tests__/rpc/nodes.spec.ts | 12 +----------- .../taquito-contracts-library/src/rpc-wrapper.ts | 5 +---- packages/taquito-rpc/src/rpc-client-interface.ts | 5 +---- .../src/rpc-client-modules/rpc-cache.ts | 3 +-- packages/taquito-rpc/src/taquito-rpc.ts | 7 +++---- packages/taquito-rpc/src/types.ts | 16 ++++------------ packages/taquito-rpc/test/taquito-rpc.spec.ts | 4 +--- 7 files changed, 12 insertions(+), 40 deletions(-) diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index 571f2fc327..3e4d5ac9cc 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -1,6 +1,6 @@ import { CONFIGS } from '../../config'; import { DefaultContractType, Protocols } from "@taquito/taquito"; -import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperationsV1, PendingOperationsV2 } from '@taquito/rpc'; +import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperationsV2 } from '@taquito/rpc'; import { encodeExpr } from '@taquito/utils'; import { Schema } from '@taquito/michelson-encoder'; import { tokenBigmapCode, tokenBigmapStorage } from '../../data/token_bigmap'; @@ -491,16 +491,6 @@ CONFIGS().forEach( } }) - parisnet('Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied', async () => { - const pendingOperations = await rpcClient.getPendingOperations({ version: '1' }) as PendingOperationsV1; - expect(pendingOperations).toBeDefined(); - expect(pendingOperations.applied).toBeInstanceOf(Array); - expect(pendingOperations.refused).toBeInstanceOf(Array); - expect(pendingOperations.outdated).toBeInstanceOf(Array); - expect(pendingOperations.branch_delayed).toBeInstanceOf(Array); - expect(pendingOperations.branch_refused).toBeInstanceOf(Array); - }); - it('Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated', async () => { const pendingOperations = await rpcClient.getPendingOperations({ version: '2' }) as PendingOperationsV2; expect(pendingOperations).toBeDefined(); diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 2b035d9249..5baf09d7d6 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -45,7 +45,6 @@ import { VotingPeriodBlockResult, TicketTokenParams, AllTicketBalances, - PendingOperationsV1, PendingOperationsV2, PendingOperationsQueryArguments, RPCSimulateOperationParam, @@ -363,9 +362,7 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { }: RPCOptions = defaultRPCOptions): Promise { return this.rpc.getAdaptiveIssuanceLaunchCycle({ block }); } - async getPendingOperations( - args: PendingOperationsQueryArguments - ): Promise { + async getPendingOperations(args: PendingOperationsQueryArguments): Promise { return this.rpc.getPendingOperations(args); } } diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index 850b66081b..be805ac76b 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -45,7 +45,6 @@ import { VotingPeriodBlockResult, TicketTokenParams, AllTicketBalances, - PendingOperationsV1, PendingOperationsV2, PendingOperationsQueryArguments, RPCSimulateOperationParam, @@ -135,9 +134,7 @@ export interface RpcClientInterface { ): Promise; getAllTicketBalances(contract: string, options?: RPCOptions): Promise; getAdaptiveIssuanceLaunchCycle(options?: RPCOptions): Promise; - getPendingOperations( - args: PendingOperationsQueryArguments - ): Promise; + getPendingOperations(args: PendingOperationsQueryArguments): Promise; } export enum RPCMethodName { diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index 1cda10c31d..4b411fba74 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -48,7 +48,6 @@ import { TicketTokenParams, AllTicketBalances, PendingOperationsQueryArguments, - PendingOperationsV1, PendingOperationsV2, RPCSimulateOperationParam, AILaunchCycleResponse, @@ -1277,7 +1276,7 @@ export class RpcClientCache implements RpcClientInterface { */ async getPendingOperations( args: PendingOperationsQueryArguments = {} - ): Promise { + ): Promise { const key = this.formatCacheKey( this.rpcClient.getRpcUrl(), RPCMethodName.GET_PENDING_OPERATIONS, diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index f9ec7a08eb..2bde596ee5 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -64,7 +64,6 @@ import { TicketTokenParams, AllTicketBalances, PendingOperationsQueryArguments, - PendingOperationsV1, PendingOperationsV2, RPCSimulateOperationParam, AILaunchCycleResponse, @@ -1216,13 +1215,13 @@ export class RpcClient implements RpcClientInterface { /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) * @param args has 5 optional properties - * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } + * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined, source: undefined, operationHash: undefined } * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-mempool-openapi-rc.json */ async getPendingOperations( args: PendingOperationsQueryArguments = {} - ): Promise { - return this.httpBackend.createRequest({ + ): Promise { + return this.httpBackend.createRequest({ url: this.createURL(`/chains/${this.chain}/mempool/pending_operations`), method: 'GET', query: args, diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 500125a70a..a059959844 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -2388,14 +2388,15 @@ export type LastRemovedCommitmentHashes = { }; export interface PendingOperationsQueryArguments { - version?: '1' | '2'; + version?: '2' | 2; validated?: boolean; - applied?: boolean; refused?: boolean; outdated?: boolean; branchRefused?: boolean; branchDelayed?: boolean; - validationPass?: '0' | '1' | '2' | '3'; + validationPass?: '0' | '1' | '2' | '3' | 0 | 1 | 2 | 3; + source?: string; + operationHash?: string; } type FailedProcessedOperation = Pick< @@ -2405,15 +2406,6 @@ type FailedProcessedOperation = Pick< error: TezosGenericOperationError[]; }; -export interface PendingOperationsV1 { - applied: Pick[]; - refused: FailedProcessedOperation[]; - outdated: FailedProcessedOperation[]; - branch_refused: FailedProcessedOperation[]; - branch_delayed: FailedProcessedOperation[]; - unprocessed: Pick[]; -} - export interface PendingOperationsV2 { validated: Pick[]; refused: FailedProcessedOperation[]; diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index c7e337c289..58a09a161e 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -25,7 +25,6 @@ import { OperationContentsAndResultSmartRollupExecuteOutboxMessage, RPCRunOperationParam, OperationMetadataBalanceUpdates, - PendingOperationsV1, PendingOperationsV2, OperationContentsAndResultSmartRollupCement, OperationContentsAndResultSmartRollupPublish, @@ -4201,8 +4200,7 @@ describe('RpcClient test', () => { describe('getPendingOperations', () => { it('should query the correct url and return pending operations in mempool', async () => { httpBackend.createRequest.mockReturnValue(Promise.resolve(pendingOperationsResponse)); - const response: PendingOperationsV1 | PendingOperationsV2 = - await client.getPendingOperations(); + const response: PendingOperationsV2 = await client.getPendingOperations(); expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ method: 'GET', From 0b84f10b1f53b9764b3cc18d61ad0e91a0bebfb9 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 6 Sep 2024 16:51:56 -0700 Subject: [PATCH 08/17] test: update estimation-tests assertion --- .../__tests__/contract/estimation-tests.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index dbfec8f639..383f14ac40 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -102,7 +102,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(374); expect(estimate.totalCost).toEqual(374); expect(estimate.usingBaseFeeMutez).toEqual(374); - expect(estimate.consumedMilligas).toEqual(1455884); + expect(estimate.consumedMilligas).toEqual(1455970); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -119,7 +119,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(445); expect(estimate.totalCost).toEqual(133945); expect(estimate.usingBaseFeeMutez).toEqual(445); - expect(estimate.consumedMilligas).toEqual(1570413); + expect(estimate.consumedMilligas).toEqual(1570499); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -132,7 +132,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(421); expect(estimate.totalCost).toEqual(84671); expect(estimate.usingBaseFeeMutez).toEqual(421); - expect(estimate.consumedMilligas).toEqual(1866508); + expect(estimate.consumedMilligas).toEqual(1866594); }); it('Verify .estimate.transfer for multiple internal originations', async () => { @@ -145,7 +145,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(539); expect(estimate.totalCost).toEqual(164039); expect(estimate.usingBaseFeeMutez).toEqual(539); - expect(estimate.consumedMilligas).toEqual(2391661); + expect(estimate.consumedMilligas).toEqual(2391747); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); From 38f286a15ca7a2ec1be8609a59924e1bdb7a8bb7 Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 9 Sep 2024 10:53:42 -0700 Subject: [PATCH 09/17] test: improve failing-noop and staking tests --- .../__tests__/contract/operations/failing-noop.spec.ts | 10 ++++------ .../__tests__/contract/operations/staking.spec.ts | 2 +- .../__tests__/wallet/failing-noop.spec.ts | 10 ++++------ .../__tests__/wallet/staking-pseudo-operations.spec.ts | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/integration-tests/__tests__/contract/operations/failing-noop.spec.ts b/integration-tests/__tests__/contract/operations/failing-noop.spec.ts index 93fdcef958..20a140d370 100644 --- a/integration-tests/__tests__/contract/operations/failing-noop.spec.ts +++ b/integration-tests/__tests__/contract/operations/failing-noop.spec.ts @@ -3,19 +3,17 @@ import { OpKind, TezosToolkit } from "@taquito/taquito"; import { InMemorySigner } from "@taquito/signer"; import { verifySignature } from "@taquito/utils"; -CONFIGS().forEach(({ setup, rpc }) => { +CONFIGS().forEach(({ setup, rpc, lib }) => { let signerAlice = new InMemorySigner('edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq') describe(`Test failing_noop through wallet api using: ${rpc}`, () => { - let Tezos: TezosToolkit; + let Tezos = lib beforeAll(async () => { setup(true) if (rpc.includes('paris')) { - Tezos = new TezosToolkit('https://rpc.tzkt.io/parisnet'); // public archive node to fetch genesis block - Tezos.setSignerProvider(signerAlice); // alice's secret key + Tezos.setProvider({signer: signerAlice, rpc: 'https://rpc.tzkt.io/parisnet'}) } else if (rpc.includes('ghost')) { - Tezos = new TezosToolkit('https://rpc.tzkt.io/ghostnet'); // public archive node to fetch genesis block - Tezos.setSignerProvider(signerAlice); // alice's secret key + Tezos.setProvider({signer: signerAlice, rpc: 'https://rpc.tzkt.io/ghostnet'}) } }); diff --git a/integration-tests/__tests__/contract/operations/staking.spec.ts b/integration-tests/__tests__/contract/operations/staking.spec.ts index f1cebad17d..ff720f3065 100644 --- a/integration-tests/__tests__/contract/operations/staking.spec.ts +++ b/integration-tests/__tests__/contract/operations/staking.spec.ts @@ -8,7 +8,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { await setup(true); // There is no baker accept staking in betanet and weeklylnet hence tests will fail // Currently TF is a baker that allows staking on parisnet. - if (rpc.includes('pariscnet')) { + if (rpc.includes('paris')) { knownBaker = 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc' // TF } const delegateOp = await Tezos.contract.setDelegate({ diff --git a/integration-tests/__tests__/wallet/failing-noop.spec.ts b/integration-tests/__tests__/wallet/failing-noop.spec.ts index fff84b0f99..8af97e8216 100644 --- a/integration-tests/__tests__/wallet/failing-noop.spec.ts +++ b/integration-tests/__tests__/wallet/failing-noop.spec.ts @@ -3,19 +3,17 @@ import { OpKind, TezosToolkit } from "@taquito/taquito"; import { InMemorySigner } from "@taquito/signer"; import { verifySignature } from "@taquito/utils"; -CONFIGS().forEach(({ setup, rpc }) => { +CONFIGS().forEach(({ setup, rpc, lib }) => { let signerAlice = new InMemorySigner('edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq') describe(`Test failing_noop through wallet api using: ${rpc}`, () => { - let Tezos: TezosToolkit; + let Tezos = lib beforeAll(async () => { setup(true) if (rpc.includes('paris')) { - Tezos = new TezosToolkit('https://rpc.tzkt.io/parisnet'); // public archive node to fetch genesis block - Tezos.setSignerProvider(signerAlice); // alice's secret key + Tezos.setProvider({signer: signerAlice, rpc: 'https://rpc.tzkt.io/parisnet'}) } else if (rpc.includes('ghost')) { - Tezos = new TezosToolkit('https://rpc.tzkt.io/ghostnet'); // public archive node to fetch genesis block - Tezos.setSignerProvider(signerAlice); // alice's secret key + Tezos.setProvider({signer: signerAlice, rpc: 'https://rpc.tzkt.io/ghostnet'}) } }); diff --git a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts index 66f01da3dd..471b7ebd92 100644 --- a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts +++ b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts @@ -9,7 +9,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { try { // There is no baker accept staking in betanet and weeklylnet hence tests will fail // Currently TF is a baker that allows staking on parisnet. - if (rpc.includes('pariscnet')) { + if (rpc.includes('paris')) { knownBaker = 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc' // TF } const delegateOp = await Tezos.contract.setDelegate({ From 1cd66b4b159239993576794469c06d35e9357e2c Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 9 Sep 2024 11:45:23 -0700 Subject: [PATCH 10/17] feat: add getSpendable rpc endpoint re #3023 --- integration-tests/__tests__/rpc/nodes.spec.ts | 7 ++++- .../src/read-provider-wrapper.ts | 3 +++ .../src/rpc-wrapper.ts | 6 +++++ .../taquito-rpc/src/rpc-client-interface.ts | 2 ++ .../src/rpc-client-modules/rpc-cache.ts | 27 +++++++++++++++++-- packages/taquito-rpc/src/taquito-rpc.ts | 23 ++++++++++++++-- packages/taquito-rpc/test/rpc-cache.spec.ts | 13 ++++++++- packages/taquito-rpc/test/taquito-rpc.spec.ts | 14 ++++++++++ .../taquito/src/read-provider/interface.ts | 12 ++++++--- .../src/read-provider/rpc-read-adapter.ts | 14 ++++++++-- packages/taquito/src/tz/interface.ts | 6 ++++- packages/taquito/src/tz/rpc-tz-provider.ts | 8 ++++++ .../test/batch/rpc-batch-provider.spec.ts | 2 ++ .../contract/rpc-contract-provider.spec.ts | 2 ++ .../estimate/rpc-estimate-provider.spec.ts | 4 +++ .../test/prepare/prepare-provider.spec.ts | 2 ++ .../read-provider/rpc-read-adapter.spec.ts | 15 +++++++++++ .../taquito/test/tz/rpc-tz-provider.spec.ts | 18 +++++++++++++ 18 files changed, 166 insertions(+), 12 deletions(-) diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index 3e4d5ac9cc..31ce129607 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -20,7 +20,7 @@ CONFIGS().forEach( }) => { const Tezos = lib; const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test; - const parisnet = protocol === Protocols.PsParisCZ ? test : test.skip; + const betanet = protocol === Protocols.PtBetaaEZ ? test : test.skip; let ticketContract: DefaultContractType; beforeAll(async () => { @@ -66,6 +66,11 @@ CONFIGS().forEach( expect(balance).toBeDefined(); }); + betanet(`Verify that rpcClient.getSpendable for knownBaker returns the spendable balance excluding frozen bonds`, async () => { + const balance = await rpcClient.getSpendable(knownBaker); + expect(balance).toBeDefined(); + }); + it(`Verify that rpcClient.getFullBalance for knownBaker returns the full balance`, async () => { const balance = await rpcClient.getFullBalance(knownBaker); expect(balance).toBeDefined(); diff --git a/packages/taquito-contracts-library/src/read-provider-wrapper.ts b/packages/taquito-contracts-library/src/read-provider-wrapper.ts index 2c6be8cbb3..8374ba8cee 100644 --- a/packages/taquito-contracts-library/src/read-provider-wrapper.ts +++ b/packages/taquito-contracts-library/src/read-provider-wrapper.ts @@ -37,6 +37,9 @@ export class ReadWrapperContractsLibrary implements TzReadProvider { getBalance(address: string, block: BlockIdentifier): Promise { return this.readProvider.getBalance(address, block); } + getSpendable(address: string, block: BlockIdentifier): Promise { + return this.readProvider.getSpendable(address, block); + } getDelegate(address: string, block: BlockIdentifier): Promise { return this.readProvider.getDelegate(address, block); } diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 5baf09d7d6..82fee9af22 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -93,6 +93,12 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getBalance(address, { block }); } + async getSpendable( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getSpendable(address, { block }); + } async getFullBalance( address: string, { block }: RPCOptions = defaultRPCOptions diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index be805ac76b..a7018599e4 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -64,6 +64,7 @@ export interface RpcClientInterface { getBlockHash(options?: RPCOptions): Promise; getLiveBlocks(options?: RPCOptions): Promise; getBalance(address: string, options?: RPCOptions): Promise; + getSpendable(address: string, options?: RPCOptions): Promise; getFullBalance(address: string, options?: RPCOptions): Promise; getStakedBalance(address: string, options?: RPCOptions): Promise; getUnstakedFinalizableBalance(address: string, options?: RPCOptions): Promise; @@ -148,6 +149,7 @@ export enum RPCMethodName { GET_BLOCK_HEADER = 'getBlockHeader', GET_BLOCK_METADATA = 'getBlockMetadata', GET_BALANCE = 'getBalance', + GET_SPENDABLE = 'getSpendable', GET_FULL_BALANCE = 'getFullBalance', GET_STAKED_BALANCE = 'getStakedBalance', GET_UNSTAKED_FINALIZABLE_BALANCE = 'getUnstakedFinalizableBalance', diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index 4b411fba74..ccd09d75f0 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -200,9 +200,9 @@ export class RpcClientCache implements RpcClientInterface { } /** - * @param address address from which we want to retrieve the balance + * @param address address from which we want to retrieve the spendable balance * @param options contains generic configuration for rpc calls to specified block (default to head) - * @description Access the spendable balance of a contract, excluding frozen bonds + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC. * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance */ async getBalance( @@ -223,6 +223,29 @@ export class RpcClientCache implements RpcClientInterface { } } + /** + * @param address address from which we want to retrieve the balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC. + */ + async getSpendable( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SPENDABLE, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getSpendable(address, { block }); + this.put(key, response); + return response; + } + } + /** * @param address address from which we want to retrieve the full balance * @param options contains generic configuration for rpc calls to specified block (default to head) diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index 2bde596ee5..43138975b9 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -166,9 +166,9 @@ export class RpcClient implements RpcClientInterface { } /** - * @param address address from which we want to retrieve the balance + * @param address address from which we want to retrieve the spendable balance * @param options contains generic configuration for rpc calls to specified block (default to head) - * @description Access the spendable balance of a contract, excluding frozen bonds + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC. * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance */ async getBalance( @@ -185,6 +185,25 @@ export class RpcClient implements RpcClientInterface { return new BigNumber(balance); } + /** + * @param address address from which we want to retrieve the spendable balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC. + */ + async getSpendable( + 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}/spendable` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + /** * @param address address from which we want to retrieve the full balance * @param options contains generic configuration for rpc calls to specified block (default to head) diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index 197a86d83c..47eb12a62d 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -58,6 +58,7 @@ describe('RpcClientCache test', () => { getBlockHash: jest.fn(), getLiveBlocks: jest.fn(), getBalance: jest.fn(), + getSpendable: jest.fn(), getFullBalance: jest.fn(), getStakedBalance: jest.fn(), getUnstakedFinalizableBalance: jest.fn(), @@ -104,6 +105,7 @@ describe('RpcClientCache test', () => { mockRpcClient.getBlockHash.mockReturnValue(blockHash); mockRpcClient.getLiveBlocks.mockReturnValue(liveBlocks); mockRpcClient.getBalance.mockReturnValue(balance); + mockRpcClient.getSpendable.mockReturnValue(balance); mockRpcClient.getFullBalance.mockReturnValue(balance); mockRpcClient.getStakedBalance.mockReturnValue(balance); mockRpcClient.getUnstakedFinalizableBalance.mockReturnValue(balance); @@ -155,6 +157,7 @@ describe('RpcClientCache test', () => { await rpcCache.getBlock(); await rpcCache.getLiveBlocks(); await rpcCache.getBalance(address); + await rpcCache.getSpendable(address); await rpcCache.getFullBalance(address); await rpcCache.getStakedBalance(address); await rpcCache.getUnstakedFinalizableBalance(address); @@ -207,7 +210,10 @@ describe('RpcClientCache test', () => { expect(rpcCache.getAllCachedData()[`rpcTest/getBalance/head/${address}/`].response).toEqual( balance ); - expect(rpcCache.getAllCachedData()[`rpcTest/getFullBalance/head/${address}/`].response).toEqual( + expect(rpcCache.getAllCachedData()[`rpcTest/getBalance/head/${address}/`].response).toEqual( + balance + ); + expect(rpcCache.getAllCachedData()[`rpcTest/getSpendable/head/${address}/`].response).toEqual( balance ); expect( @@ -323,6 +329,7 @@ describe('RpcClientCache test', () => { await rpcCache.getBlock(block); await rpcCache.getLiveBlocks(block); await rpcCache.getBalance(address, block); + await rpcCache.getSpendable(address, block); await rpcCache.getFullBalance(address, block); await rpcCache.getStakedBalance(address, block); await rpcCache.getUnstakedFinalizableBalance(address, block); @@ -388,6 +395,9 @@ describe('RpcClientCache test', () => { expect( rpcCache.getAllCachedData()[`rpcTest/getBalance/${block.block}/${address}/`].response ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getSpendable/${block.block}/${address}/`].response + ).toEqual(balance); expect( rpcCache.getAllCachedData()[`rpcTest/getFullBalance/${block.block}/${address}/`].response ).toEqual(balance); @@ -517,6 +527,7 @@ describe('RpcClientCache test', () => { await rpcCache.getBlock(); await rpcCache.getLiveBlocks(); await rpcCache.getBalance(address); + await rpcCache.getSpendable(address); await rpcCache.getFullBalance(address); await rpcCache.getStakedBalance(address); await rpcCache.getUnstakedFinalizableBalance(address); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index 58a09a161e..4917e2f99d 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -131,6 +131,20 @@ describe('RpcClient test', () => { }); }); + describe('getSpendable', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getSpendable(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/spendable`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + describe('getFullBalance', () => { it('should query the right url and return a string', async () => { httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); diff --git a/packages/taquito/src/read-provider/interface.ts b/packages/taquito/src/read-provider/interface.ts index 98cbf408c8..cb1d8d7937 100644 --- a/packages/taquito/src/read-provider/interface.ts +++ b/packages/taquito/src/read-provider/interface.ts @@ -22,13 +22,19 @@ export type BlockIdentifier = 'head' | `head~${number}` | `B${string}` | number; export interface TzReadProvider { /** - * @description Access the spendable balance of a contract, excluding frozen bonds. - * @param address address from which we want to retrieve the balance + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC. + * @param address address from which we want to retrieve the spendable balance * @param block from which we want to retrieve the balance * @returns the balance in mutez */ getBalance(address: string, block: BlockIdentifier): Promise; - + /** + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC. + * @param address address from which we want to retrieve the spendable balance + * @param block from which we want to retrieve the balance + * @returns the balance in mutez + */ + getSpendable(address: string, block: BlockIdentifier): Promise; /** * @description Access the delegate of a contract, if any. * @param address contract address from which we want to retrieve the delegate (baker) diff --git a/packages/taquito/src/read-provider/rpc-read-adapter.ts b/packages/taquito/src/read-provider/rpc-read-adapter.ts index 6cf2c999d9..863ab6ba5a 100644 --- a/packages/taquito/src/read-provider/rpc-read-adapter.ts +++ b/packages/taquito/src/read-provider/rpc-read-adapter.ts @@ -17,8 +17,8 @@ export class RpcReadAdapter implements TzReadProvider { constructor(private rpc: RpcClientInterface) {} /** - * @description Access the spendable balance of a contract, excluding frozen bonds. - * @param address address from which we want to retrieve the balance + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC. + * @param address address from which we want to retrieve the spendable balance * @param block from which we want to retrieve the balance * @returns the balance in mutez */ @@ -26,6 +26,16 @@ export class RpcReadAdapter implements TzReadProvider { return this.rpc.getBalance(address, { block: String(block) }); } + /** + * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC. + * @param address address from which we want to retrieve the spendable balance + * @param block from which we want to retrieve the balance + * @returns the balance in mutez + */ + async getSpendable(address: string, block: BlockIdentifier): Promise { + return this.rpc.getSpendable(address, { block: String(block) }); + } + /** * @description Access the delegate of a contract, if any. * @param address contract address from which we want to retrieve the delegate (baker) diff --git a/packages/taquito/src/tz/interface.ts b/packages/taquito/src/tz/interface.ts index 6f639f912e..9e2cfced11 100644 --- a/packages/taquito/src/tz/interface.ts +++ b/packages/taquito/src/tz/interface.ts @@ -7,7 +7,11 @@ export interface TzProvider { * @param address Tezos address you want to get the spendable balance for (eg tz1...) */ getBalance(address: string): Promise; - + /** + * + * @param address Tezos address you want to get the spendable balance for (eg tz1...) + */ + getSpendable(address: string): Promise; /** * * @param address Tezos address you want to get the delegate for (eg tz1...) diff --git a/packages/taquito/src/tz/rpc-tz-provider.ts b/packages/taquito/src/tz/rpc-tz-provider.ts index 120fdf378a..dfb6cd321e 100644 --- a/packages/taquito/src/tz/rpc-tz-provider.ts +++ b/packages/taquito/src/tz/rpc-tz-provider.ts @@ -28,6 +28,14 @@ export class RpcTzProvider extends Provider implements TzProvider { return this.context.readProvider.getBalance(address, 'head'); } + async getSpendable(address: string): Promise { + const addressValidation = validateAddress(address); + if (addressValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(address, invalidDetail(addressValidation)); + } + return this.context.readProvider.getSpendable(address, 'head'); + } + async getDelegate(address: string): Promise { const addressValidation = validateAddress(address); if (addressValidation !== ValidationResult.VALID) { diff --git a/packages/taquito/test/batch/rpc-batch-provider.spec.ts b/packages/taquito/test/batch/rpc-batch-provider.spec.ts index 2ad9faee04..f0aec0f7a5 100644 --- a/packages/taquito/test/batch/rpc-batch-provider.spec.ts +++ b/packages/taquito/test/batch/rpc-batch-provider.spec.ts @@ -36,6 +36,7 @@ describe('OperationBatch test', () => { getCounter: jest.Mock; getProtocolConstants: jest.Mock; getBalance: jest.Mock; + getSpendable: jest.Mock; isAccountRevealed: jest.Mock; getChainId: jest.Mock; }; @@ -92,6 +93,7 @@ describe('OperationBatch test', () => { getCounter: jest.fn(), getProtocolConstants: jest.fn(), getBalance: jest.fn(), + getSpendable: jest.fn(), isAccountRevealed: jest.fn(), getChainId: jest.fn(), }; diff --git a/packages/taquito/test/contract/rpc-contract-provider.spec.ts b/packages/taquito/test/contract/rpc-contract-provider.spec.ts index d83d04ff1f..04cc34eb00 100644 --- a/packages/taquito/test/contract/rpc-contract-provider.spec.ts +++ b/packages/taquito/test/contract/rpc-contract-provider.spec.ts @@ -58,6 +58,7 @@ describe('RpcContractProvider test', () => { getCounter: jest.Mock; getProtocolConstants: jest.Mock; getBalance: jest.Mock; + getSpendable: jest.Mock; isAccountRevealed: jest.Mock; getChainId: jest.Mock; }; @@ -124,6 +125,7 @@ describe('RpcContractProvider test', () => { getCounter: jest.fn(), getProtocolConstants: jest.fn(), getBalance: jest.fn(), + getSpendable: jest.fn(), isAccountRevealed: jest.fn(), getChainId: jest.fn(), }; diff --git a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts index c236c54c78..831c331191 100644 --- a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts +++ b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts @@ -42,6 +42,7 @@ describe('RPCEstimateProvider test signer', () => { let mockRpcClient: { getScript: jest.Mock; getBalance: jest.Mock; + getSpendable: jest.Mock; getStorage: jest.Mock; getBlockHeader: jest.Mock; getManagerKey: jest.Mock; @@ -74,6 +75,7 @@ describe('RPCEstimateProvider test signer', () => { runOperation: jest.fn(), simulateOperation: jest.fn(), getBalance: jest.fn(), + getSpendable: jest.fn(), getBlock: jest.fn(), getScript: jest.fn(), getManagerKey: jest.fn(), @@ -1124,6 +1126,7 @@ describe('RPCEstimateProvider test wallet', () => { let mockRpcClient: { getScript: jest.Mock; getBalance: jest.Mock; + getSpendable: jest.Mock; getStorage: jest.Mock; getBlockHeader: jest.Mock; getManagerKey: jest.Mock; @@ -1152,6 +1155,7 @@ describe('RPCEstimateProvider test wallet', () => { runOperation: jest.fn(), simulateOperation: jest.fn(), getBalance: jest.fn(), + getSpendable: jest.fn(), getBlock: jest.fn(), getScript: jest.fn(), getManagerKey: jest.fn(), diff --git a/packages/taquito/test/prepare/prepare-provider.spec.ts b/packages/taquito/test/prepare/prepare-provider.spec.ts index 89b4d309cf..4b51b30001 100644 --- a/packages/taquito/test/prepare/prepare-provider.spec.ts +++ b/packages/taquito/test/prepare/prepare-provider.spec.ts @@ -22,6 +22,7 @@ describe('PrepareProvider test', () => { getCounter: jest.Mock; getProtocolConstants: jest.Mock; getBalance: jest.Mock; + getSpendable: jest.Mock; isAccountRevealed: jest.Mock; getChainId: jest.Mock; }; @@ -51,6 +52,7 @@ describe('PrepareProvider test', () => { getCounter: jest.fn(), getProtocolConstants: jest.fn(), getBalance: jest.fn(), + getSpendable: jest.fn(), isAccountRevealed: jest.fn(), getChainId: jest.fn(), }; diff --git a/packages/taquito/test/read-provider/rpc-read-adapter.spec.ts b/packages/taquito/test/read-provider/rpc-read-adapter.spec.ts index 276c798c91..84face70ae 100644 --- a/packages/taquito/test/read-provider/rpc-read-adapter.spec.ts +++ b/packages/taquito/test/read-provider/rpc-read-adapter.spec.ts @@ -20,6 +20,7 @@ describe('RpcReadAdapter test', () => { let readProvider: RpcReadAdapter; let mockRpcClient: { getBalance: jest.Mock; + getSpendable: jest.Mock; getDelegate: jest.Mock; getProtocols: jest.Mock; getConstants: jest.Mock; @@ -41,6 +42,7 @@ describe('RpcReadAdapter test', () => { beforeEach(() => { mockRpcClient = { getBalance: jest.fn(), + getSpendable: jest.fn(), getDelegate: jest.fn(), getProtocols: jest.fn(), getConstants: jest.fn(), @@ -85,6 +87,19 @@ describe('RpcReadAdapter test', () => { expect(mockRpcClient.getBalance.mock.calls[0][1]).toEqual({ block: `${block}` }); }); + it(`should get the spendable given a pkh at block: ${block}`, async () => { + mockRpcClient.getSpendable.mockResolvedValue(new BigNumber('10000')); + + const result = await readProvider.getSpendable('tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', block); + expect(result).toBeInstanceOf(BigNumber); + expect(result.toString()).toStrictEqual('10000'); + + expect(mockRpcClient.getSpendable.mock.calls[0][0]).toEqual( + 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn' + ); + expect(mockRpcClient.getSpendable.mock.calls[0][1]).toEqual({ block: `${block}` }); + }); + it(`should get the delegate given a pkh at block: ${block}`, async () => { mockRpcClient.getDelegate.mockResolvedValue('tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu'); diff --git a/packages/taquito/test/tz/rpc-tz-provider.spec.ts b/packages/taquito/test/tz/rpc-tz-provider.spec.ts index af0eb87641..7fdcae5655 100644 --- a/packages/taquito/test/tz/rpc-tz-provider.spec.ts +++ b/packages/taquito/test/tz/rpc-tz-provider.spec.ts @@ -25,6 +25,24 @@ describe('RpcTzProvider test', () => { }); }); + describe('getSpendable', () => { + it('calls get spendable from the rpc client', async () => { + const mockRpcClient = { + getSpendable: jest.fn(), + }; + + mockRpcClient.getSpendable.mockResolvedValue(new BigNumber('10000')); + + const provider = new RpcTzProvider(new Context(mockRpcClient as any)); + const result = await provider.getSpendable('tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn'); + expect(result).toBeInstanceOf(BigNumber); + expect(result.toString()).toStrictEqual('10000'); + expect(mockRpcClient.getSpendable.mock.calls[0][0]).toEqual( + 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn' + ); + }); + }); + describe('getDelegate', () => { it('calls get delegate from the rpc client', async () => { const mockRpcClient = { From 750fe59ea7765956a49a30a651320d737e69061d Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 9 Sep 2024 12:06:20 -0700 Subject: [PATCH 11/17] feat: add getBalanceAndFrozenBonds and getSpendableAndFrozenBonds rpc endpoint re #3023 --- integration-tests/__tests__/rpc/nodes.spec.ts | 10 ++++ .../src/rpc-wrapper.ts | 12 +++++ .../taquito-rpc/src/rpc-client-interface.ts | 4 ++ .../src/rpc-client-modules/rpc-cache.ts | 48 +++++++++++++++++++ packages/taquito-rpc/src/taquito-rpc.ts | 40 ++++++++++++++++ packages/taquito-rpc/test/rpc-cache.spec.ts | 18 +++++++ packages/taquito-rpc/test/taquito-rpc.spec.ts | 28 +++++++++++ 7 files changed, 160 insertions(+) diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index 31ce129607..71a54bcdee 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -71,6 +71,16 @@ CONFIGS().forEach( expect(balance).toBeDefined(); }); + it(`Verify that rpcClient.getBalanceAndFrozenBonds for knownBaker returns the full balance`, async () => { + const balance = await rpcClient.getBalanceAndFrozenBonds(knownBaker); + expect(balance).toBeDefined(); + }); + + betanet(`Verify that rpcClient.getSpendableAndFrozenBonds for knownBaker returns the full balance`, async () => { + const balance = await rpcClient.getSpendableAndFrozenBonds(knownBaker); + expect(balance).toBeDefined(); + }); + it(`Verify that rpcClient.getFullBalance for knownBaker returns the full balance`, async () => { const balance = await rpcClient.getFullBalance(knownBaker); expect(balance).toBeDefined(); diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 82fee9af22..7b3ffe930e 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -99,6 +99,18 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getSpendable(address, { block }); } + async getBalanceAndFrozenBonds( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getBalanceAndFrozenBonds(address, { block }); + } + async getSpendableAndFrozenBonds( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getSpendableAndFrozenBonds(address, { block }); + } async getFullBalance( address: string, { block }: RPCOptions = defaultRPCOptions diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index a7018599e4..10b2337664 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -65,6 +65,8 @@ export interface RpcClientInterface { getLiveBlocks(options?: RPCOptions): Promise; getBalance(address: string, options?: RPCOptions): Promise; getSpendable(address: string, options?: RPCOptions): Promise; + getBalanceAndFrozenBonds(address: string, options?: RPCOptions): Promise; + getSpendableAndFrozenBonds(address: string, options?: RPCOptions): Promise; getFullBalance(address: string, options?: RPCOptions): Promise; getStakedBalance(address: string, options?: RPCOptions): Promise; getUnstakedFinalizableBalance(address: string, options?: RPCOptions): Promise; @@ -150,6 +152,8 @@ export enum RPCMethodName { GET_BLOCK_METADATA = 'getBlockMetadata', GET_BALANCE = 'getBalance', GET_SPENDABLE = 'getSpendable', + GET_BALANCE_AND_FROZEN_BONDS = 'getBalanceAndFrozenBonds', + GET_SPENDABLE_AND_FROZEN_BONDS = 'getSpendableAndFrozenBonds', GET_FULL_BALANCE = 'getFullBalance', GET_STAKED_BALANCE = 'getStakedBalance', GET_UNSTAKED_FINALIZABLE_BALANCE = 'getUnstakedFinalizableBalance', diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index ccd09d75f0..47add1d448 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -246,6 +246,54 @@ export class RpcClientCache implements RpcClientInterface { } } + /** + * @param address address from which we want to retrieve balance and frozen bonds + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'spendable_and_frozen_bonds' RPC. + */ + async getBalanceAndFrozenBonds( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_BALANCE_AND_FROZEN_BONDS, + [block, address] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getBalanceAndFrozenBonds(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param address address from which we want to retrieve spendable and frozen bonds + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'balance_and_frozen_bonds' RPC. + */ + async getSpendableAndFrozenBonds( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_SPENDABLE_AND_FROZEN_BONDS, + [block, address] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getSpendableAndFrozenBonds(address, { block }); + this.put(key, response); + return response; + } + } + /** * @param address address from which we want to retrieve the full balance * @param options contains generic configuration for rpc calls to specified block (default to head) diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index 43138975b9..d32e5c8770 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -204,6 +204,46 @@ export class RpcClient implements RpcClientInterface { return new BigNumber(balance); } + /** + * @param address address from which we want to retrieve balance and frozen bonds + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'spendable_and_frozen_bonds' RPC. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance + */ + async getBalanceAndFrozenBonds( + 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_and_frozen_bonds` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + + /** + * @param address address from which we want to retrieve spendable and frozen bonds + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'balance_and_frozen_bonds' RPC. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance + */ + async getSpendableAndFrozenBonds( + 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}/spendable_and_frozen_bonds` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + /** * @param address address from which we want to retrieve the full balance * @param options contains generic configuration for rpc calls to specified block (default to head) diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index 47eb12a62d..d5c335a57b 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -59,6 +59,8 @@ describe('RpcClientCache test', () => { getLiveBlocks: jest.fn(), getBalance: jest.fn(), getSpendable: jest.fn(), + getBalanceAndFrozenBonds: jest.fn(), + getSpendableAndFrozenBonds: jest.fn(), getFullBalance: jest.fn(), getStakedBalance: jest.fn(), getUnstakedFinalizableBalance: jest.fn(), @@ -106,6 +108,8 @@ describe('RpcClientCache test', () => { mockRpcClient.getLiveBlocks.mockReturnValue(liveBlocks); mockRpcClient.getBalance.mockReturnValue(balance); mockRpcClient.getSpendable.mockReturnValue(balance); + mockRpcClient.getBalanceAndFrozenBonds.mockReturnValue(balance); + mockRpcClient.getSpendableAndFrozenBonds.mockReturnValue(balance); mockRpcClient.getFullBalance.mockReturnValue(balance); mockRpcClient.getStakedBalance.mockReturnValue(balance); mockRpcClient.getUnstakedFinalizableBalance.mockReturnValue(balance); @@ -158,6 +162,8 @@ describe('RpcClientCache test', () => { await rpcCache.getLiveBlocks(); await rpcCache.getBalance(address); await rpcCache.getSpendable(address); + await rpcCache.getBalanceAndFrozenBonds(address); + await rpcCache.getSpendableAndFrozenBonds(address); await rpcCache.getFullBalance(address); await rpcCache.getStakedBalance(address); await rpcCache.getUnstakedFinalizableBalance(address); @@ -330,6 +336,8 @@ describe('RpcClientCache test', () => { await rpcCache.getLiveBlocks(block); await rpcCache.getBalance(address, block); await rpcCache.getSpendable(address, block); + await rpcCache.getBalanceAndFrozenBonds(address, block); + await rpcCache.getSpendableAndFrozenBonds(address, block); await rpcCache.getFullBalance(address, block); await rpcCache.getStakedBalance(address, block); await rpcCache.getUnstakedFinalizableBalance(address, block); @@ -398,6 +406,14 @@ describe('RpcClientCache test', () => { expect( rpcCache.getAllCachedData()[`rpcTest/getSpendable/${block.block}/${address}/`].response ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getBalanceAndFrozenBonds/${block.block}/${address}/`] + .response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getSpendableAndFrozenBonds/${block.block}/${address}/`] + .response + ).toEqual(balance); expect( rpcCache.getAllCachedData()[`rpcTest/getFullBalance/${block.block}/${address}/`].response ).toEqual(balance); @@ -528,6 +544,8 @@ describe('RpcClientCache test', () => { await rpcCache.getLiveBlocks(); await rpcCache.getBalance(address); await rpcCache.getSpendable(address); + await rpcCache.getBalanceAndFrozenBonds(address); + await rpcCache.getSpendableAndFrozenBonds(address); await rpcCache.getFullBalance(address); await rpcCache.getStakedBalance(address); await rpcCache.getUnstakedFinalizableBalance(address); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index 4917e2f99d..3a3847a59c 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -145,6 +145,34 @@ describe('RpcClient test', () => { }); }); + describe('getBalanceAndFrozenBonds', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getBalanceAndFrozenBonds(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/balance_and_frozen_bonds`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + + describe('getSpendableAndFrozenBonds', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getSpendableAndFrozenBonds(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/spendable_and_frozen_bonds`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + describe('getFullBalance', () => { it('should query the right url and return a string', async () => { httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); From 4bb834162da9e58d1121f7ee1833ebaed4f51373 Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 9 Sep 2024 12:10:59 -0700 Subject: [PATCH 12/17] docs: update rpc nodes doc --- docs/rpc_nodes_integration_test.md | 104 +++++++++++++++-------------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index 491f246b32..5ded3a746a 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -71,55 +71,57 @@ Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json ``` Test calling all methods from RPC node: http://localhost:20000 - ✓ Verify that rpcClient.getBlockHash returns the head block hash (13 ms) - ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (18 ms) - ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (13 ms) - ✓ Verify that rpcClient.getFullBalance for knownBaker returns the full balance (8 ms) - ✓ Verify that rpcClient.getStakedBalance for knownBaker returns the staked balance (10 ms) - ✓ Verify that rpcClient.getUnstakedFinalizableBalance for knownBaker returns the unstaked finalizable balance (11 ms) - ✓ Verify that rpcClient.getUnstakedFrozenBalance for knownBaker returns the unstaked frozen balance (7 ms) - ✓ Verify that rpcClient.getUnstakeRequests for knownBaker returns the unstaked requests (8 ms) - ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (10 ms) - ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (11 ms) - ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (15 ms) - ✓ Verify that rpcClient.getContract returns the complete status of a contract (12 ms) - ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (11 ms) - ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (8 ms) - ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (93 ms) - ✓ Verify that rpcClient.getAllDelegates returns all delegates from RPC (132 ms) - ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (10 ms) - ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (7 ms) - ✓ Verify that rpcClient.getConstants returns all constants from RPC (10 ms) - ✓ Verify that rpcClient.getBlock returns all the information about a block (10 ms) - ✓ Verify that rpcClient.getBlockHeader returns whole block header (9 ms) - ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (6 ms) - ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (12 ms) - ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (11 ms) - ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (6 ms) - ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (5 ms) - ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (6 ms) - ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (7 ms) - ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (8 ms) - ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (7 ms) - ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (6 ms) - ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (13 ms) - ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (7 ms) - ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (29 ms) - ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (21 ms) - ✓ Verify that rpcClient.getChainId returns chain ID (6 ms) - ✓ Verify that rpcClient.runOperation runs an operation without signature checks (13 ms) - ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (13 ms) - ✓ Verify that rpcClient.runView executes tzip4 views (27 ms) - ✓ Verify that rpcClient.runScriptView executes michelson view (22 ms) - ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (7 ms) - ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (17 ms) - ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (9 ms) - ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (6 ms) - ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (8 ms) - ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (7 ms) - ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (7 ms) - ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (10 ms) - ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for http://localhost:20000 (6 ms) - ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (323 ms) - ○ skipped Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://localhost:20000 + ✓ Verify that rpcClient.getBlockHash returns the head block hash (99 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (61 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (59 ms) + ✓ Verify that rpcClient.getSpendable for knownBaker returns the spendable balance excluding frozen bonds (96 ms) + ✓ Verify that rpcClient.getBalanceAndFrozenBonds for knownBaker returns the full balance (54 ms) + ✓ Verify that rpcClient.getSpendableAndFrozenBonds for knownBaker returns the full balance (53 ms) + ✓ Verify that rpcClient.getFullBalance for knownBaker returns the full balance (55 ms) + ✓ Verify that rpcClient.getStakedBalance for knownBaker returns the staked balance (60 ms) + ✓ Verify that rpcClient.getUnstakedFinalizableBalance for knownBaker returns the unstaked finalizable balance (53 ms) + ✓ Verify that rpcClient.getUnstakedFrozenBalance for knownBaker returns the unstaked frozen balance (52 ms) + ✓ Verify that rpcClient.getUnstakeRequests for knownBaker returns the unstaked requests (52 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (54 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (56 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (55 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (56 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (52 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (53 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (288 ms) + ✓ Verify that rpcClient.getAllDelegates returns all delegates from RPC (107 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (55 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (57 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (70 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (84 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (53 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (53 ms) + ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (62 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (61 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (53 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (54 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (52 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (61 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (52 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (81 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (53 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (59 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (54 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (121 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (56 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (53 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (57 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (58 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (116 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (140 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (88 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (158 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (56 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (82 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (52 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (55 ms) + ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (55 ms) + ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (56 ms) + ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for https://rpc.betanet-2024-08-29.teztnets.com (52 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (281 ms) ``` \ No newline at end of file From d7a21e006ff9436a3616d694d878114697a355f4 Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 9 Sep 2024 13:37:55 -0700 Subject: [PATCH 13/17] test: update estimation-tests assertion --- .../__tests__/contract/estimation-tests.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index 383f14ac40..3a80fbbe30 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -95,7 +95,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { it('Verify .estimate.transfer for internal transfer to allocated implicit', async () => { const tx = contract.methods.do(MANAGER_LAMBDA.transferImplicit(knownBaker, 5)).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(1456); + expect(estimate.gasLimit).toEqual(1457); expect(estimate.storageLimit).toEqual(0); expect(estimate.suggestedFeeMutez).toEqual(394); expect(estimate.burnFeeMutez).toEqual(0); @@ -119,7 +119,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(445); expect(estimate.totalCost).toEqual(133945); expect(estimate.usingBaseFeeMutez).toEqual(445); - expect(estimate.consumedMilligas).toEqual(1570499); + expect(estimate.consumedMilligas).toEqual(1570585); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -132,7 +132,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(421); expect(estimate.totalCost).toEqual(84671); expect(estimate.usingBaseFeeMutez).toEqual(421); - expect(estimate.consumedMilligas).toEqual(1866594); + expect(estimate.consumedMilligas).toEqual(1866680); }); it('Verify .estimate.transfer for multiple internal originations', async () => { @@ -145,7 +145,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(539); expect(estimate.totalCost).toEqual(164039); expect(estimate.usingBaseFeeMutez).toEqual(539); - expect(estimate.consumedMilligas).toEqual(2391747); + expect(estimate.consumedMilligas).toEqual(2391833); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); From f3246bd4e23293154f0c1b28dced8c5dad4be5ae Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 9 Sep 2024 15:29:37 -0700 Subject: [PATCH 14/17] test: update estimation-tests assertion --- integration-tests/__tests__/contract/estimation-tests.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index 3a80fbbe30..e82d62dc22 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -102,7 +102,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(374); expect(estimate.totalCost).toEqual(374); expect(estimate.usingBaseFeeMutez).toEqual(374); - expect(estimate.consumedMilligas).toEqual(1455970); + expect(estimate.consumedMilligas).toEqual(1456056); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { From 4495c2e697bb90ae0a895a96b880256b657fef22 Mon Sep 17 00:00:00 2001 From: huianyang Date: Thu, 19 Sep 2024 15:25:41 -0700 Subject: [PATCH 15/17] ci: updated ci script with rpc_url --- .github/workflows/main.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40a05936cf..af87978bfd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,7 @@ jobs: include: - testnet: parisnet testnet_uppercase: PARISNET + rpc_url: https://parisnet.ecadinfra.com steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -58,11 +59,12 @@ jobs: with: authkey: ${{ secrets.TAILSCALE_AUTHKEY }} version: 1.32.2 - - run: npm -w integration-tests run test:${{ matrix.testnet }} -- --maxWorkers=4 + - id: run-tests + run: npm -w integration-tests run test:${{ matrix.testnet }} -- --maxWorkers=4 env: # Ternary operator workaround - TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && format('https://{0}.ecadinfra.com', matrix.testnet) || null }} - integration-tests-testnet-beta-secret-key: + TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }} + integration-tests-testnet-quebecA-secret-key: runs-on: ubuntu-latest continue-on-error: true strategy: From a84eebdec3d2a4f7bb90c3cb28b5e6b113c0f5fe Mon Sep 17 00:00:00 2001 From: huianyang Date: Thu, 19 Sep 2024 19:40:29 -0700 Subject: [PATCH 16/17] test: updated testing for weeklynet --- .../__tests__/rpc/get-protocol-constants.spec.ts | 4 ++-- integration-tests/__tests__/rpc/nodes.spec.ts | 2 +- integration-tests/config.ts | 4 ++-- integration-tests/known-contracts-ProtoALph.ts | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts index 0c923b330f..0d44678e83 100644 --- a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts +++ b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts @@ -552,8 +552,8 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { max_slashing_per_block: 10000, max_slashing_threshold: 2334, cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cache_sampler_state_cycles: 8, + cache_stake_distribution_cycles: 5, + cache_sampler_state_cycles: 5, dal_parametric: { attestation_lag: 8, attestation_threshold: 66, diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index 71a54bcdee..af9ae2ae07 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -502,7 +502,7 @@ CONFIGS().forEach( } else if (rpc.includes('parisnet')) { expect(launchCycle).toEqual(6); } else if (rpc.includes('mondaynet') || rpc.includes('weeklynet')) { - expect(launchCycle).toEqual(5); + expect(launchCycle).toEqual(3); } }) diff --git a/integration-tests/config.ts b/integration-tests/config.ts index d3543694a1..35a997d877 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -117,7 +117,7 @@ const defaultConfig = ({ rpc: process.env[`TEZOS_RPC_${networkName}`] || defaultRpc, pollingIntervalMilliseconds: process.env[`POLLING_INTERVAL_MILLISECONDS`] || undefined, rpcCacheMilliseconds: process.env[`RPC_CACHE_MILLISECONDS`] || '1000', - knownBaker: process.env[`TEZOS_BAKER`] || (networkName === 'WEEKLYNET' ? 'tz1ck3EJwzFpbLVmXVuEn5Ptwzc6Aj14mHSH' : 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'), + knownBaker: process.env[`TEZOS_BAKER`] || (networkName === 'WEEKLYNET' ? 'tz1TnEtqDV9mZyts2pfMy6Jw1BTPs4LMjL8M' : 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD'), knownContract: process.env[`TEZOS_${networkName}_CONTRACT_ADDRESS`] || knownContracts.contract, knownBigMapContract: process.env[`TEZOS_${networkName}_BIGMAPCONTRACT_ADDRESS`] || knownContracts.bigMapContract, knownTzip1216Contract: process.env[`TEZOS_${networkName}_TZIP1216CONTRACT_ADDRESS`] || knownContracts.tzip12BigMapOffChainContract, @@ -166,7 +166,7 @@ const weeklynetEphemeral: Config = defaultConfig({ networkName: 'WEEKLYNET', protocol: Protocols.ProtoALpha, - defaultRpc: 'https://rpc.weeklynet-2024-09-04.teztnets.com', + defaultRpc: 'https://rpc.weeklynet-2024-09-18.teztnets.com', knownContracts: knownContractsProtoALph, signerConfig: defaultEphemeralConfig('http://key-gen-1.i.tez.ie:3010/mondaynet') }); diff --git a/integration-tests/known-contracts-ProtoALph.ts b/integration-tests/known-contracts-ProtoALph.ts index d8a8b93389..8340796734 100644 --- a/integration-tests/known-contracts-ProtoALph.ts +++ b/integration-tests/known-contracts-ProtoALph.ts @@ -1,8 +1,8 @@ import { KnownContracts } from './known-contracts'; export const knownContractsProtoALph: KnownContracts = { - contract: "KT1XXrWDuK77kQWX55zjD347Wh6bwgmJDfJ8", - bigMapContract: "KT1NSDEhMTWoX2Vie98NCtQV4fVYoPfqfAN3", - tzip12BigMapOffChainContract: "KT1X4c8BCVSDE7dtf5jPRtpYtYcaSFknwzN5", - saplingContract: "KT1JKC49zUSCXJGKT2p1bHVWmg47rAgF53ff", - onChainViewContractAddress: "KT1FVjUZeH5KM8tMwYvrVCMC3QFyDRUBFNLk", + contract: "KT1FgfeADJUoUSuRCKeLAHyWY2JUWRmATMRi", + bigMapContract: "KT1DCUzQs2h8zhmpxY8snEo4y4jWKkstYYqr", + tzip12BigMapOffChainContract: "KT1AhforFgp5QWuiw9KpL24AVxZb6qY87yTF", + saplingContract: "KT1DeGeJGLJPWcUhyqEk9nc3DN1W3rTm7JUZ", + onChainViewContractAddress: "KT1LZnxVXwQG3TwMyf6yGDyqmyh5vtNDwezP", }; From 203a9c37de5e308da67305f49223580ebb741b28 Mon Sep 17 00:00:00 2001 From: huianyang Date: Wed, 13 Nov 2024 13:09:05 -0800 Subject: [PATCH 17/17] test: imporved staking tests --- .../contract/operations/staking.spec.ts | 46 ++++++++----- .../wallet/staking-pseudo-operations.spec.ts | 67 ++++++++++--------- 2 files changed, 62 insertions(+), 51 deletions(-) diff --git a/integration-tests/__tests__/contract/operations/staking.spec.ts b/integration-tests/__tests__/contract/operations/staking.spec.ts index ff720f3065..404489b18e 100644 --- a/integration-tests/__tests__/contract/operations/staking.spec.ts +++ b/integration-tests/__tests__/contract/operations/staking.spec.ts @@ -1,30 +1,40 @@ import { CONFIGS } from "../../../config"; +import { InvalidStakingAddressError, InvalidFinalizeUnstakeAmountError } from '@taquito/core'; -CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { +CONFIGS().forEach(({ lib, rpc, setup }) => { const Tezos = lib; describe(`Staking pseudo operations: ${rpc}`, () => { - beforeAll(async () => { await setup(true); - // There is no baker accept staking in betanet and weeklylnet hence tests will fail - // Currently TF is a baker that allows staking on parisnet. - if (rpc.includes('paris')) { - knownBaker = 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc' // TF - } - const delegateOp = await Tezos.contract.setDelegate({ - delegate: knownBaker, - source: await Tezos.signer.publicKeyHash() - }); - await delegateOp.confirmation(); + try{ + const address = await Tezos.signer.publicKeyHash() + if(await Tezos.rpc.getDelegate(address) !== address){ + const delegateOp = await Tezos.contract.setDelegate({ + delegate: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', // is a delegate receiving stake on parisnet and ghostnet + source: address + }); + await delegateOp.confirmation(); + }; + }catch(e){console.log} }); - it('should throw an error when the destination specified is not the same as source', async () => { + it('should throw error when param is against pseudo operation', async () => { + expect(async () => { + const op = await Tezos.contract.stake({ amount: 1, to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }); + await op.confirmation() + }).rejects.toThrow(InvalidStakingAddressError); + expect(async () => { + const op = await Tezos.contract.unstake({ amount: 1, to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }); + await op.confirmation() + }).rejects.toThrow(InvalidStakingAddressError); + expect(async () => { + const op = await Tezos.contract.finalizeUnstake({ to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }); + await op.confirmation() + }).rejects.toThrow(InvalidStakingAddressError); expect(async () => { - const op = await Tezos.contract.stake({ - amount: 0.1, - to: knownBaker - }); - }).rejects.toThrow(); + const op = await Tezos.contract.finalizeUnstake({ amount: 1 }); + await op.confirmation() + }).rejects.toThrow(InvalidFinalizeUnstakeAmountError); }); it('should be able to stake funds to a designated delegate', async () => { diff --git a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts index 471b7ebd92..9ab9c89ea8 100644 --- a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts +++ b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts @@ -1,25 +1,41 @@ import { CONFIGS } from '../../config'; import { InvalidStakingAddressError, InvalidFinalizeUnstakeAmountError } from '@taquito/core'; -CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { +CONFIGS().forEach(({ lib, rpc, setup }) => { const Tezos = lib; describe(`Test staking pseudo operations using: ${rpc}`, () => { beforeAll(async () => { await setup(true); - try { - // There is no baker accept staking in betanet and weeklylnet hence tests will fail - // Currently TF is a baker that allows staking on parisnet. - if (rpc.includes('paris')) { - knownBaker = 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc' // TF - } - const delegateOp = await Tezos.contract.setDelegate({ - delegate: knownBaker, - source: await Tezos.signer.publicKeyHash() - }); - await delegateOp.confirmation(); - } catch (e) { - console.log(JSON.stringify(e)); - } + try{ + const address = await Tezos.signer.publicKeyHash() + if(await Tezos.rpc.getDelegate(address) !== address){ + const delegateOp = await Tezos.contract.setDelegate({ + delegate: 'tz1TGKSrZrBpND3PELJ43nVdyadoeiM1WMzb', // is a delegate receiving stake on parisnet and ghostnet + source: address + }); + await delegateOp.confirmation(); + }; + }catch(e){console.log} + }); + + it('should throw error when param is against pseudo operation', async () => { + expect(async () => { + const op = await Tezos.wallet.stake({ amount: 1, to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }).send(); + await op.confirmation() + }).rejects.toThrow(InvalidStakingAddressError); + + expect(async () => { + const op = await Tezos.wallet.unstake({ amount: 1, to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }).send(); + await op.confirmation() + }).rejects.toThrow(InvalidStakingAddressError); + expect(async () => { + const op = await Tezos.wallet.finalizeUnstake({ to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }).send(); + await op.confirmation() + }).rejects.toThrow(InvalidStakingAddressError); + expect(async () => { + const op = await Tezos.wallet.finalizeUnstake({ amount: 1 }).send(); + await op.confirmation() + }).rejects.toThrow(InvalidFinalizeUnstakeAmountError); }); it(`should be able to stake successfully: ${rpc}`, async () => { @@ -29,7 +45,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { const stakedBalance = await Tezos.rpc.getStakedBalance(await Tezos.signer.publicKeyHash()); // staked balance returned in mutez therefore dividing by 1000000 and rounding explanation here https://tezos-dev.slack.com/archives/C05RS0MEJ9H/p1714641691368019?thread_ts=1714604532.409029&cid=C05RS0MEJ9H - expect(Math.round(stakedBalance.toNumber() / 1000000)).toEqual(3); + expect(Math.round(stakedBalance.toNumber() / 1000000)).toBeGreaterThanOrEqual(3); }); it(`should be able to unstake successfully: ${rpc}`, async () => { @@ -39,7 +55,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { const UnstakedBalance = await Tezos.rpc.getUnstakedFrozenBalance(await Tezos.signer.publicKeyHash()); // unstaked balance returned in mutez therefore dividing by 1000000 and rounding explanation here https://tezos-dev.slack.com/archives/C05RS0MEJ9H/p1714641691368019?thread_ts=1714604532.409029&cid=C05RS0MEJ9H - expect(Math.round(UnstakedBalance.toNumber() / 1000000)).toEqual(1); + expect(Math.round(UnstakedBalance.toNumber() / 1000000)).toBeGreaterThanOrEqual(1); }); it(`should be able to finalizeUnstake successfully: ${rpc}`, async () => { @@ -47,20 +63,5 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => { await op.confirmation(); expect(await op.status()).toBe('applied'); }); - - it('should throw error when param is against pseudo operation', async () => { - expect(async () => { - const op = await Tezos.wallet.stake({ amount: 1, to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }).send(); - }).rejects.toThrow(InvalidStakingAddressError); - expect(async () => { - const op = await Tezos.wallet.unstake({ amount: 1, to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }).send(); - }).rejects.toThrow(InvalidStakingAddressError); - expect(async () => { - const op = await Tezos.wallet.finalizeUnstake({ to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' }).send(); - }).rejects.toThrow(InvalidStakingAddressError); - expect(async () => { - const op = await Tezos.wallet.finalizeUnstake({ amount: 1 }).send(); - }).rejects.toThrow(InvalidFinalizeUnstakeAmountError); - }); }); -}); +}); \ No newline at end of file