From 7df8e395150d141f3644c7a8ed308437de93b494 Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:16:33 -0700 Subject: [PATCH 01/35] feat: configured paris branch (#2911) * feat: configured paris branch * test: updated estimation assertion --- .github/workflows/main.yml | 2 + apps/taquito-test-dapp/src/config.ts | 1 + cspell.json | 1 + example/deploy-test-dapp-contract.ts | 2 +- .../contract/estimation-tests.spec.ts | 84 +++++++++---------- integration-tests/config.ts | 25 +++++- .../known-contracts-PtParisBQ.ts | 8 ++ integration-tests/package.json | 2 + .../taquito-local-forging/src/protocols.ts | 4 +- .../src/michelson-types.ts | 4 +- packages/taquito/src/constants.ts | 2 + 11 files changed, 86 insertions(+), 49 deletions(-) create mode 100644 integration-tests/known-contracts-PtParisBQ.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfaf4baccb..2ed2c94723 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,8 @@ jobs: include: - testnet: oxfordnet testnet_uppercase: OXFORDNET + - testnet: parisnet + testnet_uppercase: PARISNET steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/apps/taquito-test-dapp/src/config.ts b/apps/taquito-test-dapp/src/config.ts index 10a5d59c6a..117c774a2f 100644 --- a/apps/taquito-test-dapp/src/config.ts +++ b/apps/taquito-test-dapp/src/config.ts @@ -35,4 +35,5 @@ export const contractAddress = { mainnet: "KT1ShtH2zCrKMuWGRejEd6RAcnePwxBQeMAN", ghostnet: "KT1QKmcNBcfzVTXG2kBcE6XqXtEuYYUzMcT5", oxfordnet: "KT1GYx1KDhMQt2GJEztRh8EyYxJUPM6fnAMM", + parisnet: "KT1LBQmSDGsRj4LFa2bsCsZLkGCtmRFVVcPh", }; diff --git a/cspell.json b/cspell.json index f1ed6f1a4c..8b97040dd2 100644 --- a/cspell.json +++ b/cspell.json @@ -71,6 +71,7 @@ "oxfordbox", "oxfordnet", "oxheadalpha", + "parisnet", "Pkhfrom", "preattestation", "precommit", diff --git a/example/deploy-test-dapp-contract.ts b/example/deploy-test-dapp-contract.ts index d9e966f904..99462d5e3b 100644 --- a/example/deploy-test-dapp-contract.ts +++ b/example/deploy-test-dapp-contract.ts @@ -3,7 +3,7 @@ import { InMemorySigner } from '@taquito/signer' import { code, storage } from './data/test-dapp-contract'; // update the targeted rpc url before running -const rpcUrl = 'https://nairobinet.ecadinfra.com/' +const rpcUrl = 'http://parisnet.i.ecadinfra.com:8732' originate(rpcUrl) 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/config.ts b/integration-tests/config.ts index 3d008b5eb6..7e71535b17 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -8,6 +8,7 @@ import { KnownContracts } from './known-contracts'; import { knownContractsProtoALph } from './known-contracts-ProtoALph'; import { knownContractsPtGhostnet } from './known-contracts-PtGhostnet'; import { knownContractsProxfordY } from './known-contracts-ProxfordY'; +import { knownContractsPtParisBQ } from './known-contracts-PtParisBQ'; import { knownContractsPtNairobi } from './known-contracts-PtNairobi'; const nodeCrypto = require('crypto'); @@ -32,7 +33,7 @@ const forgers: ForgerType[] = [ForgerType.COMPOSITE]; // user running integration test can pass environment variable TEZOS_NETWORK_TYPE=sandbox to specify which network to run against export enum NetworkType { - TESTNET, // corresponds ghostnet, oxfordnet and weeklynet etc. + TESTNET, // corresponds ghostnet, oxfordnet, parisnet and weeklynet etc. SANDBOX, // corresponds to flextesa local chain } @@ -141,6 +142,18 @@ const oxfordnetEphemeral: Config = const oxfordnetSecretKey: Config = { ...oxfordnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-oxfordnet-full:8732' } }; +const parisnetEphemeral: Config = + defaultConfig({ + networkName: 'PARISNET', + protocol: Protocols.PtParisBQ, + defaultRpc: 'http://parisnet.i.ecadinfra.com:8732/', + knownContracts: knownContractsPtParisBQ, + signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/parisnet') + }); + +const parisnetSecretKey: Config = + { ...oxfordnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://parisnet.i.ecadinfra.com:8732/' } }; + const nairobinetSecretKey: Config = defaultConfig({ networkName: 'NAIROBINET', @@ -177,15 +190,19 @@ const weeklynetSecretKey: Config = const providers: Config[] = []; if (process.env['RUN_WITH_SECRET_KEY']) { - providers.push(oxfordnetSecretKey); + providers.push(oxfordnetSecretKey, parisnetSecretKey); +} else if (process.env['RUN_PARISNET_WITH_SECRET_KEY']) { + providers.push(parisnetSecretKey); } else if (process.env['RUN_OXFORDNET_WITH_SECRET_KEY']) { providers.push(oxfordnetSecretKey); } else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) { providers.push(ghostnetSecretKey); -} else if(process.env['RUN_NAIROBINET_WITH_SECRET_KEY']) { +} else if (process.env['RUN_NAIROBINET_WITH_SECRET_KEY']) { providers.push(nairobinetSecretKey); } else if (process.env['RUN_WEEKLYNET_WITH_SECRET_KEY']) { providers.push(weeklynetSecretKey); +} else if (process.env['PARISNET']) { + providers.push(parisnetEphemeral); } else if (process.env['OXFORDNET']) { providers.push(oxfordnetEphemeral); } else if (process.env['GHOSTNET']) { @@ -193,7 +210,7 @@ if (process.env['RUN_WITH_SECRET_KEY']) { } else if (process.env['WEEKLYNET']) { providers.push(weeklynetEphemeral); } else { - providers.push(oxfordnetEphemeral); + providers.push(oxfordnetEphemeral, parisnetEphemeral); } const setupForger = (Tezos: TezosToolkit, forger: ForgerType): void => { diff --git a/integration-tests/known-contracts-PtParisBQ.ts b/integration-tests/known-contracts-PtParisBQ.ts new file mode 100644 index 0000000000..4ac3db653e --- /dev/null +++ b/integration-tests/known-contracts-PtParisBQ.ts @@ -0,0 +1,8 @@ +import { KnownContracts } from './known-contracts'; +export const knownContractsPtParisBQ: KnownContracts = { + contract: "KT1PgBAc5e5vhzUyJoQxSEcCkZyqVadurQfN", + bigMapContract: "KT19SNmdj7frTk4gacoL6R96sRD455HUtryH", + tzip12BigMapOffChainContract: "KT1NJs9CnuYJY8wmKxscf8abmc9iHFk1X7fK", + saplingContract: "KT1U2ZBtHKD8ayWkRkrvLzJq5GAYiWEBUxhg", + onChainViewContractAddress: "KT1FmyfnNNggnhHZwJNTCqWFEN6pkXwpEv5T", +}; diff --git a/integration-tests/package.json b/integration-tests/package.json index ccb2bc9682..c5d43a0aca 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -5,6 +5,8 @@ "test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand", "test:oxfordnet": "OXFORDNET=true jest", "test:oxfordnet-secret-key": "RUN_OXFORDNET_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:weeklynet": "WEEKLYNET=true jest", "test:weeklynet-secret-key": "RUN_WEEKLYNET_WITH_SECRET_KEY=true jest --runInBand", diff --git a/packages/taquito-local-forging/src/protocols.ts b/packages/taquito-local-forging/src/protocols.ts index 4224386a4f..0c1617c236 100644 --- a/packages/taquito-local-forging/src/protocols.ts +++ b/packages/taquito-local-forging/src/protocols.ts @@ -16,6 +16,7 @@ export enum ProtocolsHash { PtMumbai2 = 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', + PtParisBQ = 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -37,7 +38,8 @@ const protoLevel: Record = { PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1: 16, PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17, ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, - ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 20, + PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz: 20, + ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 21, }; 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 84388207b3..97e52ae8b2 100644 --- a/packages/taquito-michel-codec/src/michelson-types.ts +++ b/packages/taquito-michel-codec/src/michelson-types.ts @@ -401,6 +401,7 @@ export enum Protocol { PtMumbai2 = 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', + PtParisBQ = 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', // temporary protocol hash } @@ -434,7 +435,8 @@ const protoLevel: Record = { PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1: 16, PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17, ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, - ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 20, + PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz: 20, + ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 21, }; export function ProtoGreaterOrEqual(a: ProtocolID, b: ProtocolID): boolean { diff --git a/packages/taquito/src/constants.ts b/packages/taquito/src/constants.ts index 89caed26e7..f543d7b7ca 100644 --- a/packages/taquito/src/constants.ts +++ b/packages/taquito/src/constants.ts @@ -68,6 +68,7 @@ export enum Protocols { PtMumbai2 = 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', + PtParisBQ = 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -107,6 +108,7 @@ export enum ChainIds { MUMBAINET2 = 'NetXgbcrNtXD2yA', NAIROBINET = 'NetXyuzvDo2Ugzb', OXFORDNET2 = 'NetXxWsskGahzQB', + PARISNET = 'NetXo8SqH1c38SS', } // 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 cf41c8ba6422018888ccfb655a4480ca7022dedf Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:06:20 -0700 Subject: [PATCH 02/35] 2884 remove get endorsing rights (#2916) * feat: removed rpc.getEndorsingRights * docs: update getBlock desc with default version 1 * test: updated estimation assertion * test: updated estimation assertion * test: updated estimation assertion --- docs/rpc_nodes_integration_test.md | 2 - .../contract/estimation-tests.spec.ts | 10 +-- integration-tests/__tests__/rpc/nodes.spec.ts | 13 --- .../src/rpc-wrapper.ts | 10 +-- .../taquito-rpc/src/rpc-client-interface.ts | 7 -- .../src/rpc-client-modules/rpc-cache.ts | 31 +------ packages/taquito-rpc/src/taquito-rpc.ts | 27 +----- packages/taquito-rpc/src/types.ts | 58 ++++--------- .../taquito-rpc/test/data/rpc-responses.ts | 8 -- packages/taquito-rpc/test/rpc-cache.spec.ts | 13 --- packages/taquito-rpc/test/taquito-rpc.spec.ts | 83 +------------------ 11 files changed, 28 insertions(+), 234 deletions(-) diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index 97e1c8d17b..7b7d750d92 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -32,7 +32,6 @@ Test calling all methods from RPC node: https://a-node ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (17 ms) ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (14 ms) ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (25 ms) - ✓ Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block (19 ms) ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (10 ms) ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (39 ms) ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (11 ms) @@ -83,7 +82,6 @@ Test calling all methods from RPC node: https://another-node ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (1472 ms) ✕ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (479 ms) ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (1487 ms) - ✕ Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block (539 ms) ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (615 ms) ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (1670 ms) ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (487 ms) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index dbfec8f639..e82d62dc22 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -95,14 +95,14 @@ 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); expect(estimate.minimalFeeMutez).toEqual(374); expect(estimate.totalCost).toEqual(374); expect(estimate.usingBaseFeeMutez).toEqual(374); - expect(estimate.consumedMilligas).toEqual(1455884); + expect(estimate.consumedMilligas).toEqual(1456056); }); 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(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(1866508); + 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(2391661); + expect(estimate.consumedMilligas).toEqual(2391833); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index d193f34789..b0a2a64c14 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -179,19 +179,6 @@ CONFIGS().forEach( expect(attestationRights[0].delegate).toBeUndefined(); }); - unrestrictedRPCNode('Verify that rpcClient.getEndorsingRights retrieves the list of delegates allowed to endorse a block', async () => { - const endorsingRights = await rpcClient.getEndorsingRights(); - expect(endorsingRights).toBeDefined(); - expect(endorsingRights[0].delegates).toBeDefined(); - expect(endorsingRights[0].delegates![0].delegate).toBeDefined(); - expect(typeof endorsingRights[0].delegates![0].delegate).toEqual('string'); - expect(endorsingRights[0].delegates![0].endorsing_power).toBeDefined(); - expect(typeof endorsingRights[0].delegates![0].endorsing_power).toEqual('number'); - expect(endorsingRights[0].delegates![0].first_slot).toBeDefined(); - expect(typeof endorsingRights[0].delegates![0].first_slot).toEqual('number'); - expect(endorsingRights[0].delegate).toBeUndefined(); - }); - it('Verify that rpcClient.getBallotList returns ballots casted so far during a voting period', async () => { const ballotList = await rpcClient.getBallotList(); expect(ballotList).toBeDefined(); diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index d7d50d84e4..438e5bf4d0 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -19,8 +19,6 @@ import { VotingInfoResponse, AttestationRightsQueryArguments, AttestationRightsResponse, - EndorsingRightsQueryArguments, - EndorsingRightsResponse, EntrypointsResponse, ForgeOperationsParams, ManagerKeyResponse, @@ -61,7 +59,7 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { constructor( private rpc: RpcClientInterface, private contractslibrary: ContractsLibrary - ) {} + ) { } async getContract( address: string, @@ -180,12 +178,6 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getAttestationRights(args, { block }); } - async getEndorsingRights( - args: EndorsingRightsQueryArguments, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - return this.rpc.getEndorsingRights(args, { block }); - } async getBallotList({ block }: RPCOptions = defaultRPCOptions): Promise { return this.rpc.getBallotList({ block }); } diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index 815dda2650..af9e2f8edd 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -19,8 +19,6 @@ import { DelegatesResponse, AttestationRightsQueryArguments, AttestationRightsResponse, - EndorsingRightsQueryArguments, - EndorsingRightsResponse, EntrypointsResponse, ForgeOperationsParams, ManagerKeyResponse, @@ -90,10 +88,6 @@ export interface RpcClientInterface { args: AttestationRightsQueryArguments, options?: RPCOptions ): Promise; - getEndorsingRights( - args: EndorsingRightsQueryArguments, - options?: RPCOptions - ): Promise; getBallotList(options?: RPCOptions): Promise; getBallots(options?: RPCOptions): Promise; getCurrentProposal(options?: RPCOptions): Promise; @@ -157,7 +151,6 @@ export enum RPCMethodName { GET_DELEGATES = 'getDelegates', GET_VOTING_INFO = 'getVotingInfo', GET_ATTESTATION_RIGHTS = 'getAttestationRights', - GET_ENDORSING_RIGHTS = 'getEndorsingRights', GET_ENTRYPOINTS = 'getEntrypoints', GET_LIVE_BLOCKS = 'getLiveBlocks', GET_MANAGER_KEY = 'getManagerKey', 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 8ced250a22..2fe8b79d73 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -22,8 +22,6 @@ import { VotingInfoResponse, AttestationRightsQueryArguments, AttestationRightsResponse, - EndorsingRightsQueryArguments, - EndorsingRightsResponse, EntrypointsResponse, ForgeOperationsParams, ManagerKeyResponse, @@ -75,7 +73,6 @@ type RpcMethodParam = | BakingRightsQueryArguments | PendingOperationsQueryArguments | AttestationRightsQueryArguments - | EndorsingRightsQueryArguments; const defaultTtl = 1000; @@ -94,7 +91,7 @@ export class RpcClientCache implements RpcClientInterface { constructor( private rpcClient: RpcClientInterface, private ttl = defaultTtl - ) {} + ) { } getAllCachedData() { return this._cache; @@ -572,7 +569,6 @@ export class RpcClientCache implements RpcClientInterface { * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the delegates allowed to attest a block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights */ async getAttestationRights( args: AttestationRightsQueryArguments = {}, @@ -592,31 +588,6 @@ export class RpcClientCache implements RpcClientInterface { } } - /** - * @deprecated Deprecated in favor of getAttestationRights - * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) - * @param options contains generic configuration for rpc calls - * @description Retrieves the delegates allowed to endorse a block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights - */ - async getEndorsingRights( - args: EndorsingRightsQueryArguments = {}, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - const key = this.formatCacheKey( - this.rpcClient.getRpcUrl(), - RPCMethodName.GET_ENDORSING_RIGHTS, - [block, args] - ); - if (this.has(key)) { - return this.get(key); - } else { - const response = this.rpcClient.getEndorsingRights(args, { block }); - this.put(key, response); - return response; - } - } - /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Ballots casted so far during a voting period diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index d126e366dd..db882d926b 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -36,8 +36,6 @@ import { VotingInfoResponse, AttestationRightsQueryArguments, AttestationRightsResponse, - EndorsingRightsQueryArguments, - EndorsingRightsResponse, EntrypointsResponse, ForgeOperationsParams, ManagerKeyResponse, @@ -481,8 +479,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/api/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` 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({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. */ async getBlock({ block, version }: RPCOptions = defaultRPCOptions): Promise { @@ -552,7 +550,6 @@ export class RpcClient implements RpcClientInterface { * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the delegates allowed to attest a block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights */ async getAttestationRights( args: AttestationRightsQueryArguments = {}, @@ -567,26 +564,6 @@ export class RpcClient implements RpcClientInterface { return response; } - /** - * @deprecated Deprecated in favor of getAttestationRights - * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) - * @param options contains generic configuration for rpc calls - * @description Retrieves the delegates allowed to endorse a block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights - */ - async getEndorsingRights( - args: EndorsingRightsQueryArguments = {}, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - const response = await this.httpBackend.createRequest({ - url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/endorsing_rights`), - method: 'GET', - query: args, - }); - - return response; - } - /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Ballots casted so far during a voting period diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 5867dd531e..9ee0e59cbf 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -19,19 +19,19 @@ interface INodeExtender { type OtherEltsInner = | { - value: any; - } + value: any; + } | { - inode_extender: INodeExtender; - }; + inode_extender: INodeExtender; + }; export type OtherElts = | { - node: [string, { value: string } | { node: string }][]; - } + node: [string, { value: string } | { node: string }][]; + } | { - other_elts: OtherEltsInner; - }; + other_elts: OtherEltsInner; + }; export interface Inode { length: string; @@ -1103,34 +1103,6 @@ export interface AttestationRightsResponseItem { export type AttestationRightsResponse = AttestationRightsResponseItem[]; -export type EndorsingRightsArgumentsDelegate = string | string[]; -export type EndorsingRightsArgumentsCycle = number | number[]; -export type EndorsingRightsArgumentsLevel = number | number[]; - -export interface EndorsingRightsQueryArguments { - level?: EndorsingRightsArgumentsLevel; - cycle?: EndorsingRightsArgumentsCycle; - delegate?: EndorsingRightsArgumentsDelegate; - consensus_key?: string; -} - -export interface EndorsingRightsResponseItemDelegates { - delegate: string; - first_slot: number; - endorsing_power: number; - consensus_key?: string; -} - -export interface EndorsingRightsResponseItem { - level: number; - delegate?: string; - delegates?: EndorsingRightsResponseItemDelegates[]; - slots?: number[]; - estimated_time?: Date; -} - -export type EndorsingRightsResponse = EndorsingRightsResponseItem[]; - export type BallotListResponseEnum = 'nay' | 'yay' | 'pass'; export interface BallotListResponseItem { @@ -1994,10 +1966,10 @@ export interface ConstantsResponseProto010 extends ConstantsResponseProto009 { } // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ConstantsResponseProto009 extends ConstantsResponseProto008 {} +export interface ConstantsResponseProto009 extends ConstantsResponseProto008 { } // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ConstantsResponseProto008 extends ConstantsResponseProto007 {} +export interface ConstantsResponseProto008 extends ConstantsResponseProto007 { } export interface ConstantsResponseProto007 extends Omit { @@ -2205,12 +2177,12 @@ export type ProtocolsResponse = { export type Next = | { - next: number; - } + next: number; + } | { - newest: number; - oldest: number; - }; + newest: number; + oldest: number; + }; export type LastRemovedCommitmentHashes = { last_message_hash: string; diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index 66e6ae963a..21fc5de7f3 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -2459,14 +2459,6 @@ export const attestationRights = [ ], }, ]; -export const endorsingRights = [ - { - level: 516500, - delegate: 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', - slots: [12, 37, 80, 120, 130, 206, 209, 219, 229], - estimated_time: '2021-09-27T20:41:55Z', - }, -]; export const ballotList = []; export const ballots = { yay: 0, nay: 0, pass: 0 }; export const currentPeriodKind = { diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index 9048af5407..208df91adf 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -16,7 +16,6 @@ import { blockMetadata, bakingRights, attestationRights, - endorsingRights, ballotList, ballots, currentProposal, @@ -73,7 +72,6 @@ describe('RpcClientCache test', () => { getBlockMetadata: jest.fn(), getBakingRights: jest.fn(), getAttestationRights: jest.fn(), - getEndorsingRights: jest.fn(), getBallotList: jest.fn(), getBallots: jest.fn(), getCurrentProposal: jest.fn(), @@ -113,7 +111,6 @@ describe('RpcClientCache test', () => { mockRpcClient.getBlockMetadata.mockReturnValue(blockMetadata); mockRpcClient.getBakingRights.mockReturnValue(bakingRights); mockRpcClient.getAttestationRights.mockReturnValue(attestationRights); - mockRpcClient.getEndorsingRights.mockReturnValue(endorsingRights); mockRpcClient.getBallotList.mockReturnValue(ballotList); mockRpcClient.getBallots.mockReturnValue(ballots); mockRpcClient.getCurrentProposal.mockReturnValue(currentProposal); @@ -158,7 +155,6 @@ describe('RpcClientCache test', () => { await rpcCache.getBlockMetadata(); await rpcCache.getBakingRights(); await rpcCache.getAttestationRights(); - await rpcCache.getEndorsingRights(); await rpcCache.getBallotList(); await rpcCache.getBallots(); await rpcCache.getCurrentProposal(); @@ -235,9 +231,6 @@ describe('RpcClientCache test', () => { expect(rpcCache.getAllCachedData()['rpcTest/getAttestationRights/head/{}/'].response).toEqual( attestationRights ); - expect(rpcCache.getAllCachedData()['rpcTest/getEndorsingRights/head/{}/'].response).toEqual( - endorsingRights - ); expect(rpcCache.getAllCachedData()['rpcTest/getBallotList/head/'].response).toEqual(ballotList); expect(rpcCache.getAllCachedData()['rpcTest/getBallots/head/'].response).toEqual(ballots); expect(rpcCache.getAllCachedData()['rpcTest/getCurrentProposal/head/'].response).toEqual( @@ -306,7 +299,6 @@ describe('RpcClientCache test', () => { await rpcCache.getBlockMetadata(block); await rpcCache.getBakingRights({ level: 1111 }, block); await rpcCache.getAttestationRights({ level: 151187 }, block); - await rpcCache.getEndorsingRights({ level: 1111 }, block); await rpcCache.getBallotList(block); await rpcCache.getBallots(block); await rpcCache.getCurrentProposal(block); @@ -398,10 +390,6 @@ describe('RpcClientCache test', () => { rpcCache.getAllCachedData()[`rpcTest/getAttestationRights/${block.block}/{"level":151187}/`] .response ).toEqual(attestationRights); - expect( - rpcCache.getAllCachedData()[`rpcTest/getEndorsingRights/${block.block}/{"level":1111}/`] - .response - ).toEqual(endorsingRights); expect(rpcCache.getAllCachedData()[`rpcTest/getBallotList/${block.block}/`].response).toEqual( ballotList ); @@ -470,7 +458,6 @@ describe('RpcClientCache test', () => { await rpcCache.getBlockMetadata(); await rpcCache.getBakingRights(); await rpcCache.getAttestationRights(); - await rpcCache.getEndorsingRights(); await rpcCache.getBallotList(); await rpcCache.getBallots(); await rpcCache.getCurrentProposal(); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index ba5d08f4b1..b6d2e7c5b5 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -3101,81 +3101,6 @@ describe('RpcClient test', () => { }); }); - describe('getEndorsingRights', () => { - it('query the right url and data', async () => { - httpBackend.createRequest.mockResolvedValue([ - { - level: 547386, - delegate: 'tz3WMqdzXqRWXwyvj5Hp2H7QEepaUuS7vd9K', - slots: [27], - estimated_time: '2019-08-02T09:42:56Z', - }, - { - level: 547386, - delegate: 'tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN', - slots: [23, 12, 0], - estimated_time: '2019-08-02T09:42:56Z', - }, - { - level: 547386, - delegate: 'tz3RB4aoyjov4KEVRbuhvQ1CKJgBJMWhaeB8', - slots: [31, 17, 13], - estimated_time: '2019-08-02T09:42:56Z', - }, - { - level: 547386, - delegate: 'tz3NExpXn9aPNZPorRE4SdjJ2RGrfbJgMAaV', - slots: [24, 9, 1], - estimated_time: '2019-08-02T09:42:56Z', - }, - ]); - const result = await client.getEndorsingRights(); - - expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ - method: 'GET', - query: {}, - url: 'root/chains/test/blocks/head/helpers/endorsing_rights', - }); - - expect(result[1].delegate).toEqual('tz3VEZ4k6a4Wx42iyev6i2aVAptTRLEAivNN'); - expect(result[1].estimated_time).toEqual('2019-08-02T09:42:56Z'); - expect(result[1].slots!.length).toEqual(3); - }); - - it('query the right url and data (with consensus key in delegates)', async () => { - httpBackend.createRequest.mockResolvedValue([ - { - level: 547386, - delegates: [ - { - delegate: 'tz3WMqdzXqRWXwyvj5Hp2H7QEepaUuS7vd9K', - first_slot: 1, - endorsing_power: 1, - consensus_key: 'tz1asyQFDgjv2muoaiZ5x5U5RPpaNz33Z2F6', - }, - ], - slots: [27], - estimated_time: '2019-08-02T09:42:56Z', - }, - ]); - const result = await client.getEndorsingRights(); - - expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ - method: 'GET', - query: {}, - url: 'root/chains/test/blocks/head/helpers/endorsing_rights', - }); - - expect(result[0].delegates).toBeDefined(); - expect(result[0].delegates![0].delegate).toEqual('tz3WMqdzXqRWXwyvj5Hp2H7QEepaUuS7vd9K'); - expect(result[0].delegates![0].first_slot).toEqual(1); - expect(result[0].delegates![0].endorsing_power).toEqual(1); - expect(result[0].delegates![0].consensus_key).toEqual('tz1asyQFDgjv2muoaiZ5x5U5RPpaNz33Z2F6'); - expect(result[0].estimated_time).toEqual('2019-08-02T09:42:56Z'); - expect(result[0].slots!.length).toEqual(1); - }); - }); - describe('getBallotList', () => { it('should query the right url and data', async () => { httpBackend.createRequest.mockReturnValue( @@ -3395,8 +3320,8 @@ describe('RpcClient test', () => { const balanceUpdate = 'metadata' in response.contents[0] ? (response.contents[0]['metadata'][ - 'balance_updates' - ] as OperationMetadataBalanceUpdates[]) + 'balance_updates' + ] as OperationMetadataBalanceUpdates[]) : []; expect(balanceUpdate![0]['category']).toEqual( METADATA_BALANCE_UPDATES_CATEGORY.BAKING_BONUSES @@ -3453,8 +3378,8 @@ describe('RpcClient test', () => { const balanceUpdate = 'metadata' in response.contents[0] ? (response.contents[0]['metadata'][ - 'balance_updates' - ] as OperationMetadataBalanceUpdates[]) + 'balance_updates' + ] as OperationMetadataBalanceUpdates[]) : []; expect(balanceUpdate![0]['category']).toEqual( METADATA_BALANCE_UPDATES_CATEGORY.BAKING_REWARDS From 604733903341724d2003f04793779b2caa565ed3 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 16 Apr 2024 15:44:07 -0700 Subject: [PATCH 03/35] updated protocol constants test (#2918) * updated protocol constants test * updated constants response for proto20 * updated missing properties and estimation values * removed duplicate property --- .../contract/estimation-tests.spec.ts | 8 +- .../rpc/get-protocol-constants.spec.ts | 165 +++++++- ...tadata-on-HTTPS-and-fetch-metadata.spec.ts | 387 +++++++++--------- package-lock.json | 2 +- packages/taquito-rpc/src/types.ts | 115 +++++- 5 files changed, 455 insertions(+), 222 deletions(-) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index e82d62dc22..d52fcaec73 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(1456056); + expect(estimate.consumedMilligas).toEqual(1456142); }); 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(1570585); + expect(estimate.consumedMilligas).toEqual(1570671); }); 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(1866680); + expect(estimate.consumedMilligas).toEqual(1866766); }); 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(2391833); + expect(estimate.consumedMilligas).toEqual(2391919); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); diff --git a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts index a3ac693227..575054d59c 100644 --- a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts +++ b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts @@ -1,16 +1,17 @@ import { Protocols } from "@taquito/taquito"; import { CONFIGS, NetworkType } from "../../config"; import BigNumber from 'bignumber.js'; -import { ConstantsResponseProto019 } from '@taquito/rpc'; +import { ConstantsResponseProto019, ConstantsResponseProto020 } from '@taquito/rpc'; CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { const Tezos = lib; const oxfordnet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProxfordY) ? test : test.skip; + const parisnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PtParisBQ) ? 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/'; Tezos.setRpcProvider(rpcUrl); - it(`successfully fetches Proto19(oxford2) constants at head`, async () => { + it(`should successfully fetch Proto19(oxford2) constants at head`, async () => { const constants: ConstantsResponseProto019 = await Tezos.rpc.getConstants(); expect(constants).toEqual({ adaptive_issuance_activation_vote_enable: false, @@ -140,7 +141,155 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { }); describe(`Fetch constants for testnet`, () => { - oxfordnet(`successfully fetches all constants for oxfordnet using ${rpc}`, async () => { + parisnet(`should successfully fetch all constants for Parisnet 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: "25", + 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_cycle: 12288, + blocks_per_commitment: 96, + blocks_preservation_cycles: 1, + nonce_revelation_threshold: 768, + ns_enable: true, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(1733333), + 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: 500, + 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: "80007812", + 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: 1000000000, + max_operations_time_to_live: 360, + minimal_block_delay: new BigNumber(5), + delay_increment_per_round: new BigNumber(2), + delegate_parameters_activation_delay: 5, + 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: false, + smart_rollup_challenge_window_in_blocks: 241920, + smart_rollup_commitment_period_in_blocks: 180, + smart_rollup_max_lookahead_in_blocks: 518400, + smart_rollup_max_active_outbox_levels: 241920, + 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: 8193, + dal_parameters: 8193, + metadata: 0, + raw_data: { + Blake2B: 0, + }, + }, + smart_rollup_riscv_pvm_enable: false, + smart_rollup_stake_amount: '10000000000', + smart_rollup_timeout_period_in_blocks: 120960, + testnet_dictator: 'tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8', + vdf_difficulty: new BigNumber(10000000000), + zk_rollup_enable: false, + zk_rollup_max_ticket_payload_size: 2048, + zk_rollup_min_pending_to_process: 10, + zk_rollup_origination_size: 4000, + }); + }); + + + oxfordnet(`should successfully fetch all constants for Oxfordnet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); const constants: ConstantsResponseProto019 = await Tezos.rpc.getConstants(); expect(constants).toEqual({ @@ -185,8 +334,8 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { preserved_cycles: 3, blocks_per_cycle: 8192, blocks_per_commitment: 64, - nonce_revelation_threshold: 512, blocks_per_stake_snapshot: 512, + nonce_revelation_threshold: 512, cycles_per_voting_period: 1, hard_gas_limit_per_operation: new BigNumber(1040000), hard_gas_limit_per_block: new BigNumber(2600000), @@ -227,14 +376,14 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { cache_sampler_state_cycles: 8, dal_parametric: { feature_enable: false, - number_of_slots: 256, + blocks_per_epoch: 1, attestation_lag: 4, attestation_threshold: 50, - blocks_per_epoch: 1, redundancy_factor: 16, page_size: 4096, slot_size: 1048576, - number_of_shards: 2048 + number_of_shards: 2048, + number_of_slots: 256, }, quorum_max: 7000, quorum_min: 2000, @@ -270,7 +419,7 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { }); }); - weeklynet(`successfully fetches all constants for weeklynet using ${rpc}`, async () => { + weeklynet(`should successfully fetch all constants for weeklynet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); const constants: ConstantsResponseProto019 = await Tezos.rpc.getConstants(); diff --git a/integration-tests/__tests__/tzip-metadata/tzip16-originate-contracts-with-metadata-on-HTTPS-and-fetch-metadata.spec.ts b/integration-tests/__tests__/tzip-metadata/tzip16-originate-contracts-with-metadata-on-HTTPS-and-fetch-metadata.spec.ts index 54db9cd4b8..bdeaa260cf 100644 --- a/integration-tests/__tests__/tzip-metadata/tzip16-originate-contracts-with-metadata-on-HTTPS-and-fetch-metadata.spec.ts +++ b/integration-tests/__tests__/tzip-metadata/tzip16-originate-contracts-with-metadata-on-HTTPS-and-fetch-metadata.spec.ts @@ -4,198 +4,197 @@ import { MichelsonMap } from "@taquito/taquito"; import { tzip16, Tzip16Module, stringToBytes } from '@taquito/tzip16'; CONFIGS().forEach(({ lib, rpc, setup }) => { - const Tezos = lib; - Tezos.addExtension(new Tzip16Module()); - - let contractAddressEmptyMetadata: string; - let contractAddressEmoji: string; - let contractAddressInvalidMetadata: string; - - describe(`Test contract origination having metadata stored at HTTPS URL through contract api using: ${rpc}`, () => { - - beforeEach(async () => { - await setup() - }) - test('Verify contract.originate for a contract having empty metadata stored at an HTTPS URL', async () => { - - // location of the contract metadata - const url = 'https://storage.googleapis.com/tzip-16/empty-metadata.json'; - const bytesUrl = stringToBytes(url); - - const metadataBigMAp = new MichelsonMap(); - metadataBigMAp.set("", bytesUrl); - - // Ligo Taco shop contract modified to include metadata in storage - // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A - - const tacoShopStorageMap = new MichelsonMap(); - tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); - tacoShopStorageMap.set("2", { current_stock: "120", max_price: "20" }); - tacoShopStorageMap.set("3", { current_stock: "50", max_price: "60" }); - - const op = await Tezos.contract.originate({ - code: tacoContractTzip16, - storage: { - metadata: metadataBigMAp, - taco_shop_storage: tacoShopStorageMap - }, - }); - await op.confirmation(); - contractAddressEmptyMetadata = (await op.contract()).address; - expect(op.hash).toBeDefined(); - expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); - }); - - test('Verify that the metadata for the contract having empty metadata stored at an HTTPS URL can be fetched', async () => { - - const contract = await Tezos.contract.at(contractAddressEmptyMetadata, tzip16); - const metadata = await contract.tzip16().getMetadata(); - - expect(metadata.uri).toEqual('https://storage.googleapis.com/tzip-16/empty-metadata.json'); - expect(metadata.integrityCheckResult).toBeUndefined(); - expect(metadata.sha256Hash).toBeUndefined(); - expect(metadata.metadata).toEqual({}); - }); - - test('Verify contract.originate for a contract having valid metadata stored at an HTTPS URL', async () => { - - // location of the contract metadata - const url = 'https://storage.googleapis.com/tzip-16/taco-shop-metadata.json'; - const bytesUrl = stringToBytes(url); - - const metadataBigMap = new MichelsonMap(); - metadataBigMap.set("", bytesUrl); - - // Ligo Taco shop contract modified to include metadata in storage - // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A - - const tacoShopStorageMap = new MichelsonMap(); - tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); - - const op = await Tezos.contract.originate({ - code: tacoContractTzip16, - storage: { - metadata: metadataBigMap, - taco_shop_storage: tacoShopStorageMap - }, - }); - await op.confirmation(); - expect(op.hash).toBeDefined(); - expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); - }); - - test('Verify contract.originate for a contract having valid metadata which contains emoji stored at an HTTPS URL', async () => { - - // location of the contract metadata - const url = 'https://storage.googleapis.com/tzip-16/emoji-in-metadata.json'; - const bytesUrl = stringToBytes(url); - - const metadataBigMAp = new MichelsonMap(); - metadataBigMAp.set("", bytesUrl); - - // Ligo Taco shop contract modified to include metadata in storage - // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A - - const tacoShopStorageMap = new MichelsonMap(); - tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); - - const op = await Tezos.contract.originate({ - code: tacoContractTzip16, - storage: { - metadata: metadataBigMAp, - taco_shop_storage: tacoShopStorageMap - }, - }); - await op.confirmation(); - contractAddressEmoji = (await op.contract()).address; - expect(op.hash).toBeDefined(); - expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); - }); - - test('Verify that the metadata for the contract which contains emoji can be fetched', async () => { - - const contract = await Tezos.contract.at(contractAddressEmoji, tzip16); - const metadata = await contract.tzip16().getMetadata(); - - expect(metadata.uri).toEqual('https://storage.googleapis.com/tzip-16/emoji-in-metadata.json'); - expect(metadata.integrityCheckResult).toBeUndefined(); - expect(metadata.sha256Hash).toBeUndefined(); - expect(metadata.metadata).toEqual({ - "name": "Taquito test with valid metadata containing emoji 😀 🤩", - "description": "👋 This is metadata test for Taquito integration tests 🧐 with the Ligo Taco shop contract modified to include metadata URI in the storage", - "version": "7.1.0-beta.0", - "license": { - "name": "MIT", - "details": "The MIT License" - }, - "homepage": "https://github.com/ecadlabs/taquito", - "source": { - "tools": [ - "Ligo", - "https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A" - ], - "location": "https://ligolang.org/docs/tutorials/get-started/tezos-taco-shop-payout" - } - }); - - expect(await (await contract.tzip16()).metadataName()).toBe('Taquito test with valid metadata containing emoji 😀 🤩') - expect(await (await contract.tzip16()).metadataDescription()).toBe('👋 This is metadata test for Taquito integration tests 🧐 with the Ligo Taco shop contract modified to include metadata URI in the storage') - expect(await (await contract.tzip16()).metadataVersion()).toBe('7.1.0-beta.0') - expect(await (await contract.tzip16()).metadataLicense()).toEqual({ - "name": "MIT", - "details": "The MIT License" - }) - expect(await (await contract.tzip16()).metadataAuthors()).toBeUndefined() - expect(await (await contract.tzip16()).metadataHomepage()).toBe('https://github.com/ecadlabs/taquito') - expect(await (await contract.tzip16()).metadataSource()).toEqual({ - "tools": [ - "Ligo", - "https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A" - ], - "location": "https://ligolang.org/docs/tutorials/get-started/tezos-taco-shop-payout" - }) - expect(await (await contract.tzip16()).metadataInterfaces()).toBeUndefined() - expect(await (await contract.tzip16()).metadataErrors()).toBeUndefined() - expect(await (await contract.tzip16()).metadataViews()).toEqual({}); - }); - - test('Verify contract.originate for a contract having invalid metadata stored at an HTTPS URL', async () => { - - // location of the contract metadata - const url = 'https://storage.googleapis.com/tzip-16/invalid.json'; - const bytesUrl = stringToBytes(url); - - const metadataBigMAp = new MichelsonMap(); - metadataBigMAp.set("", bytesUrl); - - // Ligo Taco shop contract modified to include metadata in storage - // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A - - const tacoShopStorageMap = new MichelsonMap(); - tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); - - const op = await Tezos.contract.originate({ - code: tacoContractTzip16, - storage: { - metadata: metadataBigMAp, - taco_shop_storage: tacoShopStorageMap - }, - }); - await op.confirmation(); - contractAddressInvalidMetadata = (await op.contract()).address; - expect(op.hash).toBeDefined(); - expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); - }); - - test('Verify that the invalid metadata of the contract failed to fetch', async () => { - - const contract = await Tezos.contract.at(contractAddressInvalidMetadata, tzip16); - try { - await contract.tzip16().getMetadata(); - } catch (error: any) { - expect(error.message).toContain(`Invalid metadata`); - } - - }); + const Tezos = lib; + Tezos.addExtension(new Tzip16Module()); + + let contractAddressEmptyMetadata: string; + let contractAddressEmoji: string; + let contractAddressInvalidMetadata: string; + + describe(`Test contract origination having metadata stored at HTTPS URL through contract api using: ${rpc}`, () => { + + beforeEach(async () => { + await setup() + }) + test('Verify contract.originate for a contract having empty metadata stored at an HTTPS URL', async () => { + + // location of the contract metadata + const url = 'https://storage.googleapis.com/tzip-16/empty-metadata.json'; + const bytesUrl = stringToBytes(url); + + const metadataBigMAp = new MichelsonMap(); + metadataBigMAp.set("", bytesUrl); + + // Ligo Taco shop contract modified to include metadata in storage + // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A + + const tacoShopStorageMap = new MichelsonMap(); + tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); + tacoShopStorageMap.set("2", { current_stock: "120", max_price: "20" }); + tacoShopStorageMap.set("3", { current_stock: "50", max_price: "60" }); + + const op = await Tezos.contract.originate({ + code: tacoContractTzip16, + storage: { + metadata: metadataBigMAp, + taco_shop_storage: tacoShopStorageMap + }, + }); + await op.confirmation(); + contractAddressEmptyMetadata = (await op.contract()).address; + expect(op.hash).toBeDefined(); + expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); }); -}) + + test('Verify that the metadata for the contract having empty metadata stored at an HTTPS URL can be fetched', async () => { + + const contract = await Tezos.contract.at(contractAddressEmptyMetadata, tzip16); + const metadata = await contract.tzip16().getMetadata(); + + expect(metadata.uri).toEqual('https://storage.googleapis.com/tzip-16/empty-metadata.json'); + expect(metadata.integrityCheckResult).toBeUndefined(); + expect(metadata.sha256Hash).toBeUndefined(); + expect(metadata.metadata).toEqual({}); + }); + + test('Verify contract.originate for a contract having valid metadata stored at an HTTPS URL', async () => { + + // location of the contract metadata + const url = 'https://storage.googleapis.com/tzip-16/taco-shop-metadata.json'; + const bytesUrl = stringToBytes(url); + + const metadataBigMap = new MichelsonMap(); + metadataBigMap.set("", bytesUrl); + + // Ligo Taco shop contract modified to include metadata in storage + // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A + + const tacoShopStorageMap = new MichelsonMap(); + tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); + + const op = await Tezos.contract.originate({ + code: tacoContractTzip16, + storage: { + metadata: metadataBigMap, + taco_shop_storage: tacoShopStorageMap + }, + }); + await op.confirmation(); + expect(op.hash).toBeDefined(); + expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); + }); + + test('Verify contract.originate for a contract having valid metadata which contains emoji stored at an HTTPS URL', async () => { + + // location of the contract metadata + const url = 'https://storage.googleapis.com/tzip-16/emoji-in-metadata.json'; + const bytesUrl = stringToBytes(url); + + const metadataBigMAp = new MichelsonMap(); + metadataBigMAp.set("", bytesUrl); + + // Ligo Taco shop contract modified to include metadata in storage + // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A + + const tacoShopStorageMap = new MichelsonMap(); + tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); + + const op = await Tezos.contract.originate({ + code: tacoContractTzip16, + storage: { + metadata: metadataBigMAp, + taco_shop_storage: tacoShopStorageMap + }, + }); + await op.confirmation(); + contractAddressEmoji = (await op.contract()).address; + expect(op.hash).toBeDefined(); + expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); + }); + + test('Verify that the metadata for the contract which contains emoji can be fetched', async () => { + + const contract = await Tezos.contract.at(contractAddressEmoji, tzip16); + const metadata = await contract.tzip16().getMetadata(); + + expect(metadata.uri).toEqual('https://storage.googleapis.com/tzip-16/emoji-in-metadata.json'); + expect(metadata.integrityCheckResult).toBeUndefined(); + expect(metadata.sha256Hash).toBeUndefined(); + expect(metadata.metadata).toEqual({ + "name": "Taquito test with valid metadata containing emoji 😀 🤩", + "description": "👋 This is metadata test for Taquito integration tests 🧐 with the Ligo Taco shop contract modified to include metadata URI in the storage", + "version": "7.1.0-beta.0", + "license": { + "name": "MIT", + "details": "The MIT License" + }, + "homepage": "https://github.com/ecadlabs/taquito", + "source": { + "tools": [ + "Ligo", + "https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A" + ], + "location": "https://ligolang.org/docs/tutorials/get-started/tezos-taco-shop-payout" + } + }); + + expect(await (await contract.tzip16()).metadataName()).toBe('Taquito test with valid metadata containing emoji 😀 🤩') + expect(await (await contract.tzip16()).metadataDescription()).toBe('👋 This is metadata test for Taquito integration tests 🧐 with the Ligo Taco shop contract modified to include metadata URI in the storage') + expect(await (await contract.tzip16()).metadataVersion()).toBe('7.1.0-beta.0') + expect(await (await contract.tzip16()).metadataLicense()).toEqual({ + "name": "MIT", + "details": "The MIT License" + }) + expect(await (await contract.tzip16()).metadataAuthors()).toBeUndefined() + expect(await (await contract.tzip16()).metadataHomepage()).toBe('https://github.com/ecadlabs/taquito') + expect(await (await contract.tzip16()).metadataSource()).toEqual({ + "tools": [ + "Ligo", + "https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A" + ], + "location": "https://ligolang.org/docs/tutorials/get-started/tezos-taco-shop-payout" + }) + expect(await (await contract.tzip16()).metadataInterfaces()).toBeUndefined() + expect(await (await contract.tzip16()).metadataErrors()).toBeUndefined() + expect(await (await contract.tzip16()).metadataViews()).toEqual({}); + }); + + test('Verify contract.originate for a contract having invalid metadata stored at an HTTPS URL', async () => { + + // location of the contract metadata + const url = 'https://storage.googleapis.com/tzip-16/invalid.json'; + const bytesUrl = stringToBytes(url); + + const metadataBigMAp = new MichelsonMap(); + metadataBigMAp.set("", bytesUrl); + + // Ligo Taco shop contract modified to include metadata in storage + // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A + + const tacoShopStorageMap = new MichelsonMap(); + tacoShopStorageMap.set("1", { current_stock: "10000", max_price: "50" }); + + const op = await Tezos.contract.originate({ + code: tacoContractTzip16, + storage: { + metadata: metadataBigMAp, + taco_shop_storage: tacoShopStorageMap + }, + }); + await op.confirmation(); + contractAddressInvalidMetadata = (await op.contract()).address; + expect(op.hash).toBeDefined(); + expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); + }); + + test('Verify that the invalid metadata of the contract failed to fetch', async () => { + + const contract = await Tezos.contract.at(contractAddressInvalidMetadata, tzip16); + try { + await contract.tzip16().getMetadata(); + } catch (error: any) { + expect(error.message).toContain(`Invalid metadata`); + } + }); + }); +}); diff --git a/package-lock.json b/package-lock.json index fadffed0cb..29ea6dcfb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -87,7 +87,7 @@ "name": "@taquito/example", "version": "19.2.0", "dependencies": { - "@ledgerhq/hw-transport-node-hid": "^6.28.5", + "@ledgerhq/hw-transport-node-hid": "^6.27.21", "@taquito/ledger-signer": "^19.2.0", "@taquito/local-forging": "^19.2.0", "@taquito/michel-codec": "^19.2.0", diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 9ee0e59cbf..16d880da8f 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -19,19 +19,19 @@ interface INodeExtender { type OtherEltsInner = | { - value: any; - } + value: any; + } | { - inode_extender: INodeExtender; - }; + inode_extender: INodeExtender; + }; export type OtherElts = | { - node: [string, { value: string } | { node: string }][]; - } + node: [string, { value: string } | { node: string }][]; + } | { - other_elts: OtherEltsInner; - }; + other_elts: OtherEltsInner; + }; export interface Inode { length: string; @@ -1676,6 +1676,7 @@ export interface OperationContentsAndResultMetadataOrigination { } export type ConstantsResponse = ConstantsResponseCommon & + ConstantsResponseProto020 & ConstantsResponseProto019 & ConstantsResponseProto017 & ConstantsResponseProto016 & @@ -1720,6 +1721,89 @@ export interface ConstantsResponseCommon { export type Ratio = { numerator: number; denominator: number }; +export interface ConstantsResponseProto020 + extends Omit< + ConstantsResponseProto019, + | 'adaptive_rewards_params' + | 'blocks_per_stake_snapshot' + | 'dal_parametric' + | 'issuance_weights' + | 'liquidity_baking_subsidy_weight' + | 'preserved_cycles' + | 'smart_rollup_reveal_activation_level' + > { + adaptive_issuance_force_activation: boolean; + adaptive_rewards_params: { + center_dz: { + denominator: string; + numerator: string; + }; + growth_rate: { + denominator: string; + numerator: string; + }; + issuance_ratio_final_max: { + denominator: string; + numerator: string; + }; + issuance_ratio_final_min: { + denominator: string; + numerator: string; + }; + issuance_ratio_initial_max: { + denominator: string; + numerator: string; + }; + issuance_ratio_initial_min: { + denominator: string; + numerator: string; + }; + max_bonus: string; + radius_dz: { + denominator: string; + numerator: string; + }; + initial_period: number; + transition_period: number; + }; + blocks_preservation_cycles: number; + consensus_rights_delay: number; + dal_parametric: { + attestation_lag: number; + attestation_threshold: number; + feature_enable: boolean; + incentives_enable: boolean; + number_of_shards: number; + number_of_slots: number; + page_size: number; + redundancy_factor: number; + slot_size: number; + }; + delegate_parameters_activation_delay: number; + direct_ticket_spending_enable: boolean; + issuance_weights: { + attesting_reward_weight: number; + baking_reward_bonus_weight: number; + baking_reward_fixed_portion_weight: number; + base_total_issued_per_minute: string; + seed_nonce_revelation_tip_weight: number; + vdf_revelation_tip_weight: number; + }; + liquidity_baking_subsidy: string; + max_slashing_per_block: number; + max_slashing_threshold: number; + ns_enable: boolean; + smart_rollup_reveal_activation_level: { + dal_attested_slots_validity_lag: number; + dal_page: number; + dal_parameters: number; + metadata: number; + raw_data: { + Blake2B: number; + }; + }; +} + export interface ConstantsResponseProto019 extends Omit< ConstantsResponseProto017, @@ -1801,6 +1885,7 @@ export interface ConstantsResponseProto019 smart_rollup_riscv_pvm_enable: boolean; zk_rollup_max_ticket_payload_size: number; } + export type ConstantsResponseProto017 = ConstantsResponseProto016; export interface ConstantsResponseProto016 @@ -1966,10 +2051,10 @@ export interface ConstantsResponseProto010 extends ConstantsResponseProto009 { } // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ConstantsResponseProto009 extends ConstantsResponseProto008 { } +export interface ConstantsResponseProto009 extends ConstantsResponseProto008 {} // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ConstantsResponseProto008 extends ConstantsResponseProto007 { } +export interface ConstantsResponseProto008 extends ConstantsResponseProto007 {} export interface ConstantsResponseProto007 extends Omit { @@ -2177,12 +2262,12 @@ export type ProtocolsResponse = { export type Next = | { - next: number; - } + next: number; + } | { - newest: number; - oldest: number; - }; + newest: number; + oldest: number; + }; export type LastRemovedCommitmentHashes = { last_message_hash: string; From bb8a27359bb0b3a5a06384258c555775d082552f Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:13:07 -0700 Subject: [PATCH 04/35] 2678 rpc ai launch cycle (#2919) * feat: support new rpc getAdaptiveIssuanceLaunchCycle and unit tests re #2678 * test: add integration test and updated response type and description * test: update test descript for clarity * test: update estimation consumedMilligas assertion * docs: updated docs/rpc_nodes_integration_test.md with getAdaptiveIssuanceLaunchCycle --- docs/rpc_nodes_integration_test.md | 99 ++++++++++--------- integration-tests/__tests__/rpc/nodes.spec.ts | 15 ++- .../src/read-provider-wrapper.ts | 9 +- .../src/rpc-wrapper.ts | 8 +- .../taquito-rpc/src/rpc-client-interface.ts | 3 + .../src/rpc-client-modules/rpc-cache.ts | 25 ++++- packages/taquito-rpc/src/taquito-rpc.ts | 18 +++- packages/taquito-rpc/src/types.ts | 2 + .../taquito-rpc/test/data/rpc-responses.ts | 2 + packages/taquito-rpc/test/rpc-cache.spec.ts | 13 ++- packages/taquito-rpc/test/taquito-rpc.spec.ts | 25 ++++- .../taquito/src/read-provider/interface.ts | 7 ++ .../src/read-provider/rpc-read-adapter.ts | 9 ++ packages/taquito/test/read-provider/data.ts | 2 + .../read-provider/rpc-read-adapter.spec.ts | 14 +++ 15 files changed, 191 insertions(+), 60 deletions(-) diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index 7b7d750d92..4cc44866b8 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -8,56 +8,59 @@ author: Roxane Letourneau 1. The RPC nodes' integration tests are disabled by default. Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json. - **oxfordnet**: `npm run test:oxfordnet rpc-nodes.spec.ts` + **oxfordnet**: `npm run test:parisnet rpc-nodes.spec.ts` **When all endpoints are accessible for a node, you will obtain:** ``` Test calling all methods from RPC node: https://a-node - ✓ Verify that rpcClient.getBlockHash returns the head block hash (19 ms) - ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (21 ms) - ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (14 ms) - ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (12 ms) - ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (17 ms) - ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (15 ms) - ✓ Verify that rpcClient.getContract returns the complete status of a contract (15 ms) - ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (11 ms) - ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (21 ms) - ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (1090 ms) - ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (16 ms) - ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (1020 ms) - ✓ Verify that rpcClient.getConstants returns all constants from RPC (18 ms) - ✓ Verify that rpcClient.getBlock returns all the information about a block (24 ms) - ✓ Verify that rpcClient.getBlockHeader returns whole block header (15 ms) - ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (17 ms) - ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (14 ms) - ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (25 ms) - ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (10 ms) - ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (39 ms) - ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (11 ms) - ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (11 ms) - ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (13 ms) - ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (10 ms) - ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (11 ms) - ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (2019 ms) - ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (11 ms) - ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (75 ms) - ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (13 ms) - ✓ Verify that rpcClient.getChainId returns chain ID (10 ms) - ✓ Verify that rpcClient.runOperation runs an operation without signature checks (15 ms) - ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (12 ms) - ✓ Verify that rpcClient.runView executes tzip4 views (29 ms) - ✓ Verify that rpcClient.runScriptView executes michelson view (25 ms) - ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (12 ms) - ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (25 ms) - ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (10 ms) - ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (11 ms) - ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (12 ms) - ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (12 ms) - ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (10 ms) - ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (12 ms) - ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (250 ms) - ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (683 ms) + Test calling all methods from RPC node: http://parisnet.i.ecadinfra.com:8732/ + ✓ Verify that rpcClient.getBlockHash returns the head block hash (32 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (48 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (28 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (27 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (30 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (61 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (29 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (32 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (27 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (153 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (31 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (34 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (28 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (52 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (27 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (30 ms) + ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (28 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (34 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (26 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (60 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (57 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (29 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (29 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (30 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (31 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (60 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (30 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (100 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (27 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (28 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (29 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (26 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (59 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (56 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (68 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (56 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (30 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (26 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (26 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (30 ms) + ✓ 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 (32 ms) + ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://parisnet.i.ecadinfra.com:8732/ (28 ms) + ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (269 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (198 ms) + ○ skipped Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for http://parisnet.i.ecadinfra.com:8732/ ``` **Otherwise, you will see which endpoints do not work for a specific node:** @@ -106,6 +109,8 @@ Test calling all methods from RPC node: https://another-node ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (488 ms) ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (486 ms) ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (561 ms) - ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (1298 ms) - ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (1060 ms) + ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://parisnet.i.ecadinfra.com:8732/ (28 ms) + ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (269 ms) + ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (198 ms) + ○ skipped Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for http://parisnet.i.ecadinfra.com:8732/ ``` \ No newline at end of file diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index b0a2a64c14..5b0014b356 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -21,7 +21,8 @@ CONFIGS().forEach( }) => { const Tezos = lib; const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test; - const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip; + const oxford = protocol === Protocols.ProxfordY ? test : test.skip; + const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip; let ticketContract: DefaultContractType; @@ -447,6 +448,16 @@ CONFIGS().forEach( expect(ticketBalances[0].amount).toBeDefined(); }); + oxford(`Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for ${rpc}`, async () => { + const launchCycle = await rpcClient.getAdaptiveIssuanceLaunchCycle(); + expect(launchCycle).toEqual(null); + }) + + parisAndAlpha(`Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for ${rpc}`, async () => { + const launchCycle = await rpcClient.getAdaptiveIssuanceLaunchCycle(); + expect(launchCycle).toEqual(6); + }) + it('Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied', async () => { const pendingOperations = await rpcClient.getPendingOperations({ version: '1' }) as PendingOperationsV1; expect(pendingOperations).toBeDefined(); @@ -457,7 +468,7 @@ CONFIGS().forEach( expect(pendingOperations.branch_refused).toBeInstanceOf(Array); }); - oxfordAndAlpha('Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated', async () => { + 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(); expect(pendingOperations.validated).toBeInstanceOf(Array); diff --git a/packages/taquito-contracts-library/src/read-provider-wrapper.ts b/packages/taquito-contracts-library/src/read-provider-wrapper.ts index c02635bcab..2c6be8cbb3 100644 --- a/packages/taquito-contracts-library/src/read-provider-wrapper.ts +++ b/packages/taquito-contracts-library/src/read-provider-wrapper.ts @@ -5,12 +5,16 @@ import { MichelsonV1Expression, SaplingDiffResponse, ScriptedContracts, + AILaunchCycleResponse, } from '@taquito/rpc'; import { ContractsLibrary } from './taquito-contracts-library'; import { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from '@taquito/taquito'; export class ReadWrapperContractsLibrary implements TzReadProvider { - constructor(private readProvider: TzReadProvider, private contractslibrary: ContractsLibrary) {} + constructor( + private readProvider: TzReadProvider, + private contractslibrary: ContractsLibrary + ) {} async getScript(address: string, block: BlockIdentifier): Promise { const contractData = this.contractslibrary.getContract(address); @@ -92,4 +96,7 @@ export class ReadWrapperContractsLibrary implements TzReadProvider { getLiveBlocks(block: BlockIdentifier): Promise { return this.readProvider.getLiveBlocks(block); } + getAdaptiveIssuanceLaunchCycle(block: BlockIdentifier): Promise { + return this.readProvider.getAdaptiveIssuanceLaunchCycle(block); + } } diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 438e5bf4d0..9ea34277d8 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -48,6 +48,7 @@ import { PendingOperationsV2, PendingOperationsQueryArguments, RPCSimulateOperationParam, + AILaunchCycleResponse, } from '@taquito/rpc'; import { ContractsLibrary } from './taquito-contracts-library'; @@ -59,7 +60,7 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { constructor( private rpc: RpcClientInterface, private contractslibrary: ContractsLibrary - ) { } + ) {} async getContract( address: string, @@ -319,6 +320,11 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getAllTicketBalances(contract, { block }); } + async getAdaptiveIssuanceLaunchCycle({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + return this.rpc.getAdaptiveIssuanceLaunchCycle({ block }); + } async getPendingOperations( args: PendingOperationsQueryArguments ): Promise { diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index af9e2f8edd..76864ed912 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -48,6 +48,7 @@ import { PendingOperationsV2, PendingOperationsQueryArguments, RPCSimulateOperationParam, + AILaunchCycleResponse, } from './types'; export interface RPCOptions { @@ -125,6 +126,7 @@ export interface RpcClientInterface { options?: RPCOptions ): Promise; getAllTicketBalances(contract: string, options?: RPCOptions): Promise; + getAdaptiveIssuanceLaunchCycle(options?: RPCOptions): Promise; getPendingOperations( args: PendingOperationsQueryArguments ): Promise; @@ -168,5 +170,6 @@ export enum RPCMethodName { GET_STORAGE_PAID_SPACE = 'getStoragePaidSpace', GET_TICKET_BALANCE = 'getTicketBalance', GET_ALL_TICKET_BALANCES = 'getAllTicketBalances', + GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE = 'getAdaptiveIssuanceLaunchCycle', GET_PENDING_OPERATIONS = 'getPendingOperations', } 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 2fe8b79d73..a4712e7bb2 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -50,6 +50,7 @@ import { PendingOperationsV1, PendingOperationsV2, RPCSimulateOperationParam, + AILaunchCycleResponse, } from '../types'; import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core'; import { @@ -72,7 +73,7 @@ type RpcMethodParam = | BigMapKey | BakingRightsQueryArguments | PendingOperationsQueryArguments - | AttestationRightsQueryArguments + | AttestationRightsQueryArguments; const defaultTtl = 1000; @@ -91,7 +92,7 @@ export class RpcClientCache implements RpcClientInterface { constructor( private rpcClient: RpcClientInterface, private ttl = defaultTtl - ) { } + ) {} getAllCachedData() { return this._cache; @@ -1095,6 +1096,26 @@ export class RpcClientCache implements RpcClientInterface { return response; } } + /** + * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch. + * @param options contains generic configuration for rpc calls to specified block (default to head) + */ + async getAdaptiveIssuanceLaunchCycle({ + block, + }: RPCOptions = defaultRPCOptions): Promise { + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE, + [block] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getAdaptiveIssuanceLaunchCycle({ block }); + this.put(key, response); + return response; + } + } /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index db882d926b..76d8a2db5c 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -66,6 +66,7 @@ import { PendingOperationsV1, PendingOperationsV2, RPCSimulateOperationParam, + AILaunchCycleResponse, } from './types'; import { castToBigNumber } from './utils/utils'; import { @@ -997,7 +998,7 @@ export class RpcClient implements RpcClientInterface { /** * @param contract address of the contract we want to retrieve storage information of * @param options contains generic configuration for rpc calls to specified block (default to head) -= * @description Access the paid storage space of the contract + * @description Access the paid storage space of the contract * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStoragePaidSpace( @@ -1054,6 +1055,21 @@ export class RpcClient implements RpcClientInterface { }); } + /** + * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch. + * @param options contains generic configuration for rpc calls to specified block (default to head) + */ + async getAdaptiveIssuanceLaunchCycle({ + block, + }: { block: string } = defaultRPCOptions): Promise { + return this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/adaptive_issuance_launch_cycle` + ), + method: 'GET', + }); + } + /** * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint) * @param args has 5 optional properties. We support version 1 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 16d880da8f..b399bc0f78 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -1246,6 +1246,8 @@ export interface ScriptedContracts { storage: MichelsonV1Expression; } +export type AILaunchCycleResponse = number | null; + export type BondId = { smart_rollup: string; }; diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index 21fc5de7f3..5f4258170a 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -4312,6 +4312,8 @@ export const ticketBalancesResponse = [ }, ]; +export const aiLaunchCycle = 6; + export const pendingOperationsResponse = { applied: [ { diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index 208df91adf..6e832637d7 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -32,6 +32,7 @@ import { constants, ticketBalancesResponse, pendingOperationsResponse, + aiLaunchCycle, } from './data/rpc-responses'; /** @@ -87,6 +88,7 @@ describe('RpcClientCache test', () => { getProtocols: jest.fn(), getTicketBalance: jest.fn(), getAllTicketBalances: jest.fn(), + getAdaptiveIssuanceLaunchCycle: jest.fn(), getPendingOperations: jest.fn(), }; @@ -125,6 +127,7 @@ describe('RpcClientCache test', () => { mockRpcClient.getProtocols.mockReturnValue(protocols); mockRpcClient.getTicketBalance.mockReturnValue('3'); mockRpcClient.getAllTicketBalances.mockReturnValue(ticketBalancesResponse); + mockRpcClient.getAdaptiveIssuanceLaunchCycle.mockReturnValue(aiLaunchCycle); mockRpcClient.getPendingOperations.mockReturnValue(pendingOperationsResponse); rpcCache = new RpcClientCache(mockRpcClient); }); @@ -176,6 +179,7 @@ describe('RpcClientCache test', () => { content: { string: 'ticket1' }, }); await rpcCache.getAllTicketBalances(contractAddress); + await rpcCache.getAdaptiveIssuanceLaunchCycle(); await rpcCache.getPendingOperations(); expect(rpcCache.getAllCachedData()['rpcTest/getBlockHash/head/'].response).toEqual(blockHash); @@ -266,6 +270,9 @@ describe('RpcClientCache test', () => { expect( rpcCache.getAllCachedData()[`rpcTest/getAllTicketBalances/head/${contractAddress}/`].response ).toEqual(ticketBalancesResponse); + expect( + rpcCache.getAllCachedData()['rpcTest/getAdaptiveIssuanceLaunchCycle/head/'].response + ).toEqual(aiLaunchCycle); expect(rpcCache.getAllCachedData()[`rpcTest/getPendingOperations/{}/`].response).toEqual( pendingOperationsResponse ); @@ -324,6 +331,7 @@ describe('RpcClientCache test', () => { block ); await rpcCache.getAllTicketBalances(contractAddress, block); + await rpcCache.getAdaptiveIssuanceLaunchCycle(block); expect(rpcCache.getAllCachedData()[`rpcTest/getBlockHash/${block.block}/`].response).toEqual( blockHash @@ -433,7 +441,9 @@ describe('RpcClientCache test', () => { rpcCache.getAllCachedData()[`rpcTest/getAllTicketBalances/${block.block}/${contractAddress}/`] .response ).toEqual(ticketBalancesResponse); - + expect( + rpcCache.getAllCachedData()[`rpcTest/getAdaptiveIssuanceLaunchCycle/${block.block}/`].response + ).toEqual(aiLaunchCycle); rpcCache.deleteAllCachedData(); }); @@ -475,6 +485,7 @@ describe('RpcClientCache test', () => { await rpcCache.getProtocols(); await rpcCache.getTicketBalance(contractAddress, ticketToken); await rpcCache.getAllTicketBalances(contractAddress); + await rpcCache.getAdaptiveIssuanceLaunchCycle(); await rpcCache.getPendingOperations(); rpcCache.deleteAllCachedData(); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index b6d2e7c5b5..dd360a5d71 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -57,6 +57,7 @@ import { smartRollupRefuteResponse, smartRollupRecoverBondResponse, smartRollupTimeoutResponse, + aiLaunchCycle, } from './data/rpc-responses'; /** @@ -3320,8 +3321,8 @@ describe('RpcClient test', () => { const balanceUpdate = 'metadata' in response.contents[0] ? (response.contents[0]['metadata'][ - 'balance_updates' - ] as OperationMetadataBalanceUpdates[]) + 'balance_updates' + ] as OperationMetadataBalanceUpdates[]) : []; expect(balanceUpdate![0]['category']).toEqual( METADATA_BALANCE_UPDATES_CATEGORY.BAKING_BONUSES @@ -3378,8 +3379,8 @@ describe('RpcClient test', () => { const balanceUpdate = 'metadata' in response.contents[0] ? (response.contents[0]['metadata'][ - 'balance_updates' - ] as OperationMetadataBalanceUpdates[]) + 'balance_updates' + ] as OperationMetadataBalanceUpdates[]) : []; expect(balanceUpdate![0]['category']).toEqual( METADATA_BALANCE_UPDATES_CATEGORY.BAKING_REWARDS @@ -3982,8 +3983,22 @@ describe('RpcClient test', () => { }); }); + describe('AdaptiveIssuanceLaunchCycle', () => { + it('should query the right url and data', async () => { + httpBackend.createRequest.mockResolvedValue(aiLaunchCycle); + const response = await client.getAdaptiveIssuanceLaunchCycle(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/adaptive_issuance_launch_cycle`, + }); + + expect(response).toEqual(aiLaunchCycle); + }); + }); + describe('getPendingOperations', () => { - it('should query the correct url and retrun pending operations in mempool', async () => { + 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(); diff --git a/packages/taquito/src/read-provider/interface.ts b/packages/taquito/src/read-provider/interface.ts index 6a7ba42df8..d92b6ea4d6 100644 --- a/packages/taquito/src/read-provider/interface.ts +++ b/packages/taquito/src/read-provider/interface.ts @@ -4,6 +4,7 @@ import { MichelsonV1Expression, SaplingDiffResponse, ScriptedContracts, + AILaunchCycleResponse, } from '@taquito/rpc'; import BigNumber from 'bignumber.js'; @@ -151,4 +152,10 @@ export interface TzReadProvider { * @param block from which we want to retrieve the information */ getLiveBlocks(block: BlockIdentifier): Promise; + + /** + * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch. + * @param block from which we want to retrieve the information + */ + getAdaptiveIssuanceLaunchCycle(block: BlockIdentifier): Promise; } diff --git a/packages/taquito/src/read-provider/rpc-read-adapter.ts b/packages/taquito/src/read-provider/rpc-read-adapter.ts index 83e3c492e0..c1a1850176 100644 --- a/packages/taquito/src/read-provider/rpc-read-adapter.ts +++ b/packages/taquito/src/read-provider/rpc-read-adapter.ts @@ -5,6 +5,7 @@ import { RpcClientInterface, SaplingDiffResponse, ScriptedContracts, + AILaunchCycleResponse, } from '@taquito/rpc'; import BigNumber from 'bignumber.js'; import { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from './interface'; @@ -212,4 +213,12 @@ export class RpcReadAdapter implements TzReadProvider { getLiveBlocks(block: BlockIdentifier): Promise { return this.rpc.getLiveBlocks({ block: String(block) }); } + + /** + * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch. + * @param block from which we want to retrieve the information + */ + getAdaptiveIssuanceLaunchCycle(block: BlockIdentifier): Promise { + return this.rpc.getAdaptiveIssuanceLaunchCycle({ block: String(block) }); + } } diff --git a/packages/taquito/test/read-provider/data.ts b/packages/taquito/test/read-provider/data.ts index b2b6b4465c..73c00f63d9 100644 --- a/packages/taquito/test/read-provider/data.ts +++ b/packages/taquito/test/read-provider/data.ts @@ -720,3 +720,5 @@ export const liveBlocks = [ 'BMcczQyMnGAzM2WJPQ2vbgyzryg52GQgNWLggpHDKPqhQzJUeT8', 'BMdaQruY6gep3cmRwGoxEUqx2XJ79XQKqpTT7jusKLA1bSTowRc', ]; + +export const aiLaunchCycle = 6; 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 a4498e9d79..276c798c91 100644 --- a/packages/taquito/test/read-provider/rpc-read-adapter.spec.ts +++ b/packages/taquito/test/read-provider/rpc-read-adapter.spec.ts @@ -11,6 +11,7 @@ import { contractResponse, contractStorage, liveBlocks, + aiLaunchCycle, saplingState, } from './data'; import { RpcClient } from '@taquito/rpc'; @@ -34,6 +35,7 @@ describe('RpcReadAdapter test', () => { getManagerKey: jest.Mock; getBlock: jest.Mock; getLiveBlocks: jest.Mock; + getAdaptiveIssuanceLaunchCycle: jest.Mock; }; beforeEach(() => { @@ -54,6 +56,7 @@ describe('RpcReadAdapter test', () => { getManagerKey: jest.fn(), getBlock: jest.fn(), getLiveBlocks: jest.fn(), + getAdaptiveIssuanceLaunchCycle: jest.fn(), }; readProvider = new RpcReadAdapter(mockRpcClient as any); }); @@ -289,6 +292,17 @@ describe('RpcReadAdapter test', () => { expect(mockRpcClient.getLiveBlocks.mock.calls[0][0]).toEqual({ block: `${block}` }); }); + + it(`should get adaptive issuance launch cycle at block: ${block}`, async () => { + mockRpcClient.getAdaptiveIssuanceLaunchCycle.mockResolvedValue(aiLaunchCycle); + + const result = await readProvider.getAdaptiveIssuanceLaunchCycle(block); + expect(result).toEqual(aiLaunchCycle); + + expect(mockRpcClient.getAdaptiveIssuanceLaunchCycle.mock.calls[0][0]).toEqual({ + block: `${block}`, + }); + }); }); it(`should get the chain id`, async () => { From b660df999414ccab6e840a905c9af707b15d19ae Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:15:55 -0700 Subject: [PATCH 05/35] 2887 update ai rpc (#2923) * feat: update getDelegates rpc type with adaptive issuance changes * test: updated estimation assertion --- .../contract/estimation-tests.spec.ts | 72 ++++++++--------- packages/taquito-rpc/src/types.ts | 15 +++- .../taquito-rpc/test/data/rpc-responses.ts | 30 +++++-- packages/taquito-rpc/test/taquito-rpc.spec.ts | 80 +++++++++++-------- 4 files changed, 115 insertions(+), 82 deletions(-) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index d52fcaec73..d167dc228e 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(186); + expect(estimate.suggestedFeeMutez).toEqual(188); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(166); - expect(estimate.totalCost).toEqual(166); - expect(estimate.usingBaseFeeMutez).toEqual(166); + expect(estimate.minimalFeeMutez).toEqual(168); + expect(estimate.totalCost).toEqual(168); + expect(estimate.usingBaseFeeMutez).toEqual(168); 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(186); + expect(estimate.suggestedFeeMutez).toEqual(188); expect(estimate.burnFeeMutez).toEqual(69250); - expect(estimate.minimalFeeMutez).toEqual(166); - expect(estimate.totalCost).toEqual(69416); - expect(estimate.usingBaseFeeMutez).toEqual(166); + expect(estimate.minimalFeeMutez).toEqual(168); + expect(estimate.totalCost).toEqual(69418); + expect(estimate.usingBaseFeeMutez).toEqual(168); 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(535); + expect(estimate.suggestedFeeMutez).toEqual(537); expect(estimate.burnFeeMutez).toEqual(147750); - expect(estimate.minimalFeeMutez).toEqual(515); - expect(estimate.totalCost).toEqual(148265); - expect(estimate.usingBaseFeeMutez).toEqual(515); + expect(estimate.minimalFeeMutez).toEqual(517); + expect(estimate.totalCost).toEqual(148267); + expect(estimate.usingBaseFeeMutez).toEqual(517); expect(estimate.consumedMilligas).toEqual(676402); }); @@ -84,11 +84,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(100); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(181); + expect(estimate.suggestedFeeMutez).toEqual(183); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(161); - expect(estimate.totalCost).toEqual(161); - expect(estimate.usingBaseFeeMutez).toEqual(161); + expect(estimate.minimalFeeMutez).toEqual(163); + expect(estimate.totalCost).toEqual(163); + expect(estimate.usingBaseFeeMutez).toEqual(163); expect(estimate.consumedMilligas).toEqual(100000); }); @@ -97,11 +97,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1457); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(394); + expect(estimate.suggestedFeeMutez).toEqual(396); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(374); - expect(estimate.totalCost).toEqual(374); - expect(estimate.usingBaseFeeMutez).toEqual(374); + expect(estimate.minimalFeeMutez).toEqual(376); + expect(estimate.totalCost).toEqual(376); + expect(estimate.usingBaseFeeMutez).toEqual(376); expect(estimate.consumedMilligas).toEqual(1456142); }); @@ -114,11 +114,11 @@ 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(465); + expect(estimate.suggestedFeeMutez).toEqual(467); expect(estimate.burnFeeMutez).toEqual(133500); - expect(estimate.minimalFeeMutez).toEqual(445); - expect(estimate.totalCost).toEqual(133945); - expect(estimate.usingBaseFeeMutez).toEqual(445); + expect(estimate.minimalFeeMutez).toEqual(447); + expect(estimate.totalCost).toEqual(133947); + expect(estimate.usingBaseFeeMutez).toEqual(447); expect(estimate.consumedMilligas).toEqual(1570671); }); @@ -127,11 +127,11 @@ 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(441); + expect(estimate.suggestedFeeMutez).toEqual(443); expect(estimate.burnFeeMutez).toEqual(84250); - expect(estimate.minimalFeeMutez).toEqual(421); - expect(estimate.totalCost).toEqual(84671); - expect(estimate.usingBaseFeeMutez).toEqual(421); + expect(estimate.minimalFeeMutez).toEqual(423); + expect(estimate.totalCost).toEqual(84673); + expect(estimate.usingBaseFeeMutez).toEqual(423); expect(estimate.consumedMilligas).toEqual(1866766); }); @@ -140,11 +140,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(2392); expect(estimate.storageLimit).toEqual(654); - expect(estimate.suggestedFeeMutez).toEqual(559); + expect(estimate.suggestedFeeMutez).toEqual(561); expect(estimate.burnFeeMutez).toEqual(163500); - expect(estimate.minimalFeeMutez).toEqual(539); - expect(estimate.totalCost).toEqual(164039); - expect(estimate.usingBaseFeeMutez).toEqual(539); + expect(estimate.minimalFeeMutez).toEqual(541); + expect(estimate.totalCost).toEqual(164041); + expect(estimate.usingBaseFeeMutez).toEqual(541); expect(estimate.consumedMilligas).toEqual(2391919); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); @@ -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(185); + expect(estimate.suggestedFeeMutez).toEqual(187); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(165); - expect(estimate.totalCost).toEqual(165); - expect(estimate.usingBaseFeeMutez).toEqual(165); + expect(estimate.minimalFeeMutez).toEqual(167); + expect(estimate.totalCost).toEqual(167); + expect(estimate.usingBaseFeeMutez).toEqual(167); expect(estimate.consumedMilligas).toEqual(100040); }); diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index b399bc0f78..f24391719b 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -41,26 +41,33 @@ export interface Inode { export interface DelegatesResponse { full_balance?: BigNumber; current_frozen_deposits?: BigNumber; + frozen_deposits?: BigNumber; staking_balance: BigNumber; - frozen_deposits_limit?: BigNumber; delegated_contracts: string[]; delegated_balance: BigNumber; + min_delegated_in_current_cycle?: MinDelegatedInCurrentCycle; deactivated: boolean; - grace_period: number; total_delegated_stake?: BigNumber; staking_denominator?: BigNumber; + active_consensus_key?: string; + grace_period: number; + pending_denunciations?: boolean; + frozen_deposits_limit?: BigNumber; voting_power?: BigNumber; current_ballot?: BallotVote; current_proposals?: string[]; remaining_proposals?: number; - active_consensus_key?: string; pending_consensus_keys?: PendingConsensusKey[]; balance?: BigNumber; - frozen_deposits?: BigNumber; frozen_balance?: BigNumber; frozen_balance_by_cycle?: Frozenbalancebycycle[]; } +export type MinDelegatedInCurrentCycle = { + amount: string; + level?: LevelInfo; +}; + export type PendingConsensusKey = { cycle: number; pkh: string; diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index 5f4258170a..6773b39dbd 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -2304,14 +2304,30 @@ export const managerKey = 'edpkvP1NXoo8vhYbPSvXdy466EHoYWBpf6zmjghB2p3DwJPjbB5ns 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, - balance: new BigNumber('5821087107868'), - frozen_balance: new BigNumber('1682643263470'), - staking_balance: new BigNumber('5792534034676'), - delegated_contracts: ['tz2ApgXezUaJKaY49nxEYbMjsjnkAz2mTiFC'], - delegated_balance: new BigNumber('12714439280'), - grace_period: 131, - voting_power: 747, + 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', diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index dd360a5d71..5fd13bd3a5 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -231,20 +231,30 @@ describe('RpcClient test', () => { describe('getDelegates', () => { const sampleResponse = { - balance: '5092341810457', - frozen_balance: '2155290163074', - frozen_balance_by_cycle: [ - { cycle: 135, deposit: '381760000000', fees: '971071', rewards: '11843833332' }, - { cycle: 136, deposit: '394368000000', fees: '1433657', rewards: '12200333332' }, - ], - staking_balance: '20936607331513', - delegated_contracts: [ - 'KT1VvXEpeBpreAVpfp4V8ZujqWu2gVykwXBJ', - 'KT1VsSxSXUkgw6zkBGgUuDXXuJs9ToPqkrCg', - ], - delegated_balance: '15908924646030', + 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: 146, + 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', }; it('should query the right url', async () => { @@ -262,30 +272,30 @@ describe('RpcClient test', () => { const response = await client.getDelegates(contractAddress); expect(response).toEqual({ - balance: new BigNumber('5092341810457'), - frozen_balance: new BigNumber('2155290163074'), - frozen_balance_by_cycle: [ - { - cycle: 135, - deposit: new BigNumber('381760000000'), - fees: new BigNumber('971071'), - rewards: new BigNumber('11843833332'), - }, - { - cycle: 136, - deposit: new BigNumber('394368000000'), - fees: new BigNumber('1433657'), - rewards: new BigNumber('12200333332'), + 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, }, - ], - staking_balance: new BigNumber('20936607331513'), - delegated_contracts: [ - 'KT1VvXEpeBpreAVpfp4V8ZujqWu2gVykwXBJ', - 'KT1VsSxSXUkgw6zkBGgUuDXXuJs9ToPqkrCg', - ], - delegated_balance: new BigNumber('15908924646030'), + }, deactivated: false, - grace_period: 146, + 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', }); }); From a89b8728b17e2952a0f78c9aea112612efa025a6 Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:42:16 -0700 Subject: [PATCH 06/35] 2676 new ai rpc (#2926) --- cspell.json | 3 + docs/quick_start.md | 2 +- docs/rpc_nodes_integration_test.md | 193 +++++++++-------- docs/rpc_package.md | 2 +- docs/tutorial.md | 4 +- docs/web3js_taquito.md | 2 +- example/package.json | 2 +- .../contract/estimation-tests.spec.ts | 10 +- integration-tests/__tests__/rpc/nodes.spec.ts | 25 +++ package-lock.json | 2 +- .../src/rpc-wrapper.ts | 31 +++ .../taquito-rpc/src/rpc-client-interface.ts | 11 + .../src/rpc-client-modules/rpc-cache.ts | 204 ++++++++++++++---- packages/taquito-rpc/src/taquito-rpc.ts | 197 +++++++++++++---- packages/taquito-rpc/src/types.ts | 15 ++ .../taquito-rpc/test/data/rpc-responses.ts | 19 +- packages/taquito-rpc/test/rpc-cache.spec.ts | 59 +++++ packages/taquito-rpc/test/taquito-rpc.spec.ts | 93 ++++++++ .../taquito/src/read-provider/interface.ts | 2 +- .../src/read-provider/rpc-read-adapter.ts | 2 +- packages/taquito/src/tz/interface.ts | 2 +- 21 files changed, 698 insertions(+), 182 deletions(-) diff --git a/cspell.json b/cspell.json index 8b97040dd2..3faa1d4073 100644 --- a/cspell.json +++ b/cspell.json @@ -32,6 +32,7 @@ "entrypoints", "eztz", "FAILWITH", + "Finalizable", "flextesa", "florencenet", "forgeable", @@ -116,10 +117,12 @@ "typeof", "tzip", "Umami", + "unfinalizable", "unopt", "UNPAIR", "Unparsing", "unstake", + "Unstaked", "vals", "walletbeacon", "weeklynet", diff --git a/docs/quick_start.md b/docs/quick_start.md index 95a4e57850..3db98ac188 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -53,7 +53,7 @@ Alternatively, you can use a `WalletProvider` to interact with a wallet. Please ## Examples -### Get the current Tezos balance for an address +### Get the current Tezos spendable balance for an address ```js live noInline // import { TezosToolkit } from '@taquito/taquito'; diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index 4cc44866b8..493c643821 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -13,104 +13,113 @@ Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json **When all endpoints are accessible for a node, you will obtain:** ``` -Test calling all methods from RPC node: https://a-node Test calling all methods from RPC node: http://parisnet.i.ecadinfra.com:8732/ - ✓ Verify that rpcClient.getBlockHash returns the head block hash (32 ms) - ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (48 ms) - ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (28 ms) - ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (27 ms) - ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (30 ms) - ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (61 ms) - ✓ Verify that rpcClient.getContract returns the complete status of a contract (29 ms) - ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (32 ms) - ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (27 ms) - ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (153 ms) - ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (31 ms) - ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (34 ms) - ✓ Verify that rpcClient.getConstants returns all constants from RPC (28 ms) - ✓ Verify that rpcClient.getBlock returns all the information about a block (52 ms) - ✓ Verify that rpcClient.getBlockHeader returns whole block header (27 ms) - ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (30 ms) - ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (28 ms) - ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (34 ms) - ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (26 ms) - ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (60 ms) - ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (57 ms) - ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (29 ms) - ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (29 ms) - ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (30 ms) - ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (31 ms) - ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (60 ms) - ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (30 ms) - ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (100 ms) - ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (27 ms) - ✓ Verify that rpcClient.getChainId returns chain ID (28 ms) - ✓ Verify that rpcClient.runOperation runs an operation without signature checks (29 ms) - ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (26 ms) - ✓ Verify that rpcClient.runView executes tzip4 views (59 ms) - ✓ Verify that rpcClient.runScriptView executes michelson view (56 ms) - ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (68 ms) - ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (56 ms) - ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (30 ms) - ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (26 ms) - ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (26 ms) - ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (30 ms) + ✓ Verify that rpcClient.getBlockHash returns the head block hash (37 ms) + ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (53 ms) + ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (32 ms) + ✓ Verify that rpcClient.getFullBalance for knownBaker returns the spendable balance excluding frozen bonds (37 ms) + ✓ Verify that rpcClient.getStakedBalance for knownBaker returns the spendable balance excluding frozen bonds (34 ms) + ✓ Verify that rpcClient.getUnstakedFinalizableBalance for knownBaker returns the spendable balance excluding frozen bonds (37 ms) + ✓ Verify that rpcClient.getUnstakedFrozenBalance for knownBaker returns the spendable balance excluding frozen bonds (33 ms) + ✓ Verify that rpcClient.getUnstakeRequests for knownBaker returns the spendable balance excluding frozen bonds (29 ms) + ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (35 ms) + ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (33 ms) + ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (30 ms) + ✓ Verify that rpcClient.getContract returns the complete status of a contract (30 ms) + ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (30 ms) + ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (30 ms) + ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (151 ms) + ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (32 ms) + ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (30 ms) + ✓ Verify that rpcClient.getConstants returns all constants from RPC (33 ms) + ✓ Verify that rpcClient.getBlock returns all the information about a block (46 ms) + ✓ Verify that rpcClient.getBlockHeader returns whole block header (34 ms) + ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (33 ms) + ✓ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (38 ms) + ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (41 ms) + ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (30 ms) + ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (29 ms) + ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (30 ms) + ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (32 ms) + ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (34 ms) + ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (32 ms) + ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (34 ms) + ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (38 ms) + ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (28 ms) + ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (104 ms) + ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (28 ms) + ✓ Verify that rpcClient.getChainId returns chain ID (44 ms) + ✓ Verify that rpcClient.runOperation runs an operation without signature checks (33 ms) + ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (35 ms) + ✓ Verify that rpcClient.runView executes tzip4 views (64 ms) + ✓ Verify that rpcClient.runScriptView executes michelson view (60 ms) + ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (29 ms) + ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (64 ms) + ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (33 ms) + ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (32 ms) + ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (30 ms) + ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (29 ms) ✓ 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 (32 ms) - ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://parisnet.i.ecadinfra.com:8732/ (28 ms) - ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (269 ms) - ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (198 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/ ``` **Otherwise, you will see which endpoints do not work for a specific node:** ``` -Test calling all methods from RPC node: https://another-node - ✓ Verify that rpcClient.getBlockHash returns the head block hash (486 ms) - ✓ Verify that rpcClient.getLiveBlocks returns the ancestors of the head block (650 ms) - ✓ Verify that rpcClient.getBalance for knownBaker returns the spendable balance excluding frozen bonds (616 ms) - ✓ Verify that rpcClient.getStorage for knownContract returns the data of a contract (534 ms) - ✓ Verify that rpcClient.getScript for know contract returns the code and data of a contract (591 ms) - ✓ Verify that rpcClient.getNormalizedScript for known contract returns the script of the contract and normalize it using the requested unparsing mode (680 ms) - ✓ Verify that rpcClient.getContract returns the complete status of a contract (605 ms) - ✓ Verify that rpcClient.getManagerKey for known baker returns the manager key of the contract (553 ms) - ✓ Verify that rpcClient.getDelegate for known baker returns the delegate of the contract (613 ms) - ✓ Verify that rpcClient.getBigMapExpr for encoded expression returns the value associated with a key in a big map (3074 ms) - ✓ Verify that rpcClient.getDelegates for known baker returns information about a delegate from RPC (674 ms) - ✓ Verify that rpc.getVotingInfo for known baker returns voting information about a delegate from RPC (612 ms) - ✓ Verify that rpcClient.getConstants returns all constants from RPC (513 ms) - ✓ Verify that rpcClient.getBlock returns all the information about a block (549 ms) - ✓ Verify that rpcClient.getBlockHeader returns whole block header (516 ms) - ✓ Verify that rpcClient.getBlockMetadata returns all metadata associated to the block (1472 ms) - ✕ Verify that rpcClient.getBakingRights retrieves the list of delegates allowed to bake a block (479 ms) - ✓ Verify that rpcClient.getAttestationRights retrieves the list of delegates allowed to attest a block (1487 ms) - ✓ Verify that rpcClient.getBallotList returns ballots casted so far during a voting period (615 ms) - ✓ Verify that rpcClient.getBallots returns sum of ballots casted so far during a voting period (1670 ms) - ✓ Verify that rpcClient.getCurrentPeriod returns current period kind (487 ms) - ✓ Verify that rpcClient.getCurrentProposal returns current proposal under evaluation (471 ms) - ✓ Verify that rpcClient.getCurrentQuorum returns current expected quorum (462 ms) - ✓ Verify that rpcClient.getVotesListings returns list of delegates with their voting weight, in number of rolls (590 ms) - ✓ Verify that rpcClient.getProposals returns list of proposals with number of supporters (631 ms) - ✓ Verify that rpcClient.forgeOperations forges an operation and returns the unsigned bytes (600 ms) - ✓ Verify that rpcClient.injectOperation injects an operation in node and broadcast it (654 ms) - ✓ Verify that rpcClient.preapplyOperations simulates the validation of an operation (1585 ms) - ✓ Verify that rpcClient.getEntrypoints for known contract returns list of entrypoints of the contract (771 ms) - ✓ Verify that rpcClient.getChainId returns chain ID (671 ms) - ✓ Verify that rpcClient.runOperation runs an operation without signature checks (614 ms) - ✓ Verify that rpcClient.simulateOperation simulates an operation without signature checks (1330 ms) - ✓ Verify that rpcClient.runView executes tzip4 views (1149 ms) - ✓ Verify that rpcClient.runScriptView executes michelson view (1111 ms) - ✓ Verify that rpcClient.getSuccessorPeriod will get the voting period of next block (478 ms) - ✓ Verify that rpcClient.getSaplingDiffById will access the value associated with a sapling state ID (995 ms) - ✓ Verify that rpcClient.getSaplingDiffByContract will access the value associated with a sapling state (665 ms) - ✓ Verify that rpcClient.getProtocols will list past and present Tezos protocols (511 ms) - ✓ Verify that rpcClient.getStorageUsedSpace will retrieve the used space of a contract storage (616 ms) - ✓ Verify that rpcClient.getStoragePaidSpace will retrieve the paid space of a contract storage (488 ms) - ✓ Verify that rpcClient.ticketBalance will retrieve the specified ticket owned by the given contract (486 ms) - ✓ Verify that rpcClient.allTicketBalances will retrieve all tickets owned by the given contract (561 ms) - ✓ Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for http://parisnet.i.ecadinfra.com:8732/ (28 ms) - ✓ Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied (269 ms) - ✓ Verify that rpcClient.getPendingOperations v2 will retrieve the pending operations in mempool with property validated (198 ms) - ○ skipped Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for http://parisnet.i.ecadinfra.com:8732/ + 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.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 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/docs/rpc_package.md b/docs/rpc_package.md index 4c21f2fa92..9f1ec494c7 100644 --- a/docs/rpc_package.md +++ b/docs/rpc_package.md @@ -24,7 +24,7 @@ const client = new RpcClient(' https://ghostnet.ecadinfra.com/', 'NetXLH1uAxK7CC The `RpcClient` constructor takes the URL of the node you want to use and the chain ID. ```js -/* Fetching the balance of an account +/* Fetching the spendable balance of an account * using the client set up above */ const balance = await client.getBalance('tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb'); diff --git a/docs/tutorial.md b/docs/tutorial.md index 806732436b..5d4e04865e 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -105,7 +105,7 @@ tezosToolkit.tz.getBalance("tz1YvE7Sfo92ueEPEdZceNWd5MWNeMNSt16L").then(balance }); ``` -Running `npx ts-node index.ts` should now show the balance of the specified address. This balance is in units of Mutez (micro Tez). Tez is the currency of Tezos, its code is `XTZ`, and the symbol is `ꜩ`. 1 Tez is 1,000,000 Mutez. +Running `npx ts-node index.ts` should now show the spendable balance of the specified address. This balance is in units of Mutez (micro Tez). Tez is the currency of Tezos, its code is `XTZ`, and the symbol is `ꜩ`. 1 Tez is 1,000,000 Mutez. Congratulations! You have just interacted with the Tezos blockchain using Taquito. In the next section, we will establish a high-level understanding of the blockchain, Tezos, dApps, and Taquito. If you are already familiar with these concepts, you can skip to [Sending a Transfer operation to the blockchain using Taquito](#sending-operations). @@ -239,7 +239,7 @@ For the purpose of this section, I have created a new address and funded it on t
How to create my own public/private key pair? - + Most users can simply use a wallet to create addresses. This is useful for dApps that run inside a browser. If you are running a dApp as a desktop, mobile, or server process, you can create your own key pair. Here is how you can do it: ```bash diff --git a/docs/web3js_taquito.md b/docs/web3js_taquito.md index 305aa9980c..3b40c29a38 100644 --- a/docs/web3js_taquito.md +++ b/docs/web3js_taquito.md @@ -53,7 +53,7 @@ const balance = await web3.eth.getBalance('account_address'); const balance = await Tezos.tz.getBalance('account_address'); ``` -Both Web3js and Taquito use the `getBalance` method with the account address to fetch its balance from the network. +Both Web3js and Taquito use the `getBalance` method with the account address to fetch its spendable balance from the network. ## Transfer tokens diff --git a/example/package.json b/example/package.json index 20c005bf7c..ebfa3a03ec 100644 --- a/example/package.json +++ b/example/package.json @@ -41,7 +41,7 @@ "example:scan-path-ledger": "node -r ts-node/register --preserve-symlinks scan-path-ledger.ts" }, "dependencies": { - "@ledgerhq/hw-transport-node-hid": "^6.27.21", + "@ledgerhq/hw-transport-node-hid": "^6.28.5", "@taquito/ledger-signer": "^19.2.0", "@taquito/local-forging": "^19.2.0", "@taquito/michel-codec": "^19.2.0", diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index d167dc228e..05b06fcce7 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(376); expect(estimate.totalCost).toEqual(376); expect(estimate.usingBaseFeeMutez).toEqual(376); - expect(estimate.consumedMilligas).toEqual(1456142); + expect(estimate.consumedMilligas).toEqual(1456228); }); 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(447); expect(estimate.totalCost).toEqual(133947); expect(estimate.usingBaseFeeMutez).toEqual(447); - expect(estimate.consumedMilligas).toEqual(1570671); + expect(estimate.consumedMilligas).toEqual(1570757); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -132,20 +132,20 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(423); expect(estimate.totalCost).toEqual(84673); expect(estimate.usingBaseFeeMutez).toEqual(423); - expect(estimate.consumedMilligas).toEqual(1866766); + expect(estimate.consumedMilligas).toEqual(1866852); }); 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(2392); + expect(estimate.gasLimit).toEqual(2393); expect(estimate.storageLimit).toEqual(654); expect(estimate.suggestedFeeMutez).toEqual(561); expect(estimate.burnFeeMutez).toEqual(163500); expect(estimate.minimalFeeMutez).toEqual(541); expect(estimate.totalCost).toEqual(164041); expect(estimate.usingBaseFeeMutez).toEqual(541); - expect(estimate.consumedMilligas).toEqual(2391919); + expect(estimate.consumedMilligas).toEqual(2392005); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index 5b0014b356..c03f92e3ad 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -69,6 +69,31 @@ CONFIGS().forEach( expect(balance).toBeDefined(); }); + it(`Verify that rpcClient.getFullBalance for knownBaker returns the full balance`, async () => { + const balance = await rpcClient.getFullBalance(knownBaker); + expect(balance).toBeDefined(); + }); + + it(`Verify that rpcClient.getStakedBalance for knownBaker returns the staked balance`, async () => { + const balance = await rpcClient.getStakedBalance(knownBaker); + expect(balance).toBeDefined(); + }); + + it(`Verify that rpcClient.getUnstakedFinalizableBalance for knownBaker returns the unstaked finalizable balance`, async () => { + const balance = await rpcClient.getUnstakedFinalizableBalance(knownBaker); + expect(balance).toBeDefined(); + }); + + it(`Verify that rpcClient.getUnstakedFrozenBalance for knownBaker returns the unstaked frozen balance`, async () => { + const balance = await rpcClient.getUnstakedFrozenBalance(knownBaker); + expect(balance).toBeDefined(); + }); + + it(`Verify that rpcClient.getUnstakeRequests for knownBaker returns the unstaked requests`, async () => { + const response = await rpcClient.getUnstakeRequests('tz1KqYu4VQG67fgq1Pfn93ASoZxhSW7mTDbC'); + expect(response).toBeDefined(); + }); + it(`Verify that rpcClient.getStorage for knownContract returns the data of a contract`, async () => { const storage = await rpcClient.getStorage(knownContract); expect(storage).toBeDefined(); diff --git a/package-lock.json b/package-lock.json index 29ea6dcfb9..fadffed0cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -87,7 +87,7 @@ "name": "@taquito/example", "version": "19.2.0", "dependencies": { - "@ledgerhq/hw-transport-node-hid": "^6.27.21", + "@ledgerhq/hw-transport-node-hid": "^6.28.5", "@taquito/ledger-signer": "^19.2.0", "@taquito/local-forging": "^19.2.0", "@taquito/michel-codec": "^19.2.0", diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 9ea34277d8..eb026ade9a 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -3,6 +3,7 @@ import { BakingRightsQueryArguments, BakingRightsResponse, BalanceResponse, + UnstakeRequestsResponse, BallotListResponse, BallotsResponse, BigMapKey, @@ -92,6 +93,36 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { ): Promise { return this.rpc.getBalance(address, { block }); } + async getFullBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getFullBalance(address, { block }); + } + async getStakedBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getStakedBalance(address, { block }); + } + async getUnstakedFinalizableBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getUnstakedFinalizableBalance(address, { block }); + } + async getUnstakedFrozenBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getUnstakedFrozenBalance(address, { block }); + } + async getUnstakeRequests( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + return this.rpc.getUnstakeRequests(address, { block }); + } async getBlockHash({ block }: RPCOptions = defaultRPCOptions): Promise { return this.rpc.getBlockHash({ block }); } diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index 76864ed912..72e56d5f02 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -3,6 +3,7 @@ import { BakingRightsQueryArguments, BakingRightsResponse, BalanceResponse, + UnstakeRequestsResponse, BallotListResponse, BallotsResponse, BigMapGetResponse, @@ -63,6 +64,11 @@ export interface RpcClientInterface { getBlockHash(options?: RPCOptions): Promise; getLiveBlocks(options?: RPCOptions): Promise; getBalance(address: string, options?: RPCOptions): Promise; + getFullBalance(address: string, options?: RPCOptions): Promise; + getStakedBalance(address: string, options?: RPCOptions): Promise; + getUnstakedFinalizableBalance(address: string, options?: RPCOptions): Promise; + getUnstakedFrozenBalance(address: string, options?: RPCOptions): Promise; + getUnstakeRequests(address: string, options?: RPCOptions): Promise; getStorage(address: string, options?: RPCOptions): Promise; getScript(address: string, options?: RPCOptions): Promise; getNormalizedScript( @@ -143,6 +149,11 @@ export enum RPCMethodName { GET_BLOCK_HEADER = 'getBlockHeader', GET_BLOCK_METADATA = 'getBlockMetadata', GET_BALANCE = 'getBalance', + GET_FULL_BALANCE = 'getFullBalance', + GET_STAKED_BALANCE = 'getStakedBalance', + GET_UNSTAKED_FINALIZABLE_BALANCE = 'getUnstakedFinalizableBalance', + GET_UNSTAKED_FROZEN_BALANCE = 'getUnstakedFrozenBalance', + GET_UNSTAKE_REQUESTS = 'getUnstakeRequests', GET_CHAIN_ID = 'getChainId', GET_CONSTANTS = 'getConstants', GET_CONTRACT = 'getContract', 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 a4712e7bb2..45a0632983 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -5,6 +5,7 @@ import { BakingRightsQueryArguments, BakingRightsResponse, BalanceResponse, + UnstakeRequestsResponse, BallotListResponse, BallotsResponse, BigMapGetResponse, @@ -164,7 +165,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Get the block's hash, its unique identifier. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-hash + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-hash */ async getBlockHash({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HASH, [ @@ -182,7 +183,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-live-blocks + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-live-blocks */ async getLiveBlocks({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_LIVE_BLOCKS, [ @@ -201,7 +202,7 @@ 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 Access the spendable balance of a contract, excluding frozen bonds - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance */ async getBalance( address: string, @@ -221,11 +222,134 @@ export class RpcClientCache implements RpcClientInterface { } } + /** + * @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) + * @description Access the full balance of a contract, including frozen bonds and stake. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance + */ + async getFullBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_FULL_BALANCE, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getFullBalance(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param address address from which we want to retrieve the staked balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-staked-balance + */ + async getStakedBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STAKED_BALANCE, [ + block, + address, + ]); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getStakedBalance(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param address address from which we want to retrieve the unstaked finalizable balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the balance of a contract that was requested for an unstake operation, and is no longer frozen, which means it will appear in the spendable balance of the contract after any stake/unstake/finalize_unstake operation. Returns None if the contract is originated. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-finalizable-balance + */ + async getUnstakedFinalizableBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_UNSTAKED_FINALIZABLE_BALANCE, + [block, address] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getUnstakedFinalizableBalance(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param address address from which we want to retrieve the unstaked frozen balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the balance of a contract that was requested for an unstake operation, but is still frozen for the duration of the slashing period. Returns None if the contract is originated. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-frozen-balance + */ + async getUnstakedFrozenBalance( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_UNSTAKED_FROZEN_BALANCE, + [block, address] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getUnstakedFrozenBalance(address, { block }); + this.put(key, response); + return response; + } + } + + /** + * @param address address from which we want to retrieve the unstake requests + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the unstake requests of the contract. The requests that appear in the finalizable field can be finalized, which means that the contract can transfer these (no longer frozen) funds to their spendable balance with a [finalize_unstake] operation call. Returns null if there is no unstake request pending. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstake-requests + */ + async getUnstakeRequests( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const key = this.formatCacheKey( + this.rpcClient.getRpcUrl(), + RPCMethodName.GET_UNSTAKE_REQUESTS, + [block, address] + ); + if (this.has(key)) { + return this.get(key); + } else { + const response = this.rpcClient.getUnstakeRequests(address, { block }); + this.put(key, response); + return response; + } + } + /** * @param address contract address from which we want to retrieve the storage * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the data of the contract. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-storage + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStorage( address: string, @@ -249,7 +373,7 @@ export class RpcClientCache implements RpcClientInterface { * @param address contract address from which we want to retrieve the script * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the code and data of the contract. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-script */ async getScript( address: string, @@ -300,7 +424,7 @@ export class RpcClientCache implements RpcClientInterface { * @param address contract address from which we want to retrieve * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete status of a contract. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id */ async getContract( address: string, @@ -324,7 +448,7 @@ export class RpcClientCache implements RpcClientInterface { * @param address contract address from which we want to retrieve the manager * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the manager of an implicit contract - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-manager-key + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-manager-key */ async getManagerKey( address: string, @@ -348,7 +472,7 @@ export class RpcClientCache implements RpcClientInterface { * @param address contract address from which we want to retrieve the delegate (baker) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the delegate of a contract, if any - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-delegate + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-delegate */ async getDelegate( address: string, @@ -373,7 +497,7 @@ export class RpcClientCache implements RpcClientInterface { * @param address contract address from which we want to retrieve the big map key * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in the big map storage of the contract. - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get + * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-context-contracts-contract-id-big-map-get */ async getBigMapKey( address: string, @@ -401,7 +525,7 @@ export class RpcClientCache implements RpcClientInterface { * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method)) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in a big map. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr */ async getBigMapExpr( id: string, @@ -426,7 +550,7 @@ export class RpcClientCache implements RpcClientInterface { * @param address delegate address which we want to retrieve * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Everything about a delegate - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh */ async getDelegates( address: string, @@ -473,7 +597,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description All constants - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-constants */ async getConstants({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONSTANTS, [ @@ -491,7 +615,7 @@ 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/api/rpc.html#get-block-id + * @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({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. @@ -510,7 +634,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description The whole block header - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-header + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-header */ async getBlockHeader({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HEADER, [ @@ -528,7 +652,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) and version * @description All the metadata associated to the block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-metadata + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-metadata */ async getBlockMetadata({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_METADATA, [ @@ -547,7 +671,7 @@ export class RpcClientCache implements RpcClientInterface { * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the list of delegates allowed to bake a block. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getBakingRights( args: BakingRightsQueryArguments = {}, @@ -570,6 +694,7 @@ export class RpcClientCache implements RpcClientInterface { * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the delegates allowed to attest a block + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getAttestationRights( args: AttestationRightsQueryArguments = {}, @@ -592,7 +717,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Ballots casted so far during a voting period - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballot-list + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballot-list */ async getBallotList({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOT_LIST, [ @@ -610,7 +735,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Sum of ballots casted so far during a voting period - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballots + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballots */ async getBallots({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOTS, [block]); @@ -626,7 +751,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current proposal under evaluation. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-proposal */ async getCurrentProposal({ block, @@ -648,7 +773,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current expected quorum. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-quorum */ async getCurrentQuorum({ block, @@ -668,7 +793,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List of delegates with their voting power - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-listings */ async getVotesListings({ block, @@ -688,7 +813,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List of proposals with number of supporters - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-proposals + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-proposals */ async getProposals({ block }: RPCOptions = defaultRPCOptions): Promise { const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROPOSALS, [ @@ -707,7 +832,7 @@ export class RpcClientCache implements RpcClientInterface { * @param data operation contents to forge * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Forge an operation returning the unsigned bytes - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async forgeOperations( data: ForgeOperationsParams, @@ -719,7 +844,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param signedOpBytes signed bytes to inject * @description Inject an operation in node and broadcast it and return the ID of the operation - * @see https://tezos.gitlab.io/api/rpc.html#post-injection-operation + * @see https://tezos.gitlab.io/shell/rpc.html#post-injection-operation */ async injectOperation(signedOpBytes: string): Promise { return this.rpcClient.injectOperation(signedOpBytes); @@ -729,7 +854,7 @@ export class RpcClientCache implements RpcClientInterface { * @param ops Operations to apply * @param options contains generic configuration for rpc calls to specified block and version * @description Simulate the application of the operations with the context of the given block and return the result of each operation application - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations + * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-helpers-preapply-operations */ async preapplyOperations( ops: PreapplyParams, @@ -742,7 +867,7 @@ export class RpcClientCache implements RpcClientInterface { * @param contract address of the contract we want to get the entrypoints of * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Return the list of entrypoints of the contract - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-entrypoints + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-entrypoints * @version 005_PsBABY5H */ async getEntrypoints( @@ -768,7 +893,7 @@ export class RpcClientCache implements RpcClientInterface { * @param op Operation to run * @param options contains generic configuration for rpc calls to specified block and version * @description Run an operation with the context of the given block and without signature checks and return the operation application result, including the consumed gas. - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-operation + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runOperation( op: RPCRunOperationParam, @@ -781,7 +906,7 @@ export class RpcClientCache implements RpcClientInterface { * @param op Operation to simulate * @param options contains generic configuration for rpc calls to specified block and version * @description Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result. - * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/oxford-openapi.json + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async simulateOperation( op: RPCSimulateOperationParam, @@ -794,7 +919,7 @@ export class RpcClientCache implements RpcClientInterface { * @param code Code to run * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Run a Michelson script in the current context - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-code + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runCode( code: RPCRunCodeParam, @@ -807,6 +932,7 @@ export class RpcClientCache implements RpcClientInterface { * @param viewScriptParams Parameters of the script view to run * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Simulate a call to a michelson view + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runScriptView( { unparsing_mode = 'Readable', ...rest }: RPCRunScriptViewParam, @@ -824,7 +950,8 @@ export class RpcClientCache implements RpcClientInterface { /** * @param viewParams Parameters of the view to run * @param options contains generic configuration for rpc calls to specified block (default to head) - * @description Simulate a call to a view following the TZIP-4 standard. See https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints. + * @description Simulate a call to a view following the TZIP-4 standard. + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runView( { unparsing_mode = 'Readable', ...rest }: RPCRunViewParam, @@ -859,7 +986,7 @@ export class RpcClientCache implements RpcClientInterface { * A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint. * A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package. * @example packData({ data: { string: "test" }, type: { prim: "string" } }) - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async packData( data: PackDataParams, @@ -891,7 +1018,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-period */ async getCurrentPeriod({ block, @@ -912,7 +1039,7 @@ export class RpcClientCache implements RpcClientInterface { * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-successor-period + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-successor-period */ async getSuccessorPeriod({ block, @@ -1001,7 +1128,7 @@ export class RpcClientCache implements RpcClientInterface { * @param contract address of the contract we want to retrieve storage information of * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the used storage space of the contract - * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getStorageUsedSpace( contract: string, @@ -1025,7 +1152,7 @@ export class RpcClientCache implements RpcClientInterface { * @param contract address of the contract we want to retrieve storage information of * @param options contains generic configuration for rpc calls to specified block (default to head) = * @description Access the paid storage space of the contract - * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getStoragePaidSpace( contract: string, @@ -1051,7 +1178,7 @@ export class RpcClientCache implements RpcClientInterface { * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the contract's balance of ticket with specified ticketer, content type, and content. * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } } - * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getTicketBalance( contract: string, @@ -1077,7 +1204,7 @@ export class RpcClientCache implements RpcClientInterface { * @param contract originated address we want to retrieve ticket balances of * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage. - * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getAllTicketBalances( contract: string, @@ -1099,6 +1226,7 @@ export class RpcClientCache implements RpcClientInterface { /** * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch. * @param options contains generic configuration for rpc calls to specified block (default to head) + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-adaptive-issuance-launch-cycle */ async getAdaptiveIssuanceLaunchCycle({ block, @@ -1121,7 +1249,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 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response * @default args { version: '1', applied: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } - * @see https://tezos.gitlab.io/CHANGES.html?highlight=pending_operations#id4 + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-mempool-openapi-rc.json */ async getPendingOperations( args: PendingOperationsQueryArguments = {} diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index 76d8a2db5c..4afdb8edde 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -19,6 +19,7 @@ import { BakingRightsQueryArguments, BakingRightsResponse, BalanceResponse, + UnstakeRequestsResponse, BallotListResponse, BallotsResponse, BigMapGetResponse, @@ -141,7 +142,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Get the block's hash, its unique identifier. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-hash + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-hash */ async getBlockHash({ block }: RPCOptions = defaultRPCOptions): Promise { const hash = await this.httpBackend.createRequest({ @@ -154,7 +155,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-live-blocks + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-live-blocks */ async getLiveBlocks({ block }: RPCOptions = defaultRPCOptions): Promise { const blocks = await this.httpBackend.createRequest({ @@ -168,7 +169,7 @@ export class RpcClient 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 Access the spendable balance of a contract, excluding frozen bonds - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance */ async getBalance( address: string, @@ -184,11 +185,131 @@ export class RpcClient implements RpcClientInterface { 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) + * @description Access the full balance of a contract, including frozen bonds and stake. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance + */ + async getFullBalance( + 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}/full_balance` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + + /** + * @param address address from which we want to retrieve the staked balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-staked-balance + */ + async getStakedBalance( + 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}/staked_balance` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + + /** + * @param address address from which we want to retrieve the unstaked finalizable balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the balance of a contract that was requested for an unstake operation, and is no longer frozen, which means it will appear in the spendable balance of the contract after any stake/unstake/finalize_unstake operation. Returns None if the contract is originated. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-finalizable-balance + */ + async getUnstakedFinalizableBalance( + 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}/unstaked_finalizable_balance` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + + /** + * @param address address from which we want to retrieve the unstaked frozen balance + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the balance of a contract that was requested for an unstake operation, but is still frozen for the duration of the slashing period. Returns None if the contract is originated. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-frozen-balance + */ + async getUnstakedFrozenBalance( + 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}/unstaked_frozen_balance` + ), + method: 'GET', + }); + return new BigNumber(balance); + } + + /** + * @param address address from which we want to retrieve the unstaked requests + * @param options contains generic configuration for rpc calls to specified block (default to head) + * @description Access the unstake requests of the contract. The requests that appear in the finalizable field can be finalized, which means that the contract can transfer these (no longer frozen) funds to their spendable balance with a [finalize_unstake] operation call. Returns null if there is no unstake request pending. + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstake-requests + */ + async getUnstakeRequests( + address: string, + { block }: RPCOptions = defaultRPCOptions + ): Promise { + this.validateAddress(address); + const response = await this.httpBackend.createRequest({ + url: this.createURL( + `/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstake_requests` + ), + method: 'GET', + }); + return response === null + ? null + : { + finalizable: response.finalizable.map(({ amount, ...rest }) => { + const castedToBigNumber: any = castToBigNumber({ amount }, ['amount']); + return { + ...rest, + amount: castedToBigNumber.amount, + }; + }), + unfinalizable: { + delegate: response.unfinalizable.delegate, + requests: response.unfinalizable.requests.map(({ amount, cycle }) => { + const castedToBigNumber: any = castToBigNumber({ amount }, ['amount']); + return { + cycle, + amount: castedToBigNumber.amount, + }; + }), + }, + }; + } + /** * @param address contract address from which we want to retrieve the storage * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the data of the contract. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-storage + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-storage */ async getStorage( address: string, @@ -207,7 +328,7 @@ export class RpcClient implements RpcClientInterface { * @param address contract address from which we want to retrieve the script * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the code and data of the contract. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-script */ async getScript( address: string, @@ -249,7 +370,7 @@ export class RpcClient implements RpcClientInterface { * @param address contract address from which we want to retrieve * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the complete status of a contract. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id */ async getContract( address: string, @@ -270,7 +391,7 @@ export class RpcClient implements RpcClientInterface { * @param address contract address from which we want to retrieve the manager * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the manager of an implicit contract - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-manager-key + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-manager-key */ async getManagerKey( address: string, @@ -289,7 +410,7 @@ export class RpcClient implements RpcClientInterface { * @param address contract address from which we want to retrieve the delegate (baker) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the delegate of a contract, if any - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-delegate + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-delegate */ async getDelegate( address: string, @@ -319,7 +440,7 @@ export class RpcClient implements RpcClientInterface { * @param address contract address from which we want to retrieve the big map key * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in the big map storage of the contract. - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get + * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-context-contracts-contract-id-big-map-get */ async getBigMapKey( address: string, @@ -343,7 +464,7 @@ export class RpcClient implements RpcClientInterface { * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method)) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the value associated with a key in a big map. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr */ async getBigMapExpr( id: string, @@ -360,7 +481,7 @@ export class RpcClient implements RpcClientInterface { * @param address delegate address which we want to retrieve * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Everything about a delegate - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh */ async getDelegates( address: string, @@ -432,7 +553,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description All constants - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-constants */ async getConstants({ block }: RPCOptions = defaultRPCOptions): Promise { const response = await this.httpBackend.createRequest({ @@ -479,7 +600,7 @@ 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/api/rpc.html#get-block-id + * @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({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash.. @@ -498,7 +619,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description The whole block header - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-header + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-header */ async getBlockHeader({ block }: RPCOptions = defaultRPCOptions): Promise { const response = await this.httpBackend.createRequest({ @@ -512,7 +633,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) and version * @description All the metadata associated to the block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-metadata + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-metadata */ async getBlockMetadata({ block, @@ -532,7 +653,7 @@ export class RpcClient implements RpcClientInterface { * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the list of delegates allowed to bake a block. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getBakingRights( args: BakingRightsQueryArguments = {}, @@ -551,6 +672,7 @@ export class RpcClient implements RpcClientInterface { * @param args contains optional query arguments (level, cycle, delegate, and consensus_key) * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Retrieves the delegates allowed to attest a block + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getAttestationRights( args: AttestationRightsQueryArguments = {}, @@ -568,7 +690,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Ballots casted so far during a voting period - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballot-list + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballot-list */ async getBallotList({ block }: RPCOptions = defaultRPCOptions): Promise { const response = await this.httpBackend.createRequest({ @@ -582,7 +704,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Sum of ballots casted so far during a voting period - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballots + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballots */ async getBallots({ block }: RPCOptions = defaultRPCOptions): Promise { const response = await this.httpBackend.createRequest({ @@ -597,7 +719,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current proposal under evaluation. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-proposal */ async getCurrentProposal({ block, @@ -613,7 +735,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Current expected quorum. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-quorum */ async getCurrentQuorum({ block, @@ -629,7 +751,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List of delegates with their voting power - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-listings */ async getVotesListings({ block, @@ -652,7 +774,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description List of proposals with number of supporters - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-proposals + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-proposals */ async getProposals({ block }: RPCOptions = defaultRPCOptions): Promise { const response = await this.httpBackend.createRequest({ @@ -671,7 +793,7 @@ export class RpcClient implements RpcClientInterface { * @param data operation contents to forge * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Forge an operation returning the unsigned bytes - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async forgeOperations( data: ForgeOperationsParams, @@ -689,7 +811,7 @@ export class RpcClient implements RpcClientInterface { /** * @param signedOpBytes signed bytes to inject * @description Inject an operation in node and broadcast it and return the ID of the operation - * @see https://tezos.gitlab.io/api/rpc.html#post-injection-operation + * @see https://tezos.gitlab.io/shell/rpc.html#post-injection-operation */ async injectOperation(signedOpBytes: string): Promise { return this.httpBackend.createRequest( @@ -705,7 +827,7 @@ export class RpcClient implements RpcClientInterface { * @param ops Operations to apply * @param options contains generic configuration for rpc calls to specified block and version * @description Simulate the application of the operations with the context of the given block and return the result of each operation application - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations + * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-helpers-preapply-operations */ async preapplyOperations( ops: PreapplyParams, @@ -725,7 +847,7 @@ export class RpcClient implements RpcClientInterface { * @param contract address of the contract we want to get the entrypoints of * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Return the list of entrypoints of the contract - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-entrypoints + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-entrypoints * @version 005_PsBABY5H */ async getEntrypoints( @@ -750,7 +872,7 @@ export class RpcClient implements RpcClientInterface { * @param op Operation to run * @param options contains generic configuration for rpc calls to specified block and version * @description Run an operation with the context of the given block and without signature checks and return the operation application result, including the consumed gas. - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-operation + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runOperation( op: RPCRunOperationParam, @@ -770,7 +892,7 @@ export class RpcClient implements RpcClientInterface { * @param op Operation to simulate * @param options contains generic configuration for rpc calls to specified block and version * @description Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result. - * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/oxford-openapi.json + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async simulateOperation( op: RPCSimulateOperationParam, @@ -792,7 +914,7 @@ export class RpcClient implements RpcClientInterface { * @param code Code to run * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Run a Michelson script in the current context - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-run-code + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runCode( code: RPCRunCodeParam, @@ -813,6 +935,7 @@ export class RpcClient implements RpcClientInterface { * @param viewScriptParams Parameters of the script view to run * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Simulate a call to a michelson view + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runScriptView( { unparsing_mode = 'Readable', ...rest }: RPCRunScriptViewParam, @@ -835,7 +958,8 @@ export class RpcClient implements RpcClientInterface { /** * @param viewParams Parameters of the view to run * @param options contains generic configuration for rpc calls to specified block (default to head) - * @description Simulate a call to a view following the TZIP-4 standard. See https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints. + * @description Simulate a call to a view following the TZIP-4 standard. + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async runView( { unparsing_mode = 'Readable', ...rest }: RPCRunViewParam, @@ -869,7 +993,7 @@ export class RpcClient implements RpcClientInterface { * A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint. * A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package. * @example packData({ data: { string: "test" }, type: { prim: "string" } }) - * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async packData(data: PackDataParams, { block }: RPCOptions = defaultRPCOptions) { const { gas, ...rest } = await this.httpBackend.createRequest( @@ -901,7 +1025,7 @@ export class RpcClient implements RpcClientInterface { /** * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-period */ async getCurrentPeriod({ block, @@ -918,7 +1042,7 @@ export class RpcClient implements RpcClientInterface { * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head. - * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-successor-period + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-successor-period */ async getSuccessorPeriod({ block, @@ -981,7 +1105,7 @@ export class RpcClient implements RpcClientInterface { * @param contract address of the contract we want to retrieve storage information of * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the used storage space of the contract - * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getStorageUsedSpace( contract: string, @@ -999,7 +1123,7 @@ export class RpcClient implements RpcClientInterface { * @param contract address of the contract we want to retrieve storage information of * @param options contains generic configuration for rpc calls to specified block (default to head) * @description Access the paid storage space of the contract - * @see https://tezos.gitlab.io/lima/rpc.html#get-block-id-context-contracts-contract-id-storage + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-openapi-rc.json */ async getStoragePaidSpace( contract: string, @@ -1058,6 +1182,7 @@ export class RpcClient implements RpcClientInterface { /** * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch. * @param options contains generic configuration for rpc calls to specified block (default to head) + * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-adaptive-issuance-launch-cycle */ async getAdaptiveIssuanceLaunchCycle({ block, @@ -1074,7 +1199,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 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response * @default args { version: '1', applied: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } - * @see https://tezos.gitlab.io/CHANGES.html?highlight=pending_operations#id4 + * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-mempool-openapi-rc.json */ async getPendingOperations( args: PendingOperationsQueryArguments = {} diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index f24391719b..2226b0bbe3 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -11,6 +11,21 @@ export type DelegateResponse = string | null; export type OperationHash = string; +export type UnstakeRequestsResponse = { + finalizable: { + delegate: string; + cycle: number; + amount: BigNumber; + }[]; + unfinalizable: { + delegate: string; + requests: { + cycle: number; + amount: BigNumber; + }[]; + }; +} | null; + interface INodeExtender { length: string; segment: string; diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index 6773b39dbd..d8af80159e 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -2299,7 +2299,24 @@ export const contract = { 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' }] }; diff --git a/packages/taquito-rpc/test/rpc-cache.spec.ts b/packages/taquito-rpc/test/rpc-cache.spec.ts index 6e832637d7..2a6c775a3f 100644 --- a/packages/taquito-rpc/test/rpc-cache.spec.ts +++ b/packages/taquito-rpc/test/rpc-cache.spec.ts @@ -4,6 +4,7 @@ import { blockHash, liveBlocks, balance, + unstakeRequestsResponse, storage, script, contract, @@ -57,6 +58,11 @@ describe('RpcClientCache test', () => { getBlockHash: jest.fn(), getLiveBlocks: jest.fn(), getBalance: jest.fn(), + getFullBalance: jest.fn(), + getStakedBalance: jest.fn(), + getUnstakedFinalizableBalance: jest.fn(), + getUnstakedFrozenBalance: jest.fn(), + getUnstakeRequests: jest.fn(), getStorage: jest.fn(), getStorageUsedSpace: jest.fn(), getStoragePaidSpace: jest.fn(), @@ -97,6 +103,11 @@ describe('RpcClientCache test', () => { mockRpcClient.getBlockHash.mockReturnValue(blockHash); mockRpcClient.getLiveBlocks.mockReturnValue(liveBlocks); mockRpcClient.getBalance.mockReturnValue(balance); + mockRpcClient.getFullBalance.mockReturnValue(balance); + mockRpcClient.getStakedBalance.mockReturnValue(balance); + mockRpcClient.getUnstakedFinalizableBalance.mockReturnValue(balance); + mockRpcClient.getUnstakedFrozenBalance.mockReturnValue(balance); + mockRpcClient.getUnstakeRequests.mockReturnValue(unstakeRequestsResponse); mockRpcClient.getStorage.mockReturnValue(storage); mockRpcClient.getStorageUsedSpace.mockReturnValue('100'); mockRpcClient.getStoragePaidSpace.mockReturnValue('120'); @@ -142,6 +153,11 @@ describe('RpcClientCache test', () => { await rpcCache.getBlock(); await rpcCache.getLiveBlocks(); await rpcCache.getBalance(address); + await rpcCache.getFullBalance(address); + await rpcCache.getStakedBalance(address); + await rpcCache.getUnstakedFinalizableBalance(address); + await rpcCache.getUnstakedFrozenBalance(address); + await rpcCache.getUnstakeRequests(address); await rpcCache.getStorage(contractAddress); await rpcCache.getStoragePaidSpace(contractAddress); await rpcCache.getStorageUsedSpace(contractAddress); @@ -188,6 +204,21 @@ describe('RpcClientCache test', () => { expect(rpcCache.getAllCachedData()[`rpcTest/getBalance/head/${address}/`].response).toEqual( balance ); + expect(rpcCache.getAllCachedData()[`rpcTest/getFullBalance/head/${address}/`].response).toEqual( + balance + ); + expect( + rpcCache.getAllCachedData()[`rpcTest/getStakedBalance/head/${address}/`].response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getUnstakedFinalizableBalance/head/${address}/`].response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getUnstakedFrozenBalance/head/${address}/`].response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getUnstakeRequests/head/${address}/`].response + ).toEqual(unstakeRequestsResponse); expect( rpcCache.getAllCachedData()[`rpcTest/getStorage/head/${contractAddress}/`].response ).toEqual(storage); @@ -286,6 +317,11 @@ describe('RpcClientCache test', () => { await rpcCache.getBlock(block); await rpcCache.getLiveBlocks(block); await rpcCache.getBalance(address, block); + await rpcCache.getFullBalance(address, block); + await rpcCache.getStakedBalance(address, block); + await rpcCache.getUnstakedFinalizableBalance(address, block); + await rpcCache.getUnstakedFrozenBalance(address, block); + await rpcCache.getUnstakeRequests(address, block); await rpcCache.getStorage(contractAddress, block); await rpcCache.getStoragePaidSpace(contractAddress, block); await rpcCache.getStorageUsedSpace(contractAddress, block); @@ -345,6 +381,24 @@ describe('RpcClientCache test', () => { expect( rpcCache.getAllCachedData()[`rpcTest/getBalance/${block.block}/${address}/`].response ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getFullBalance/${block.block}/${address}/`].response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getStakedBalance/${block.block}/${address}/`].response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[ + `rpcTest/getUnstakedFinalizableBalance/${block.block}/${address}/` + ].response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getUnstakedFrozenBalance/${block.block}/${address}/`] + .response + ).toEqual(balance); + expect( + rpcCache.getAllCachedData()[`rpcTest/getUnstakeRequests/${block.block}/${address}/`].response + ).toEqual(unstakeRequestsResponse); expect( rpcCache.getAllCachedData()[`rpcTest/getStorage/${block.block}/${contractAddress}/`].response ).toEqual(storage); @@ -452,6 +506,11 @@ describe('RpcClientCache test', () => { await rpcCache.getBlock(); await rpcCache.getLiveBlocks(); await rpcCache.getBalance(address); + await rpcCache.getFullBalance(address); + await rpcCache.getStakedBalance(address); + await rpcCache.getUnstakedFinalizableBalance(address); + await rpcCache.getUnstakedFrozenBalance(address); + await rpcCache.getUnstakeRequests(address); await rpcCache.getStorage(contractAddress); await rpcCache.getStoragePaidSpace(contractAddress); await rpcCache.getStorageUsedSpace(contractAddress); diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index 5fd13bd3a5..a2ccb5360c 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -58,6 +58,7 @@ import { smartRollupRecoverBondResponse, smartRollupTimeoutResponse, aiLaunchCycle, + unstakeRequestsResponse, } from './data/rpc-responses'; /** @@ -129,6 +130,98 @@ describe('RpcClient test', () => { }); }); + describe('getFullBalance', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getFullBalance(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/full_balance`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + + describe('getStakedBalance', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getStakedBalance(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/staked_balance`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + + describe('getUnstakedFinalizableBalance', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getUnstakedFinalizableBalance(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/unstaked_finalizable_balance`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + + describe('getUnstakedFrozenBalance', () => { + it('should query the right url and return a string', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve('10000')); + const balance = await client.getUnstakedFrozenBalance(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/unstaked_frozen_balance`, + }); + expect(balance).toBeInstanceOf(BigNumber); + expect(balance.toString()).toEqual('10000'); + }); + }); + + describe('getUnstakeRequests', () => { + it('should query the right url', async () => { + httpBackend.createRequest.mockReturnValue(Promise.resolve(unstakeRequestsResponse)); + await client.getUnstakeRequests(contractAddress); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: `root/chains/test/blocks/head/context/contracts/${contractAddress}/unstake_requests`, + }); + }); + + it('should parse the response properly', async () => { + httpBackend.createRequest.mockResolvedValue(unstakeRequestsResponse); + const response = await client.getUnstakeRequests(contractAddress); + + expect(response).toEqual({ + finalizable: [ + { + delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', + cycle: 10, + amount: new BigNumber('500000000'), + }, + ], + unfinalizable: { + delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', + requests: [ + { + cycle: 11, + amount: new BigNumber('200000000'), + }, + ], + }, + }); + }); + }); + describe('getStorage', () => { it('should query the right url', async () => { await client.getStorage(contractAddress); diff --git a/packages/taquito/src/read-provider/interface.ts b/packages/taquito/src/read-provider/interface.ts index d92b6ea4d6..98cbf408c8 100644 --- a/packages/taquito/src/read-provider/interface.ts +++ b/packages/taquito/src/read-provider/interface.ts @@ -22,7 +22,7 @@ export type BlockIdentifier = 'head' | `head~${number}` | `B${string}` | number; export interface TzReadProvider { /** - * @description Access the balance of a contract. + * @description Access the spendable balance of a contract, excluding frozen bonds. * @param address address from which we want to retrieve the balance * @param block from which we want to retrieve the balance * @returns the balance in mutez diff --git a/packages/taquito/src/read-provider/rpc-read-adapter.ts b/packages/taquito/src/read-provider/rpc-read-adapter.ts index c1a1850176..6cf2c999d9 100644 --- a/packages/taquito/src/read-provider/rpc-read-adapter.ts +++ b/packages/taquito/src/read-provider/rpc-read-adapter.ts @@ -17,7 +17,7 @@ export class RpcReadAdapter implements TzReadProvider { constructor(private rpc: RpcClientInterface) {} /** - * @description Access the balance of a contract. + * @description Access the spendable balance of a contract, excluding frozen bonds. * @param address address from which we want to retrieve the balance * @param block from which we want to retrieve the balance * @returns the balance in mutez diff --git a/packages/taquito/src/tz/interface.ts b/packages/taquito/src/tz/interface.ts index 6aad73afbd..6f639f912e 100644 --- a/packages/taquito/src/tz/interface.ts +++ b/packages/taquito/src/tz/interface.ts @@ -4,7 +4,7 @@ import { Operation } from '../operations/operations'; export interface TzProvider { /** * - * @param address Tezos address you want to get the balance for (eg tz1...) + * @param address Tezos address you want to get the spendable balance for (eg tz1...) */ getBalance(address: string): Promise; From d95d865d97ba27e962802f0ebc0526a6595d77e9 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 23 Apr 2024 18:11:36 -0700 Subject: [PATCH 07/35] added staking support in contract API, with unit and integration tests (#2930) * added staking support in contract API, with unit and integration tests * updated ux to not require destination (for stake/unstake) and not require a param for finalize unstake * updated error message * addressed PR comments * remove wrong check * removed undefined check for a more general falsy check --- .../contract/operations/staking.spec.ts | 56 +++ packages/taquito-core/src/errors.ts | 22 + packages/taquito/package.json | 2 +- packages/taquito/src/contract/interface.ts | 33 ++ .../src/contract/rpc-contract-provider.ts | 128 ++++++ .../estimate/estimate-provider-interface.ts | 38 ++ .../src/estimate/rpc-estimate-provider.ts | 129 +++++- packages/taquito/src/operations/types.ts | 42 ++ .../taquito/src/prepare/prepare-provider.ts | 142 ++++++ packages/taquito/test/contract/helper.ts | 183 ++++++++ .../contract/rpc-contract-provider.spec.ts | 416 ++++++++++++++++++ .../estimate/rpc-estimate-provider.spec.ts | 33 ++ .../test/prepare/prepare-provider.spec.ts | 233 ++++++++++ 13 files changed, 1455 insertions(+), 2 deletions(-) create mode 100644 integration-tests/__tests__/contract/operations/staking.spec.ts diff --git a/integration-tests/__tests__/contract/operations/staking.spec.ts b/integration-tests/__tests__/contract/operations/staking.spec.ts new file mode 100644 index 0000000000..f09db91058 --- /dev/null +++ b/integration-tests/__tests__/contract/operations/staking.spec.ts @@ -0,0 +1,56 @@ +import { CONFIGS } from "../../../config"; + +CONFIGS().forEach(({ lib, rpc, setup }) => { + const Tezos = lib; + + describe(`Staking pseudo operations: ${rpc}`, () => { + + beforeAll(async () => { + await setup(true); + + const delegateOp = await Tezos.contract.setDelegate({ + delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', + source: await Tezos.signer.publicKeyHash() + }); + + await delegateOp.confirmation(); + }); + + it('should throw an error when the destination specified is not the same as source', async () => { + expect(async () => { + const op = await Tezos.contract.stake({ + amount: 0.1, + to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' + }); + }).rejects.toThrow(); + }); + + it('should be able to stake funds to a designated delegate', async () => { + const op = await Tezos.contract.stake({ + amount: 0.1 + }); + await op.confirmation(); + + expect(op.hash).toBeDefined(); + expect(op.status).toEqual('applied'); + }); + + it('should be able to unstake funds from a designated delegate', async () => { + const op = await Tezos.contract.unstake({ + amount: 0.1 + }); + await op.confirmation(); + + expect(op.hash).toBeDefined(); + expect(op.status).toEqual('applied'); + }); + + it('should be able to finalize_unstake funds from a designated delegate', async () => { + const op = await Tezos.contract.finalizeUnstake({}); + await op.confirmation(); + + expect(op.hash).toBeDefined(); + expect(op.status).toEqual('applied'); + }); + }); +}); diff --git a/packages/taquito-core/src/errors.ts b/packages/taquito-core/src/errors.ts index 104e821a16..192147c35a 100644 --- a/packages/taquito-core/src/errors.ts +++ b/packages/taquito-core/src/errors.ts @@ -62,6 +62,28 @@ export class InvalidAddressError extends ParameterValidationError { } } +export class InvalidStakingAddressError extends ParameterValidationError { + constructor( + public readonly address: string, + public readonly errorDetail?: string + ) { + super(); + this.name = 'InvalidStakingAddressError'; + this.message = `Invalid staking address "${address}", you can only set destination as your own address`; + } +} + +export class InvalidFinalizeUnstakeAmountError extends ParameterValidationError { + constructor( + public readonly address: string, + public readonly errorDetail?: string + ) { + super(); + this.name = 'InvalidFinalizeUnstakeAmountError'; + this.message = `The amount can only be 0 when finalizing an unstake`; + } +} + /** * @category Error * @description Error that indicates an invalid block hash being passed or used diff --git a/packages/taquito/package.json b/packages/taquito/package.json index 268d2ebeec..38801ea3dd 100644 --- a/packages/taquito/package.json +++ b/packages/taquito/package.json @@ -31,7 +31,7 @@ "node": ">=18" }, "scripts": { - "test": "jest --coverage --testPathIgnorePatterns=operation-factory.spec.ts", + "test": "jest --coverage", "test:watch": "jest --coverage --watch", "test:prod": "npm run lint && npm run test -- --no-cache", "lint": "eslint --ext .js,.ts .", diff --git a/packages/taquito/src/contract/interface.ts b/packages/taquito/src/contract/interface.ts index ef3b5ea24c..cbcf003bef 100644 --- a/packages/taquito/src/contract/interface.ts +++ b/packages/taquito/src/contract/interface.ts @@ -25,6 +25,9 @@ import { SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams, + StakeParams, + UnstakeParams, + FinalizeUnstakeParams, } from '../operations/types'; import { ContractAbstraction, ContractStorageType, DefaultContractType } from './contract'; import { IncreasePaidStorageOperation } from '../operations/increase-paid-storage-operation'; @@ -158,6 +161,36 @@ export interface ContractProvider extends StorageProvider { */ transfer(params: TransferParams): Promise; + /** + * + * @description Stake tz from current address to a specific address. Built on top of the existing transaction operation + * + * @returns An operation handle with the result from the rpc node + * + * @param Stake pseudo-operation parameter + */ + stake(params: StakeParams): Promise; + + /** + * + * @description Unstake tz from current address to a specific address. Built on top of the existing transaction operation + * + * @returns An operation handle with the result from the rpc node + * + * @param Unstake pseudo-operation parameter + */ + unstake(params: UnstakeParams): Promise; + + /** + * + * @description Finalize unstake tz from current address to a specific address. Built on top of the existing transaction operation + * + * @returns An operation handle with the result from the rpc node + * + * @param finalize_unstake pseudo-operation parameter + */ + finalizeUnstake(params: FinalizeUnstakeParams): Promise; + /** * * @description Transfer tickets from an implicit account to a contract or another implicit account. diff --git a/packages/taquito/src/contract/rpc-contract-provider.ts b/packages/taquito/src/contract/rpc-contract-provider.ts index 34695f0d4c..d4d490981d 100644 --- a/packages/taquito/src/contract/rpc-contract-provider.ts +++ b/packages/taquito/src/contract/rpc-contract-provider.ts @@ -30,6 +30,8 @@ import { InvalidAddressError, InvalidContractAddressError, InvalidAmountError, + InvalidFinalizeUnstakeAmountError, + InvalidStakingAddressError, } from '@taquito/core'; import { OperationBatch } from '../batch/rpc-batch-provider'; import { Context } from '../context'; @@ -56,6 +58,9 @@ import { SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams, + StakeParams, + UnstakeParams, + FinalizeUnstakeParams, } from '../operations/types'; import { DefaultContractType, ContractStorageType, ContractAbstraction } from './contract'; import { InvalidDelegationSource, RevealOperationError } from './errors'; @@ -395,6 +400,129 @@ export class RpcContractProvider extends Provider implements ContractProvider, S return new TransactionOperation(hash, content, source, forgedBytes, opResponse, context); } + /** + * + * @description Stake a given amount for the source address + * + * @returns An operation handle with the result from the rpc node + * + * @param Stake pseudo-operation parameter + */ + async stake(params: StakeParams) { + const sourceValidation = validateAddress(params.source ?? ''); + if (params.source && sourceValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(params.source, invalidDetail(sourceValidation)); + } + + if (!params.to) { + params.to = params.source; + } + if (params.to && params.to !== params.source) { + throw new InvalidStakingAddressError(params.to); + } + + if (params.amount < 0) { + throw new InvalidAmountError(params.amount.toString()); + } + const publicKeyHash = await this.signer.publicKeyHash(); + const estimate = await this.estimate(params, this.estimator.stake.bind(this.estimator)); + + const source = params.source || publicKeyHash; + const prepared = await this.prepare.stake({ ...params, ...estimate }); + const content = prepared.opOb.contents.find( + (op) => op.kind === OpKind.TRANSACTION + ) as OperationContentsTransaction; + + const opBytes = await this.forge(prepared); + const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes); + return new TransactionOperation(hash, content, source, forgedBytes, opResponse, context); + } + + /** + * + * @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance. + * Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over, + * the operation "finalize unstake" must be called for the funds to appear in the liquid balance. + * + * @returns An operation handle with the result from the rpc node + * + * @param Unstake pseudo-operation parameter + */ + async unstake(params: UnstakeParams) { + const sourceValidation = validateAddress(params.source ?? ''); + if (params.source && sourceValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(params.source, invalidDetail(sourceValidation)); + } + + if (!params.to) { + params.to = params.source; + } + + if (params.to && params.to !== params.source) { + throw new InvalidStakingAddressError(params.to); + } + + if (params.amount < 0) { + throw new InvalidAmountError(params.amount.toString()); + } + const publicKeyHash = await this.signer.publicKeyHash(); + const estimate = await this.estimate(params, this.estimator.unstake.bind(this.estimator)); + + const source = params.source || publicKeyHash; + const prepared = await this.prepare.unstake({ ...params, ...estimate }); + const content = prepared.opOb.contents.find( + (op) => op.kind === OpKind.TRANSACTION + ) as OperationContentsTransaction; + + const opBytes = await this.forge(prepared); + const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes); + return new TransactionOperation(hash, content, source, forgedBytes, opResponse, context); + } + + /** + * + * @description Transfer all the finalizable unstaked funds of the source to their liquid balance + * @returns An operation handle with the result from the rpc node + * + * @param Finalize_unstake pseudo-operation parameter + */ + async finalizeUnstake(params: FinalizeUnstakeParams) { + const sourceValidation = validateAddress(params.source ?? ''); + if (params.source && sourceValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(params.source, invalidDetail(sourceValidation)); + } + + if (!params.to) { + params.to = params.source; + } + if (params.to && params.to !== params.source) { + throw new InvalidStakingAddressError(params.to); + } + + if (!params.amount) { + params.amount = 0; + } + if (params.amount !== undefined && params.amount > 0) { + throw new InvalidFinalizeUnstakeAmountError('Amount must be 0 to finalize unstake.'); + } + + const publicKeyHash = await this.signer.publicKeyHash(); + const estimate = await this.estimate( + params, + this.estimator.finalizeUnstake.bind(this.estimator) + ); + + const source = params.source || publicKeyHash; + const prepared = await this.prepare.finalizeUnstake({ ...params, ...estimate }); + const content = prepared.opOb.contents.find( + (op) => op.kind === OpKind.TRANSACTION + ) as OperationContentsTransaction; + + const opBytes = await this.forge(prepared); + const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes); + return new TransactionOperation(hash, content, source, forgedBytes, opResponse, context); + } + /** * * @description Transfer Tickets to a smart contract address diff --git a/packages/taquito/src/estimate/estimate-provider-interface.ts b/packages/taquito/src/estimate/estimate-provider-interface.ts index 4a8ed02138..dc5644cec7 100644 --- a/packages/taquito/src/estimate/estimate-provider-interface.ts +++ b/packages/taquito/src/estimate/estimate-provider-interface.ts @@ -14,6 +14,9 @@ import { SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, + StakeParams, + UnstakeParams, + FinalizeUnstakeParams, } from '../operations/types'; import { Estimate } from './estimate'; import { ContractMethod, ContractMethodObject, ContractProvider } from '../contract'; @@ -39,6 +42,41 @@ export interface EstimationProvider { */ transfer({ fee, storageLimit, gasLimit, ...rest }: TransferParams): Promise; + /** + * + * @description Estimate gasLimit, storageLimit and fees for an stake pseudo-operation + * + * @returns An estimation of gasLimit, storageLimit and fees for the operation + * + * @param Estimate + */ + stake({ fee, storageLimit, gasLimit, ...rest }: StakeParams): Promise; + + /** + * + * @description Estimate gasLimit, storageLimit and fees for an unstake pseudo-operation + * + * @returns An estimation of gasLimit, storageLimit and fees for the operation + * + * @param Estimate + */ + unstake({ fee, storageLimit, gasLimit, ...rest }: UnstakeParams): Promise; + + /** + * + * @description Estimate gasLimit, storageLimit and fees for an finalize_unstake pseudo-operation + * + * @returns An estimation of gasLimit, storageLimit and fees for the operation + * + * @param Estimate + */ + finalizeUnstake({ + fee, + storageLimit, + gasLimit, + ...rest + }: FinalizeUnstakeParams): Promise; + /** * * @description Estimate gasLimit, storageLimit and fees for an transferTicket operation diff --git a/packages/taquito/src/estimate/rpc-estimate-provider.ts b/packages/taquito/src/estimate/rpc-estimate-provider.ts index bbe13d9b62..76875ec62b 100644 --- a/packages/taquito/src/estimate/rpc-estimate-provider.ts +++ b/packages/taquito/src/estimate/rpc-estimate-provider.ts @@ -17,6 +17,9 @@ import { SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, + StakeParams, + UnstakeParams, + FinalizeUnstakeParams, } from '../operations/types'; import { Estimate, EstimateProperties } from './estimate'; import { EstimationProvider } from '../estimate/estimate-provider-interface'; @@ -26,7 +29,7 @@ import { ContractMethod, ContractMethodObject, ContractProvider } from '../contr import { Provider } from '../provider'; import { PrepareProvider } from '../prepare/prepare-provider'; import { PreparedOperation } from '../prepare'; -import { InvalidAddressError, InvalidAmountError } from '@taquito/core'; +import { InvalidAddressError, InvalidAmountError, InvalidStakingAddressError } from '@taquito/core'; // stub signature that won't be verified by tezos rpc simulate_operation const STUB_SIGNATURE = @@ -203,6 +206,130 @@ export class RPCEstimateProvider extends Provider implements EstimationProvider return Estimate.createEstimateInstanceFromProperties(estimateProperties); } + /** + * + * @description Estimate gasLimit, storageLimit and fees for an stake pseudo-operation + * + * @returns An estimation of gasLimit, storageLimit and fees for the operation + * + * @param Stake pseudo-operation parameter + */ + async stake({ fee, storageLimit, gasLimit, ...rest }: StakeParams) { + const sourceValidation = validateAddress(rest.source ?? ''); + if (rest.source && sourceValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(rest.source, invalidDetail(sourceValidation)); + } + + if (!rest.to) { + rest.to = rest.source; + } + if (rest.to && rest.to !== rest.source) { + throw new InvalidStakingAddressError(rest.to); + } + + if (rest.amount < 0) { + throw new InvalidAmountError(rest.amount.toString()); + } + const preparedOperation = await this.prepare.stake({ + fee, + storageLimit, + gasLimit, + ...rest, + }); + const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); + const estimateProperties = await this.calculateEstimates(preparedOperation, protocolConstants); + + if (preparedOperation.opOb.contents[0].kind === 'reveal') { + estimateProperties.shift(); + estimateProperties[0].opSize -= this.OP_SIZE_REVEAL / 2; + } + return Estimate.createEstimateInstanceFromProperties(estimateProperties); + } + + /** + * + * @description Estimate gasLimit, storageLimit and fees for an Unstake pseudo-operation + * + * @returns An estimation of gasLimit, storageLimit and fees for the operation + * + * @param Unstake pseudo-operation parameter + */ + async unstake({ fee, storageLimit, gasLimit, ...rest }: UnstakeParams) { + const sourceValidation = validateAddress(rest.source ?? ''); + if (rest.source && sourceValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(rest.source, invalidDetail(sourceValidation)); + } + + if (!rest.to) { + rest.to = rest.source; + } + if (rest.to && rest.to !== rest.source) { + throw new InvalidStakingAddressError(rest.to); + } + + if (rest.amount < 0) { + throw new InvalidAmountError(rest.amount.toString()); + } + const preparedOperation = await this.prepare.unstake({ + fee, + storageLimit, + gasLimit, + ...rest, + }); + const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); + const estimateProperties = await this.calculateEstimates(preparedOperation, protocolConstants); + + if (preparedOperation.opOb.contents[0].kind === 'reveal') { + estimateProperties.shift(); + estimateProperties[0].opSize -= this.OP_SIZE_REVEAL / 2; + } + return Estimate.createEstimateInstanceFromProperties(estimateProperties); + } + + /** + * + * @description Estimate gasLimit, storageLimit and fees for an finalize_unstake pseudo-operation + * + * @returns An estimation of gasLimit, storageLimit and fees for the operation + * + * @param finalize_unstake pseudo-operation parameter + */ + async finalizeUnstake({ fee, storageLimit, gasLimit, ...rest }: FinalizeUnstakeParams) { + const sourceValidation = validateAddress(rest.source ?? ''); + if (rest.source && sourceValidation !== ValidationResult.VALID) { + throw new InvalidAddressError(rest.source, invalidDetail(sourceValidation)); + } + + if (!rest.to) { + rest.to = rest.source; + } + if (rest.to && rest.to !== rest.source) { + throw new InvalidStakingAddressError(rest.to); + } + + if (!rest.amount) { + rest.amount = 0; + } + if (rest.amount !== undefined && rest.amount !== 0) { + throw new Error('Amount must be 0 for finalize_unstake operation'); + } + + const preparedOperation = await this.prepare.finalizeUnstake({ + fee, + storageLimit, + gasLimit, + ...rest, + }); + const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); + const estimateProperties = await this.calculateEstimates(preparedOperation, protocolConstants); + + if (preparedOperation.opOb.contents[0].kind === 'reveal') { + estimateProperties.shift(); + estimateProperties[0].opSize -= this.OP_SIZE_REVEAL / 2; + } + return Estimate.createEstimateInstanceFromProperties(estimateProperties); + } + /** * * @description Estimate gasLimit, storageLimit and fees for a transferTicket operation diff --git a/packages/taquito/src/operations/types.ts b/packages/taquito/src/operations/types.ts index 7077bcf2cf..e6f860ad4f 100644 --- a/packages/taquito/src/operations/types.ts +++ b/packages/taquito/src/operations/types.ts @@ -310,6 +310,48 @@ export interface TransferParams { mutez?: boolean; } +/** + * @description RPC Stake pseudo operation params + */ +export interface StakeParams { + to?: string; + source?: string; + amount: number; + fee?: number; + parameter?: TransactionOperationParameter; + gasLimit?: number; + storageLimit?: number; + mutez?: boolean; +} + +/** + * @description RPC unstake pseudo operation params + */ +export interface UnstakeParams { + to?: string; + source?: string; + amount: number; + fee?: number; + parameter?: TransactionOperationParameter; + gasLimit?: number; + storageLimit?: number; + mutez?: boolean; +} + +/** + * @description RPC finalize_unstake pseudo operation params + */ +export interface FinalizeUnstakeParams { + to?: string; + source?: string; + amount?: number; + fee?: number; + parameter?: TransactionOperationParameter; + gasLimit?: number; + storageLimit?: number; + mutez?: boolean; +} + /** * @description RPC register global constant operation */ diff --git a/packages/taquito/src/prepare/prepare-provider.ts b/packages/taquito/src/prepare/prepare-provider.ts index 90f94108de..1989137e74 100644 --- a/packages/taquito/src/prepare/prepare-provider.ts +++ b/packages/taquito/src/prepare/prepare-provider.ts @@ -28,6 +28,9 @@ import { isOpWithFee, RegisterDelegateParams, ActivationParams, + StakeParams, + UnstakeParams, + FinalizeUnstakeParams, } from '../operations/types'; import { PreparationProvider, PreparedOperation } from './interface'; import { REVEAL_STORAGE_LIMIT, Protocols, getRevealFee, getRevealGasLimit } from '../constants'; @@ -453,6 +456,145 @@ export class PrepareProvider extends Provider implements PreparationProvider { }; } + /** + * + * @description Method to prepare a stake pseudo-operation + * @param operation RPCOperation object or RPCOperation array + * @param source string or undefined source pkh + * @returns a PreparedOperation object + */ + async stake({ fee, storageLimit, gasLimit, ...rest }: StakeParams): Promise { + const { pkh } = await this.getKeys(); + + const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); + const DEFAULT_PARAMS = await this.getOperationLimits(protocolConstants); + const op = await createTransferOperation({ + ...rest, + to: pkh, + ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS), + parameter: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + }); + + const operation = await this.addRevealOperationIfNeeded(op, pkh); + const ops = this.convertIntoArray(operation); + + const hash = await this.getBlockHash(); + const protocol = await this.getProtocolHash(); + + this.#counters = {}; + const headCounter = parseInt(await this.getHeadCounter(pkh), 10); + const contents = this.constructOpContents(ops, headCounter, pkh, rest.source); + + return { + opOb: { + branch: hash, + contents, + protocol, + }, + counter: headCounter, + }; + } + + /** + * + * @description Method to prepare a unstake pseudo-operation + * @param operation RPCOperation object or RPCOperation array + * @param source string or undefined source pkh + * @returns a PreparedOperation object + */ + async unstake({ + fee, + storageLimit, + gasLimit, + ...rest + }: UnstakeParams): Promise { + const { pkh } = await this.getKeys(); + + const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); + const DEFAULT_PARAMS = await this.getOperationLimits(protocolConstants); + const op = await createTransferOperation({ + ...rest, + to: pkh, + ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS), + parameter: { + entrypoint: 'unstake', + value: { prim: 'Unit' }, + }, + }); + + const operation = await this.addRevealOperationIfNeeded(op, pkh); + const ops = this.convertIntoArray(operation); + + const hash = await this.getBlockHash(); + const protocol = await this.getProtocolHash(); + + this.#counters = {}; + const headCounter = parseInt(await this.getHeadCounter(pkh), 10); + const contents = this.constructOpContents(ops, headCounter, pkh, rest.source); + + return { + opOb: { + branch: hash, + contents, + protocol, + }, + counter: headCounter, + }; + } + + /** + * + * @description Method to prepare a finalize_unstake pseudo-operation + * @param operation RPCOperation object or RPCOperation array + * @param source string or undefined source pkh + * @returns a PreparedOperation object + */ + async finalizeUnstake({ + fee, + storageLimit, + gasLimit, + ...rest + }: FinalizeUnstakeParams): Promise { + const { pkh } = await this.getKeys(); + + const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); + const DEFAULT_PARAMS = await this.getOperationLimits(protocolConstants); + const op = await createTransferOperation({ + ...rest, + to: pkh, + amount: 0, + ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS), + parameter: { + entrypoint: 'finalize_unstake', + value: { prim: 'Unit' }, + }, + }); + + const operation = await this.addRevealOperationIfNeeded(op, pkh); + const ops = this.convertIntoArray(operation); + + const hash = await this.getBlockHash(); + const protocol = await this.getProtocolHash(); + + this.#counters = {}; + const headCounter = parseInt(await this.getHeadCounter(pkh), 10); + const contents = this.constructOpContents(ops, headCounter, pkh, rest.source); + + return { + opOb: { + branch: hash, + contents, + protocol, + }, + counter: headCounter, + }; + } + /** * * @description Method to prepare a delegation operation diff --git a/packages/taquito/test/contract/helper.ts b/packages/taquito/test/contract/helper.ts index de8c8ee5c1..323b512f61 100644 --- a/packages/taquito/test/contract/helper.ts +++ b/packages/taquito/test/contract/helper.ts @@ -1658,3 +1658,186 @@ export const smartRollupExecuteOutboxMessageNoReveal = { signature: 'sigs8LVwSkqcMLzTVZWa1yS8aNz26A8bzR6QUHws5uVELh6kcmH7dWz5aKPqW3RXoFfynf5kVCvLJcsP3ucB5P6DEbD2YcQR', }; + +export const stakeNoReveal = { + contents: [ + { + kind: 'transaction', + source: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + fee: '623', + counter: '390', + gas_limit: '3630', + storage_limit: '0', + amount: '6000000000', + destination: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + parameters: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + change: '-623', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '623', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'contract', + contract: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + change: '-6000000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + staker: { + baker: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + }, + change: '6000000000', + origin: 'block', + }, + ], + consumed_milligas: '3629020', + }, + }, + }, + ], + signature: + 'sigRn6MmipGZEBYYCrN5MYQmc8A6ye8iBJdahUY4gfHwFAP8kFXaoRvEx51bmo2qmfEDobuUJ4Ld9HKyuS9tV45qmKzLhuVE', +}; + +export const unstakeNoReveal = { + contents: [ + { + kind: 'transaction', + source: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + fee: '689', + counter: '408', + gas_limit: '4250', + storage_limit: '0', + amount: '99999999999000000', + destination: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + parameters: { + entrypoint: 'unstake', + value: { + prim: 'Unit', + }, + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + change: '-689', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '689', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + balance_updates: [ + { + kind: 'staking', + category: 'delegate_denominator', + delegate: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + change: '-1000000000', + origin: 'block', + }, + { + kind: 'staking', + category: 'delegator_numerator', + delegator: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + change: '-1000000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'deposits', + staker: { + contract: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + delegate: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + }, + change: '-1000000000', + origin: 'block', + }, + { + kind: 'freezer', + category: 'unstaked_deposits', + staker: { + contract: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + delegate: 'tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp', + }, + cycle: 37, + change: '1000000000', + origin: 'block', + }, + ], + consumed_milligas: '4249152', + }, + }, + }, + ], + signature: + 'sighibvGpL1NnZUyBfHPpPqE67tCb3aFK9L5JWhXA1GS9GqcizyZEEUfAGvzLMHxFG9oohhDzCJdMLFxppy3xbS9ZX45tWhM', +}; + +export const finalizeUnstakeNoReveal = { + contents: [ + { + kind: 'transaction', + source: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + fee: '409', + counter: '409', + gas_limit: '1529', + storage_limit: '0', + amount: '0', + destination: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + parameters: { + entrypoint: 'finalize_unstake', + value: { + prim: 'Unit', + }, + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX', + change: '-409', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '409', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + consumed_milligas: '1528887', + }, + }, + }, + ], + signature: + 'sigoVqiaKpRr5jctRcRXmpJaeRFPxKTRAaUyEbhGXWbKyo1EZ1eBCjVzN7Cg7nzSexQLWit75o2cJPd3bfJn1ciwHRHDLCSf', +}; diff --git a/packages/taquito/test/contract/rpc-contract-provider.spec.ts b/packages/taquito/test/contract/rpc-contract-provider.spec.ts index ee44dea222..d83d04ff1f 100644 --- a/packages/taquito/test/contract/rpc-contract-provider.spec.ts +++ b/packages/taquito/test/contract/rpc-contract-provider.spec.ts @@ -87,6 +87,9 @@ describe('RpcContractProvider test', () => { contractCall: jest.Mock; smartRollupOriginate: jest.Mock; smartRollupExecuteOutboxMessage: jest.Mock; + stake: jest.Mock; + unstake: jest.Mock; + finalizeUnstake: jest.Mock; }; beforeEach(() => { @@ -146,6 +149,9 @@ describe('RpcContractProvider test', () => { contractCall: jest.fn(), smartRollupOriginate: jest.fn(), smartRollupExecuteOutboxMessage: jest.fn(), + stake: jest.fn(), + unstake: jest.fn(), + finalizeUnstake: jest.fn(), }; // Required for operations confirmation polling @@ -628,6 +634,416 @@ describe('RpcContractProvider test', () => { }); }); + describe('transfer - staking pseudo operations', () => { + it('should be able to produce a reveal and stake pseudo operation', async () => { + const result = await rpcContractProvider.stake({ + amount: 2, + fee: 10000, + gasLimit: 10600, + storageLimit: 300, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '10000', + gas_limit: '10600', + storage_limit: '300', + amount: '2000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce an error if destination is passed and is different than the source', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.stake.mockResolvedValue(estimate); + + expect(async () => { + await rpcContractProvider.stake({ + to: 'tz1iedjFYksExq8snZK9MNo4AvXHBdXfTsGX', + amount: 2, + }); + }).rejects.toThrow(); + }); + + it('should be able to produce a stake operation when no fees are specified', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.stake.mockResolvedValue(estimate); + + const result = await rpcContractProvider.stake({ + amount: 2, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '301', + gas_limit: '1', + storage_limit: '1000', + amount: '2000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce a stake operation without reveal when manager is defined', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.stake.mockResolvedValue(estimate); + + mockReadProvider.isAccountRevealed.mockResolvedValue(true); + + const result = await rpcContractProvider.stake({ + amount: 2, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'transaction', + fee: '301', + gas_limit: '1', + storage_limit: '1000', + amount: '2000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '1', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce a reveal and unstake pseudo operation', async () => { + const result = await rpcContractProvider.unstake({ + amount: 2, + fee: 10000, + gasLimit: 10600, + storageLimit: 300, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '10000', + gas_limit: '10600', + storage_limit: '300', + amount: '2000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce a reveal and unstake pseudo operation when no fees are specified', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.unstake.mockResolvedValue(estimate); + + const result = await rpcContractProvider.unstake({ + amount: 2, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '301', + gas_limit: '1', + storage_limit: '1000', + amount: '2000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce a reveal and unstake pseudo operation without reveal when account is revealed', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.unstake.mockResolvedValue(estimate); + + mockReadProvider.isAccountRevealed.mockResolvedValue(true); + + const result = await rpcContractProvider.unstake({ + amount: 2, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'transaction', + fee: '301', + gas_limit: '1', + storage_limit: '1000', + amount: '2000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '1', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce a reveal and finalize_unstake pseudo operation', async () => { + const result = await rpcContractProvider.finalizeUnstake({ + fee: 10000, + gasLimit: 10600, + storageLimit: 300, + }); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '10000', + gas_limit: '10600', + storage_limit: '300', + amount: '0', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'finalize_unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should throw an error when an amount other than 0 is specified on a finalize_unstake pseudo-operation', async () => { + await expect( + rpcContractProvider.finalizeUnstake({ + amount: 2, + }) + ).rejects.toThrow(); + }); + + it('should be able to produce a reveal and finalize_unstake pseudo operation when no fees are specified', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.finalizeUnstake.mockResolvedValue(estimate); + + const result = await rpcContractProvider.finalizeUnstake({}); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '301', + gas_limit: '1', + storage_limit: '1000', + amount: '0', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'finalize_unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + + it('should be able to produce a reveal and finalize_unstake pseudo operation without reveal when account is revealed', async () => { + const estimate = new Estimate(1000, 1000, 180, 1000); + mockEstimate.finalizeUnstake.mockResolvedValue(estimate); + + mockReadProvider.isAccountRevealed.mockResolvedValue(true); + + const result = await rpcContractProvider.finalizeUnstake({}); + + expect(result.raw).toEqual({ + opbytes: 'test', + opOb: { + branch: 'test', + contents: [ + { + kind: 'transaction', + fee: '301', + gas_limit: '1', + storage_limit: '1000', + amount: '0', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'finalize_unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '1', + }, + ], + protocol: 'test_proto', + signature: 'test_sig', + }, + counter: 0, + }); + }); + }); + describe('transferTicket', () => { it('validate that a reveal operation will be added when needed', async () => { mockRpcClient.getManagerKey.mockReturnValue(null); diff --git a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts index e06f698daf..c236c54c78 100644 --- a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts +++ b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts @@ -22,6 +22,9 @@ import { smartRollupAddMessagesNoReveal, smartRollupOriginateWithReveal, smartRollupExecuteOutboxMessageNoReveal, + stakeNoReveal, + unstakeNoReveal, + finalizeUnstakeNoReveal, } from '../contract/helper'; import { OpKind, PvmKind } from '@taquito/rpc'; import { TransferTicketParams } from '../../src/operations/types'; @@ -178,6 +181,36 @@ describe('RPCEstimateProvider test signer', () => { }); }); + describe('staking', () => { + it('should return estimates for stake pseudo-operation', async () => { + mockRpcClient.simulateOperation.mockResolvedValue(stakeNoReveal); + + const estimate = await estimateProvider.stake({ + amount: 2, + }); + + expect(estimate.gasLimit).toEqual(3730); + }); + + it('should return estimates for unstake pseudo-operation', async () => { + mockRpcClient.simulateOperation.mockResolvedValue(unstakeNoReveal); + + const estimate = await estimateProvider.unstake({ + amount: 2, + }); + + expect(estimate.gasLimit).toEqual(4350); + }); + + it('should return estimates for finalize_unstake pseudo-operation', async () => { + mockRpcClient.simulateOperation.mockResolvedValue(finalizeUnstakeNoReveal); + + const estimate = await estimateProvider.finalizeUnstake({}); + + expect(estimate.gasLimit).toEqual(1629); + }); + }); + describe('transfer', () => { it('return the correct estimate for multiple internal origination', async () => { mockRpcClient.getManagerKey.mockResolvedValue(null); diff --git a/packages/taquito/test/prepare/prepare-provider.spec.ts b/packages/taquito/test/prepare/prepare-provider.spec.ts index cb7c4892b7..89b4d309cf 100644 --- a/packages/taquito/test/prepare/prepare-provider.spec.ts +++ b/packages/taquito/test/prepare/prepare-provider.spec.ts @@ -264,6 +264,239 @@ describe('PrepareProvider test', () => { }); }); + describe('stake', () => { + it('should return a prepared stake pseudo operation with a reveal op', async () => { + mockReadProvider.isAccountRevealed.mockResolvedValue(false); + + const prepared = await prepareProvider.stake({ + amount: 1000000000, + }); + + expect(prepared).toEqual({ + opOb: { + branch: 'test_block_hash', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '0', + gas_limit: '1040000', + storage_limit: '60000', + amount: '1000000000000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_protocol', + }, + counter: 0, + }); + }); + + it('should return a prepared stake pseudo operation without a reveal op', async () => { + mockReadProvider.isAccountRevealed.mockResolvedValue(true); + + const prepared = await prepareProvider.stake({ + amount: 1000000000, + }); + + expect(prepared).toEqual({ + opOb: { + branch: 'test_block_hash', + contents: [ + { + kind: 'transaction', + fee: '0', + gas_limit: '1040000', + storage_limit: '60000', + amount: '1000000000000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'stake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '1', + }, + ], + protocol: 'test_protocol', + }, + counter: 0, + }); + }); + }); + + describe('finalize_unstake', () => { + it('should return an unstake pseudo operation with a reveal op', async () => { + mockReadProvider.isAccountRevealed.mockResolvedValue(false); + + const prepared = await prepareProvider.unstake({ + amount: 9999, + }); + + expect(prepared).toEqual({ + opOb: { + branch: 'test_block_hash', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '0', + gas_limit: '1040000', + storage_limit: '60000', + amount: '9999000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_protocol', + }, + counter: 0, + }); + }); + + it('should return an unstake pseudo operation without a reveal op', async () => { + mockReadProvider.isAccountRevealed.mockResolvedValue(true); + + const prepared = await prepareProvider.unstake({ + amount: 9999, + }); + + expect(prepared).toEqual({ + opOb: { + branch: 'test_block_hash', + contents: [ + { + kind: 'transaction', + fee: '0', + gas_limit: '1040000', + storage_limit: '60000', + amount: '9999000000', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '1', + }, + ], + protocol: 'test_protocol', + }, + counter: 0, + }); + }); + }); + + describe('finalize_unstake', () => { + it('should return a prepared finalize_unstake pseudo operation with a reveal op', async () => { + mockReadProvider.isAccountRevealed.mockResolvedValue(false); + + const prepared = await prepareProvider.finalizeUnstake({}); + + expect(prepared).toEqual({ + opOb: { + branch: 'test_block_hash', + contents: [ + { + kind: 'reveal', + fee: '331', + public_key: 'test_pub_key', + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + gas_limit: '625', + storage_limit: '0', + counter: '1', + }, + { + kind: 'transaction', + fee: '0', + gas_limit: '1040000', + storage_limit: '60000', + amount: '0', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'finalize_unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '2', + }, + ], + protocol: 'test_protocol', + }, + counter: 0, + }); + }); + + it('should return a prepared finalize_unstake pseudo operation without a reveal op', async () => { + mockReadProvider.isAccountRevealed.mockResolvedValue(true); + + const prepared = await prepareProvider.finalizeUnstake({}); + + expect(prepared).toEqual({ + opOb: { + branch: 'test_block_hash', + contents: [ + { + kind: 'transaction', + fee: '0', + gas_limit: '1040000', + storage_limit: '60000', + amount: '0', + destination: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + parameters: { + entrypoint: 'finalize_unstake', + value: { + prim: 'Unit', + }, + }, + source: 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM', + counter: '1', + }, + ], + protocol: 'test_protocol', + }, + counter: 0, + }); + }); + }); + describe('drainDelegate', () => { it('should return a prepared drain_delegate operation', async () => { mockReadProvider.isAccountRevealed.mockResolvedValue(true); From 4e1b113642b9e14dda58a789da67178813eaa8e6 Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Wed, 24 Apr 2024 15:52:41 -0700 Subject: [PATCH 08/35] feat: walletAPI supports stake, unstake, finalizeUnstake with integration-tests (#2935) --- .../wallet/staking-pseudo-operations.spec.ts | 62 ++++++++++++ .../src/taquito-beacon-wallet.ts | 56 ++++++++++- packages/taquito/src/wallet/interface.ts | 26 +++++ packages/taquito/src/wallet/legacy.ts | 15 +++ packages/taquito/src/wallet/wallet.ts | 98 ++++++++++++++++++- 5 files changed, 253 insertions(+), 4 deletions(-) create mode 100644 integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts diff --git a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts new file mode 100644 index 0000000000..4aa9137437 --- /dev/null +++ b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts @@ -0,0 +1,62 @@ +import { CONFIGS } from '../../config'; +import { Protocols } from '@taquito/taquito'; +import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; +import { InvalidStakingAddressError, InvalidFinalizeUnstakeAmountError } from '@taquito/core'; + +CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { + const Tezos = lib; + const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip; + describe(`Test staking pseudo operations using: ${rpc}`, () => { + beforeAll(async () => { + await setup(true); + try { + const delegateOp = await Tezos.contract.setDelegate({ + delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', // can use knownBaker in future + source: await Tezos.signer.publicKeyHash() + }); + await delegateOp.confirmation(); + } catch (e) { + console.log(JSON.stringify(e)); + } + }); + + parisAndAlpha(`should be able to stake successfully: ${rpc}`, async () => { + const op = await Tezos.wallet.stake({ amount: 3000000, mutez: true }).send() + await op.confirmation(); + expect(op.status).toBeTruthy(); + + const stakedBalance = await Tezos.rpc.getStakedBalance(await Tezos.signer.publicKeyHash()); + expect(stakedBalance.toNumber()).toEqual(3000000); + }); + + parisAndAlpha(`should be able to unstake successfully: ${rpc}`, async () => { + const op = await Tezos.wallet.unstake({ amount: 1 }).send() + await op.confirmation(); + expect(op.status).toBeTruthy(); + + const UnstakedBalance = await Tezos.rpc.getUnstakedFrozenBalance(await Tezos.signer.publicKeyHash()); + expect(UnstakedBalance.toNumber()).toEqual(1000000); // 1000000 mutez = 1 tez + }); + + parisAndAlpha(`should be able to finalizeUnstake successfully: ${rpc}`, async () => { + const op = await Tezos.wallet.finalizeUnstake({ }).send() + await op.confirmation(); + expect(op.status).toBeTruthy(); + }); + + parisAndAlpha('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); + }); + }); +}); diff --git a/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts b/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts index a683acae70..c725124970 100644 --- a/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts +++ b/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts @@ -23,6 +23,9 @@ import { WalletOriginateParams, WalletProvider, WalletTransferParams, + WalletStakeParams, + WalletUnstakeParams, + WalletFinalizeUnstakeParams, } from '@taquito/taquito'; import { buf2hex, hex2buf, mergebuf } from '@taquito/utils'; import { UnsupportedActionError } from '@taquito/core'; @@ -89,6 +92,51 @@ export class BeaconWallet implements WalletProvider { ); } + async mapStakeParamsToWalletParams(params: () => Promise) { + let walletParams: WalletStakeParams; + await this.client.showPrepare(); + try { + walletParams = await params(); + } catch (err) { + await this.client.hideUI(['alert']); + throw err; + } + return this.removeDefaultParams( + walletParams, + await createTransferOperation(this.formatParameters(walletParams)) + ); + } + + async mapUnstakeParamsToWalletParams(params: () => Promise) { + let walletParams: WalletUnstakeParams; + await this.client.showPrepare(); + try { + walletParams = await params(); + } catch (err) { + await this.client.hideUI(['alert']); + throw err; + } + return this.removeDefaultParams( + walletParams, + await createTransferOperation(this.formatParameters(walletParams)) + ); + } + + async mapFinalizeUnstakeParamsToWalletParams(params: () => Promise) { + let walletParams: WalletFinalizeUnstakeParams; + await this.client.showPrepare(); + try { + walletParams = await params(); + } catch (err) { + await this.client.hideUI(['alert']); + throw err; + } + return this.removeDefaultParams( + walletParams, + await createTransferOperation(this.formatParameters(walletParams)) + ); + } + async mapIncreasePaidStorageWalletParams(params: () => Promise) { let walletParams: WalletIncreasePaidStorageParams; await this.client.showPrepare(); @@ -148,7 +196,13 @@ export class BeaconWallet implements WalletProvider { } removeDefaultParams( - params: WalletTransferParams | WalletOriginateParams | WalletDelegateParams, + params: + | WalletTransferParams + | WalletStakeParams + | WalletUnstakeParams + | WalletFinalizeUnstakeParams + | WalletOriginateParams + | WalletDelegateParams, operatedParams: any ) { // If fee, storageLimit or gasLimit is undefined by user diff --git a/packages/taquito/src/wallet/interface.ts b/packages/taquito/src/wallet/interface.ts index a117882fe4..20e10fa560 100644 --- a/packages/taquito/src/wallet/interface.ts +++ b/packages/taquito/src/wallet/interface.ts @@ -4,12 +4,21 @@ import { IncreasePaidStorageParams, OriginateParams, TransferParams, + StakeParams, + UnstakeParams, + FinalizeUnstakeParams, } from '../operations/types'; export type WalletDefinedFields = 'source'; export type WalletTransferParams = Omit; +export type WalletStakeParams = Omit; + +export type WalletUnstakeParams = Omit; + +export type WalletFinalizeUnstakeParams = Omit; + export type WalletOriginateParams = Omit< OriginateParams, WalletDefinedFields @@ -37,6 +46,23 @@ export interface WalletProvider { */ mapTransferParamsToWalletParams: (params: () => Promise) => Promise; + /** + * @description Transform WalletStakeParams into a format compliant with the underlying wallet + */ + mapStakeParamsToWalletParams: (params: () => Promise) => Promise; + + /** + * @description Transform WalletUnstakeParams into a format compliant with the underlying wallet + */ + mapUnstakeParamsToWalletParams: (params: () => Promise) => Promise; + + /** + * @description Transform WalletFinalizeUnstakeParams into a format compliant with the underlying wallet + */ + mapFinalizeUnstakeParamsToWalletParams: ( + params: () => Promise + ) => Promise; + /** * @description Transform WalletOriginateParams into a format compliant with the underlying wallet */ diff --git a/packages/taquito/src/wallet/legacy.ts b/packages/taquito/src/wallet/legacy.ts index 010d66e707..7e84c26f43 100644 --- a/packages/taquito/src/wallet/legacy.ts +++ b/packages/taquito/src/wallet/legacy.ts @@ -6,6 +6,9 @@ import { WalletOriginateParams, WalletProvider, WalletTransferParams, + WalletStakeParams, + WalletUnstakeParams, + WalletFinalizeUnstakeParams, } from './interface'; import { WalletParamsWithKind } from './wallet'; @@ -24,6 +27,18 @@ export class LegacyWalletProvider implements WalletProvider { return attachKind(await params(), OpKind.TRANSACTION); } + async mapStakeParamsToWalletParams(params: () => Promise) { + return attachKind(await params(), OpKind.TRANSACTION); + } + + async mapUnstakeParamsToWalletParams(params: () => Promise) { + return attachKind(await params(), OpKind.TRANSACTION); + } + + async mapFinalizeUnstakeParamsToWalletParams(params: () => Promise) { + return attachKind(await params(), OpKind.TRANSACTION); + } + async mapOriginateParamsToWalletParams(params: () => Promise) { return attachKind(await params(), OpKind.ORIGINATION); } diff --git a/packages/taquito/src/wallet/wallet.ts b/packages/taquito/src/wallet/wallet.ts index f35fa37da6..11ed4826e7 100644 --- a/packages/taquito/src/wallet/wallet.ts +++ b/packages/taquito/src/wallet/wallet.ts @@ -16,11 +16,16 @@ import { WalletOriginateParams, WalletProvider, WalletTransferParams, + WalletStakeParams, + WalletUnstakeParams, + WalletFinalizeUnstakeParams, } from './interface'; import { InvalidAddressError, InvalidContractAddressError, InvalidOperationKindError, + InvalidStakingAddressError, + InvalidFinalizeUnstakeAmountError, } from '@taquito/core'; import { validateAddress, @@ -351,11 +356,98 @@ export class Wallet { /** * - * @description + * @description Stake a given amount for the source address * - * @returns + * @returns An operation handle with the result from the rpc node + * + * @param Stake pseudo-operation parameter + */ + stake(params: WalletStakeParams) { + return this.walletCommand(async () => { + const mappedParams = await this.walletProvider.mapStakeParamsToWalletParams(async () => { + const source = await this.pkh(); + if (!params.to) { + params.to = source; + } + if (params.to !== source) { + throw new InvalidStakingAddressError(params.to); + } + params.parameter = { entrypoint: 'stake', value: { prim: 'Unit' } }; + return params; + }); + const opHash = await this.walletProvider.sendOperations([mappedParams]); + return this.context.operationFactory.createTransactionOperation(opHash); + }); + } + + /** + * + * @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance. + * Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over, + * the operation "finalize unstake" must be called for the funds to appear in the liquid balance. + * + * @returns An operation handle with the result from the rpc node + * + * @param Unstake pseudo-operation parameter + */ + unstake(params: WalletUnstakeParams) { + return this.walletCommand(async () => { + const mappedParams = await this.walletProvider.mapUnstakeParamsToWalletParams(async () => { + const source = await this.pkh(); + if (!params.to) { + params.to = source; + } + if (params.to !== source) { + throw new InvalidStakingAddressError(params.to); + } + params.parameter = { entrypoint: 'unstake', value: { prim: 'Unit' } }; + return params; + }); + const opHash = await this.walletProvider.sendOperations([mappedParams]); + return await this.context.operationFactory.createTransactionOperation(opHash); + }); + } + + /** + * + * @description Transfer all the finalizable unstaked funds of the source to their liquid balance + * @returns An operation handle with the result from the rpc node * - * @param params + * @param Finalize_unstake pseudo-operation parameter + */ + finalizeUnstake(params: WalletFinalizeUnstakeParams) { + return this.walletCommand(async () => { + const mappedParams = await this.walletProvider.mapFinalizeUnstakeParamsToWalletParams( + async () => { + const source = await this.pkh(); + if (!params.to) { + params.to = source; + } + if (params.to !== source) { + throw new InvalidStakingAddressError(params.to); + } + if (!params.amount) { + params.amount = 0; + } + if (params.amount !== 0) { + throw new InvalidFinalizeUnstakeAmountError('Amount must be 0 to finalize unstake.'); + } + params.parameter = { entrypoint: 'finalize_unstake', value: { prim: 'Unit' } }; + return params; + } + ); + const opHash = await this.walletProvider.sendOperations([mappedParams]); + return await this.context.operationFactory.createTransactionOperation(opHash); + }); + } + + /** + * + * @description Increase the paid storage of a smart contract. + * + * @returns A wallet command from which we can send the operation to the wallet + * + * @param params operation parameter */ increasePaidStorage(params: WalletIncreasePaidStorageParams) { const destinationValidation = validateAddress(params.destination); From 90843eeb39055a98291543da90dd341615d6365a Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:21:05 -0700 Subject: [PATCH 09/35] docs: adapting getPendingOperations version change in description (#2936) --- packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts | 5 ++--- packages/taquito-rpc/src/taquito-rpc.ts | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) 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 45a0632983..1b4eea2eda 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -1247,9 +1247,8 @@ 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 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response - * @default args { version: '1', applied: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } - * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/paris-mempool-openapi-rc.json + * @param args has 5 optional properties. We support version 1 & 2 + * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } */ async getPendingOperations( args: PendingOperationsQueryArguments = {} diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index 4afdb8edde..cb67f97100 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -1197,8 +1197,8 @@ 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 as default will output { applied: { kind: endorsement} } version 2 will output { validated: { kind: attestation} }. The rest of the properties is to filter pending operations response - * @default args { version: '1', applied: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined } + * @param args has 5 optional properties. We support version 1 & 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 */ async getPendingOperations( From 0ef631853ccfda5c5faed584f16069f34085817e Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:32:17 -0700 Subject: [PATCH 10/35] feat: update rpc for dal (#2937) --- packages/taquito-rpc/src/types.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 2226b0bbe3..5b501b3a9c 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -2161,20 +2161,23 @@ export interface BlockMetadata { max_operation_list_length: MaxOperationListLength[]; proposer?: string; baker: string; - level?: Level; level_info?: LevelInfo; - voting_period_kind?: string; voting_period_info?: VotingPeriodBlockResult; nonce_hash?: string; - consumed_gas?: string; deactivated?: string[]; balance_updates?: OperationBalanceUpdates; - liquidity_baking_escape_ema?: number; liquidity_baking_toggle_ema?: number; + adaptive_issuance_vote_ema?: number; + adaptive_issuance_activation_cycle?: number; implicit_operations_results?: SuccessfulManagerOperationResult[]; - consumed_milligas?: string; proposer_consensus_key?: string; baker_consensus_key?: string; + consumed_milligas?: string; + dal_attestation?: string; + level?: Level; + voting_period_kind?: string; + consumed_gas?: string; + liquidity_baking_escape_ema?: number; } export type RPCRunOperationParam = { @@ -2411,6 +2414,7 @@ export enum SmartRollupRefuteRevealProofKind { RAW_DATA_PROOF = 'raw_data_proof', METADATA_PROOF = 'metadata_proof', DAL_PAGE_PROOF = 'dal_page_proof', + DAL_PARAMETERS_PROOF = 'dal_parameters_proof', } export interface SmartRollupRefuteRevealProofRaw { @@ -2429,11 +2433,14 @@ export interface SmartRollupRefuteRevealProofDalPage { }; dal_proof: string; } - +export interface SmartRollupRefuteRevealProofDalParameters { + reveal_proof_kind: SmartRollupRefuteRevealProofKind.DAL_PARAMETERS_PROOF; +} export type SmartRollupRefuteRevealProofOptions = | SmartRollupRefuteRevealProofRaw | SmartRollupRefuteRevealProofMetadata - | SmartRollupRefuteRevealProofDalPage; + | SmartRollupRefuteRevealProofDalPage + | SmartRollupRefuteRevealProofDalParameters; export type SmartRollupGameStatus = | SmartRollupRefuteGameStatusOptions.ONGOING From 88980709574468fad5e4e7d63d34e1d71accf550 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Thu, 25 Apr 2024 14:06:19 -0700 Subject: [PATCH 11/35] chore(releng) bump version to 20.0.0-beta.0 --- apps/taquito-test-dapp/package.json | 10 +- example/package.json | 22 +- integration-tests/package.json | 30 +-- lerna.json | 2 +- package-lock.json | 204 +++++++++--------- packages/taquito-beacon-wallet/package.json | 6 +- packages/taquito-beacon-wallet/src/version.ts | 4 +- .../taquito-contracts-library/package.json | 10 +- .../taquito-contracts-library/src/version.ts | 4 +- packages/taquito-core/package.json | 2 +- packages/taquito-core/src/version.ts | 4 +- packages/taquito-http-utils/package.json | 4 +- packages/taquito-http-utils/src/version.ts | 4 +- packages/taquito-ledger-signer/package.json | 8 +- packages/taquito-ledger-signer/src/version.ts | 4 +- packages/taquito-local-forging/package.json | 8 +- packages/taquito-local-forging/src/version.ts | 4 +- .../pack-test-tool/package.json | 4 +- packages/taquito-michel-codec/package.json | 4 +- packages/taquito-michel-codec/src/version.ts | 4 +- .../taquito-michelson-encoder/package.json | 8 +- .../taquito-michelson-encoder/src/version.ts | 4 +- packages/taquito-remote-signer/package.json | 10 +- packages/taquito-remote-signer/src/version.ts | 4 +- packages/taquito-rpc/package.json | 8 +- packages/taquito-rpc/src/version.ts | 4 +- packages/taquito-sapling/package.json | 10 +- packages/taquito-sapling/src/version.ts | 4 +- packages/taquito-signer/package.json | 8 +- packages/taquito-signer/src/version.ts | 4 +- packages/taquito-timelock/package.json | 8 +- packages/taquito-timelock/src/version.ts | 4 +- packages/taquito-tzip12/package.json | 10 +- packages/taquito-tzip12/src/version.ts | 4 +- packages/taquito-tzip16/package.json | 14 +- packages/taquito-tzip16/src/version.ts | 4 +- packages/taquito-utils/package.json | 4 +- packages/taquito-utils/src/version.ts | 4 +- packages/taquito/README.md | 2 +- packages/taquito/assets-manifest.json | 2 +- packages/taquito/package.json | 16 +- packages/taquito/src/version.ts | 4 +- 42 files changed, 241 insertions(+), 241 deletions(-) diff --git a/apps/taquito-test-dapp/package.json b/apps/taquito-test-dapp/package.json index 6aee4c753a..f29b421582 100644 --- a/apps/taquito-test-dapp/package.json +++ b/apps/taquito-test-dapp/package.json @@ -1,7 +1,7 @@ { "name": "taquito-test-dapp-vite", "private": true, - "version": "19.2.0", + "version": "20.0.0-beta.0", "type": "module", "scripts": { "dev": "vite", @@ -26,10 +26,10 @@ "dependencies": { "@airgap/beacon-sdk": "^4.2.1", "@airgap/beacon-types": "^4.2.1", - "@taquito/beacon-wallet": "^19.2.0", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/beacon-wallet": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "buffer": "^6.0.3", "svelte-select": "^5.7.0", "vite-compatible-readable-stream": "^3.6.1" diff --git a/example/package.json b/example/package.json index ebfa3a03ec..b597447708 100644 --- a/example/package.json +++ b/example/package.json @@ -1,7 +1,7 @@ { "name": "@taquito/example", "private": true, - "version": "19.2.0", + "version": "20.0.0-beta.0", "scripts": { "example": "node -r ts-node/register --preserve-symlinks example-node.ts", "example:activation": "node -r ts-node/register --preserve-symlinks example-activate.ts", @@ -42,16 +42,16 @@ }, "dependencies": { "@ledgerhq/hw-transport-node-hid": "^6.28.5", - "@taquito/ledger-signer": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/sapling": "^19.2.0", - "@taquito/signer": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip16": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/ledger-signer": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/sapling": "^20.0.0-beta.0", + "@taquito/signer": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/integration-tests/package.json b/integration-tests/package.json index c5d43a0aca..0282d31a4b 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -15,26 +15,26 @@ "originate-known-contracts": "node -r ts-node/register originate-known-contracts.ts", "originate-known-contracts-and-run-test": "node -r ts-node/register originate-known-contracts.ts && jest" }, - "version": "19.2.0", + "version": "20.0.0-beta.0", "dependencies": { "@ledgerhq/devices": "8.2.2", "@ledgerhq/hw-transport": "6.30.5", "@ledgerhq/hw-transport-node-hid": "6.28.5", "@ledgerhq/hw-transport-node-hid-noevents": "6.29.5", - "@taquito/contracts-library": "^19.2.0", - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/remote-signer": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/sapling": "^19.2.0", - "@taquito/signer": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip12": "^19.2.0", - "@taquito/tzip16": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/contracts-library": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/remote-signer": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/sapling": "^20.0.0-beta.0", + "@taquito/signer": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip12": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1" diff --git a/lerna.json b/lerna.json index 3c6da77aa3..52f59785cc 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "useNx": true, - "version": "19.2.0" + "version": "20.0.0-beta.0" } diff --git a/package-lock.json b/package-lock.json index fadffed0cb..2b8f429535 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,14 +56,14 @@ }, "apps/taquito-test-dapp": { "name": "taquito-test-dapp-vite", - "version": "19.2.0", + "version": "20.0.0-beta.0", "dependencies": { "@airgap/beacon-sdk": "^4.2.1", "@airgap/beacon-types": "^4.2.1", - "@taquito/beacon-wallet": "^19.2.0", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/beacon-wallet": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "buffer": "^6.0.3", "svelte-select": "^5.7.0", "vite-compatible-readable-stream": "^3.6.1" @@ -85,19 +85,19 @@ }, "example": { "name": "@taquito/example", - "version": "19.2.0", + "version": "20.0.0-beta.0", "dependencies": { "@ledgerhq/hw-transport-node-hid": "^6.28.5", - "@taquito/ledger-signer": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/sapling": "^19.2.0", - "@taquito/signer": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip16": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/ledger-signer": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/sapling": "^20.0.0-beta.0", + "@taquito/signer": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -106,26 +106,26 @@ } }, "integration-tests": { - "version": "19.2.0", + "version": "20.0.0-beta.0", "dependencies": { "@ledgerhq/devices": "8.2.2", "@ledgerhq/hw-transport": "6.30.5", "@ledgerhq/hw-transport-node-hid": "6.28.5", "@ledgerhq/hw-transport-node-hid-noevents": "6.29.5", - "@taquito/contracts-library": "^19.2.0", - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/remote-signer": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/sapling": "^19.2.0", - "@taquito/signer": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip12": "^19.2.0", - "@taquito/tzip16": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/contracts-library": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/remote-signer": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/sapling": "^20.0.0-beta.0", + "@taquito/signer": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip12": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1" @@ -23405,17 +23405,17 @@ }, "packages/taquito": { "name": "@taquito/taquito", - "version": "19.2.0", + "version": "20.0.0-beta.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -23463,12 +23463,12 @@ }, "packages/taquito-beacon-wallet": { "name": "@taquito/beacon-wallet", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@airgap/beacon-dapp": "^4.2.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0" + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -23508,13 +23508,13 @@ }, "packages/taquito-contracts-library": { "name": "@taquito/contracts-library", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -23551,7 +23551,7 @@ }, "packages/taquito-core": { "name": "@taquito/core", - "version": "19.1.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "json-stringify-safe": "^5.0.1" @@ -23567,10 +23567,10 @@ }, "packages/taquito-http-utils": { "name": "@taquito/http-utils", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", + "@taquito/core": "^20.0.0-beta.0", "node-fetch": "^2.7.0" }, "devDependencies": { @@ -23627,14 +23627,14 @@ }, "packages/taquito-ledger-signer": { "name": "@taquito/ledger-signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@ledgerhq/hw-transport": "^6.30.5", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "buffer": "^6.0.3" }, "devDependencies": { @@ -23671,15 +23671,15 @@ }, "packages/taquito-local-forging": { "name": "@taquito/local-forging", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { - "@taquito/rpc": "^19.2.0", + "@taquito/rpc": "^20.0.0-beta.0", "@types/bluebird": "^3.5.40", "@types/estree": "^1.0.2", "@types/jest": "^29.5.5", @@ -23717,10 +23717,10 @@ }, "packages/taquito-michel-codec": { "name": "@taquito/michel-codec", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "MIT", "dependencies": { - "@taquito/core": "^19.1.0" + "@taquito/core": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -23749,21 +23749,21 @@ } }, "packages/taquito-michel-codec/pack-test-tool": { - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^19.2.0", + "@taquito/rpc": "^20.0.0-beta.0", "yargs": "^17.7.2" } }, "packages/taquito-michelson-encoder": { "name": "@taquito/michelson-encoder", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -23800,15 +23800,15 @@ }, "packages/taquito-remote-signer": { "name": "@taquito/remote-signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { @@ -23845,12 +23845,12 @@ }, "packages/taquito-rpc": { "name": "@taquito/rpc", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -23886,17 +23886,17 @@ }, "packages/taquito-sapling": { "name": "@taquito/sapling", - "version": "19.2.0", + "version": "20.0.0-beta.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@airgap/sapling-wasm": "0.0.9", "@stablelib/nacl": "^1.0.4", "@stablelib/random": "^1.0.2", - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1", @@ -23956,7 +23956,7 @@ }, "packages/taquito-signer": { "name": "@taquito/signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -23965,9 +23965,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -24010,7 +24010,7 @@ }, "packages/taquito-timelock": { "name": "@taquito/timelock", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -24018,9 +24018,9 @@ "big-integer": "^1.6.52" }, "devDependencies": { - "@taquito/signer": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/signer": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", @@ -24064,13 +24064,13 @@ }, "packages/taquito-tzip12": { "name": "@taquito/tzip12", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip16": "^19.2.0" + "@taquito/core": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -24106,15 +24106,15 @@ }, "packages/taquito-tzip16": { "name": "@taquito/tzip16", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, @@ -24153,12 +24153,12 @@ }, "packages/taquito-utils": { "name": "@taquito/utils", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0", + "@taquito/core": "^20.0.0-beta.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/packages/taquito-beacon-wallet/package.json b/packages/taquito-beacon-wallet/package.json index 3da826a3e4..7e1fb86ae4 100644 --- a/packages/taquito-beacon-wallet/package.json +++ b/packages/taquito-beacon-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/beacon-wallet", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Beacon wallet provider", "keywords": [ "tezos", @@ -68,8 +68,8 @@ }, "dependencies": { "@airgap/beacon-dapp": "^4.2.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0" + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-beacon-wallet/src/version.ts b/packages/taquito-beacon-wallet/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-beacon-wallet/src/version.ts +++ b/packages/taquito-beacon-wallet/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-contracts-library/package.json b/packages/taquito-contracts-library/package.json index d3f25a610d..30c3ade5f8 100644 --- a/packages/taquito-contracts-library/package.json +++ b/packages/taquito-contracts-library/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/contracts-library", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Can be used as an extension on the TezosToolkit to provide contracts data", "keywords": [ "tezos" @@ -67,10 +67,10 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/packages/taquito-contracts-library/src/version.ts b/packages/taquito-contracts-library/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-contracts-library/src/version.ts +++ b/packages/taquito-contracts-library/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-core/package.json b/packages/taquito-core/package.json index 5131b41f99..5a97575ffa 100644 --- a/packages/taquito-core/package.json +++ b/packages/taquito-core/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/core", - "version": "19.1.0", + "version": "20.0.0-beta.0", "description": "Classes, interfaces, and types shared across Taquito packages", "keywords": [ "tezos", diff --git a/packages/taquito-core/src/version.ts b/packages/taquito-core/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-core/src/version.ts +++ b/packages/taquito-core/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-http-utils/package.json b/packages/taquito-http-utils/package.json index 7e090bea79..ed581088b9 100644 --- a/packages/taquito-http-utils/package.json +++ b/packages/taquito-http-utils/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/http-utils", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "", "keywords": [ "tezos" @@ -58,7 +58,7 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", + "@taquito/core": "^20.0.0-beta.0", "node-fetch": "^2.7.0" }, "devDependencies": { diff --git a/packages/taquito-http-utils/src/version.ts b/packages/taquito-http-utils/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-http-utils/src/version.ts +++ b/packages/taquito-http-utils/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-ledger-signer/package.json b/packages/taquito-ledger-signer/package.json index d57c0fc3a7..f22f0367e9 100644 --- a/packages/taquito-ledger-signer/package.json +++ b/packages/taquito-ledger-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/ledger-signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Ledger signer provider", "keywords": [ "tezos", @@ -59,9 +59,9 @@ "dependencies": { "@ledgerhq/hw-transport": "^6.30.5", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "buffer": "^6.0.3" }, "devDependencies": { diff --git a/packages/taquito-ledger-signer/src/version.ts b/packages/taquito-ledger-signer/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-ledger-signer/src/version.ts +++ b/packages/taquito-ledger-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-local-forging/package.json b/packages/taquito-local-forging/package.json index 9c28876742..797f9f5e6e 100644 --- a/packages/taquito-local-forging/package.json +++ b/packages/taquito-local-forging/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/local-forging", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Provide local forging functionality to be with taquito", "keywords": [ "tezos", @@ -67,12 +67,12 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { - "@taquito/rpc": "^19.2.0", + "@taquito/rpc": "^20.0.0-beta.0", "@types/bluebird": "^3.5.40", "@types/estree": "^1.0.2", "@types/jest": "^29.5.5", diff --git a/packages/taquito-local-forging/src/version.ts b/packages/taquito-local-forging/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-local-forging/src/version.ts +++ b/packages/taquito-local-forging/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-michel-codec/pack-test-tool/package.json b/packages/taquito-michel-codec/pack-test-tool/package.json index 906642aef2..76a6472cda 100644 --- a/packages/taquito-michel-codec/pack-test-tool/package.json +++ b/packages/taquito-michel-codec/pack-test-tool/package.json @@ -1,6 +1,6 @@ { "name": "pack-test-tool", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Generate pack test data via Tezos RPC", "main": "pack-test-tool.js", "private": true, @@ -8,7 +8,7 @@ "author": "Eugene Zagidullin ", "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^19.2.0", + "@taquito/rpc": "^20.0.0-beta.0", "yargs": "^17.7.2" } } diff --git a/packages/taquito-michel-codec/package.json b/packages/taquito-michel-codec/package.json index e48a5cb7ab..426af16a70 100644 --- a/packages/taquito-michel-codec/package.json +++ b/packages/taquito-michel-codec/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/michel-codec", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Michelson parser/validator/formatter", "keywords": [ "tezos", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0" + "@taquito/core": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-michel-codec/src/version.ts b/packages/taquito-michel-codec/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-michel-codec/src/version.ts +++ b/packages/taquito-michel-codec/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-michelson-encoder/package.json b/packages/taquito-michelson-encoder/package.json index 719ec9aa56..66a5182228 100644 --- a/packages/taquito-michelson-encoder/package.json +++ b/packages/taquito-michelson-encoder/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/michelson-encoder", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "converts michelson data and types into convenient JS/TS objects", "keywords": [ "tezos", @@ -67,9 +67,9 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, diff --git a/packages/taquito-michelson-encoder/src/version.ts b/packages/taquito-michelson-encoder/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-michelson-encoder/src/version.ts +++ b/packages/taquito-michelson-encoder/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-remote-signer/package.json b/packages/taquito-remote-signer/package.json index 84eb096103..28539ec87f 100644 --- a/packages/taquito-remote-signer/package.json +++ b/packages/taquito-remote-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/remote-signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Remote signer provider", "keywords": [ "tezos", @@ -62,10 +62,10 @@ "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { diff --git a/packages/taquito-remote-signer/src/version.ts b/packages/taquito-remote-signer/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-remote-signer/src/version.ts +++ b/packages/taquito-remote-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-rpc/package.json b/packages/taquito-rpc/package.json index 223f14420a..57f0780bce 100644 --- a/packages/taquito-rpc/package.json +++ b/packages/taquito-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/rpc", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Provides low level methods, and types to invoke RPC calls from a Nomadic Tezos RPC node", "keywords": [ "tezos", @@ -66,9 +66,9 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/packages/taquito-rpc/src/version.ts b/packages/taquito-rpc/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-rpc/src/version.ts +++ b/packages/taquito-rpc/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-sapling/package.json b/packages/taquito-sapling/package.json index e8d7053bcc..1bc3279acf 100644 --- a/packages/taquito-sapling/package.json +++ b/packages/taquito-sapling/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/sapling", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Allows reading and preparing sapling transactions", "keywords": [ "tezos", @@ -68,10 +68,10 @@ "@airgap/sapling-wasm": "0.0.9", "@stablelib/nacl": "^1.0.4", "@stablelib/random": "^1.0.2", - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1", diff --git a/packages/taquito-sapling/src/version.ts b/packages/taquito-sapling/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-sapling/src/version.ts +++ b/packages/taquito-sapling/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-signer/package.json b/packages/taquito-signer/package.json index 12c9f076bc..0a01a2504e 100644 --- a/packages/taquito-signer/package.json +++ b/packages/taquito-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Provide signing functionality to be with taquito", "keywords": [ "tezos", @@ -72,9 +72,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", diff --git a/packages/taquito-signer/src/version.ts b/packages/taquito-signer/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-signer/src/version.ts +++ b/packages/taquito-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-timelock/package.json b/packages/taquito-timelock/package.json index 633a2f4039..2400995295 100644 --- a/packages/taquito-timelock/package.json +++ b/packages/taquito-timelock/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/timelock", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "TypeScript implementation of the Timelock feature in Tezos", "main": "./dist/taquito-timelock.umd.js", "module": "./dist/taquito-timelock.es6.js", @@ -68,9 +68,9 @@ "big-integer": "^1.6.52" }, "devDependencies": { - "@taquito/signer": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/signer": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", diff --git a/packages/taquito-timelock/src/version.ts b/packages/taquito-timelock/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-timelock/src/version.ts +++ b/packages/taquito-timelock/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-tzip12/package.json b/packages/taquito-tzip12/package.json index 8f4a4da481..f594e81564 100644 --- a/packages/taquito-tzip12/package.json +++ b/packages/taquito-tzip12/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/tzip12", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Tzip12", "keywords": [ "tezos", @@ -62,10 +62,10 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip16": "^19.2.0" + "@taquito/core": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-tzip12/src/version.ts b/packages/taquito-tzip12/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-tzip12/src/version.ts +++ b/packages/taquito-tzip12/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-tzip16/package.json b/packages/taquito-tzip16/package.json index ed1a83b950..f22497f09a 100644 --- a/packages/taquito-tzip16/package.json +++ b/packages/taquito-tzip16/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/tzip16", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "Tzip16", "keywords": [ "tezos", @@ -61,12 +61,12 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, diff --git a/packages/taquito-tzip16/src/version.ts b/packages/taquito-tzip16/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-tzip16/src/version.ts +++ b/packages/taquito-tzip16/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito-utils/package.json b/packages/taquito-utils/package.json index b40b29c4af..57b2c2b3ea 100644 --- a/packages/taquito-utils/package.json +++ b/packages/taquito-utils/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/utils", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "converts michelson data and types into convenient JS/TS objects", "keywords": [ "tezos", @@ -64,7 +64,7 @@ "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0", + "@taquito/core": "^20.0.0-beta.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/packages/taquito-utils/src/version.ts b/packages/taquito-utils/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito-utils/src/version.ts +++ b/packages/taquito-utils/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; diff --git a/packages/taquito/README.md b/packages/taquito/README.md index ccbab63416..b58f419f79 100644 --- a/packages/taquito/README.md +++ b/packages/taquito/README.md @@ -7,7 +7,7 @@ The `@taquito/taquito` package contains higher-level functionality that builds u ## CDN Bundle ```html - ``` diff --git a/packages/taquito/assets-manifest.json b/packages/taquito/assets-manifest.json index 2cda686ec5..20728d3a47 100644 --- a/packages/taquito/assets-manifest.json +++ b/packages/taquito/assets-manifest.json @@ -5,6 +5,6 @@ }, "main.js": { "src": "dist/taquito.min.js", - "integrity": "sha256-SBnOaGNmGpU2dRZi5x2Fql8ttF2HYMVJSrEn0FUrgC8= sha384-yfyuDWhL5IMuPidvT0J7Mc2a2JI8d3XEhSRvvFKN94+UVDQVjWYqqHywNO+uxa4J sha512-Xi8RDZZPlKx8kx/yJvNXokVQHpdr/0bzb+h2t2HLDayVebG2pjHqqNlYhedGRx/2My9DjVNCPJJIELGVrVCp8A==" + "integrity": "sha256-rVK1f5P5V7CfiSgRvlkiOOQNfW0NzyJmiwvrrhacp+4= sha384-XGIZ8FBP7rHqz4ZSz9zvYS3z3kgz4Cds0yo28rzGKTzghLLocRMXN1XkyA4XpY0B sha512-W42Dvr4p//vRwUCuvKzcByEsprNTM6On7fCUOnB1C17fjAD197UlUuAtyolMVu6me3ths2YqGzFABLkGDN94dQ==" } } \ No newline at end of file diff --git a/packages/taquito/package.json b/packages/taquito/package.json index 38801ea3dd..45887acfd8 100644 --- a/packages/taquito/package.json +++ b/packages/taquito/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/taquito", - "version": "19.2.0", + "version": "20.0.0-beta.0", "description": "High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.", "keywords": [ "tezos", @@ -77,13 +77,13 @@ ] }, "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, diff --git a/packages/taquito/src/version.ts b/packages/taquito/src/version.ts index dd87766ac7..344ce1130b 100644 --- a/packages/taquito/src/version.ts +++ b/packages/taquito/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '79be4991733872e1a9d0b3b9159462100349421a', - version: '19.2.0', + commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', + version: '20.0.0-beta.0', }; From e5a73d5d8b117a7e74bd58ca6df248e92d9dc56c Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:33:22 -0700 Subject: [PATCH 12/35] test: added pseudo-entrypoints-forgin.spec.ts (#2938) --- .../pseudo-entrypoints-forging.spec.ts | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts diff --git a/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts b/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts new file mode 100644 index 0000000000..65a0a3f624 --- /dev/null +++ b/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts @@ -0,0 +1,39 @@ +import { CONFIGS } from "../config"; +import { DefaultContractType, UnitValue } from "@taquito/taquito"; +import { LocalForger, ProtocolsHash } from '@taquito/local-forging' + +CONFIGS().forEach(({ rpc, protocol, setup, lib }) => { + const Tezos = lib; + + describe(`Test forging pseudo entrypoints: ${rpc}`, () => { + let contract: DefaultContractType + // for every new protocol need to check https://tezos.gitlab.io/shell/p2p_api.html#alpha-entrypoint-determined-from-data-8-bit-tag for the latest entrypoints and corresponding tag + let entrypoint = { 0: 'default', 1: 'root', 2: 'do', 3: 'set_delegate', 4: 'remove_delegate', 5: 'deposit', 6: 'stake', 7: 'unstake', 8: 'finalize_unstake', 9: 'set_delegate_parameters' } + + beforeAll(async () => { + await setup(); + try { + // for every new entrypoint will need to modify the contract code to have new entrypoint covered + let op = await Tezos.contract.originate({ + code: [{ "prim": "parameter", "args": [{ "prim": "or", "args": [{ "prim": "unit", "annots": ["%default"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%root"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%do"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%set_delegate"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%remove_delegate"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%deposit"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%stake"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%unstake"] }, { "prim": "or", "args": [{ "prim": "unit", "annots": ["%finalize_unstake"] }, { "prim": "unit", "annots": ["%set_delegate_parameters"] }] }] }] }] }] }] }] }] }] }] }, { "prim": "storage", "args": [{ "prim": "string" }] }, { "prim": "code", "args": [[{ "prim": "CAR" }, { "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "default" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "root" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "do" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "set_delegate" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "remove_delegate" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "deposit" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "stake" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "unstake" }] }], [{ "prim": "IF_LEFT", "args": [[{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "finalize_unstake" }] }], [{ "prim": "DROP" }, { "prim": "PUSH", "args": [{ "prim": "string" }, { "string": "set_delegate_parameters" }] }]] }]] }]] }]] }]] }]] }]] }]] }]] }, { "prim": "NIL", "args": [{ "prim": "operation" }] }, { "prim": "PAIR" }]] }], + storage: 'init' + }) + await op.confirmation(); + contract = await op.contract(); + } catch(e) {console.log(e)} + }) + + Object.values(entrypoint).forEach(name => { + it(`Verify that local forge will return same result as for rpc forge for entrypoints name ${name}`, async () => { + const localForger = new LocalForger(protocol as unknown as ProtocolsHash); + const methodObject = await contract.methodsObject[name](UnitValue) + const prepared = await Tezos.prepare.contractCall(methodObject) + const operation = Tezos.prepare.toForge(prepared) + const result = await localForger.forge(operation); + const rpcResult = await Tezos.rpc.forgeOperations(operation); + expect(result).toEqual(rpcResult); + }); + }) + + }); +}); From 08404243d124fae1a39ca6e4a00bf1bcc6817f68 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Mon, 6 May 2024 11:54:56 -0700 Subject: [PATCH 13/35] updated baker account for staking tests (#2951) * updated baker account for staking tests * updated paris tests to not run on oxfordnet --- .../contract/operations/staking.spec.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/integration-tests/__tests__/contract/operations/staking.spec.ts b/integration-tests/__tests__/contract/operations/staking.spec.ts index f09db91058..3fe41a086a 100644 --- a/integration-tests/__tests__/contract/operations/staking.spec.ts +++ b/integration-tests/__tests__/contract/operations/staking.spec.ts @@ -1,7 +1,10 @@ import { CONFIGS } from "../../../config"; +import { Protocols } from '@taquito/taquito'; +import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; -CONFIGS().forEach(({ lib, rpc, setup }) => { +CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => { const Tezos = lib; + const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip; describe(`Staking pseudo operations: ${rpc}`, () => { @@ -9,23 +12,23 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { await setup(true); const delegateOp = await Tezos.contract.setDelegate({ - delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', + delegate: knownBaker, source: await Tezos.signer.publicKeyHash() }); await delegateOp.confirmation(); }); - it('should throw an error when the destination specified is not the same as source', async () => { + parisAndAlpha('should throw an error when the destination specified is not the same as source', async () => { expect(async () => { const op = await Tezos.contract.stake({ amount: 0.1, - to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA' + to: knownBaker }); }).rejects.toThrow(); }); - it('should be able to stake funds to a designated delegate', async () => { + parisAndAlpha('should be able to stake funds to a designated delegate', async () => { const op = await Tezos.contract.stake({ amount: 0.1 }); @@ -35,7 +38,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { expect(op.status).toEqual('applied'); }); - it('should be able to unstake funds from a designated delegate', async () => { + parisAndAlpha('should be able to unstake funds from a designated delegate', async () => { const op = await Tezos.contract.unstake({ amount: 0.1 }); @@ -45,7 +48,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { expect(op.status).toEqual('applied'); }); - it('should be able to finalize_unstake funds from a designated delegate', async () => { + parisAndAlpha('should be able to finalize_unstake funds from a designated delegate', async () => { const op = await Tezos.contract.finalizeUnstake({}); await op.confirmation(); From cce27ff9423030b3f5332dedbe158c271004e328 Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Mon, 6 May 2024 11:55:20 -0700 Subject: [PATCH 14/35] Staking wallet api refine (#2950) * test: updated wallet/staking tests to be robust and walletAPI desc to be accurate * docs: address comments for typedoc * docs: added rounding explanation --- .../wallet/staking-pseudo-operations.spec.ts | 20 +++--- packages/taquito/src/wallet/wallet.ts | 63 +++---------------- 2 files changed, 19 insertions(+), 64 deletions(-) diff --git a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts index 4aa9137437..8662eb7337 100644 --- a/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts +++ b/integration-tests/__tests__/wallet/staking-pseudo-operations.spec.ts @@ -3,7 +3,7 @@ import { Protocols } from '@taquito/taquito'; import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; import { InvalidStakingAddressError, InvalidFinalizeUnstakeAmountError } from '@taquito/core'; -CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { +CONFIGS().forEach(({ lib, rpc, setup, protocol, knownBaker }) => { const Tezos = lib; const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip; describe(`Test staking pseudo operations using: ${rpc}`, () => { @@ -11,7 +11,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { await setup(true); try { const delegateOp = await Tezos.contract.setDelegate({ - delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA', // can use knownBaker in future + delegate: knownBaker, source: await Tezos.signer.publicKeyHash() }); await delegateOp.confirmation(); @@ -21,27 +21,29 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { }); parisAndAlpha(`should be able to stake successfully: ${rpc}`, async () => { - const op = await Tezos.wallet.stake({ amount: 3000000, mutez: true }).send() + const op = await Tezos.wallet.stake({ amount: 3 }).send() await op.confirmation(); - expect(op.status).toBeTruthy(); + expect(await op.status()).toBe('applied'); const stakedBalance = await Tezos.rpc.getStakedBalance(await Tezos.signer.publicKeyHash()); - expect(stakedBalance.toNumber()).toEqual(3000000); + // 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); }); parisAndAlpha(`should be able to unstake successfully: ${rpc}`, async () => { const op = await Tezos.wallet.unstake({ amount: 1 }).send() await op.confirmation(); - expect(op.status).toBeTruthy(); + expect(await op.status()).toBe('applied'); const UnstakedBalance = await Tezos.rpc.getUnstakedFrozenBalance(await Tezos.signer.publicKeyHash()); - expect(UnstakedBalance.toNumber()).toEqual(1000000); // 1000000 mutez = 1 tez + // 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); }); parisAndAlpha(`should be able to finalizeUnstake successfully: ${rpc}`, async () => { - const op = await Tezos.wallet.finalizeUnstake({ }).send() + const op = await Tezos.wallet.finalizeUnstake({}).send() await op.confirmation(); - expect(op.status).toBeTruthy(); + expect(await op.status()).toBe('applied'); }); parisAndAlpha('should throw error when param is against pseudo operation', async () => { diff --git a/packages/taquito/src/wallet/wallet.ts b/packages/taquito/src/wallet/wallet.ts index 11ed4826e7..5e92cf645b 100644 --- a/packages/taquito/src/wallet/wallet.ts +++ b/packages/taquito/src/wallet/wallet.ts @@ -54,9 +54,7 @@ export class WalletOperationBatch { ) {} /** - * * @description Add a transaction operation to the batch - * * @param params Transfer operation parameter */ withTransfer(params: WalletTransferParams) { @@ -69,9 +67,7 @@ export class WalletOperationBatch { } /** - * * @description Add a contract call to the batch - * * @param params Call a contract method * @param options Generic operation parameters */ @@ -83,9 +79,7 @@ export class WalletOperationBatch { } /** - * * @description Add a delegation operation to the batch - * * @param params Delegation operation parameter */ withDelegation(params: WalletDelegateParams) { @@ -98,9 +92,7 @@ export class WalletOperationBatch { } /** - * * @description Add an origination operation to the batch - * * @param params Origination operation parameter */ withOrigination( @@ -111,9 +103,7 @@ export class WalletOperationBatch { } /** - * * @description Add an IncreasePaidStorage operation to the batch - * * @param param IncreasePaidStorage operation parameter */ withIncreasePaidStorage(params: WalletIncreasePaidStorageParams) { @@ -145,9 +135,7 @@ export class WalletOperationBatch { } /** - * * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array - * * @param params Operations parameter * @throws {@link InvalidOperationKindError} */ @@ -175,9 +163,7 @@ export class WalletOperationBatch { } /** - * * @description Submit batch operation to wallet - * */ async send() { const ops: WalletParamsWithKind[] = []; @@ -204,7 +190,6 @@ export class Wallet { /** * @description Retrieve the PKH of the account that is currently in use by the wallet - * * @param option Option to use while fetching the PKH. * If forceRefetch is specified the wallet provider implementation will refetch the PKH from the wallet */ @@ -217,7 +202,6 @@ export class Wallet { /** * @description Retrieve the PK of the account that is currently in use by the wallet - * * @param option Option to use while fetching the PK. * If forceRefetch is specified the wallet provider implementation will refetch the PK from the wallet */ @@ -235,11 +219,8 @@ export class Wallet { }; /** - * * @description Originate a new contract according to the script in parameters. - * - * @returns An operation handle with the result from the rpc node - * + * @returns a OriginationWalletOperation promise object when followed by .send() * @param originateParams Originate operation parameter */ originate( @@ -259,11 +240,8 @@ export class Wallet { } /** - * * @description Set the delegate for a contract. - * - * @returns An operation handle with the result from the rpc node - * + * @returns a WalletDelegateParams promise object when followed by .send() * @param delegateParams operation parameter */ setDelegate(params: WalletDelegateParams) { @@ -281,11 +259,8 @@ export class Wallet { } /** - * * @description failing_noop operation that is guaranteed to fail. DISCLAIMER: Not all wallets support signing failing_noop operations. - * * @returns Signature for a failing_noop - * * @param params operation parameter */ async signFailingNoop(params: WalletFailingNoopParams) { @@ -315,11 +290,8 @@ export class Wallet { } /** - * * @description Register the current address as delegate. - * - * @returns An operation handle with the result from the rpc node - * + * @returns a DelegationWalletOperation promise object when followed by .send() */ registerDelegate() { return this.walletCommand(async () => { @@ -333,11 +305,8 @@ export class Wallet { } /** - * * @description Transfer tezos tokens from current address to a specific address or call a smart contract. - * - * @returns A wallet command from which we can send the operation to the wallet - * + * @returns a TransactionWalletOperation promise object when followed by .send() * @param params operation parameter */ transfer(params: WalletTransferParams) { @@ -355,11 +324,8 @@ export class Wallet { } /** - * * @description Stake a given amount for the source address - * - * @returns An operation handle with the result from the rpc node - * + * @returns a TransactionWalletOperation promise object when followed by .send() * @param Stake pseudo-operation parameter */ stake(params: WalletStakeParams) { @@ -381,13 +347,10 @@ export class Wallet { } /** - * * @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance. * Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over, * the operation "finalize unstake" must be called for the funds to appear in the liquid balance. - * - * @returns An operation handle with the result from the rpc node - * + * @returns a TransactionWalletOperation promise object when followed by .send() * @param Unstake pseudo-operation parameter */ unstake(params: WalletUnstakeParams) { @@ -409,10 +372,8 @@ export class Wallet { } /** - * * @description Transfer all the finalizable unstaked funds of the source to their liquid balance - * @returns An operation handle with the result from the rpc node - * + * @returns a TransactionWalletOperation promise object when followed by .send() * @param Finalize_unstake pseudo-operation parameter */ finalizeUnstake(params: WalletFinalizeUnstakeParams) { @@ -442,11 +403,8 @@ export class Wallet { } /** - * * @description Increase the paid storage of a smart contract. - * - * @returns A wallet command from which we can send the operation to the wallet - * + * @returns a IncreasePaidStorageWalletOperation promise object when followed by .send() * @param params operation parameter */ increasePaidStorage(params: WalletIncreasePaidStorageParams) { @@ -464,11 +422,8 @@ export class Wallet { } /** - * * @description Create a batch of operation - * * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch - * * @param params List of operation to initialize the batch with */ batch(params?: Parameters[0]) { @@ -482,10 +437,8 @@ export class Wallet { } /** - * * @description Create an smart contract abstraction for the address specified. Calling entrypoints with the returned * smart contract abstraction will leverage the wallet provider to make smart contract calls - * * @param address Smart contract address * @throws {@link InvalidContractAddressError} If the contract address is not valid */ From 4fc008a7a6143ed283ebdae8979b32545d60d72e Mon Sep 17 00:00:00 2001 From: ac10n Date: Mon, 6 May 2024 13:35:39 -0700 Subject: [PATCH 15/35] Documentation for Staking (#2928) * docs: draft of documentation for staking * docs: modifications in response to An's comments * docs: fix spelling errors * docs: added code samples * docs: fixed mermaid error * docs: add a note to doc that staking will be disabled for about two weeks after protocol activation * docs: add wallet api code --- docs/staking.md | 168 ++++++++++++++++++++++++++++++++++++++++++++ website/sidebars.js | 1 + 2 files changed, 169 insertions(+) create mode 100644 docs/staking.md diff --git a/docs/staking.md b/docs/staking.md new file mode 100644 index 0000000000..64343e3940 --- /dev/null +++ b/docs/staking.md @@ -0,0 +1,168 @@ +--- +title: Staking and Adaptive Issuance +author: Alireza Haghshenas +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Staking and Adaptive Issuance + +Staking is an update to the "Proof of Stake" Mechanism in Tezos. + +Before Staking, the only way for Tez holders to participate in the network was by delegating their tokens to a baker. Delegated funds contributed to a delegate's voting and baking power, but were not subject to staking: they could not be slashed in case the baker misbehaved. This is a useful feature for many users, but limits the total amount of staked tez to the amount of tez that bakers themselves hold. In other words, participating in the "Proof of Stake" mechanism required setting up and maintaining a baker, which is a significant barrier to entry for many users. + +Staking changes this by allowing any user to participate in the "Proof of Stake" mechanism without setting up a baker. Users can now stake their tokens to their delegates, and their staked tokens will be subject to slashing in case of delegate/baker's misbehaviour. This allows the total amount of staked Tez to be much higher than the amount of tez that bakers themselves hold, which in turn increases the security of the network. + +Users can control their staked funds using the `stake`, `unstake`, and `finalize_unstake` operations. These are implemented as pseudo-entrypoints, and the parameters are passed to a transfer operation with the same destination as the sender. + +To accept staked funds, a delegate needs to have opted in to staking. This is done by `set_delegate_parameters`. This part is not supported by Taquito, as it is not a dApp operation. More information [here](https://tezos.gitlab.io/paris/adaptive_issuance.html#staking-policy-configuration). + +:::info +After protocol Paris is activated, the adaptive issuance will still be disabled for about two weeks. During this period, staking operations will result in this error: `proto.019-PtParisB.operation.manual_staking_forbidden`. +::: + +# Staking Funds +To stake your funds, you need to call the `stake` operation. +Before you can stake your funds, two conditions should be met: +1. You need yor have delegated your funds to a delegate before you can stake them (by calling [`setDelegate`](#set_delegate)) +1. Your delegate should accept staking by calling `set_delegate_parameters` + + + + + +```javascript + +const op = await Tezos.contract.stake({ + amount: 100, + mutez: false + }); + await op.confirmation(); + +``` + + + + +```javascript + +const op = await Tezos.wallet.stake({ + amount: 100, + mutez: false + }).send(); + await op.confirmation(); + +``` + + + + +# Unstaking Funds + +To unstake your funds, you need to call the `unstake` operation. This will change your fund's status to "Unstaked + Frozen" +The unstaked funds will still be frozen (and subject to slashing for 4 cycles). After that, your funds will be in "Unstaked + Finalizable" state. + + + + +```javascript + +const op = await Tezos.contract.unstake({ + amount: 50, + mutez: false + }); + await op.confirmation(); + +``` + + + + +```javascript + +const op = await Tezos.wallet.unstake({ + amount: 50, + mutez: false + }).send(); + await op.confirmation(); + +``` + + + + +# Finalizing Unstake + +To finalize your unstaked funds, you need to call the `finalize_unstake` operation. This will change your fund's status back to "spendable". + + + + +```javascript + +const op = await Tezos.contract.finalizeUnstake(); + await op.confirmation(); + +``` + + + + +```javascript + +const op = await Tezos.wallet.finalizeUnstake().send(); + await op.confirmation(); + +``` + + + + +# Additional Info and Some Notes + +## Cycle +At the time of this writing, a cycle is ~~16384~~ blocks (with Paris protocol will be 24576), and ~~15~~ (10) seconds per block. This means a cycle is about 2.8 days (and will stay the same after Paris). This might change with the activation of newer protocols. + +## Overstaking +A delegate can set the maximum amount of staking they can accept, as a multiply of their own balance. If a delegate's limit is exceeded, the exceeding stake is automatically considered as delegation for the delegate's baking and voting power calculation, but it does remain slashable. That means it's your responsibility to make sure you're not overstaking. Remember that overstaking can even happen after you have staked successfully, because your delegate changes their own balance, or their staking parameter. + + +## Changing Delegate +When you change your delegate, your funds will be automatically unstaked. You will have to wait for 4 cycles before you can stake them again. + +## No need to finalize_unstake in some cases +The `stake` and `unstake` operations will automatically finalize all currently finalizable funds. + +## Adaptive Issuance +A concept related to staking is adaptive issuance. Adaptive issuance is a mechanism that adjusts the block reward based on the total amount of staked tez. In short, the reward will be adjusted to keep the staked funds about 50% of the total supply. To read more about the mechanism, you can check [this document](https://tezos.gitlab.io/paris/adaptive_issuance.html#adaptive-issuance). + +## Staking Rewards +In delegation, rewards were given to the baker, and it was the baker's responsibility to distribute the rewards to the delegators. In staking, the rewards are given directly to the staker. However, rewards are not given immediately, but are distributed through staked (frozen) balance, and the user can spend the reward along with their initial stake when they `unstake` and `finalize_unstake`. + +## Lifetime of Staked Funds + +Before you stake some of your Tez, it is in "Spendable" state. When you stake it, it will be in "Staked" state. When you unstake it, it will be in "Unstaked + Frozen" state, this fund is still subject to slashing. After 4 cycles, it will be in "Unstaked + Finalizable" state. You can finalize it to make it "Spendable" again. + +```mermaid +graph LR +A[Spendable] -- "stake(amount)" --> B[Staked] +B -- "unstake(amount)" --> C[Unstaked + Frozen] +C -- wait 4 cycles --> D[Unstaked + Finalizable] +D -- finalize_unstake --> A +``` diff --git a/website/sidebars.js b/website/sidebars.js index 164d24d0d1..62419a44b6 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -58,6 +58,7 @@ const sidebars = { 'smart_rollups', 'proposal_and_ballot', 'failing_noop', + 'staking', ] }, { From 5fc27dae4cf58aa2428629551217a073f8408da5 Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Mon, 6 May 2024 14:38:02 -0700 Subject: [PATCH 16/35] 2880 forger attestation with dal (#2949) * feat: added rpc type of attestation_with_dal & endorsement_with_dal * feat: added local-forger support of attestation_with_dal * test: added unit tests * test: removed logging --- .../__tests__/local-forging.spec.ts | 16 +++- integration-tests/data/allTestsCases.ts | 18 ++++ .../taquito-local-forging/src/constants.ts | 3 +- packages/taquito-local-forging/src/decoder.ts | 6 +- packages/taquito-local-forging/src/encoder.ts | 5 +- .../src/schema/operation.ts | 3 +- .../taquito-local-forging/src/validator.ts | 6 +- packages/taquito-rpc/src/opkind.ts | 4 +- packages/taquito-rpc/src/types.ts | 47 ++++++---- packages/taquito-rpc/test/taquito-rpc.spec.ts | 94 ++++++++----------- 10 files changed, 111 insertions(+), 91 deletions(-) diff --git a/integration-tests/__tests__/local-forging.spec.ts b/integration-tests/__tests__/local-forging.spec.ts index caea007eb1..990ca9f030 100644 --- a/integration-tests/__tests__/local-forging.spec.ts +++ b/integration-tests/__tests__/local-forging.spec.ts @@ -1,5 +1,5 @@ import { CONFIGS } from "../config"; -import { commonCases, oxfordCases } from '../data/allTestsCases'; +import { commonCases, oxfordCases, parisCases } from '../data/allTestsCases'; import { LocalForger, ProtocolsHash } from '@taquito/local-forging' import { Protocols, TezosToolkit } from "@taquito/taquito"; import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; @@ -7,9 +7,18 @@ import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; CONFIGS().forEach(({ rpc, protocol }) => { const Tezos = new TezosToolkit(rpc); const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip + const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip describe(`Test local forger: ${rpc}`, () => { - // all protocols + parisCases.forEach(({ name, operation, expected }) => { + parisAndAlpha(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { + const localForger = new LocalForger(protocol as unknown as ProtocolsHash); + const result = await localForger.forge(operation); + const rpcResult = await Tezos.rpc.forgeOperations(operation); + expect(result).toEqual(rpcResult); + expect(await localForger.parse(result)).toEqual(expected || operation); + }); + }); oxfordCases.forEach(({ name, operation, expected }) => { oxfordAndAlpha(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { const localForger = new LocalForger(protocol as unknown as ProtocolsHash); @@ -17,10 +26,9 @@ CONFIGS().forEach(({ rpc, protocol }) => { const rpcResult = await Tezos.rpc.forgeOperations(operation); expect(result).toEqual(rpcResult); expect(await localForger.parse(result)).toEqual(expected || operation); - }); }); - + // all protocols commonCases.forEach(({ name, operation, expected }) => { it(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { const localForger = new LocalForger(protocol as unknown as ProtocolsHash); diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index 7bec96eb48..9b624df795 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -49,6 +49,24 @@ interface TestCase { expected?: object; } +export const parisCases: TestCase[] = [ + { + name: 'Attestation With Dal operation', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.ATTESTATION_WITH_DAL, + slot: 0, + level: 66299, + round: 5, + block_payload_hash: 'vh3FEkypvxUYLwjGYd2Sme7aWyfX8npDsqxcL6imVpBWnAZeNn2n', + dal_attestation: '10' + } + ] + } + }, +] export const oxfordCases: TestCase[] = [ { name: 'Origination of a contract that contains the types chest, chest_key and the instruction OPEN_CHEST', diff --git a/packages/taquito-local-forging/src/constants.ts b/packages/taquito-local-forging/src/constants.ts index 666716b799..50b461d51e 100644 --- a/packages/taquito-local-forging/src/constants.ts +++ b/packages/taquito-local-forging/src/constants.ts @@ -43,7 +43,7 @@ export enum CODEC { OP_BALLOT = 'ballot', OP_FAILING_NOOP = 'failing_noop', OP_ATTESTATION = 'attestation', - OP_ENDORSEMENT = 'endorsement', + OP_ATTESTATION_WITH_DAL = 'attestation_with_dal', OP_SEED_NONCE_REVELATION = 'seed_nonce_revelation', OP_REVEAL = 'reveal', OP_PROPOSALS = 'proposals', @@ -239,6 +239,7 @@ export const kindMapping: { [key: number]: string } = { 0x6d: 'origination', 0x06: 'ballot', 0x15: 'attestation', + 0x17: 'attestation_with_dal', 0x01: 'seed_nonce_revelation', 0x05: 'proposals', 0x6f: 'register_global_constant', diff --git a/packages/taquito-local-forging/src/decoder.ts b/packages/taquito-local-forging/src/decoder.ts index 0bcfb7c212..d0c621b9d1 100644 --- a/packages/taquito-local-forging/src/decoder.ts +++ b/packages/taquito-local-forging/src/decoder.ts @@ -32,7 +32,7 @@ import { BallotSchema, DelegationSchema, AttestationSchema, - EndorsementSchema, + AttestationWithDalSchema, IncreasePaidStorageSchema, UpdateConsensusKeySchema, DrainDelegateSchema, @@ -102,8 +102,8 @@ decoders[CODEC.OP_ORIGINATION] = (val: Uint8ArrayConsumer) => decoders[CODEC.OP_BALLOT] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(BallotSchema)(val); decoders[CODEC.OP_ATTESTATION] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(AttestationSchema)(val); -decoders[CODEC.OP_ENDORSEMENT] = (val: Uint8ArrayConsumer) => - schemaDecoder(decoders)(EndorsementSchema)(val); +decoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val: Uint8ArrayConsumer) => + schemaDecoder(decoders)(AttestationWithDalSchema)(val); decoders[CODEC.OP_SEED_NONCE_REVELATION] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(SeedNonceRevelationSchema)(val); decoders[CODEC.OP_PROPOSALS] = (val: Uint8ArrayConsumer) => diff --git a/packages/taquito-local-forging/src/encoder.ts b/packages/taquito-local-forging/src/encoder.ts index 96f7f99133..d8f96b818a 100644 --- a/packages/taquito-local-forging/src/encoder.ts +++ b/packages/taquito-local-forging/src/encoder.ts @@ -32,7 +32,7 @@ import { BallotSchema, DelegationSchema, AttestationSchema, - EndorsementSchema, + AttestationWithDalSchema, IncreasePaidStorageSchema, UpdateConsensusKeySchema, DrainDelegateSchema, @@ -93,7 +93,8 @@ encoders[CODEC.OP_TRANSACTION] = (val: any) => schemaEncoder(encoders)(Transacti encoders[CODEC.OP_ORIGINATION] = (val: any) => schemaEncoder(encoders)(OriginationSchema)(val); encoders[CODEC.OP_BALLOT] = (val: any) => schemaEncoder(encoders)(BallotSchema)(val); encoders[CODEC.OP_ATTESTATION] = (val: any) => schemaEncoder(encoders)(AttestationSchema)(val); -encoders[CODEC.OP_ENDORSEMENT] = (val: any) => schemaEncoder(encoders)(EndorsementSchema)(val); +encoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val: any) => + schemaEncoder(encoders)(AttestationWithDalSchema)(val); encoders[CODEC.OP_SEED_NONCE_REVELATION] = (val: any) => schemaEncoder(encoders)(SeedNonceRevelationSchema)(val); encoders[CODEC.OP_PROPOSALS] = (val: any) => schemaEncoder(encoders)(ProposalsSchema)(val); diff --git a/packages/taquito-local-forging/src/schema/operation.ts b/packages/taquito-local-forging/src/schema/operation.ts index 3e9640065b..920bdef3e8 100644 --- a/packages/taquito-local-forging/src/schema/operation.ts +++ b/packages/taquito-local-forging/src/schema/operation.ts @@ -72,11 +72,12 @@ export const AttestationSchema = { block_payload_hash: CODEC.BLOCK_PAYLOAD_HASH, }; -export const EndorsementSchema = { +export const AttestationWithDalSchema = { slot: CODEC.INT16, level: CODEC.INT32, round: CODEC.INT32, block_payload_hash: CODEC.BLOCK_PAYLOAD_HASH, + dal_attestation: CODEC.ZARITH, }; export const SeedNonceRevelationSchema = { diff --git a/packages/taquito-local-forging/src/validator.ts b/packages/taquito-local-forging/src/validator.ts index 59d277f634..7d7a51e3d8 100644 --- a/packages/taquito-local-forging/src/validator.ts +++ b/packages/taquito-local-forging/src/validator.ts @@ -11,7 +11,7 @@ import { RevealSchema, RegisterGlobalConstantSchema, AttestationSchema, - EndorsementSchema, + AttestationWithDalSchema, TransferTicketSchema, IncreasePaidStorageSchema, UpdateConsensusKeySchema, @@ -31,7 +31,7 @@ type OperationKind = | OpKind.ORIGINATION | OpKind.BALLOT | OpKind.ATTESTATION - | OpKind.ENDORSEMENT + | OpKind.ATTESTATION_WITH_DAL | OpKind.SEED_NONCE_REVELATION | OpKind.PROPOSALS | OpKind.REGISTER_GLOBAL_CONSTANT @@ -52,7 +52,7 @@ const OperationKindMapping = { origination: OriginationSchema, ballot: BallotSchema, attestation: AttestationSchema, - endorsement: EndorsementSchema, + attestation_with_dal: AttestationWithDalSchema, seed_nonce_revelation: SeedNonceRevelationSchema, proposals: ProposalsSchema, register_global_constant: RegisterGlobalConstantSchema, diff --git a/packages/taquito-rpc/src/opkind.ts b/packages/taquito-rpc/src/opkind.ts index 80b6a47c21..3b9e3ebb58 100644 --- a/packages/taquito-rpc/src/opkind.ts +++ b/packages/taquito-rpc/src/opkind.ts @@ -11,8 +11,8 @@ export enum OpKind { SET_DEPOSITS_LIMIT = 'set_deposits_limit', DOUBLE_PREATTESTATION_EVIDENCE = 'double_preattestation_evidence', DOUBLE_PREENDORSEMENT_EVIDENCE = 'double_preendorsement_evidence', - ATTESTATION_WITH_SLOT = 'attestation_with_slot', - ENDORSEMENT_WITH_SLOT = 'endorsement_with_slot', + ATTESTATION_WITH_DAL = 'attestation_with_dal', + ENDORSEMENT_WITH_DAL = 'endorsement_with_dal', SEED_NONCE_REVELATION = 'seed_nonce_revelation', DOUBLE_ATTESTATION_EVIDENCE = 'double_attestation_evidence', DOUBLE_ENDORSEMENT_EVIDENCE = 'double_endorsement_evidence', diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 5b501b3a9c..4d6bf03cb6 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -247,16 +247,22 @@ export interface OperationContentsSetDepositsLimit { limit?: string; } -export interface OperationContentsAttestationWithSlot { - kind: OpKind.ATTESTATION_WITH_SLOT; - endorsement: InlinedAttestation; +export interface OperationContentsAttestationWithDal { + kind: OpKind.ATTESTATION_WITH_DAL; slot: number; + level: number; + round: number; + block_payload_hash: string; + dal_attestation: string; } -export interface OperationContentsEndorsementWithSlot { - kind: OpKind.ENDORSEMENT_WITH_SLOT; - endorsement: InlinedEndorsement; +export interface OperationContentsEndorsementWithDal { + kind: OpKind.ENDORSEMENT_WITH_DAL; slot: number; + level: number; + round: number; + block_payload_hash: string; + dal_attestation: string; } export interface OperationContentsRevelation { @@ -523,8 +529,8 @@ export type OperationContents = | OperationContentsTransaction | OperationContentsOrigination | OperationContentsDelegation - | OperationContentsAttestationWithSlot - | OperationContentsEndorsementWithSlot + | OperationContentsAttestationWithDal + | OperationContentsEndorsementWithDal | OperationContentsFailingNoop | OperationContentsRegisterGlobalConstant | OperationContentsSetDepositsLimit @@ -551,8 +557,7 @@ export interface OperationContentsAndResultMetadataExtended1 { export interface OperationContentsAndResultMetadataExtended0 { balance_updates?: OperationMetadataBalanceUpdates[]; delegate: string; - slots?: number[]; - endorsement_power?: number; + endorsement_power: number; consensus_key?: string; } @@ -718,10 +723,13 @@ export interface OperationContentsAndResultDoublePreattestation { metadata: OperationContentsAndResultMetadata; } -export interface OperationContentsAndResultAttestationWithSlot { - kind: OpKind.ATTESTATION_WITH_SLOT; - endorsement: InlinedAttestation; +export interface OperationContentsAndResultAttestationWithDal { + kind: OpKind.ATTESTATION_WITH_DAL; slot: number; + level: number; + round: number; + block_payload_hash: string; + dal_attestation: string; metadata: OperationContentsAndResultMetadataExtended1; } @@ -732,10 +740,13 @@ export interface OperationContentsAndResultDoublePreEndorsement { metadata: OperationContentsAndResultMetadata; } -export interface OperationContentsAndResultEndorsementWithSlot { - kind: OpKind.ENDORSEMENT_WITH_SLOT; - endorsement: InlinedEndorsement; +export interface OperationContentsAndResultEndorsementWithDal { + kind: OpKind.ENDORSEMENT_WITH_DAL; slot: number; + level: number; + round: number; + block_payload_hash: string; + dal_attestation: string; metadata: OperationContentsAndResultMetadataExtended0; } @@ -1017,8 +1028,8 @@ export type OperationContentsAndResult = | OperationContentsAndResultTransaction | OperationContentsAndResultOrigination | OperationContentsAndResultDelegation - | OperationContentsAndResultAttestationWithSlot - | OperationContentsAndResultEndorsementWithSlot + | OperationContentsAndResultAttestationWithDal + | OperationContentsAndResultEndorsementWithDal | OperationContentsAndResultRegisterGlobalConstant | OperationContentsAndResultSetDepositsLimit | OperationContentsAndResultTransferTicket diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index a2ccb5360c..c4007fbbba 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -5,7 +5,7 @@ import BigNumber from 'bignumber.js'; import { LazyStorageDiffBigMap, OperationContentsAndResultEndorsement, - OperationContentsAndResultEndorsementWithSlot, + OperationContentsAndResultAttestationWithDal, OperationContentsAndResultOrigination, OperationResultTransaction, OperationContentsAndResultTransaction, @@ -1788,74 +1788,54 @@ describe('RpcClient test', () => { expect(transaction.metadata.operation_result.consumed_gas).toEqual('24660'); }); - it('should query the right url and property for operation, proto 9, endorsement_with_slot', async () => { + it('should query the right url and property for operation, proto 20, attestation_with_dal', async () => { httpBackend.createRequest.mockReturnValue( Promise.resolve({ - protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', - chain_id: 'NetXxkAx4woPLyu', - hash: 'BLRWVvWTrqgUt1JL76RnUguKhkqfbHnXVrznXpuCrhxemSuCrb3', + protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', + chain_id: 'NetXo8SqH1c38SS', + hash: 'BKsCfYZrh417adJiKbGsyhVG2XrvUBJDhhkCAkZQzWzkEHCejXr', header: { - level: 174209, - proto: 1, - predecessor: 'BMarN3hiEmCrSrfeo6qndubHe9FXpPy4qcj3Xr2NBGGfG4Tfcaj', - timestamp: '2021-05-07T18:37:59Z', + level: 416914, + proto: 2, + predecessor: 'BLBXzegi3m1K8YjP7w9YgEpts5a9ZCFjY7xqRcm16p6yFxXbZGT', + timestamp: '2024-05-06T18:01:07Z', validation_pass: 4, - operations_hash: 'LLoaFb5cQjcr2pzKbLsmhPN2NgLY5gGs9ePimjRsNyCtgAQejfbXg', - fitness: ['01', '000000000002a880'], - context: 'CoWMJU1LmpfMn92zz4Ah1TrwXaSHnRWcy8dcso32AH7miULKad1d', - priority: 0, - proof_of_work_nonce: '08351e3d59170e00', + operations_hash: 'LLoZxmgEJQyZ74XCrZQu8Jtcov4SnGGRyuYf32fYmURW2Xfcj58Gv', + fitness: ['02', '00065c92', '', 'ffffffff', '00000000'], + context: 'CoV1GGrMBca5uBG4AzQbKNrQhQHHTtSYJAHVk7pJtuMw3uWiNvTV', + payload_hash: 'vh1mfavAuf7E1m1tZUEHkWomS8BDiLsVZz9T1A79Afu8Cag5DQHG', + payload_round: 0, + proof_of_work_nonce: 'e38cf66600000000', + liquidity_baking_toggle_vote: 'on', + adaptive_issuance_vote: 'on', signature: - 'sigg9pz9Q5i17nDZpZ3mbbMQsLHNuHX3SxTxHguLwgR9xYL2x17TmH7QfVFsadQTa61QCnq5vuFXkFtymeQKNh74VsWnMu9D', + 'sighpgD4aPxorZUvPxKvBHYNvnQEBRctF14bYXFX9qLbXbCGZv64S1dFVduBLzWBSEXCcHWiBuUT1iLZt9SE2mKCTkLtWuo5', }, metadata: {}, operations: [ [ { - protocol: 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', - chain_id: 'NetXxkAx4woPLyu', - hash: 'ooYSSxYcgreJQtrzxqyBpBdCntVbnbvHdtqA7RZsFcSDz4XFZJY', - branch: 'BMarN3hiEmCrSrfeo6qndubHe9FXpPy4qcj3Xr2NBGGfG4Tfcaj', + protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', + chain_id: 'NetXo8SqH1c38SS', + hash: 'opSmHyeasw4QcJ4Jc2qi6arNeSQMhFRjHBdFYWXGoMydLkgVRtb', + branch: 'BLHyjaqV2FhuHLQL3CBjWJqgZZ77BxcNxh3ehXcNYMQjjqAPwqA', contents: [ { - kind: 'endorsement_with_slot', - endorsement: { - branch: 'BMarN3hiEmCrSrfeo6qndubHe9FXpPy4qcj3Xr2NBGGfG4Tfcaj', - operations: { kind: 'endorsement', level: 174208 }, - signature: - 'signiPFVn2gFXvu7dKxEnifWQgbzan9ca6z7XSS5PyNBin2BufNBTFz9hgM7imvWf2HSj6NY3ECtEvb5xmwiYnUDbpSTUQC6', - }, - slot: 4, + kind: 'attestation_with_dal', + slot: 19, + level: 416913, + round: 0, + block_payload_hash: 'vh27AvfjAJob9VdcZHEPHFbMAzi6nhCiHVzAyDBEdAPDCcEa676t', + dal_attestation: '0', metadata: { - balance_updates: [ - { - kind: 'contract', - contract: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', - change: '-320000000', - origin: 'block', - }, - { - kind: 'freezer', - category: 'deposits', - delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', - cycle: 85, - change: '320000000', - origin: 'block', - }, - { - kind: 'freezer', - category: 'rewards', - delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', - cycle: 85, - change: '6250000', - origin: 'block', - }, - ], - delegate: 'tz1VWasoyFGAWZt5K2qZRzP3cWzv3z7MMhP8', - slots: [4, 11, 18, 21, 24], + delegate: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', + consensus_power: 532, + consensus_key: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', }, }, ], + signature: + 'sigh9rmktxbqmK6fXaq2ciAQrbrVH8pZhKeXEKHCzgNmJaP6gc1njofiMMzvhx2SRXQ7Gv8aVDzBM18kDGmUoBxQA693Bk2o', }, ], ], @@ -1869,10 +1849,10 @@ describe('RpcClient test', () => { url: 'root/chains/test/blocks/head', }); const endorsementWithSlot = response.operations[0][0] - .contents[0] as OperationContentsAndResultEndorsementWithSlot; - expect(endorsementWithSlot.kind).toEqual('endorsement_with_slot'); - expect(endorsementWithSlot.metadata.slots).toEqual([4, 11, 18, 21, 24]); - expect(endorsementWithSlot.slot).toEqual(4); + .contents[0] as OperationContentsAndResultAttestationWithDal; + expect(endorsementWithSlot.kind).toEqual('attestation_with_dal'); + expect(endorsementWithSlot.slot).toEqual(19); + expect(endorsementWithSlot.dal_attestation).toEqual('0'); }); it('should query the right url and properties (big_map_diff and lazy_storage_diff) in transaction operation result, proto 9', async () => { From c42a4204a26c558c17580e5acd770959f123af2b Mon Sep 17 00:00:00 2001 From: Eugene Zagidullin Date: Wed, 8 May 2024 21:39:33 +0300 Subject: [PATCH 17/35] New Paris protocol ticket literal (#2940) * ticket literal * legacy ticket typeckeck fix * feat: adding local-forger opMapping with Ticket --------- Co-authored-by: huianyang --- .../taquito-local-forging/src/constants.ts | 3 +- packages/taquito-michel-codec/src/binary.ts | 7 +- .../src/michelson-typecheck.ts | 113 ++++++++++-------- .../src/michelson-types.ts | 43 +++---- .../src/michelson-validator.ts | 19 ++- .../test/typecheck.spec.ts | 16 ++- 6 files changed, 123 insertions(+), 78 deletions(-) diff --git a/packages/taquito-local-forging/src/constants.ts b/packages/taquito-local-forging/src/constants.ts index 50b461d51e..3be2753908 100644 --- a/packages/taquito-local-forging/src/constants.ts +++ b/packages/taquito-local-forging/src/constants.ts @@ -61,7 +61,7 @@ export enum CODEC { OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE = 'smart_rollup_execute_outbox_message', } -// See https://tezos.gitlab.io/whitedoc/michelson.html#full-grammar +// See https://tezos.gitlab.io/shell/p2p_api.html#alpha-michelson-v1-primitives-enumeration-unsigned-8-bit-integer export const opMapping: { [key: string]: string } = { '00': 'parameter', '01': 'storage', @@ -220,6 +220,7 @@ export const opMapping: { [key: string]: string } = { '9a': 'TICKET', '9b': 'BYTES', '9c': 'NAT', + '9d': 'Ticket', }; export const opMappingReverse = (() => { diff --git a/packages/taquito-michel-codec/src/binary.ts b/packages/taquito-michel-codec/src/binary.ts index 158a8861a3..446e776529 100644 --- a/packages/taquito-michel-codec/src/binary.ts +++ b/packages/taquito-michel-codec/src/binary.ts @@ -196,6 +196,7 @@ const primitives: PrimID[] = [ 'TICKET', 'BYTES', 'NAT', + 'Ticket', ]; const primTags: { [key in PrimID]?: number } & { [key: string]: number | undefined } = @@ -263,7 +264,7 @@ class Reader { private buffer: number[] | Uint8Array, private idx: number = 0, private cap: number = buffer.length - ) {} + ) { } /** Remaining length */ get length(): number { @@ -577,8 +578,8 @@ function writeExpr(expr: Expr, wr: Writer, tf: WriteTransformFunc): void { const tag = (e.args?.length || 0) < 3 ? Tag.Prim0 + - (e.args?.length || 0) * 2 + - (e.annots === undefined || e.annots.length === 0 ? 0 : 1) + (e.args?.length || 0) * 2 + + (e.annots === undefined || e.annots.length === 0 ? 0 : 1) : Tag.Prim; wr.writeUint8(tag); diff --git a/packages/taquito-michel-codec/src/michelson-typecheck.ts b/packages/taquito-michel-codec/src/michelson-typecheck.ts index cfcb5a73c5..0b44a1d582 100644 --- a/packages/taquito-michel-codec/src/michelson-typecheck.ts +++ b/packages/taquito-michel-codec/src/michelson-typecheck.ts @@ -136,8 +136,7 @@ function assertScalarTypesEqual(a: MichelsonType, b: MichelsonType, field = fals if (parseInt(a.args[0].int, 10) !== parseInt((b as typeof a).args[0].int, 10)) { throw new MichelsonTypeError( a, - `${typeID(a)}: type argument mismatch: ${a.args[0].int} != ${ - (b as typeof a).args[0].int + `${typeID(a)}: type argument mismatch: ${a.args[0].int} != ${(b as typeof a).args[0].int }`, undefined ); @@ -429,7 +428,7 @@ function assertDataValidInternal(d: MichelsonData, t: MichelsonType, ctx: Contex if ( 'string' in d && checkDecodeTezosID(d.string, 'ED25519PublicKey', 'SECP256K1PublicKey', 'P256PublicKey') !== - null + null ) { return; } else if ('bytes' in d) { @@ -549,15 +548,25 @@ function assertDataValidInternal(d: MichelsonData, t: MichelsonType, ctx: Contex throw new MichelsonTypeError(t, `sapling state expected: ${JSON.stringify(d)}`, d); case 'ticket': - assertDataValidInternal( - d, - { - prim: 'pair', - args: [{ prim: 'address' }, t.args[0], { prim: 'nat' }], - }, - ctx - ); - return; + if ('prim' in d && d.prim === 'Ticket') { + assertDataValidInternal(d.args[0], { prim: 'address' }, ctx); + assertTypesEqual(d.args[1], t.args[0]); + assertDataValidInternal(d.args[2], t.args[0], ctx); + assertDataValidInternal(d.args[3], { prim: 'nat' }, ctx); + return; + } else if (isPairData(d)) { + // backward compatibility + assertDataValidInternal( + d, + { + prim: 'pair', + args: [{ prim: 'address' }, t.args[0], { prim: 'nat' }], + }, + ctx + ); + return; + } + throw new MichelsonTypeError(t, `ticket expected: ${JSON.stringify(d)}`, d); default: throw new MichelsonTypeError( @@ -732,10 +741,10 @@ function functionTypeInternal( const ann = a.v !== undefined || a.t !== undefined || a.f !== undefined ? [ - ...((a.v === null ? src.v : a.v) || []), - ...((a.t === null ? src.t : a.t) || []), - ...((a.f === null ? src.f : a.f) || []), - ] + ...((a.v === null ? src.v : a.v) || []), + ...((a.t === null ? src.t : a.t) || []), + ...((a.f === null ? src.f : a.f) || []), + ] : undefined; const { annots: _annots, ...rest } = t; @@ -783,12 +792,12 @@ function functionTypeInternal( ? ['@' + fieldAnn.slice(1)] : undefined : insVarAnn === '@%%' - ? varAnn - ? ['@' + varAnn.slice(1) + '.' + (fieldAnn ? fieldAnn.slice(1) : defField)] - : fieldAnn - ? ['@' + fieldAnn.slice(1)] - : undefined - : [insVarAnn] + ? varAnn + ? ['@' + varAnn.slice(1) + '.' + (fieldAnn ? fieldAnn.slice(1) : defField)] + : fieldAnn + ? ['@' + fieldAnn.slice(1)] + : undefined + : [insVarAnn] : null, }); } @@ -1689,8 +1698,8 @@ function functionTypeInternal( return s.prim === 'list' ? [annotateVar({ prim: 'list', args: [body[0]] }), ...tail] : s.prim === 'map' - ? [annotateVar({ prim: 'map', args: [s.args[0], body[0]] }), ...tail] - : [annotateVar({ prim: 'option', args: [body[0]] }), ...tail]; + ? [annotateVar({ prim: 'map', args: [s.args[0], body[0]] }), ...tail] + : [annotateVar({ prim: 'option', args: [body[0]] }), ...tail]; } case 'ITER': { @@ -1988,35 +1997,35 @@ function functionTypeInternal( } return ProtoInferiorTo(proto, Protocol.PtJakarta) ? [ - annotateVar({ - prim: 'option', - args: [ - { - prim: 'pair', - args: [{ prim: 'int' }, annotate(s[1], { t: null })], - }, - ], - }), - ...stack.slice(2), - ] + annotateVar({ + prim: 'option', + args: [ + { + prim: 'pair', + args: [{ prim: 'int' }, annotate(s[1], { t: null })], + }, + ], + }), + ...stack.slice(2), + ] : [ - annotateVar({ - prim: 'option', - args: [ - { - prim: 'pair', - args: [ - { prim: 'bytes' }, - { - prim: 'pair', - args: [{ prim: 'int' }, annotate(s[1], { t: null })], - }, - ], - }, - ], - }), - ...stack.slice(2), - ]; + annotateVar({ + prim: 'option', + args: [ + { + prim: 'pair', + args: [ + { prim: 'bytes' }, + { + prim: 'pair', + args: [{ prim: 'int' }, annotate(s[1], { t: null })], + }, + ], + }, + ], + }), + ...stack.slice(2), + ]; } case 'OPEN_CHEST': diff --git a/packages/taquito-michel-codec/src/michelson-types.ts b/packages/taquito-michel-codec/src/michelson-types.ts index 97e52ae8b2..c7d4f252b2 100644 --- a/packages/taquito-michel-codec/src/michelson-types.ts +++ b/packages/taquito-michel-codec/src/michelson-types.ts @@ -128,7 +128,7 @@ type Instr0 = Prim0; type InstrX = PrimX; export type MichelsonCode = InstructionList | MichelsonInstruction; -export interface InstructionList extends List {} +export interface InstructionList extends List { } export type MichelsonNoArgInstruction = Instr0; export type MichelsonInstruction = @@ -224,23 +224,23 @@ export type MichelsonTypeChest = Type0<'chest'>; type TypeList = T & Node; export type MichelsonTypePair = TypeX<'pair', T> | TypeList; -export interface MichelsonTypeOption extends TypeX<'option', [T]> {} -export interface MichelsonTypeList extends TypeX<'list', [T]> {} -export interface MichelsonTypeContract extends TypeX<'contract', [T]> {} -export interface MichelsonTypeOr extends TypeX<'or', T> {} +export interface MichelsonTypeOption extends TypeX<'option', [T]> { } +export interface MichelsonTypeList extends TypeX<'list', [T]> { } +export interface MichelsonTypeContract extends TypeX<'contract', [T]> { } +export interface MichelsonTypeOr extends TypeX<'or', T> { } export interface MichelsonTypeLambda - extends TypeX<'lambda', [Arg, Ret]> {} + extends TypeX<'lambda', [Arg, Ret]> { } -export interface MichelsonTypeSet extends TypeX<'set', [T]> {} +export interface MichelsonTypeSet extends TypeX<'set', [T]> { } export interface MichelsonTypeMap - extends TypeX<'map', [K, V]> {} + extends TypeX<'map', [K, V]> { } export interface MichelsonTypeBigMap - extends TypeX<'big_map', [K, V]> {} + extends TypeX<'big_map', [K, V]> { } export interface MichelsonTypeSaplingState - extends TypeX<'sapling_state', [IntLiteral]> {} + extends TypeX<'sapling_state', [IntLiteral]> { } export interface MichelsonTypeSaplingTransaction - extends TypeX<'sapling_transaction', [IntLiteral]> {} -export interface MichelsonTypeTicket extends TypeX<'ticket', [T]> {} + extends TypeX<'sapling_transaction', [IntLiteral]> { } +export interface MichelsonTypeTicket extends TypeX<'ticket', [T]> { } export type MichelsonType = T extends 'int' ? MichelsonTypeInt @@ -317,7 +317,8 @@ export type MichelsonDataID = | 'Left' | 'Right' | 'Some' - | 'Lambda_rec'; + | 'Lambda_rec' + | 'Ticket'; type Data0 = Prim0; type DataX = PrimX; @@ -329,6 +330,7 @@ export type MichelsonDataPair = DataX<'Pair', T> | Da export type MichelsonMapElt = PrimX<'Elt', [MichelsonData, MichelsonData]>; export type MichelsonMapEltList = List; export type MichelsonLambdaRec = DataX<'Lambda_rec', [InstructionList]>; +export type MichelsonTicket = PrimX<'Ticket', [StringLiteral | BytesLiteral, MichelsonType, MichelsonData, IntLiteral]>; export type MichelsonData = | IntLiteral @@ -341,7 +343,8 @@ export type MichelsonData = | MichelsonDataPair | InstructionList | MichelsonMapEltList - | MichelsonLambdaRec; + | MichelsonLambdaRec + | MichelsonTicket; // Top level script sections @@ -360,12 +363,12 @@ export type MichelsonContract = MichelsonContractSection[]; export type MichelsonContractSection = T extends 'parameter' - ? MichelsonContractParameter - : T extends 'storage' - ? MichelsonContractStorage - : T extends 'view' - ? MichelsonContractView - : MichelsonContractCode; + ? MichelsonContractParameter + : T extends 'storage' + ? MichelsonContractStorage + : T extends 'view' + ? MichelsonContractView + : MichelsonContractCode; // Code analysis types export interface MichelsonTypeFailed { diff --git a/packages/taquito-michel-codec/src/michelson-validator.ts b/packages/taquito-michel-codec/src/michelson-validator.ts index 58382e647e..feeaa750cd 100644 --- a/packages/taquito-michel-codec/src/michelson-validator.ts +++ b/packages/taquito-michel-codec/src/michelson-validator.ts @@ -1,4 +1,4 @@ -import { Prim, Expr, IntLiteral, StringLiteral } from './micheline'; +import { Prim, Expr, IntLiteral, StringLiteral, BytesLiteral } from './micheline'; import { Tuple, NoArgs, ReqArgs, MichelsonError } from './utils'; import { MichelsonCode, @@ -232,6 +232,14 @@ function assertStringLiteral(ex: Expr): ex is StringLiteral { throw new MichelsonValidationError(ex, 'string literal expected'); } +// usually an address +function assertStringOrBytes(ex: Expr): ex is StringLiteral | BytesLiteral { + if ('string' in ex || 'bytes' in ex) { + return true; + } + throw new MichelsonValidationError(ex, 'string or bytes literal expected'); +} + function assertArgs( ex: Prim, n: N @@ -733,6 +741,15 @@ export function assertMichelsonData(ex: Expr): ex is MichelsonData { } break; + case 'Ticket': + if (assertArgs(ex, 4)) { + assertStringOrBytes(ex.args[0]); + assertMichelsonType(ex.args[1]); + assertMichelsonData(ex.args[2]); + assertIntLiteral(ex.args[3]); + } + break; + default: if (Object.prototype.hasOwnProperty.call(instructionIDs, ex.prim)) { assertMichelsonInstruction(ex); diff --git a/packages/taquito-michel-codec/test/typecheck.spec.ts b/packages/taquito-michel-codec/test/typecheck.spec.ts index 30adbad8c0..a50efefecd 100644 --- a/packages/taquito-michel-codec/test/typecheck.spec.ts +++ b/packages/taquito-michel-codec/test/typecheck.spec.ts @@ -131,7 +131,7 @@ describe('Typecheck', () => { assertDataValid(data, typedef); }); - it('assertDataValid: ticket', () => { + it('assertDataValid: legacy ticket', () => { const typedef: MichelsonType = { prim: 'ticket', args: [{ prim: 'bytes' }] }; const data: MichelsonData = [ { string: 'KT1ThEdxfUcWUwqsdergy3QnbCWGHSUHeHJq' }, @@ -141,6 +141,20 @@ describe('Typecheck', () => { assertDataValid(data, typedef); }); + it('assertDataValid: ticket', () => { + const typedef: MichelsonType = { prim: 'ticket', args: [{ prim: 'string' }] }; + const data: MichelsonData = { + prim: 'Ticket', + args: [ + { string: 'KT1ThEdxfUcWUwqsdergy3QnbCWGHSUHeHJq' }, + { prim: 'string' }, + { string: 'TicketTicket' }, + { int: '42' }, + ] + }; + assertDataValid(data, typedef); + }); + it('assertTypesEqual: identical', () => { const pair: MichelsonType = { prim: 'pair', From 0491a9f4faa1d633bcf63cc48a8df400285e7a2e Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Wed, 8 May 2024 17:18:05 -0700 Subject: [PATCH 18/35] 2881 dal publish commitment (#2948) * feat: added rpc type of dal_publish_commitment * feat: added forger support of dal_publish_commitment * test: added dal_publish_commitment unit test * test: remove debug logging * docs: add comments for commitment_proof bytes length --- .../__tests__/local-forging.spec.ts | 4 +- integration-tests/data/allTestsCases.ts | 21 ++ packages/taquito-local-forging/src/codec.ts | 44 +++- .../taquito-local-forging/src/constants.ts | 5 +- packages/taquito-local-forging/src/decoder.ts | 5 + packages/taquito-local-forging/src/encoder.ts | 5 + packages/taquito-local-forging/src/errors.ts | 31 ++- .../src/schema/operation.ts | 10 +- .../taquito-local-forging/src/validator.ts | 5 +- packages/taquito-rpc/src/opkind.ts | 1 + packages/taquito-rpc/src/types.ts | 61 ++++- packages/taquito-rpc/test/taquito-rpc.spec.ts | 236 +++++++++++++----- packages/taquito-utils/src/constants.ts | 7 + 13 files changed, 354 insertions(+), 81 deletions(-) diff --git a/integration-tests/__tests__/local-forging.spec.ts b/integration-tests/__tests__/local-forging.spec.ts index 990ca9f030..b047d03e0d 100644 --- a/integration-tests/__tests__/local-forging.spec.ts +++ b/integration-tests/__tests__/local-forging.spec.ts @@ -16,9 +16,9 @@ CONFIGS().forEach(({ rpc, protocol }) => { const result = await localForger.forge(operation); const rpcResult = await Tezos.rpc.forgeOperations(operation); expect(result).toEqual(rpcResult); - expect(await localForger.parse(result)).toEqual(expected || operation); + expect(await localForger.parse(rpcResult)).toEqual(expected || operation); + }); }); - }); oxfordCases.forEach(({ name, operation, expected }) => { oxfordAndAlpha(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { const localForger = new LocalForger(protocol as unknown as ProtocolsHash); diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index 9b624df795..c8ea6b13ee 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -66,6 +66,27 @@ export const parisCases: TestCase[] = [ ] } }, + { + name: 'Dal Publish Commitment operation1', + operation: { + branch: 'BMT5yA3UH3CJkaYJBq33Q1BNZU6NL4zZNBhCHKwxygSm59P1x9M', + contents: [ + { + kind: OpKind.DAL_PUBLISH_COMMITMENT, + source: 'tz1Mp9zrMAJ3jckh3juLXGobfDv6oyUycfSy', + fee: '513', + counter: '67', + gas_limit: '1433', + storage_limit: '0', + slot_header: { + slot_index: 10, + commitment: 'sh1vHbHrPSt7eWqYJmM9EUk5scjbvR5PKBckJxmmDJzYHHBkca8Lz4hxXX6zpW5wbhJhswJd4v', + commitment_proof: '90c6576ad09e11b14eb464cdd214fe061ba8e8e5a3175e29fe7ff40526f90c2f2f4e02fe9fe03f7adb0fe286d7828b970eb1979f0f65ca3637a51d5456b442377d20397eb1b02544c2e435d79e156881443179fe16b32ad9e9501622a647c2ce' + } + } + ] + } + }, ] export const oxfordCases: TestCase[] = [ { diff --git a/packages/taquito-local-forging/src/codec.ts b/packages/taquito-local-forging/src/codec.ts index 7fba0d570b..a6676bf351 100644 --- a/packages/taquito-local-forging/src/codec.ts +++ b/packages/taquito-local-forging/src/codec.ts @@ -18,6 +18,7 @@ import { DecodePvmKindError, InvalidSmartRollupCommitmentHashError, InvalidSmartRollupAddressError, + InvalidDalCommitmentError, } from './errors'; import BigNumber from 'bignumber.js'; import { entrypointMapping, entrypointMappingReverse, ENTRYPOINT_MAX_LENGTH } from './constants'; @@ -29,7 +30,7 @@ import { stripLengthPrefixFromBytes, } from './michelson/codec'; import { Uint8ArrayConsumer } from './uint8array-consumer'; -import { pad } from './utils'; +import { pad, toHexString } from './utils'; import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core'; // https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging @@ -470,7 +471,7 @@ export const parametersEncoder = (val: { entrypoint: string; value: MichelsonVal const encodedEntrypoint = entrypointEncoder(val.entrypoint); const parameters = valueEncoder(val.value); - const length = (parameters.length / 2).toString(16).padStart(8, '0'); + const length = pad(parameters.length / 2); return `ff${encodedEntrypoint}${length}${parameters}`; }; @@ -541,3 +542,42 @@ export const smartRollupMessageDecoder = (val: Uint8ArrayConsumer) => { const ret = stripLengthPrefixFromBytes(new Uint8ArrayConsumer(valueArray)); return ret.map((value) => Buffer.from(value).toString('hex')); }; + +export const dalCommitmentEncoder = (val: string): string => { + const prefix = val.substring(0, 2); + if (prefix === Prefix.SH) { + return prefixEncoder(Prefix.SH)(val); + } + throw new InvalidDalCommitmentError( + val, + invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SH}'` + ); +}; + +export const dalCommitmentDecoder = (val: Uint8ArrayConsumer) => { + const commitment = prefixDecoder(Prefix.SH)(val); + if (commitment.substring(0, 2) !== Prefix.SH) { + throw new InvalidDalCommitmentError( + commitment, + invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SH}'` + ); + } + return commitment; +}; + +export const slotHeaderEncoder = (val: { + slot_index: number; + commitment: string; + commitment_proof: string; +}) => { + return pad(val.slot_index, 2) + dalCommitmentEncoder(val.commitment) + val.commitment_proof; +}; + +export const slotHeaderDecoder = (val: Uint8ArrayConsumer) => { + const preamble = val.consume(1); + return { + slot_index: Number(preamble[0].toString(10)), + commitment: dalCommitmentDecoder(val), + commitment_proof: toHexString(val.consume(96)), // rpcForger expect commitment_proof bytes to be len 96 + }; +}; diff --git a/packages/taquito-local-forging/src/constants.ts b/packages/taquito-local-forging/src/constants.ts index 3be2753908..656f2613f3 100644 --- a/packages/taquito-local-forging/src/constants.ts +++ b/packages/taquito-local-forging/src/constants.ts @@ -59,6 +59,8 @@ export enum CODEC { PVM_KIND = 'pvm_kind', OP_SMART_ROLLUP_ADD_MESSAGES = 'smart_rollup_add_messages', OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE = 'smart_rollup_execute_outbox_message', + OP_DAL_PUBLISH_COMMITMENT = 'dal_publish_commitment', + SLOT_HEADER = 'slot_header', } // See https://tezos.gitlab.io/shell/p2p_api.html#alpha-michelson-v1-primitives-enumeration-unsigned-8-bit-integer @@ -231,7 +233,7 @@ export const opMappingReverse = (() => { return result; })(); -// See https://tezos.gitlab.io/shell/p2p_api.html?highlight=p2p +// See https://tezos.gitlab.io/shell/p2p_api.html export const kindMapping: { [key: number]: string } = { 0x04: 'activate_account', 0x6b: 'reveal', @@ -252,6 +254,7 @@ export const kindMapping: { [key: number]: string } = { 0xc8: 'smart_rollup_originate', 0xc9: 'smart_rollup_add_messages', 0xce: 'smart_rollup_execute_outbox_message', + 0xe6: 'dal_publish_commitment', 0x11: 'failing_noop', }; diff --git a/packages/taquito-local-forging/src/decoder.ts b/packages/taquito-local-forging/src/decoder.ts index d0c621b9d1..196e854c30 100644 --- a/packages/taquito-local-forging/src/decoder.ts +++ b/packages/taquito-local-forging/src/decoder.ts @@ -24,6 +24,7 @@ import { tz1Decoder, valueParameterDecoder, zarithDecoder, + slotHeaderDecoder, } from './codec'; import { CODEC } from './constants'; import { scriptDecoder } from './michelson/codec'; @@ -50,6 +51,7 @@ import { SmartRollupOriginateSchema, SmartRollupAddMessagesSchema, SmartRollupExecuteOutboxMessageSchema, + DalPublishCommitmentSchema, FailingNoopSchema, } from './schema/operation'; import { Uint8ArrayConsumer } from './uint8array-consumer'; @@ -86,6 +88,7 @@ export const decoders: { [key: string]: Decoder } = { [CODEC.PVM_KIND]: pvmKindDecoder, [CODEC.PADDED_BYTES]: paddedBytesDecoder, [CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder, + [CODEC.SLOT_HEADER]: slotHeaderDecoder, }; decoders[CODEC.OPERATION] = operationDecoder(decoders); @@ -125,6 +128,8 @@ decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(val); decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(val); +decoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val: Uint8ArrayConsumer) => + schemaDecoder(decoders)(DalPublishCommitmentSchema)(val); decoders[CODEC.MANAGER] = schemaDecoder(decoders)(ManagerOperationSchema); decoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val: Uint8ArrayConsumer) => schemaDecoder(decoders)(SetDepositsLimitSchema)(val); diff --git a/packages/taquito-local-forging/src/encoder.ts b/packages/taquito-local-forging/src/encoder.ts index d8f96b818a..c5c3974e02 100644 --- a/packages/taquito-local-forging/src/encoder.ts +++ b/packages/taquito-local-forging/src/encoder.ts @@ -24,6 +24,7 @@ import { tz1Encoder, valueParameterEncoder, zarithEncoder, + slotHeaderEncoder, } from './codec'; import { CODEC } from './constants'; import { scriptEncoder } from './michelson/codec'; @@ -50,6 +51,7 @@ import { SmartRollupOriginateSchema, SmartRollupExecuteOutboxMessageSchema, SmartRollupAddMessagesSchema, + DalPublishCommitmentSchema, FailingNoopSchema, } from './schema/operation'; @@ -84,6 +86,7 @@ export const encoders: { [key: string]: Encoder } = { [CODEC.PVM_KIND]: pvmKindEncoder, [CODEC.PADDED_BYTES]: paddedBytesEncoder, [CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder, + [CODEC.SLOT_HEADER]: slotHeaderEncoder, }; encoders[CODEC.OPERATION] = operationEncoder(encoders); @@ -114,6 +117,8 @@ encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val: any) => schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(val); encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val: any) => schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(val); +encoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val: any) => + schemaEncoder(encoders)(DalPublishCommitmentSchema)(val); encoders[CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema); encoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encoders)(SetDepositsLimitSchema)(val); diff --git a/packages/taquito-local-forging/src/errors.ts b/packages/taquito-local-forging/src/errors.ts index cb6f26557c..2d5c9bece5 100644 --- a/packages/taquito-local-forging/src/errors.ts +++ b/packages/taquito-local-forging/src/errors.ts @@ -6,7 +6,10 @@ import { ENTRYPOINT_MAX_LENGTH } from './constants'; * @category Error * @description Error that indicates an invalid operation content being passed or used */ export class InvalidOperationSchemaError extends ParameterValidationError { - constructor(public readonly operation: OperationContents, public readonly errorDetail?: string) { + constructor( + public readonly operation: OperationContents, + public readonly errorDetail?: string + ) { super(); this.name = 'InvalidOperationSchemaError'; this.message = `Invalid operation content recevied`; @@ -125,7 +128,10 @@ export class DecodePvmKindError extends ParameterValidationError { * @description Error that indicates an invalid Smart Rollup Address (sr1) */ export class InvalidSmartRollupAddressError extends ParameterValidationError { - constructor(public readonly address: string, public readonly errorDetail?: string) { + constructor( + public readonly address: string, + public readonly errorDetail?: string + ) { super(); this.name = 'InvalidSmartRollupAddress'; this.message = `Invalid smart rollup address "${address}"`; @@ -138,10 +144,29 @@ export class InvalidSmartRollupAddressError extends ParameterValidationError { * @description Error that indicates an invalid Smart Rollup commitment hash (src1) */ export class InvalidSmartRollupCommitmentHashError extends ParameterValidationError { - constructor(public readonly hash: string, public readonly errorDetail?: string) { + constructor( + public readonly hash: string, + public readonly errorDetail?: string + ) { super(); this.name = 'InvalidSmartRollupCommitmentHashError'; this.message = `Invalid smart rollup commitment hash "${hash}"`; errorDetail ? (this.message += ` ${errorDetail}.`) : ''; } } + +/** + * @category Error + * @description Error that indicates an invalid dal commitment (sh) + */ +export class InvalidDalCommitmentError extends ParameterValidationError { + constructor( + public readonly commitment: string, + public readonly errorDetail?: string + ) { + super(); + this.name = 'InvalidDalCommitmentError'; + this.message = `Invalid dal commitment "${commitment}"`; + errorDetail ? (this.message += ` ${errorDetail}.`) : ''; + } +} diff --git a/packages/taquito-local-forging/src/schema/operation.ts b/packages/taquito-local-forging/src/schema/operation.ts index 920bdef3e8..3d0709fd91 100644 --- a/packages/taquito-local-forging/src/schema/operation.ts +++ b/packages/taquito-local-forging/src/schema/operation.ts @@ -180,6 +180,15 @@ export const SmartRollupExecuteOutboxMessageSchema = { output_proof: CODEC.PADDED_BYTES, }; +export const DalPublishCommitmentSchema = { + source: CODEC.PKH, + fee: CODEC.ZARITH, + counter: CODEC.ZARITH, + gas_limit: CODEC.ZARITH, + storage_limit: CODEC.ZARITH, + slot_header: CODEC.SLOT_HEADER, +}; + export const FailingNoopSchema = { arbitrary: CODEC.PADDED_BYTES, }; @@ -196,7 +205,6 @@ export const operationEncoder = export const operationDecoder = (decoders: { [key: string]: Decoder }) => (value: Uint8ArrayConsumer) => { const op = value.consume(1); - const operationName = kindMapping[op[0]]; if (operationName === undefined) { throw new UnsupportedOperationError(op[0].toString()); diff --git a/packages/taquito-local-forging/src/validator.ts b/packages/taquito-local-forging/src/validator.ts index 7d7a51e3d8..4a917845f9 100644 --- a/packages/taquito-local-forging/src/validator.ts +++ b/packages/taquito-local-forging/src/validator.ts @@ -20,6 +20,7 @@ import { SmartRollupOriginateSchema, SmartRollupAddMessagesSchema, SmartRollupExecuteOutboxMessageSchema, + DalPublishCommitmentSchema, FailingNoopSchema, } from './schema/operation'; @@ -42,7 +43,8 @@ type OperationKind = | OpKind.SET_DEPOSITS_LIMIT | OpKind.SMART_ROLLUP_ORIGINATE | OpKind.SMART_ROLLUP_ADD_MESSAGES - | OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE; + | OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE + | OpKind.DAL_PUBLISH_COMMITMENT; const OperationKindMapping = { activate_account: ActivationSchema, @@ -64,6 +66,7 @@ const OperationKindMapping = { smart_rollup_originate: SmartRollupOriginateSchema, smart_rollup_add_messages: SmartRollupAddMessagesSchema, smart_rollup_execute_outbox_message: SmartRollupExecuteOutboxMessageSchema, + dal_publish_commitment: DalPublishCommitmentSchema, failing_noop: FailingNoopSchema, }; diff --git a/packages/taquito-rpc/src/opkind.ts b/packages/taquito-rpc/src/opkind.ts index 3b9e3ebb58..f395d53192 100644 --- a/packages/taquito-rpc/src/opkind.ts +++ b/packages/taquito-rpc/src/opkind.ts @@ -36,4 +36,5 @@ export enum OpKind { SMART_ROLLUP_RECOVER_BOND = 'smart_rollup_recover_bond', SMART_ROLLUP_REFUTE = 'smart_rollup_refute', SMART_ROLLUP_TIMEOUT = 'smart_rollup_timeout', + DAL_PUBLISH_COMMITMENT = 'dal_publish_commitment', } diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 4d6bf03cb6..7e6d789df2 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -510,6 +510,20 @@ export interface OperationContentsSmartRollupTimeout { stakers: SmartRollupTimeoutStakers; } +export interface OperationContentsDalPublishCommitment { + kind: OpKind.DAL_PUBLISH_COMMITMENT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + slot_header: { + slot_index: number; + commitment: string; + commitment_proof: string; + }; +} + export type OperationContents = | OperationContentsAttestation | OperationContentsPreattestation @@ -545,7 +559,8 @@ export type OperationContents = | OperationContentsSmartRollupCement | OperationContentsSmartRollupRefute | OperationContentsSmartRollupRecoverBond - | OperationContentsSmartRollupTimeout; + | OperationContentsSmartRollupTimeout + | OperationContentsDalPublishCommitment; export interface OperationContentsAndResultMetadataExtended1 { balance_updates?: OperationMetadataBalanceUpdates[]; @@ -680,6 +695,12 @@ export interface OperationContentsAndResultMetadataSmartRollupTimeout { internal_operation_results?: InternalOperationResult[]; } +export interface OperationContentsAndResultMetadataDalPublishCommitment { + balance_updates?: OperationMetadataBalanceUpdates[]; + operation_result: OperationResultDalPublishCommitment; + internal_operation_results?: InternalOperationResult[]; +} + export interface OperationContentsAndResultAttestation { kind: OpKind.ATTESTATION; block_payload_hash?: string; @@ -1010,6 +1031,21 @@ export interface OperationContentsAndResultSmartRollupTimeout { metadata: OperationContentsAndResultMetadataSmartRollupTimeout; } +export interface OperationContentsAndResultDalPublishCommitment { + kind: OpKind.DAL_PUBLISH_COMMITMENT; + source: string; + fee: string; + counter: string; + gas_limit: string; + storage_limit: string; + slot_header: { + slot_index: number; + commitment: string; + commitment_proof: string; + }; + metadata: OperationContentsAndResultMetadataDalPublishCommitment; +} + export type OperationContentsAndResult = | OperationContentsAndResultAttestation | OperationContentsAndResultPreattestation @@ -1044,7 +1080,8 @@ export type OperationContentsAndResult = | OperationContentsAndResultSmartRollupCement | OperationContentsAndResultSmartRollupRefute | OperationContentsAndResultSmartRollupRecoverBond - | OperationContentsAndResultSmartRollupTimeout; + | OperationContentsAndResultSmartRollupTimeout + | OperationContentsAndResultDalPublishCommitment; export type OperationContentsAndResultWithFee = | OperationContentsAndResultTransaction @@ -1055,8 +1092,11 @@ export type OperationContentsAndResultWithFee = | OperationContentsAndResultSetDepositsLimit | OperationContentsAndResultUpdateConsensusKey | OperationContentsAndResultIncreasePaidStorage + | OperationContentsAndResultTransferTicket | OperationContentsAndResultSmartRollupAddMessages - | OperationContentsAndResultSmartRollupOriginate; + | OperationContentsAndResultSmartRollupOriginate + | OperationContentsAndResultSmartRollupExecuteOutboxMessage + | OperationContentsAndResultDalPublishCommitment; export enum OPERATION_METADATA { TOO_LARGE = 'too large', @@ -1424,6 +1464,18 @@ export interface OperationResultSmartRollupTimeout { errors?: TezosGenericOperationError[]; } +export interface OperationResultDalPublishCommitment { + status: OperationResultStatusEnum; + slot_header?: { + version: string; + level: number; + index: number; + commitment: string; + }; + consumed_milligas?: string; + errors?: TezosGenericOperationError[]; +} + export interface ContractBigMapDiffItem { key_hash?: string; key?: MichelsonV1Expression; @@ -1486,7 +1538,8 @@ export type OperationResult = | OperationResultSmartRollupRefute | OperationResultSmartRollupRecoverBond | OperationResultSmartRollupTimeout - | OperationResultSmartRollupExecuteOutboxMessage; + | OperationResultSmartRollupExecuteOutboxMessage + | OperationResultDalPublishCommitment; export interface OperationResultTransaction { status: OperationResultStatusEnum; diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index c4007fbbba..e35bc95caa 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -37,6 +37,7 @@ import { SmartRollupRefutationStart, SmartRollupRefutationOptions, RPCSimulateOperationParam, + OperationContentsAndResultDalPublishCommitment, } from '../src/types'; import { blockIthacanetResponse, @@ -1788,73 +1789,6 @@ describe('RpcClient test', () => { expect(transaction.metadata.operation_result.consumed_gas).toEqual('24660'); }); - it('should query the right url and property for operation, proto 20, attestation_with_dal', async () => { - httpBackend.createRequest.mockReturnValue( - Promise.resolve({ - protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', - chain_id: 'NetXo8SqH1c38SS', - hash: 'BKsCfYZrh417adJiKbGsyhVG2XrvUBJDhhkCAkZQzWzkEHCejXr', - header: { - level: 416914, - proto: 2, - predecessor: 'BLBXzegi3m1K8YjP7w9YgEpts5a9ZCFjY7xqRcm16p6yFxXbZGT', - timestamp: '2024-05-06T18:01:07Z', - validation_pass: 4, - operations_hash: 'LLoZxmgEJQyZ74XCrZQu8Jtcov4SnGGRyuYf32fYmURW2Xfcj58Gv', - fitness: ['02', '00065c92', '', 'ffffffff', '00000000'], - context: 'CoV1GGrMBca5uBG4AzQbKNrQhQHHTtSYJAHVk7pJtuMw3uWiNvTV', - payload_hash: 'vh1mfavAuf7E1m1tZUEHkWomS8BDiLsVZz9T1A79Afu8Cag5DQHG', - payload_round: 0, - proof_of_work_nonce: 'e38cf66600000000', - liquidity_baking_toggle_vote: 'on', - adaptive_issuance_vote: 'on', - signature: - 'sighpgD4aPxorZUvPxKvBHYNvnQEBRctF14bYXFX9qLbXbCGZv64S1dFVduBLzWBSEXCcHWiBuUT1iLZt9SE2mKCTkLtWuo5', - }, - metadata: {}, - operations: [ - [ - { - protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', - chain_id: 'NetXo8SqH1c38SS', - hash: 'opSmHyeasw4QcJ4Jc2qi6arNeSQMhFRjHBdFYWXGoMydLkgVRtb', - branch: 'BLHyjaqV2FhuHLQL3CBjWJqgZZ77BxcNxh3ehXcNYMQjjqAPwqA', - contents: [ - { - kind: 'attestation_with_dal', - slot: 19, - level: 416913, - round: 0, - block_payload_hash: 'vh27AvfjAJob9VdcZHEPHFbMAzi6nhCiHVzAyDBEdAPDCcEa676t', - dal_attestation: '0', - metadata: { - delegate: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', - consensus_power: 532, - consensus_key: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', - }, - }, - ], - signature: - 'sigh9rmktxbqmK6fXaq2ciAQrbrVH8pZhKeXEKHCzgNmJaP6gc1njofiMMzvhx2SRXQ7Gv8aVDzBM18kDGmUoBxQA693Bk2o', - }, - ], - ], - }) - ); - - const response = await client.getBlock(); - - expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ - method: 'GET', - url: 'root/chains/test/blocks/head', - }); - const endorsementWithSlot = response.operations[0][0] - .contents[0] as OperationContentsAndResultAttestationWithDal; - expect(endorsementWithSlot.kind).toEqual('attestation_with_dal'); - expect(endorsementWithSlot.slot).toEqual(19); - expect(endorsementWithSlot.dal_attestation).toEqual('0'); - }); - it('should query the right url and properties (big_map_diff and lazy_storage_diff) in transaction operation result, proto 9', async () => { httpBackend.createRequest.mockReturnValue( Promise.resolve({ @@ -3144,6 +3078,174 @@ describe('RpcClient test', () => { expect(ticketReceipt?.updates[0].account).toEqual('KT1JoRgUcR6NApwMLnBZ2pehCzp8tR4HtkHj'); expect(ticketReceipt?.updates[0].amount).toEqual('1'); }); + + it('should query the right url and property for operation, proto 20, attestation_with_dal', async () => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', + chain_id: 'NetXo8SqH1c38SS', + hash: 'BKsCfYZrh417adJiKbGsyhVG2XrvUBJDhhkCAkZQzWzkEHCejXr', + header: { + level: 416914, + proto: 2, + predecessor: 'BLBXzegi3m1K8YjP7w9YgEpts5a9ZCFjY7xqRcm16p6yFxXbZGT', + timestamp: '2024-05-06T18:01:07Z', + validation_pass: 4, + operations_hash: 'LLoZxmgEJQyZ74XCrZQu8Jtcov4SnGGRyuYf32fYmURW2Xfcj58Gv', + fitness: ['02', '00065c92', '', 'ffffffff', '00000000'], + context: 'CoV1GGrMBca5uBG4AzQbKNrQhQHHTtSYJAHVk7pJtuMw3uWiNvTV', + payload_hash: 'vh1mfavAuf7E1m1tZUEHkWomS8BDiLsVZz9T1A79Afu8Cag5DQHG', + payload_round: 0, + proof_of_work_nonce: 'e38cf66600000000', + liquidity_baking_toggle_vote: 'on', + adaptive_issuance_vote: 'on', + signature: + 'sighpgD4aPxorZUvPxKvBHYNvnQEBRctF14bYXFX9qLbXbCGZv64S1dFVduBLzWBSEXCcHWiBuUT1iLZt9SE2mKCTkLtWuo5', + }, + metadata: {}, + operations: [ + [ + { + protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', + chain_id: 'NetXo8SqH1c38SS', + hash: 'opSmHyeasw4QcJ4Jc2qi6arNeSQMhFRjHBdFYWXGoMydLkgVRtb', + branch: 'BLHyjaqV2FhuHLQL3CBjWJqgZZ77BxcNxh3ehXcNYMQjjqAPwqA', + contents: [ + { + kind: 'attestation_with_dal', + slot: 19, + level: 416913, + round: 0, + block_payload_hash: 'vh27AvfjAJob9VdcZHEPHFbMAzi6nhCiHVzAyDBEdAPDCcEa676t', + dal_attestation: '0', + metadata: { + delegate: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', + consensus_power: 532, + consensus_key: 'tz1Zt8QQ9aBznYNk5LUBjtME9DuExomw9YRs', + }, + }, + ], + signature: + 'sigh9rmktxbqmK6fXaq2ciAQrbrVH8pZhKeXEKHCzgNmJaP6gc1njofiMMzvhx2SRXQ7Gv8aVDzBM18kDGmUoBxQA693Bk2o', + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + const endorsementWithSlot = response.operations[0][0] + .contents[0] as OperationContentsAndResultAttestationWithDal; + expect(endorsementWithSlot.kind).toEqual('attestation_with_dal'); + expect(endorsementWithSlot.slot).toEqual(19); + expect(endorsementWithSlot.dal_attestation).toEqual('0'); + }); + + it('should query the right url and property for operation, proto 20, dal_publish_commitment', async () => { + httpBackend.createRequest.mockReturnValue( + Promise.resolve({ + protocol: 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz', + chain_id: 'NetXo8SqH1c38SS', + hash: 'BKsCfYZrh417adJiKbGsyhVG2XrvUBJDhhkCAkZQzWzkEHCejXr', + header: { + level: 416914, + proto: 2, + predecessor: 'BLBXzegi3m1K8YjP7w9YgEpts5a9ZCFjY7xqRcm16p6yFxXbZGT', + timestamp: '2024-05-06T18:01:07Z', + validation_pass: 4, + operations_hash: 'LLoZxmgEJQyZ74XCrZQu8Jtcov4SnGGRyuYf32fYmURW2Xfcj58Gv', + fitness: ['02', '00065c92', '', 'ffffffff', '00000000'], + context: 'CoV1GGrMBca5uBG4AzQbKNrQhQHHTtSYJAHVk7pJtuMw3uWiNvTV', + payload_hash: 'vh1mfavAuf7E1m1tZUEHkWomS8BDiLsVZz9T1A79Afu8Cag5DQHG', + payload_round: 0, + proof_of_work_nonce: 'e38cf66600000000', + liquidity_baking_toggle_vote: 'on', + adaptive_issuance_vote: 'on', + signature: + 'sighpgD4aPxorZUvPxKvBHYNvnQEBRctF14bYXFX9qLbXbCGZv64S1dFVduBLzWBSEXCcHWiBuUT1iLZt9SE2mKCTkLtWuo5', + }, + metadata: {}, + operations: [ + [ + { + protocol: 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', + chain_id: 'NetXycmjU7QxoVf', + hash: 'onhU8VcKQ7Jfh2wE2ABJMq4MHN2x9262WVeSXV6SVzpZjZcqSj8', + branch: 'BMT5yA3UH3CJkaYJBq33Q1BNZU6NL4zZNBhCHKwxygSm59P1x9M', + contents: [ + { + kind: 'dal_publish_commitment', + source: 'tz1Mp9zrMAJ3jckh3juLXGobfDv6oyUycfSy', + fee: '513', + counter: '67', + gas_limit: '1433', + storage_limit: '0', + slot_header: { + slot_index: 0, + commitment: + 'sh1vHbHrPSt7eWqYJmM9EUk5scjbvR5PKBckJxmmDJzYHHBkca8Lz4hxXX6zpW5wbhJhswJd4v', + commitment_proof: + '90c6576ad09e11b14eb464cdd214fe061ba8e8e5a3175e29fe7ff40526f90c2f2f4e02fe9fe03f7adb0fe286d7828b970eb1979f0f65ca3637a51d5456b442377d20397eb1b02544c2e435d79e156881443179fe16b32ad9e9501622a647c2ce', + }, + metadata: { + balance_updates: [ + { + kind: 'contract', + contract: 'tz1Mp9zrMAJ3jckh3juLXGobfDv6oyUycfSy', + change: '-513', + origin: 'block', + }, + { + kind: 'accumulator', + category: 'block fees', + change: '513', + origin: 'block', + }, + ], + operation_result: { + status: 'applied', + slot_header: { + version: '0', + level: 117424, + index: 0, + commitment: + 'sh1vHbHrPSt7eWqYJmM9EUk5scjbvR5PKBckJxmmDJzYHHBkca8Lz4hxXX6zpW5wbhJhswJd4v', + }, + consumed_milligas: '1332590', + }, + }, + }, + ], + signature: + 'sigwNUDa4HvpGMwpNEuqha91o9vgQzE4AkHZvLiYybRv1137jtorpHr1RZrhw5K167Z4e5UkbPHUsBMTq3KFyPkA1N6ZQnZD', + }, + ], + ], + }) + ); + + const response = await client.getBlock(); + + expect(httpBackend.createRequest.mock.calls[0][0]).toEqual({ + method: 'GET', + url: 'root/chains/test/blocks/head', + }); + const endorsementWithSlot = response.operations[0][0] + .contents[0] as OperationContentsAndResultDalPublishCommitment; + expect(endorsementWithSlot.kind).toEqual('dal_publish_commitment'); + expect(endorsementWithSlot.slot_header.slot_index).toEqual(0); + expect(endorsementWithSlot.slot_header.commitment).toEqual( + 'sh1vHbHrPSt7eWqYJmM9EUk5scjbvR5PKBckJxmmDJzYHHBkca8Lz4hxXX6zpW5wbhJhswJd4v' + ); + expect(endorsementWithSlot.slot_header.commitment_proof).toEqual( + '90c6576ad09e11b14eb464cdd214fe061ba8e8e5a3175e29fe7ff40526f90c2f2f4e02fe9fe03f7adb0fe286d7828b970eb1979f0f65ca3637a51d5456b442377d20397eb1b02544c2e435d79e156881443179fe16b32ad9e9501622a647c2ce' + ); + }); }); describe('getBakingRights', () => { diff --git a/packages/taquito-utils/src/constants.ts b/packages/taquito-utils/src/constants.ts index 6af505c530..c866e2fbf6 100644 --- a/packages/taquito-utils/src/constants.ts +++ b/packages/taquito-utils/src/constants.ts @@ -1,3 +1,4 @@ +// ref https://gitlab.com/tezos/tezos/-/blob/master/src/lib_crypto/base58.ml export enum Prefix { TZ1 = 'tz1', TZ2 = 'tz2', @@ -45,6 +46,8 @@ export enum Prefix { SR1 = 'sr1', SRC1 = 'src1', + + SH = 'sh', } export const prefix = { @@ -94,6 +97,8 @@ export const prefix = { [Prefix.SR1]: new Uint8Array([6, 124, 117]), [Prefix.SRC1]: new Uint8Array([17, 165, 134, 138]), + + [Prefix.SH]: new Uint8Array([2, 116, 180]), }; export const prefixLength: { [key: string]: number } = { @@ -124,4 +129,6 @@ export const prefixLength: { [key: string]: number } = { [Prefix.SR1]: 20, [Prefix.SRC1]: 32, + + [Prefix.SH]: 48, }; From 1847951be278836e73dd92b7cc8feb0178407154 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Thu, 9 May 2024 16:04:15 -0700 Subject: [PATCH 19/35] Update Paris branch with newest Beacon version (v4.2.2-beta.4) (#2956) * update beacon version to v4.2.2-beta.4 * removed space --- apps/taquito-test-dapp/package.json | 4 +- package-lock.json | 231 +++++++++--------- packages/taquito-beacon-wallet/package.json | 2 +- website/package-lock.json | 104 ++++---- .../version-17.4.0/batch-api.md | 1 - 5 files changed, 168 insertions(+), 174 deletions(-) diff --git a/apps/taquito-test-dapp/package.json b/apps/taquito-test-dapp/package.json index f29b421582..7f7712acf5 100644 --- a/apps/taquito-test-dapp/package.json +++ b/apps/taquito-test-dapp/package.json @@ -24,8 +24,8 @@ "vite": "^4.4.11" }, "dependencies": { - "@airgap/beacon-sdk": "^4.2.1", - "@airgap/beacon-types": "^4.2.1", + "@airgap/beacon-sdk": "^4.2.2-beta.4", + "@airgap/beacon-types": "^4.2.2-beta.4", "@taquito/beacon-wallet": "^20.0.0-beta.0", "@taquito/core": "^20.0.0-beta.0", "@taquito/taquito": "^20.0.0-beta.0", diff --git a/package-lock.json b/package-lock.json index 2b8f429535..1dc1a903b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,8 +58,8 @@ "name": "taquito-test-dapp-vite", "version": "20.0.0-beta.0", "dependencies": { - "@airgap/beacon-sdk": "^4.2.1", - "@airgap/beacon-types": "^4.2.1", + "@airgap/beacon-sdk": "^4.2.2-beta.4", + "@airgap/beacon-types": "^4.2.2-beta.4", "@taquito/beacon-wallet": "^20.0.0-beta.0", "@taquito/core": "^20.0.0-beta.0", "@taquito/taquito": "^20.0.0-beta.0", @@ -156,30 +156,30 @@ } }, "node_modules/@airgap/beacon-blockchain-substrate": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-blockchain-substrate/-/beacon-blockchain-substrate-4.2.1.tgz", - "integrity": "sha512-Zaggh3QdYYlXV8DsdbPcLuKCLCG9mqSBCQSrLZphaHi9phL16GuAcM7UnuQTnN9UbAS1gkLe3I1IIXZHNpMTig==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-blockchain-substrate/-/beacon-blockchain-substrate-4.2.2-beta.4.tgz", + "integrity": "sha512-x1Pl5wJSE0XW/7+TlR0Tr2WJm8LL/zVFF1/YbZRfJWazxs4LIx54An84FKq4NQZA6gEAMHzBuxcImTw1TnF0/A==", "dependencies": { - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-ui": "4.2.1" + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-ui": "4.2.2-beta.4" } }, "node_modules/@airgap/beacon-blockchain-tezos": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-blockchain-tezos/-/beacon-blockchain-tezos-4.2.1.tgz", - "integrity": "sha512-vVwROjzt70MjiSDKbsUV2gHxFT8YMfCnn9t/FR04nn/DIxWrnxmRPoWh8lnqJOx2SHuqQgVDTE0i4kxBYuW94Q==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-blockchain-tezos/-/beacon-blockchain-tezos-4.2.2-beta.4.tgz", + "integrity": "sha512-hDFrMyS5gmuUpV9mzQr/fffbPUgHEMPBPjPaGT1u2jIsp7d8kela42SVsums8IzEWBElrb/zZm7wPktfjt08Mw==", "dependencies": { - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-ui": "4.2.1" + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-ui": "4.2.2-beta.4" } }, "node_modules/@airgap/beacon-core": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.2.1.tgz", - "integrity": "sha512-rOfvmxTcfoPfC40G2RoPxp9HtQjeNZGuecvmsGAkbEcJHZpgNXoyp5zt8YeBBpxA8KsV156FcUDjyHadSFjaWw==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.2.2-beta.4.tgz", + "integrity": "sha512-Kx/9XIFl9mSBel83A4HS+wQt3RFoTqkEZke6OmvNYiVdgd6UQHMgoLJb5Tlf8FTM9HXma3A36JxwvRSwDpHvwA==", "dependencies": { - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-utils": "4.2.1", + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-utils": "4.2.2-beta.4", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", "@stablelib/utf8": "^1.0.1", @@ -214,91 +214,91 @@ } }, "node_modules/@airgap/beacon-dapp": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-4.2.1.tgz", - "integrity": "sha512-lt1B8JL2yQkun0imhQv/Fz/LhHTrXo1xdBlYUopOGi6KHtXXyGZpMTrAqEUWn/nKYcygjx+zNI5NaMxDn2Ejlg==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-4.2.2-beta.4.tgz", + "integrity": "sha512-NVjQsnpC7/mlSr/SDqtoFYG//PJBT/kY2p2GXXdXu4HffqmmSDRwHQjVFDDnx2MCaA6ZQ8bDWHC246vW4ogLkw==", "dependencies": { - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-transport-matrix": "4.2.1", - "@airgap/beacon-transport-postmessage": "4.2.1", - "@airgap/beacon-transport-walletconnect": "4.2.1", - "@airgap/beacon-ui": "4.2.1" + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-transport-matrix": "4.2.2-beta.4", + "@airgap/beacon-transport-postmessage": "4.2.2-beta.4", + "@airgap/beacon-transport-walletconnect": "4.2.2-beta.4", + "@airgap/beacon-ui": "4.2.2-beta.4" } }, "node_modules/@airgap/beacon-sdk": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-sdk/-/beacon-sdk-4.2.1.tgz", - "integrity": "sha512-/NhrQBETARyB3UT1c7/IEAItV1RmCpdGd2m32Dn8MsyAmHki+y+BuKBuWuywjKOZHqVntkeqIWvh9thmBnih/w==", - "dependencies": { - "@airgap/beacon-blockchain-substrate": "4.2.1", - "@airgap/beacon-blockchain-tezos": "4.2.1", - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-dapp": "4.2.1", - "@airgap/beacon-transport-matrix": "4.2.1", - "@airgap/beacon-transport-postmessage": "4.2.1", - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-ui": "4.2.1", - "@airgap/beacon-utils": "4.2.1", - "@airgap/beacon-wallet": "4.2.1" + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-sdk/-/beacon-sdk-4.2.2-beta.4.tgz", + "integrity": "sha512-eFCaeDr06Z7y+tyVIEYMmlPnUkc/rxa8atXhqZEoxZEGmlfQqTgHP+hrQLkeKLXPY22IOIoQGLcB9HX+cAqobg==", + "dependencies": { + "@airgap/beacon-blockchain-substrate": "4.2.2-beta.4", + "@airgap/beacon-blockchain-tezos": "4.2.2-beta.4", + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-dapp": "4.2.2-beta.4", + "@airgap/beacon-transport-matrix": "4.2.2-beta.4", + "@airgap/beacon-transport-postmessage": "4.2.2-beta.4", + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-ui": "4.2.2-beta.4", + "@airgap/beacon-utils": "4.2.2-beta.4", + "@airgap/beacon-wallet": "4.2.2-beta.4" } }, "node_modules/@airgap/beacon-transport-matrix": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-4.2.1.tgz", - "integrity": "sha512-ggvKQPreXVrm5t3kPV/RGBTIxo8ujSrE6tb6kpUAQyMC+mfMPY5WeP8qwqgMT+yzRMYUlkJa3u+hNxoSQIKK+A==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-4.2.2-beta.4.tgz", + "integrity": "sha512-M1FLP9gctmj0/LZr4BKu0G8tsWwy0qjh+HOeLT7nFqk5ibT6kyiQsQc5/QRc8ltrV7y62rJfgVDxFvnsUSYdHg==", "dependencies": { - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-utils": "4.2.1", + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-utils": "4.2.2-beta.4", "axios": "^1.6.2" } }, "node_modules/@airgap/beacon-transport-postmessage": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.2.1.tgz", - "integrity": "sha512-/sq2yz90scWNwb93nhe9hXQZpetXLuc/BRJcyg3W3Sv53wEQ5yPb9XmedFhuFo/Tc8nTt5kZgz5ORXgDnlATJg==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.2.2-beta.4.tgz", + "integrity": "sha512-NvGGUJa2i7KTHtwVdMtD4ZVbtj08llZwKE2Uw3HYXsWBgOVOjpdcsw8JTrPnys2QWedYgZIxf1wHUOQ6tjdPbQ==", "dependencies": { - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-utils": "4.2.1" + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-utils": "4.2.2-beta.4" } }, "node_modules/@airgap/beacon-transport-walletconnect": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-walletconnect/-/beacon-transport-walletconnect-4.2.1.tgz", - "integrity": "sha512-HTjKXtXP3z/Xg2yViE2o4gi556ickOTHjFz7t9ftp75qARP+XOW0uWcwTTV8YVK4mW5fXe0lM2M5nGXWD6nE8g==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-walletconnect/-/beacon-transport-walletconnect-4.2.2-beta.4.tgz", + "integrity": "sha512-dQ1StvlcuuzI4d1pBJjZqar+4Nb2TwNMs4B6w/sOTEaF7zFoHOaj9RGDUtp03kS4cqEI2B+0UgwsW4n6sjjVow==", "dependencies": { - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-utils": "4.2.1", + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-utils": "4.2.2-beta.4", "@walletconnect/sign-client": "2.11.2" } }, "node_modules/@airgap/beacon-types": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.2.1.tgz", - "integrity": "sha512-6PBO/FCb2kDgfJdLVhImcK9oXq3Pa444/xOW3a5WEbVqq+q9qo5OjdscJFAviQgRMz8NJJvOn8/5RbRJBy2uWw==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.2.2-beta.4.tgz", + "integrity": "sha512-0lrGvI2+325Nt8ma1SjzMaQSXjDSrrUuLrPIitBJ8b7ZTN4yi09/abFpa3+7u4AG8BLCSvn5HC34LJpCNomcpQ==", "dependencies": { "@types/chrome": "0.0.246" } }, "node_modules/@airgap/beacon-ui": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.2.1.tgz", - "integrity": "sha512-doCNbi9iaJQmNWKr54/i39VkgO/IFdxArdyxrUYAT2Z6bcLa+cJu3ttNjVQKoAhm8Z07QFWneMnS7RbYZRNbWg==", - "dependencies": { - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-transport-postmessage": "4.2.1", - "@airgap/beacon-types": "4.2.1", - "@airgap/beacon-utils": "4.2.1", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.2.2-beta.4.tgz", + "integrity": "sha512-39ekAnMYPV6GAkz5JmlQAABmVt9vf+bVkS4RLfph1+Ebymp6savJLf+MgD0eOHT2Xl+gsmzehtJ5y2p+lY8Bsw==", + "dependencies": { + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-transport-postmessage": "4.2.2-beta.4", + "@airgap/beacon-types": "4.2.2-beta.4", + "@airgap/beacon-utils": "4.2.2-beta.4", "@walletconnect/utils": "2.11.2", "qrcode-svg": "^1.1.0", "solid-js": "^1.7.11" } }, "node_modules/@airgap/beacon-utils": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.2.1.tgz", - "integrity": "sha512-Ob9OE1w9jnytC9s9UYuClBef1lmJnKFnB8NsqeLPur2AHC+9M2aeua92cS6KY8GkQo3EN4KzaCguC3QFo3nsVw==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.2.2-beta.4.tgz", + "integrity": "sha512-/kQ798X2vbNp6ZoD2mUFLKkyH1LEorSqKmi8dCDU21HKjW0Re4OrbbelZ9WK1qmzPMfzfrOCzBUYJHnc+xsv+Q==", "dependencies": { "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", @@ -334,13 +334,13 @@ } }, "node_modules/@airgap/beacon-wallet": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@airgap/beacon-wallet/-/beacon-wallet-4.2.1.tgz", - "integrity": "sha512-YnEKbLVGlqZ2YwkD+bIKu6ZqMpIje2QtKccpnYbLsOSqZHY0+0n5iu63qkKw8Wy6PWDp1JN4CFVQVnGrRo7f9g==", + "version": "4.2.2-beta.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-wallet/-/beacon-wallet-4.2.2-beta.4.tgz", + "integrity": "sha512-LWGfrnjqVCsiBaF87vdxlndNYOEskzaoAJIaXSOP/XPgaxAou2Vp+DLeWwgCqRhzVKZ3EUg58/t55ShfpBd8+Q==", "dependencies": { - "@airgap/beacon-core": "4.2.1", - "@airgap/beacon-transport-matrix": "4.2.1", - "@airgap/beacon-transport-postmessage": "4.2.1" + "@airgap/beacon-core": "4.2.2-beta.4", + "@airgap/beacon-transport-matrix": "4.2.2-beta.4", + "@airgap/beacon-transport-postmessage": "4.2.2-beta.4" } }, "node_modules/@airgap/sapling-wasm": { @@ -6871,33 +6871,22 @@ } }, "node_modules/@walletconnect/logger": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/logger/-/logger-2.0.1.tgz", - "integrity": "sha512-SsTKdsgWm+oDTBeNE/zHxxr5eJfZmE9/5yp/Ku+zJtcTAjELb3DXueWkDXmE9h8uHIbJzIb5wj5lPdzyrjT6hQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@walletconnect/logger/-/logger-2.1.2.tgz", + "integrity": "sha512-aAb28I3S6pYXZHQm5ESB+V6rDqIYfsnHaQyzFbwUUBFY4H0OXx/YtTl8lvhUNhMMfb9UxbwEBS253TlXUYJWSw==", "dependencies": { - "pino": "7.11.0", - "tslib": "1.14.1" + "@walletconnect/safe-json": "^1.0.2", + "pino": "7.11.0" } }, - "node_modules/@walletconnect/logger/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@walletconnect/relay-api": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", - "integrity": "sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.10.tgz", + "integrity": "sha512-tqrdd4zU9VBNqUaXXQASaexklv6A54yEyQQEXYOCr+Jz8Ket0dmPBDyg19LVSNUN2cipAghQc45/KVmfFJ0cYw==", "dependencies": { - "@walletconnect/jsonrpc-types": "^1.0.2", - "tslib": "1.14.1" + "@walletconnect/jsonrpc-types": "^1.0.2" } }, - "node_modules/@walletconnect/relay-api/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@walletconnect/relay-auth": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz", @@ -9166,6 +9155,11 @@ "typedarray": "^0.0.6" } }, + "node_modules/confbox": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", + "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==" + }, "node_modules/consola": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", @@ -12965,9 +12959,9 @@ "dev": true }, "node_modules/iron-webcrypto": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.0.tgz", - "integrity": "sha512-5vgYsCakNlaQub1orZK5QmNYhwYtcllTkZBp5sfIaCqY93Cf6l+v2rtE+E4TMbcfjxDMCdrO8wmp7+ZvhDECLA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.1.tgz", + "integrity": "sha512-5xGwQUWHQSy039rFr+5q/zOmj7GP0Ypzvo34Ep+61bPIhaLduEDp/PvLGlU3awD2mzWUR0weN2vJ1mILydFPEg==", "funding": { "url": "https://github.com/sponsors/brc-dd" } @@ -14422,7 +14416,8 @@ "node_modules/jsonc-parser": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true }, "node_modules/jsonfile": { "version": "6.1.0", @@ -16377,14 +16372,14 @@ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" }, "node_modules/mlly": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.1.tgz", - "integrity": "sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.0.tgz", + "integrity": "sha512-U9SDaXGEREBYQgfejV97coK0UL1r+qnF2SyO9A3qcI8MzKnsIFKHNVEkrDyNncQTKQQumsasmeq84eNMdBfsNQ==", "dependencies": { "acorn": "^8.11.3", "pathe": "^1.1.2", - "pkg-types": "^1.0.3", - "ufo": "^1.3.2" + "pkg-types": "^1.1.0", + "ufo": "^1.5.3" } }, "node_modules/modify-values": { @@ -18282,13 +18277,13 @@ } }, "node_modules/pkg-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.1.tgz", + "integrity": "sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==", "dependencies": { - "jsonc-parser": "^3.2.0", - "mlly": "^1.2.0", - "pathe": "^1.1.0" + "confbox": "^0.1.7", + "mlly": "^1.7.0", + "pathe": "^1.1.2" } }, "node_modules/pkg-up": { @@ -20697,9 +20692,9 @@ } }, "node_modules/solid-js": { - "version": "1.8.16", - "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.8.16.tgz", - "integrity": "sha512-rja94MNU9flF3qQRLNsu60QHKBDKBkVE1DldJZPIfn2ypIn3NV2WpSbGTQIvsyGPBo+9E2IMjwqnqpbgfWuzeg==", + "version": "1.8.17", + "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.8.17.tgz", + "integrity": "sha512-E0FkUgv9sG/gEBWkHr/2XkBluHb1fkrHywUgA6o6XolPDCJ4g1HaLmQufcBBhiF36ee40q+HpG/vCZu7fLpI3Q==", "dependencies": { "csstype": "^3.1.0", "seroval": "^1.0.4", @@ -22511,9 +22506,9 @@ } }, "node_modules/unstorage/node_modules/lru-cache": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", - "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", "engines": { "node": "14 || >=16.14" } @@ -23466,7 +23461,7 @@ "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@airgap/beacon-dapp": "^4.2.1", + "@airgap/beacon-dapp": "^4.2.2-beta.4", "@taquito/core": "^20.0.0-beta.0", "@taquito/taquito": "^20.0.0-beta.0" }, diff --git a/packages/taquito-beacon-wallet/package.json b/packages/taquito-beacon-wallet/package.json index 7e1fb86ae4..6b61fd82c3 100644 --- a/packages/taquito-beacon-wallet/package.json +++ b/packages/taquito-beacon-wallet/package.json @@ -67,7 +67,7 @@ ] }, "dependencies": { - "@airgap/beacon-dapp": "^4.2.1", + "@airgap/beacon-dapp": "^4.2.2-beta.4", "@taquito/core": "^20.0.0-beta.0", "@taquito/taquito": "^20.0.0-beta.0" }, diff --git a/website/package-lock.json b/website/package-lock.json index a72c7cb37d..8483cef250 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -69,17 +69,17 @@ }, "../packages/taquito": { "name": "@taquito/taquito", - "version": "19.2.0", + "version": "20.0.0-beta.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/local-forging": "^19.2.0", - "@taquito/michel-codec": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/local-forging": "^20.0.0-beta.0", + "@taquito/michel-codec": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -127,12 +127,12 @@ }, "../packages/taquito-beacon-wallet": { "name": "@taquito/beacon-wallet", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@airgap/beacon-dapp": "^4.2.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0" + "@airgap/beacon-dapp": "^4.2.2-beta.4", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -172,7 +172,7 @@ }, "../packages/taquito-core": { "name": "@taquito/core", - "version": "19.1.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "json-stringify-safe": "^5.0.1" @@ -188,10 +188,10 @@ }, "../packages/taquito-http-utils": { "name": "@taquito/http-utils", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", + "@taquito/core": "^20.0.0-beta.0", "node-fetch": "^2.7.0" }, "devDependencies": { @@ -229,14 +229,14 @@ }, "../packages/taquito-ledger-signer": { "name": "@taquito/ledger-signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@ledgerhq/hw-transport": "^6.30.5", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "buffer": "^6.0.3" }, "devDependencies": { @@ -273,10 +273,10 @@ }, "../packages/taquito-michel-codec": { "name": "@taquito/michel-codec", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "MIT", "dependencies": { - "@taquito/core": "^19.1.0" + "@taquito/core": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -306,12 +306,12 @@ }, "../packages/taquito-michelson-encoder": { "name": "@taquito/michelson-encoder", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/rpc": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -348,15 +348,15 @@ }, "../packages/taquito-remote-signer": { "name": "@taquito/remote-signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { @@ -393,12 +393,12 @@ }, "../packages/taquito-rpc": { "name": "@taquito/rpc", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -434,7 +434,7 @@ }, "../packages/taquito-signer": { "name": "@taquito/signer", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -443,9 +443,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^19.1.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -488,13 +488,13 @@ }, "../packages/taquito-tzip12": { "name": "@taquito/tzip12", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/tzip16": "^19.2.0" + "@taquito/core": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/tzip16": "^20.0.0-beta.0" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -530,15 +530,15 @@ }, "../packages/taquito-tzip16": { "name": "@taquito/tzip16", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^19.1.0", - "@taquito/http-utils": "^19.2.0", - "@taquito/michelson-encoder": "^19.2.0", - "@taquito/rpc": "^19.2.0", - "@taquito/taquito": "^19.2.0", - "@taquito/utils": "^19.2.0", + "@taquito/core": "^20.0.0-beta.0", + "@taquito/http-utils": "^20.0.0-beta.0", + "@taquito/michelson-encoder": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/taquito": "^20.0.0-beta.0", + "@taquito/utils": "^20.0.0-beta.0", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, @@ -577,12 +577,12 @@ }, "../packages/taquito-utils": { "name": "@taquito/utils", - "version": "19.2.0", + "version": "20.0.0-beta.0", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0", + "@taquito/core": "^20.0.0-beta.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/website/versioned_docs/version-17.4.0/batch-api.md b/website/versioned_docs/version-17.4.0/batch-api.md index ccd9e35bd7..611cb48799 100644 --- a/website/versioned_docs/version-17.4.0/batch-api.md +++ b/website/versioned_docs/version-17.4.0/batch-api.md @@ -31,7 +31,6 @@ await op2.confirmation(); */ ``` - ## How does it work? The `contract` or `wallet` property of the `TezosToolkit` object exposes a method called `batch` (the choice between `contract` or `wallet` depends on your use case, whether the transaction will be signed by a wallet or not). Subsequently, the returned object exposes six different methods that you can concatenate according to the number of transactions to emit. From 65bd4814eeea5e4276c7dfa2a7e0596f6c1b6073 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 14 May 2024 10:03:56 -0700 Subject: [PATCH 20/35] updated algoliasearch and fortawesome deps (#2954) --- website/package-lock.json | 226 +++++++++++++++++++------------------- website/package.json | 6 +- 2 files changed, 116 insertions(+), 116 deletions(-) diff --git a/website/package-lock.json b/website/package-lock.json index 8483cef250..ee8993761e 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -14,8 +14,8 @@ "@docusaurus/theme-live-codeblock": "2.4.3", "@docusaurus/theme-mermaid": "^2.4.3", "@docusaurus/theme-search-algolia": "2.4.3", - "@fortawesome/fontawesome-svg-core": "^6.4.2", - "@fortawesome/free-solid-svg-icons": "^6.4.2", + "@fortawesome/fontawesome-svg-core": "^6.5.2", + "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/react-fontawesome": "^0.2.0", "@ledgerhq/hw-transport-webhid": "^6.28.5", "@mdx-js/react": "^1.6.22", @@ -34,7 +34,7 @@ "@taquito/tzip16": "file:../packages/taquito-tzip16", "@taquito/utils": "file:../packages/taquito-utils", "abort-controller": "^3.0.0", - "algoliasearch": "^4.22.1", + "algoliasearch": "^4.23.2", "axios": "^0.28.0", "buffer": "^6.0.3", "classnames": "^2.3.2", @@ -665,74 +665,74 @@ } }, "node_modules/@algolia/cache-browser-local-storage": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.23.1.tgz", - "integrity": "sha512-1sAJYmXN9TOk6Hd8BUQOglxP9Kq9F0qlISsuWxH6y4UjevevgxhLvA6VrODJb1ghwwQi0nODXxwUhNh0sGF8xw==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.23.3.tgz", + "integrity": "sha512-vRHXYCpPlTDE7i6UOy2xE03zHF2C8MEFjPN2v7fRbqVpcOvAUQK81x3Kc21xyb5aSIpYCjWCZbYZuz8Glyzyyg==", "dependencies": { - "@algolia/cache-common": "4.23.1" + "@algolia/cache-common": "4.23.3" } }, "node_modules/@algolia/cache-common": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.23.1.tgz", - "integrity": "sha512-w0sqXuwbGyIDsFDHTZzTv79rZjW7vc/6vCPdqYAAkiUlvvCdUo0cCWFXpbMpvYHBS2IXZXJaQY0R9yL/bmk9VQ==" + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.23.3.tgz", + "integrity": "sha512-h9XcNI6lxYStaw32pHpB1TMm0RuxphF+Ik4o7tcQiodEdpKK+wKufY6QXtba7t3k8eseirEMVB83uFFF3Nu54A==" }, "node_modules/@algolia/cache-in-memory": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.23.1.tgz", - "integrity": "sha512-Wy5J4c2vLi1Vfsc3qoM/trVtvN9BlV+X2hfiAhfTVclyney6fs/Rjus8lbadl1x5GjlPIgMNGxvr/A/wnJQUBw==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.23.3.tgz", + "integrity": "sha512-yvpbuUXg/+0rbcagxNT7un0eo3czx2Uf0y4eiR4z4SD7SiptwYTpbuS0IHxcLHG3lq22ukx1T6Kjtk/rT+mqNg==", "dependencies": { - "@algolia/cache-common": "4.23.1" + "@algolia/cache-common": "4.23.3" } }, "node_modules/@algolia/client-account": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.23.1.tgz", - "integrity": "sha512-E8rALAfC7G1gruxW4zO3WgBkWQDJq1Crnxi45uo/KUYf78x+T7YwojyS42fHz//thbtPyPUC5WZCQlnzqgMZlg==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.23.3.tgz", + "integrity": "sha512-hpa6S5d7iQmretHHF40QGq6hz0anWEHGlULcTIT9tbUssWUriN9AUXIFQ8Ei4w9azD0hc1rUok9/DeQQobhQMA==", "dependencies": { - "@algolia/client-common": "4.23.1", - "@algolia/client-search": "4.23.1", - "@algolia/transporter": "4.23.1" + "@algolia/client-common": "4.23.3", + "@algolia/client-search": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/@algolia/client-analytics": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.23.1.tgz", - "integrity": "sha512-xtfp/M3TjHStStH/UQoxmt8SeVpxSgdZGcCY61+chG9fmbJHgeYtzECQu7SVZ+LPTW0nmyqMrpKQ9kFcgPnV1A==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.23.3.tgz", + "integrity": "sha512-LBsEARGS9cj8VkTAVEZphjxTjMVCci+zIIiRhpFun9jGDUlS1XmhCW7CTrnaWeIuCQS/2iPyRqSy1nXPjcBLRA==", "dependencies": { - "@algolia/client-common": "4.23.1", - "@algolia/client-search": "4.23.1", - "@algolia/requester-common": "4.23.1", - "@algolia/transporter": "4.23.1" + "@algolia/client-common": "4.23.3", + "@algolia/client-search": "4.23.3", + "@algolia/requester-common": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/@algolia/client-common": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.23.1.tgz", - "integrity": "sha512-01lBsO8r4KeXWIDzVQoPMYwOndeAvSQk3xk3Bxwrt2ag5jrGswiq8DgEqPVx+PQw+7T5GY6dS25cYcdv1dVorA==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.23.3.tgz", + "integrity": "sha512-l6EiPxdAlg8CYhroqS5ybfIczsGUIAC47slLPOMDeKSVXYG1n0qGiz4RjAHLw2aD0xzh2EXZ7aRguPfz7UKDKw==", "dependencies": { - "@algolia/requester-common": "4.23.1", - "@algolia/transporter": "4.23.1" + "@algolia/requester-common": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/@algolia/client-personalization": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-4.23.1.tgz", - "integrity": "sha512-B8UEALAg1/6DaLuJOxYTfGBVrLZN4M7FoaYrjbHLw2oF5Y6bxe59Y5ug+lSbs6v9bWx7U9rNVpd8m2I8pobFcA==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-4.23.3.tgz", + "integrity": "sha512-3E3yF3Ocr1tB/xOZiuC3doHQBQ2zu2MPTYZ0d4lpfWads2WTKG7ZzmGnsHmm63RflvDeLK/UVx7j2b3QuwKQ2g==", "dependencies": { - "@algolia/client-common": "4.23.1", - "@algolia/requester-common": "4.23.1", - "@algolia/transporter": "4.23.1" + "@algolia/client-common": "4.23.3", + "@algolia/requester-common": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/@algolia/client-search": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.23.1.tgz", - "integrity": "sha512-jeA1ZksO0N33SZhcLRa4paUI7LFJrrhtMlw27eIdPTVv/npV0dMLoNGPg3MuLSeZqRKqfpY7tTOBjRZFMhskLg==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.23.3.tgz", + "integrity": "sha512-P4VAKFHqU0wx9O+q29Q8YVuaowaZ5EM77rxfmGnkHUJggh28useXQdopokgwMeYw2XUht49WX5RcTQ40rZIabw==", "dependencies": { - "@algolia/client-common": "4.23.1", - "@algolia/requester-common": "4.23.1", - "@algolia/transporter": "4.23.1" + "@algolia/client-common": "4.23.3", + "@algolia/requester-common": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/@algolia/events": { @@ -741,65 +741,65 @@ "integrity": "sha512-FQzvOCgoFXAbf5Y6mYozw2aj5KCJoA3m4heImceldzPSMbdyS4atVjJzXKMsfX3wnZTFYwkkt8/z8UesLHlSBQ==" }, "node_modules/@algolia/logger-common": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.23.1.tgz", - "integrity": "sha512-hGsqJrpeZfw1Ng8ctWj9gg8zXlSmEMA0cfbBn3yoZa3so8oQZmB9uz57AJcJj1CfSBf+5SK8/AF4kjTungvgUA==" + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.23.3.tgz", + "integrity": "sha512-y9kBtmJwiZ9ZZ+1Ek66P0M68mHQzKRxkW5kAAXYN/rdzgDN0d2COsViEFufxJ0pb45K4FRcfC7+33YB4BLrZ+g==" }, "node_modules/@algolia/logger-console": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.23.1.tgz", - "integrity": "sha512-6QYjtxsDwrdFeLoCcZmi9af/EbWkpUYSclx2d342EoayaY8S2tCORgqwzDmPPOpvi5Y6zPnDsj2BG7vrpK8bdg==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.23.3.tgz", + "integrity": "sha512-8xoiseoWDKuCVnWP8jHthgaeobDLolh00KJAdMe9XPrWPuf1by732jSpgy2BlsLTaT9m32pHI8CRfrOqQzHv3A==", "dependencies": { - "@algolia/logger-common": "4.23.1" + "@algolia/logger-common": "4.23.3" } }, "node_modules/@algolia/recommend": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-4.23.1.tgz", - "integrity": "sha512-9Td+htxUYkUxrkaPOum9Q1jAy+NogxpwZ+Vvn3X+IBIfXECrNhIff+u1ddIirRM2rMphWrrO/3GWLZaKY7FOxw==", - "dependencies": { - "@algolia/cache-browser-local-storage": "4.23.1", - "@algolia/cache-common": "4.23.1", - "@algolia/cache-in-memory": "4.23.1", - "@algolia/client-common": "4.23.1", - "@algolia/client-search": "4.23.1", - "@algolia/logger-common": "4.23.1", - "@algolia/logger-console": "4.23.1", - "@algolia/requester-browser-xhr": "4.23.1", - "@algolia/requester-common": "4.23.1", - "@algolia/requester-node-http": "4.23.1", - "@algolia/transporter": "4.23.1" + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-4.23.3.tgz", + "integrity": "sha512-9fK4nXZF0bFkdcLBRDexsnGzVmu4TSYZqxdpgBW2tEyfuSSY54D4qSRkLmNkrrz4YFvdh2GM1gA8vSsnZPR73w==", + "dependencies": { + "@algolia/cache-browser-local-storage": "4.23.3", + "@algolia/cache-common": "4.23.3", + "@algolia/cache-in-memory": "4.23.3", + "@algolia/client-common": "4.23.3", + "@algolia/client-search": "4.23.3", + "@algolia/logger-common": "4.23.3", + "@algolia/logger-console": "4.23.3", + "@algolia/requester-browser-xhr": "4.23.3", + "@algolia/requester-common": "4.23.3", + "@algolia/requester-node-http": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/@algolia/requester-browser-xhr": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.23.1.tgz", - "integrity": "sha512-dM8acMp6sn1HRoQrUiBYQCZvTrFwLwFuHagZH88nKhL52bUrtZXH2qUQ8RMQBb9am71J9COLyMgZYdyR+u8Ktg==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.23.3.tgz", + "integrity": "sha512-jDWGIQ96BhXbmONAQsasIpTYWslyjkiGu0Quydjlowe+ciqySpiDUrJHERIRfELE5+wFc7hc1Q5hqjGoV7yghw==", "dependencies": { - "@algolia/requester-common": "4.23.1" + "@algolia/requester-common": "4.23.3" } }, "node_modules/@algolia/requester-common": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.23.1.tgz", - "integrity": "sha512-G9+ySLxPBtn2o6Mk4NoxPnkYtAe/isxrVy5LmJ4za+aYEdV5tvZpgvn+k4558T7XoRBrI2eQKyjnvQs7zJeCdw==" + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.23.3.tgz", + "integrity": "sha512-xloIdr/bedtYEGcXCiF2muajyvRhwop4cMZo+K2qzNht0CMzlRkm8YsDdj5IaBhshqfgmBb3rTg4sL4/PpvLYw==" }, "node_modules/@algolia/requester-node-http": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.23.1.tgz", - "integrity": "sha512-prpVKKc/WRAtZqZx3A6Ds+D6bl3jgnY4Nw8BhCO9yzwMu5oXaOFsZrzFRBeVUJbtOWMc/DMP38vY6DpdV6NSfw==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.23.3.tgz", + "integrity": "sha512-zgu++8Uj03IWDEJM3fuNl34s746JnZOWn1Uz5taV1dFyJhVM/kTNw9Ik7YJWiUNHJQXcaD8IXD1eCb0nq/aByA==", "dependencies": { - "@algolia/requester-common": "4.23.1" + "@algolia/requester-common": "4.23.3" } }, "node_modules/@algolia/transporter": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.23.1.tgz", - "integrity": "sha512-8ucVx0hV7yIeTZUFsix31UEIJFRauPriWlzLBbDy9gRHrK45WbMQ1S9FliDdoY5OvbFxi0/5OKRj0Dw1EkbcJA==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.23.3.tgz", + "integrity": "sha512-Wjl5gttqnf/gQKJA+dafnD0Y6Yw97yvfY8R9h0dQltX1GXTgNs1zWgvtWW0tHl1EgMdhAyw189uWiZMnL3QebQ==", "dependencies": { - "@algolia/cache-common": "4.23.1", - "@algolia/logger-common": "4.23.1", - "@algolia/requester-common": "4.23.1" + "@algolia/cache-common": "4.23.3", + "@algolia/logger-common": "4.23.3", + "@algolia/requester-common": "4.23.3" } }, "node_modules/@ampproject/remapping": { @@ -4546,33 +4546,33 @@ "integrity": "sha512-EnfRJvrnzkHwN3BPMCayCFT5lCqInzg3RdlRsDjDvB1EJli6Usj26T6lJ67BU2UcYXBS5xcp1Wj4+zRzj2NaZg==" }, "node_modules/@fortawesome/fontawesome-common-types": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.5.1.tgz", - "integrity": "sha512-GkWzv+L6d2bI5f/Vk6ikJ9xtl7dfXtoRu3YGE6nq0p/FFqA1ebMOAWg3XgRyb0I6LYyYkiAo+3/KrwuBp8xG7A==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.5.2.tgz", + "integrity": "sha512-gBxPg3aVO6J0kpfHNILc+NMhXnqHumFxOmjYCFfOiLZfwhnnfhtsdA2hfJlDnj+8PjAs6kKQPenOTKj3Rf7zHw==", "hasInstallScript": true, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/fontawesome-svg-core": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.5.1.tgz", - "integrity": "sha512-MfRCYlQPXoLlpem+egxjfkEuP9UQswTrlCOsknus/NcMoblTH2g0jPrapbcIb04KGA7E2GZxbAccGZfWoYgsrQ==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.5.2.tgz", + "integrity": "sha512-5CdaCBGl8Rh9ohNdxeeTMxIj8oc3KNBgIeLMvJosBMdslK/UnEB8rzyDRrbKdL1kDweqBPo4GT9wvnakHWucZw==", "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.1" + "@fortawesome/fontawesome-common-types": "6.5.2" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-solid-svg-icons": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.1.tgz", - "integrity": "sha512-S1PPfU3mIJa59biTtXJz1oI0+KAXW6bkAb31XKhxdxtuXDiUIFsih4JR1v5BbxY7hVHsD1RKq+jRkVRaf773NQ==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.2.tgz", + "integrity": "sha512-QWFZYXFE7O1Gr1dTIp+D6UcFUF0qElOnZptpi7PBUMylJh+vFmIedVe1Ir6RM1t2tEQLLSV1k7bR4o92M+uqlw==", "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.1" + "@fortawesome/fontawesome-common-types": "6.5.2" }, "engines": { "node": ">=6" @@ -7353,25 +7353,25 @@ } }, "node_modules/algoliasearch": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.23.1.tgz", - "integrity": "sha512-LNK5n23zDXVf8kaLMZrVDEy4ecxIFUDEsQlx+He1l+TCmP8eiheLVMi5eyZlU6qmmq3UWCxZmp6hzCXS/hvXEw==", - "dependencies": { - "@algolia/cache-browser-local-storage": "4.23.1", - "@algolia/cache-common": "4.23.1", - "@algolia/cache-in-memory": "4.23.1", - "@algolia/client-account": "4.23.1", - "@algolia/client-analytics": "4.23.1", - "@algolia/client-common": "4.23.1", - "@algolia/client-personalization": "4.23.1", - "@algolia/client-search": "4.23.1", - "@algolia/logger-common": "4.23.1", - "@algolia/logger-console": "4.23.1", - "@algolia/recommend": "4.23.1", - "@algolia/requester-browser-xhr": "4.23.1", - "@algolia/requester-common": "4.23.1", - "@algolia/requester-node-http": "4.23.1", - "@algolia/transporter": "4.23.1" + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.23.3.tgz", + "integrity": "sha512-Le/3YgNvjW9zxIQMRhUHuhiUjAlKY/zsdZpfq4dlLqg6mEm0nL6yk+7f2hDOtLpxsgE4jSzDmvHL7nXdBp5feg==", + "dependencies": { + "@algolia/cache-browser-local-storage": "4.23.3", + "@algolia/cache-common": "4.23.3", + "@algolia/cache-in-memory": "4.23.3", + "@algolia/client-account": "4.23.3", + "@algolia/client-analytics": "4.23.3", + "@algolia/client-common": "4.23.3", + "@algolia/client-personalization": "4.23.3", + "@algolia/client-search": "4.23.3", + "@algolia/logger-common": "4.23.3", + "@algolia/logger-console": "4.23.3", + "@algolia/recommend": "4.23.3", + "@algolia/requester-browser-xhr": "4.23.3", + "@algolia/requester-common": "4.23.3", + "@algolia/requester-node-http": "4.23.3", + "@algolia/transporter": "4.23.3" } }, "node_modules/algoliasearch-helper": { diff --git a/website/package.json b/website/package.json index 78a2c6136c..14289f3145 100644 --- a/website/package.json +++ b/website/package.json @@ -23,8 +23,8 @@ "@docusaurus/theme-live-codeblock": "2.4.3", "@docusaurus/theme-mermaid": "^2.4.3", "@docusaurus/theme-search-algolia": "2.4.3", - "@fortawesome/fontawesome-svg-core": "^6.4.2", - "@fortawesome/free-solid-svg-icons": "^6.4.2", + "@fortawesome/fontawesome-svg-core": "^6.5.2", + "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/react-fontawesome": "^0.2.0", "@ledgerhq/hw-transport-webhid": "^6.28.5", "@mdx-js/react": "^1.6.22", @@ -43,7 +43,7 @@ "@taquito/tzip16": "file:../packages/taquito-tzip16", "@taquito/utils": "file:../packages/taquito-utils", "abort-controller": "^3.0.0", - "algoliasearch": "^4.22.1", + "algoliasearch": "^4.23.2", "axios": "^0.28.0", "buffer": "^6.0.3", "classnames": "^2.3.2", From 9c30e016251a372acd8733af09205fb9d7a66630 Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Tue, 14 May 2024 10:24:12 -0700 Subject: [PATCH 21/35] 2912 paris cleanup (#2957) * test: replaced all oxford ref with paris * test: updated test mentioning protocol * test: removed unneeded test case * test: refine failing_noop test --- .github/workflows/main.yml | 2 - docs/rpc_nodes.md | 2 - docs/rpc_nodes_integration_test.md | 2 +- docs/wallet_API.md | 4 +- integration-tests/README.md | 12 +- .../contract/operations/failing-noop.spec.ts | 22 +- .../originate-contract-with-chest.spec.ts | 10 +- .../__tests__/local-forging.spec.ts | 12 +- .../pseudo-entrypoints-forging.spec.ts | 4 +- .../rpc/get-protocol-constants.spec.ts | 132 -------- integration-tests/__tests__/rpc/nodes.spec.ts | 6 - .../__tests__/wallet/failing-noop.spec.ts | 22 +- integration-tests/config.ts | 25 +- integration-tests/data/allTestsCases.ts | 294 +++++++++--------- .../known-contracts-ProxfordY.ts | 8 - integration-tests/package.json | 2 - .../src/taquito-local-forging.ts | 2 +- 17 files changed, 185 insertions(+), 376 deletions(-) delete mode 100644 integration-tests/known-contracts-ProxfordY.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ed2c94723..4b879164be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,8 +43,6 @@ jobs: strategy: matrix: include: - - testnet: oxfordnet - testnet_uppercase: OXFORDNET - testnet: parisnet testnet_uppercase: PARISNET steps: diff --git a/docs/rpc_nodes.md b/docs/rpc_nodes.md index 6ce4048300..7b2996617a 100644 --- a/docs/rpc_nodes.md +++ b/docs/rpc_nodes.md @@ -25,13 +25,11 @@ values={[ |------------------|--------------|------------------------------------------|---------------------------------------------------------------------------------| | ECAD Labs | Mainnet | https://mainnet.ecadinfra.com | [Check](https://mainnet.ecadinfra.com/chains/main/blocks/head/header) | | ECAD Labs | Ghostnet | https://ghostnet.ecadinfra.com | [Check](https://ghostnet.ecadinfra.com/chains/main/blocks/head/header) | -| ECAD Labs | Oxfordnet | https://oxfordnet.ecadinfra.com | [Check](https://oxfordnet.ecadinfra.com/chains/main/blocks/head/header) | | SmartPy | Mainnet | https://mainnet.smartpy.io | [Check](https://mainnet.smartpy.io/chains/main/blocks/head/header) | | SmartPy | Ghostnet | https://ghostnet.smartpy.io | [Check](https://ghostnet.smartpy.io/chains/main/blocks/head/header) | | Tezos Foundation | Mainnet | https://rpc.tzbeta.net/ | [Check](https://rpc.tzbeta.net/chains/main/blocks/head/header) | | Marigold | Mainnet | https://mainnet.tezos.marigold.dev/ | [Check](https://mainnet.tezos.marigold.dev/chains/main/blocks/head/header) | | Marigold | Ghostnet | https://ghostnet.tezos.marigold.dev/ | [Check](https://ghostnet.tezos.marigold.dev/chains/main/blocks/head/header) | -| Marigold | Oxfordnet | https://oxfordnet.tezos.marigold.dev/ | [Check](https://oxfordnet.tezos.marigold.dev/chains/main/blocks/head/header) | *If you are aware of a public node missing from our list or our information is inaccurate, please help us by submitting an issue or pull request on our GitHub page.* diff --git a/docs/rpc_nodes_integration_test.md b/docs/rpc_nodes_integration_test.md index 493c643821..a811b85c76 100644 --- a/docs/rpc_nodes_integration_test.md +++ b/docs/rpc_nodes_integration_test.md @@ -8,7 +8,7 @@ author: Roxane Letourneau 1. The RPC nodes' integration tests are disabled by default. Remove `./rpc-nodes.spec.ts` from `"testPathIgnorePatterns"` in the package.json. - **oxfordnet**: `npm run test:parisnet rpc-nodes.spec.ts` + **parisnet**: `npm run test:parisnet rpc-nodes.spec.ts` **When all endpoints are accessible for a node, you will obtain:** diff --git a/docs/wallet_API.md b/docs/wallet_API.md index f73f5d32e9..04ad53a32c 100644 --- a/docs/wallet_API.md +++ b/docs/wallet_API.md @@ -88,7 +88,7 @@ Please check out the section [Subscribing to events](#subscribing-to-events) to In previous versions of Beacon, you were able to set the `network` property when doing `requestPermissions()`. This behavior was removed from Beacon, and you must now set the network when instantiating the wallet. -You can choose among `mainnet`, `oxfordnet`, `ghostnet` and `custom` to set up the network. Once the permissions have been configured, you can get the user's address by calling the `getPKH` method on the wallet: +You can choose among `mainnet`, `parisnet`, `ghostnet` and `custom` to set up the network. Once the permissions have been configured, you can get the user's address by calling the `getPKH` method on the wallet: ```js const userAddress = await wallet.getPKH(); @@ -175,7 +175,7 @@ const wallet = new TempleWallet('MyAwesomeDapp'); The class constructor takes one parameter, the name of your dapp (this will be used later in the transaction confirmation pop-up). After the instantiation, we can connect the wallet by calling the `connect` method: ```js -await wallet.connect('mainnet' | 'oxfordnet' | 'ghostnet' | 'mondaynet' | 'sandbox'); +await wallet.connect('mainnet' | 'parisnet' | 'ghostnet' | 'mondaynet' | 'sandbox'); ``` (Temple used to be called Thanos and some Taquito code still uses the name Thanos.) diff --git a/integration-tests/README.md b/integration-tests/README.md index 65e60ff3c7..d76fc14dc9 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -37,7 +37,7 @@ Depending on the current Tezos upgrade cycle, multiple testnet networks may be c ``` -OXFORDNET=true npm run test +PARISNET=true npm run test ``` ## Configuration @@ -52,7 +52,7 @@ If different testnets are configured in the `config.ts` file, you can run tests ``` -npm run test:oxfordnet contract-with-bigmap-init.spec.ts +npm run test:parisnet contract-with-bigmap-init.spec.ts ``` @@ -60,7 +60,7 @@ Or for a specific test within a test file: ``` -npm run test:oxfordnet -- -t "Verify contract.originate for a contract and call deposit method with unit param" +npm run test:parisnet -- -t "Verify contract.originate for a contract and call deposit method with unit param" ``` @@ -70,7 +70,7 @@ npm run test:oxfordnet -- -t "Verify contract.originate for a contract and call To run tests against a node that is not pre-configured in Taquito, use: -`export TEZOS_RPC_OXFORDNET='http://localhost:8732'`. +`export TEZOS_RPC_PARISNET='http://localhost:8732'`. ## Using a Secret Key Instead of the Keygen API @@ -79,7 +79,7 @@ By default, the integration tests use an ephemeral key managed by the Keygen API ``` -npm run test:oxfordnet-secret-key contract-with-bigmap-init.spec.ts +npm run test:parisnet-secret-key contract-with-bigmap-init.spec.ts ``` @@ -103,7 +103,7 @@ To review the graphical report of the test run, open the index.html file in ~/ta ## Taquito Integration Tests with Flextesa :::warning -Due to the discontinuation of Flextesa support from Protocol Oxford onwards, we unfortunately will not be testing against sandboxes anymore. +Due to the discontinuation of Flextesa support from Protocol Oxford onwards, we unfortunately will not be testing against sandboxes anymore. The only sandbox tests we're running points to the latest Nairobibox to specifically test for the `ballot` and `drain_delegate` operation. ::: diff --git a/integration-tests/__tests__/contract/operations/failing-noop.spec.ts b/integration-tests/__tests__/contract/operations/failing-noop.spec.ts index 8727149479..223b985eb1 100644 --- a/integration-tests/__tests__/contract/operations/failing-noop.spec.ts +++ b/integration-tests/__tests__/contract/operations/failing-noop.spec.ts @@ -3,21 +3,17 @@ import { OpKind, TezosToolkit } from "@taquito/taquito"; import { InMemorySigner } from "@taquito/signer"; import { verifySignature } from "@taquito/utils"; -CONFIGS().forEach(({ rpc }) => { - const aliceSKey = 'edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq' - +CONFIGS().forEach(({ lib, setup, rpc }) => { describe(`Test failing_noop through contract api using: ${rpc}`, () => { - let Tezos: TezosToolkit; + let Tezos = lib; beforeAll(async () => { - if(rpc.includes('oxfordnet')){ - Tezos = new TezosToolkit('https://rpc.tzkt.io/oxfordnet'); - } else if(rpc.includes('ghostnet')){ - Tezos = new TezosToolkit('https://rpc.tzkt.io/ghostnet'); - } else { - Tezos = new TezosToolkit(rpc); + setup(true); + if (rpc.includes('parisnet')) { + Tezos.setProvider({ rpc: 'https://rpc.tzkt.io/parisnet' }); // public archive node to fetch genesis block + } else if (rpc.includes('ghostnet')) { + Tezos.setProvider({ rpc: 'https://rpc.tzkt.io/ghostnet' }); // public archive node to fetch genesis block } - Tezos.setSignerProvider(new InMemorySigner(aliceSKey)); }); it('Verify that the contract.failingNoop signs a text on the genesis block', async () => { @@ -43,8 +39,8 @@ CONFIGS().forEach(({ rpc }) => { let Mainnet: TezosToolkit; beforeAll(async () => { - Mainnet = new TezosToolkit('https://rpc.tzkt.io/mainnet'); // this is a mainnet archive history mode public rpc node url - Mainnet.setSignerProvider(new InMemorySigner(aliceSKey)); + Mainnet = new TezosToolkit('https://rpc.tzkt.io/mainnet'); // public archive node to fetch genesis block + Mainnet.setSignerProvider(new InMemorySigner('edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq')); // alice's secret key }); it('Verify that the contract.failingNoop result is as expected when the block and secret key are kept constant', async () => { diff --git a/integration-tests/__tests__/contract/originate-contract-with-chest.spec.ts b/integration-tests/__tests__/contract/originate-contract-with-chest.spec.ts index 70e9a83e4b..3c0b1908a6 100644 --- a/integration-tests/__tests__/contract/originate-contract-with-chest.spec.ts +++ b/integration-tests/__tests__/contract/originate-contract-with-chest.spec.ts @@ -1,12 +1,10 @@ -import { DefaultContractType, OriginationOperation, Protocols } from "@taquito/taquito"; +import { DefaultContractType, OriginationOperation } from "@taquito/taquito"; import { CONFIGS } from "../../config"; -import { ProtoGreaterOrEqual } from "@taquito/michel-codec"; import { buf2hex } from "@taquito/utils"; import { Chest } from '@taquito/timelock'; -CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { +CONFIGS().forEach(({ lib, rpc, setup }) => { const Tezos = lib; - const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip; describe(`Test contract origination with timelock types (chest or chest_key) in storage and retrieve its value through contract api: ${rpc}`, () => { const { chest, key } = Chest.newChestAndKey(new TextEncoder().encode('test'), 1000); @@ -31,7 +29,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { await opChestKey.confirmation() }) - oxfordAndAlpha('Verify contract.originate for a contract with chest in storage', async () => { + it('Verify contract.originate for a contract with chest in storage', async () => { expect(opChest.hash).toBeDefined(); expect(opChest.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY) const contract = await opChest.contract(); @@ -40,7 +38,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { expect(storage).toEqual(buf2hex(chest.encode())); }); - oxfordAndAlpha('Verify contract.originate for a contract with chest_key in storage', async () => { + it('Verify contract.originate for a contract with chest_key in storage', async () => { expect(opChestKey.hash).toBeDefined(); expect(opChestKey.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY) const contract = await opChestKey.contract(); diff --git a/integration-tests/__tests__/local-forging.spec.ts b/integration-tests/__tests__/local-forging.spec.ts index b047d03e0d..d5cd1634af 100644 --- a/integration-tests/__tests__/local-forging.spec.ts +++ b/integration-tests/__tests__/local-forging.spec.ts @@ -1,12 +1,11 @@ import { CONFIGS } from "../config"; -import { commonCases, oxfordCases, parisCases } from '../data/allTestsCases'; +import { commonCases, parisCases } from '../data/allTestsCases'; import { LocalForger, ProtocolsHash } from '@taquito/local-forging' import { Protocols, TezosToolkit } from "@taquito/taquito"; import { ProtoGreaterOrEqual } from '@taquito/michel-codec'; CONFIGS().forEach(({ rpc, protocol }) => { const Tezos = new TezosToolkit(rpc); - const oxfordAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.ProxfordY) ? test : test.skip const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip describe(`Test local forger: ${rpc}`, () => { @@ -19,15 +18,6 @@ CONFIGS().forEach(({ rpc, protocol }) => { expect(await localForger.parse(rpcResult)).toEqual(expected || operation); }); }); - oxfordCases.forEach(({ name, operation, expected }) => { - oxfordAndAlpha(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { - const localForger = new LocalForger(protocol as unknown as ProtocolsHash); - const result = await localForger.forge(operation); - const rpcResult = await Tezos.rpc.forgeOperations(operation); - expect(result).toEqual(rpcResult); - expect(await localForger.parse(result)).toEqual(expected || operation); - }); - }); // all protocols commonCases.forEach(({ name, operation, expected }) => { it(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => { diff --git a/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts b/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts index 65a0a3f624..d32c05525c 100644 --- a/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts +++ b/integration-tests/__tests__/pseudo-entrypoints-forging.spec.ts @@ -8,7 +8,7 @@ CONFIGS().forEach(({ rpc, protocol, setup, lib }) => { describe(`Test forging pseudo entrypoints: ${rpc}`, () => { let contract: DefaultContractType // for every new protocol need to check https://tezos.gitlab.io/shell/p2p_api.html#alpha-entrypoint-determined-from-data-8-bit-tag for the latest entrypoints and corresponding tag - let entrypoint = { 0: 'default', 1: 'root', 2: 'do', 3: 'set_delegate', 4: 'remove_delegate', 5: 'deposit', 6: 'stake', 7: 'unstake', 8: 'finalize_unstake', 9: 'set_delegate_parameters' } + let parisEntrypoint = { 0: 'default', 1: 'root', 2: 'do', 3: 'set_delegate', 4: 'remove_delegate', 5: 'deposit', 6: 'stake', 7: 'unstake', 8: 'finalize_unstake', 9: 'set_delegate_parameters' } beforeAll(async () => { await setup(); @@ -23,7 +23,7 @@ CONFIGS().forEach(({ rpc, protocol, setup, lib }) => { } catch(e) {console.log(e)} }) - Object.values(entrypoint).forEach(name => { + Object.values(parisEntrypoint).forEach(name => { it(`Verify that local forge will return same result as for rpc forge for entrypoints name ${name}`, async () => { const localForger = new LocalForger(protocol as unknown as ProtocolsHash); const methodObject = await contract.methodsObject[name](UnitValue) diff --git a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts index 575054d59c..f6d241d129 100644 --- a/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts +++ b/integration-tests/__tests__/rpc/get-protocol-constants.spec.ts @@ -5,7 +5,6 @@ import { ConstantsResponseProto019, ConstantsResponseProto020 } from '@taquito/r CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { const Tezos = lib; - const oxfordnet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProxfordY) ? test : test.skip; const parisnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PtParisBQ) ? test : test.skip; const weeklynet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProtoALpha) ? test : test.skip; describe('Test fetching constants for all protocols on Mainnet', () => { @@ -288,137 +287,6 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => { }); }); - - oxfordnet(`should successfully fetch all constants for Oxfordnet using ${rpc}`, async () => { - Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto019 = await Tezos.rpc.getConstants(); - expect(constants).toEqual({ - adaptive_issuance_activation_vote_enable: false, - adaptive_issuance_launch_ema_threshold: 100000000, - adaptive_rewards_params: { - center_dz: { - denominator: "2", - numerator: "1", - }, - growth_rate: { - denominator: "100", - numerator: "1", - }, - issuance_ratio_max: { - denominator: "20", - numerator: "1", - }, - issuance_ratio_min: { - denominator: "2000", - numerator: "1", - }, - max_bonus: "50000000000000", - radius_dz: { - denominator: "50", - numerator: "1", - }, - }, - autostaking_enable: true, - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - 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', - preserved_cycles: 3, - blocks_per_cycle: 8192, - blocks_per_commitment: 64, - blocks_per_stake_snapshot: 512, - nonce_revelation_threshold: 512, - cycles_per_voting_period: 1, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(2600000), - 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_baking: 5, - percentage_of_frozen_deposits_slashed_per_double_attestation: 50, - minimal_frozen_stake: '600000000', - limit_of_delegation_over_baking: 9, - issuance_weights: { - attesting_reward_weight: 10240, - baking_reward_bonus_weight: 5120, - baking_reward_fixed_portion_weight: 5120, - base_total_issued_per_minute: "85007812", - liquidity_baking_subsidy_weight: 1280, - seed_nonce_revelation_tip_weight: 1, - vdf_revelation_tip_weight: 1, - }, - min_proposal_quorum: 500, - edge_of_staking_over_delegation: 2, - global_limit_of_staking_over_baking: 5, - liquidity_baking_toggle_ema_threshold: 1000000000, - max_operations_time_to_live: 240, - minimal_block_delay: new BigNumber(8), - delay_increment_per_round: new BigNumber(3), - consensus_committee_size: 7000, - consensus_threshold: 4667, - minimal_participation_ratio: { - numerator: 2, - denominator: 3 - }, - max_slashing_period: 2, - cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cache_sampler_state_cycles: 8, - dal_parametric: { - feature_enable: false, - blocks_per_epoch: 1, - attestation_lag: 4, - attestation_threshold: 50, - redundancy_factor: 16, - page_size: 4096, - slot_size: 1048576, - number_of_shards: 2048, - number_of_slots: 256, - }, - quorum_max: 7000, - quorum_min: 2000, - smart_rollup_arith_pvm_enable: false, - smart_rollup_challenge_window_in_blocks: 40, - 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_max_number_of_cemented_commitments: 5, - smart_rollup_max_number_of_parallel_games: 32, - smart_rollup_message_size_limit: 4096, - smart_rollup_number_of_sections_in_dissection: 32, - smart_rollup_origination_size: 6314, - smart_rollup_private_enable: true, - smart_rollup_reveal_activation_level: { - dal_page: 2147483646, - dal_parameters: 2147483646, - metadata: 0, - raw_data: { - Blake2B: 0, - }, - }, - smart_rollup_riscv_pvm_enable: false, - smart_rollup_stake_amount: '10000000000', - smart_rollup_timeout_period_in_blocks: 500, - testnet_dictator: 'tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8', - vdf_difficulty: new BigNumber(10000000000), - zk_rollup_enable: false, - zk_rollup_max_ticket_payload_size: 2048, - zk_rollup_min_pending_to_process: 10, - zk_rollup_origination_size: 4000, - }); - }); - weeklynet(`should successfully fetch all constants for weeklynet using ${rpc}`, async () => { Tezos.setRpcProvider(rpc); const constants: ConstantsResponseProto019 = await Tezos.rpc.getConstants(); diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index c03f92e3ad..5a0fd6acf3 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -21,7 +21,6 @@ CONFIGS().forEach( }) => { const Tezos = lib; const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test; - const oxford = protocol === Protocols.ProxfordY ? test : test.skip; const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip; let ticketContract: DefaultContractType; @@ -473,11 +472,6 @@ CONFIGS().forEach( expect(ticketBalances[0].amount).toBeDefined(); }); - oxford(`Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle null for ${rpc}`, async () => { - const launchCycle = await rpcClient.getAdaptiveIssuanceLaunchCycle(); - expect(launchCycle).toEqual(null); - }) - parisAndAlpha(`Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for ${rpc}`, async () => { const launchCycle = await rpcClient.getAdaptiveIssuanceLaunchCycle(); expect(launchCycle).toEqual(6); diff --git a/integration-tests/__tests__/wallet/failing-noop.spec.ts b/integration-tests/__tests__/wallet/failing-noop.spec.ts index cf64261eaa..edc9cb99ee 100644 --- a/integration-tests/__tests__/wallet/failing-noop.spec.ts +++ b/integration-tests/__tests__/wallet/failing-noop.spec.ts @@ -3,21 +3,17 @@ import { OpKind, TezosToolkit } from "@taquito/taquito"; import { InMemorySigner } from "@taquito/signer"; import { verifySignature } from "@taquito/utils"; -CONFIGS().forEach(({ rpc }) => { - const aliceSKey = 'edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq' - +CONFIGS().forEach(({ lib, setup, rpc }) => { describe(`Test failing_noop through wallet api using: ${rpc}`, () => { - let Tezos: TezosToolkit; + let Tezos = lib; beforeAll(async () => { - if(rpc.includes('oxfordnet')){ - Tezos = new TezosToolkit('https://rpc.tzkt.io/oxfordnet'); - } else if(rpc.includes('ghostnet')){ - Tezos = new TezosToolkit('https://rpc.tzkt.io/ghostnet'); - } else { - Tezos = new TezosToolkit(rpc); + setup(true) + if (rpc.includes('parisnet')) { + Tezos.setProvider({ rpc: 'https://rpc.tzkt.io/parisnet' }); // public archive node to fetch genesis block + } else if (rpc.includes('ghostnet')) { + Tezos.setProvider({ rpc: 'https://rpc.tzkt.io/ghostnet' }); // public archive node to fetch genesis block } - Tezos.setSignerProvider(new InMemorySigner(aliceSKey)); }); it('Verify that the wallet.failingNoop signs a text on the genesis block', async () => { @@ -43,8 +39,8 @@ CONFIGS().forEach(({ rpc }) => { let Mainnet: TezosToolkit; beforeAll(async () => { - Mainnet = new TezosToolkit('https://rpc.tzkt.io/mainnet'); // this is an archive node public rpc url for mainnet - Mainnet.setSignerProvider(new InMemorySigner(aliceSKey)); + Mainnet = new TezosToolkit('https://rpc.tzkt.io/mainnet'); // public archive node to fetch genesis block + Mainnet.setSignerProvider(new InMemorySigner('edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq')); // alice's secret key }); it('Verify that the wallet.failingNoop result is as expected when the block and secret key are kept constant', async () => { diff --git a/integration-tests/config.ts b/integration-tests/config.ts index 7e71535b17..daf75f09db 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -7,7 +7,6 @@ import { RpcClient, RpcClientCache } from '@taquito/rpc'; import { KnownContracts } from './known-contracts'; import { knownContractsProtoALph } from './known-contracts-ProtoALph'; import { knownContractsPtGhostnet } from './known-contracts-PtGhostnet'; -import { knownContractsProxfordY } from './known-contracts-ProxfordY'; import { knownContractsPtParisBQ } from './known-contracts-PtParisBQ'; import { knownContractsPtNairobi } from './known-contracts-PtNairobi'; @@ -33,7 +32,7 @@ const forgers: ForgerType[] = [ForgerType.COMPOSITE]; // user running integration test can pass environment variable TEZOS_NETWORK_TYPE=sandbox to specify which network to run against export enum NetworkType { - TESTNET, // corresponds ghostnet, oxfordnet, parisnet and weeklynet etc. + TESTNET, // corresponds ghostnet, parisnet and weeklynet etc. SANDBOX, // corresponds to flextesa local chain } @@ -130,18 +129,6 @@ const defaultConfig = ({ } } -const oxfordnetEphemeral: Config = - defaultConfig({ - networkName: 'OXFORDNET', - protocol: Protocols.ProxfordY, - defaultRpc: 'http://ecad-oxfordnet-full.i.tez.ie:8732', - knownContracts: knownContractsProxfordY, - signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/oxfordnet') - }); - -const oxfordnetSecretKey: Config = - { ...oxfordnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-oxfordnet-full:8732' } }; - const parisnetEphemeral: Config = defaultConfig({ networkName: 'PARISNET', @@ -152,7 +139,7 @@ const parisnetEphemeral: Config = }); const parisnetSecretKey: Config = - { ...oxfordnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://parisnet.i.ecadinfra.com:8732/' } }; + { ...parisnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://parisnet.i.ecadinfra.com:8732/' } }; const nairobinetSecretKey: Config = defaultConfig({ @@ -190,11 +177,9 @@ const weeklynetSecretKey: Config = const providers: Config[] = []; if (process.env['RUN_WITH_SECRET_KEY']) { - providers.push(oxfordnetSecretKey, parisnetSecretKey); + providers.push(parisnetSecretKey); } else if (process.env['RUN_PARISNET_WITH_SECRET_KEY']) { providers.push(parisnetSecretKey); -} else if (process.env['RUN_OXFORDNET_WITH_SECRET_KEY']) { - providers.push(oxfordnetSecretKey); } else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) { providers.push(ghostnetSecretKey); } else if (process.env['RUN_NAIROBINET_WITH_SECRET_KEY']) { @@ -203,14 +188,12 @@ if (process.env['RUN_WITH_SECRET_KEY']) { providers.push(weeklynetSecretKey); } else if (process.env['PARISNET']) { providers.push(parisnetEphemeral); -} else if (process.env['OXFORDNET']) { - providers.push(oxfordnetEphemeral); } else if (process.env['GHOSTNET']) { providers.push(ghostnetEphemeral); } else if (process.env['WEEKLYNET']) { providers.push(weeklynetEphemeral); } else { - providers.push(oxfordnetEphemeral, parisnetEphemeral); + providers.push(parisnetEphemeral); } const setupForger = (Tezos: TezosToolkit, forger: ForgerType): void => { diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index c8ea6b13ee..f47cfd39fd 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -88,153 +88,6 @@ export const parisCases: TestCase[] = [ } }, ] -export const oxfordCases: TestCase[] = [ - { - name: 'Origination of a contract that contains the types chest, chest_key and the instruction OPEN_CHEST', - operation: { - branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', - contents: [ - { - kind: OpKind.ORIGINATION, - counter: '1', - source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', - fee: '10000', - gas_limit: '10', - storage_limit: '10', - balance: '0', - script: { - code: timelockCode, - storage: timelockStorage, - }, - }, - ], - }, - expected: { - branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', - contents: [ - { - kind: OpKind.ORIGINATION, - counter: '1', - source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', - fee: '10000', - gas_limit: '10', - storage_limit: '10', - balance: '0', - script: { - code: timelockExpected, - storage: timelockStorage, - }, - }, - ], - }, - }, - { - name: 'Attestation', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', - contents: [ - { - kind: OpKind.ATTESTATION, - slot: 0, - level: 66299, - round: 5, - block_payload_hash: 'vh3FEkypvxUYLwjGYd2Sme7aWyfX8npDsqxcL6imVpBWnAZeNn2n', - } - ] - } - }, - { - name: 'Transaction with stake entrypoint', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', - contents: [{ - kind: OpKind.TRANSACTION, - source: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", - fee: "0", - counter: "407", - gas_limit: "1040000", - storage_limit: "60000", - amount: "1000000000", - destination: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", - parameters: - { entrypoint: "stake", value: { prim: "Unit" } } - }] - }, - }, - { - name: 'Transaction with unstake entrypoint', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', - contents: [ - { - kind: OpKind.TRANSACTION, - source: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", - fee: "689", - counter: "408", - gas_limit: "4250", - storage_limit: "0", - amount: "99999999999000000", - destination: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", - parameters: - { entrypoint: "unstake", value: { prim: "Unit" } } - }], - }, - }, - { - name: 'Transaction with finalize_unstake entrypoint', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', - contents: [ - { - kind: OpKind.TRANSACTION, - source: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", - fee: "409", - counter: "409", - gas_limit: "1529", - storage_limit: "0", - amount: "0", - destination: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", - parameters: - { - entrypoint: "finalize_unstake", - value: { prim: "Unit" } - } - }], - }, - }, - { - name: 'Transaction with set_delegate_parameters entrypoint', - operation: { - branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', - contents: [ - { - kind: OpKind.TRANSACTION, - source: "tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp", - fee: "351", - counter: "391", - gas_limit: "791", - storage_limit: "0", - amount: "0", - destination: "tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp", - parameters: - { - entrypoint: "set_delegate_parameters", - value: - { - prim: "Pair", - args: - [{ int: "5000000" }, - { - prim: "Pair", - args: - [{ int: "1000000000" }, { prim: "Unit" }] - }] - } - } - }] - }, - }, -]; export const commonCases: TestCase[] = [ { @@ -1625,5 +1478,150 @@ export const commonCases: TestCase[] = [ } ] } - } + }, + { + name: 'Origination of a contract that contains the types chest, chest_key and the instruction OPEN_CHEST', + operation: { + branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', + contents: [ + { + kind: OpKind.ORIGINATION, + counter: '1', + source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', + fee: '10000', + gas_limit: '10', + storage_limit: '10', + balance: '0', + script: { + code: timelockCode, + storage: timelockStorage, + }, + }, + ], + }, + expected: { + branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', + contents: [ + { + kind: OpKind.ORIGINATION, + counter: '1', + source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn', + fee: '10000', + gas_limit: '10', + storage_limit: '10', + balance: '0', + script: { + code: timelockExpected, + storage: timelockStorage, + }, + }, + ], + }, + }, + { + name: 'Attestation', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.ATTESTATION, + slot: 0, + level: 66299, + round: 5, + block_payload_hash: 'vh3FEkypvxUYLwjGYd2Sme7aWyfX8npDsqxcL6imVpBWnAZeNn2n', + } + ] + } + }, + { + name: 'Transaction with stake entrypoint', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [{ + kind: OpKind.TRANSACTION, + source: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", + fee: "0", + counter: "407", + gas_limit: "1040000", + storage_limit: "60000", + amount: "1000000000", + destination: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", + parameters: + { entrypoint: "stake", value: { prim: "Unit" } } + }] + }, + }, + { + name: 'Transaction with unstake entrypoint', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.TRANSACTION, + source: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", + fee: "689", + counter: "408", + gas_limit: "4250", + storage_limit: "0", + amount: "99999999999000000", + destination: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", + parameters: + { entrypoint: "unstake", value: { prim: "Unit" } } + }], + }, + }, + { + name: 'Transaction with finalize_unstake entrypoint', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.TRANSACTION, + source: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", + fee: "409", + counter: "409", + gas_limit: "1529", + storage_limit: "0", + amount: "0", + destination: "tz1eDDguimfor6kkt96Ri4pBeEZXEzvuyjQX", + parameters: + { + entrypoint: "finalize_unstake", + value: { prim: "Unit" } + } + }], + }, + }, + { + name: 'Transaction with set_delegate_parameters entrypoint', + operation: { + branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX', + contents: [ + { + kind: OpKind.TRANSACTION, + source: "tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp", + fee: "351", + counter: "391", + gas_limit: "791", + storage_limit: "0", + amount: "0", + destination: "tz1X1TKpLiZuPEo2YVvDiqQ47Zp9a797ejkp", + parameters: + { + entrypoint: "set_delegate_parameters", + value: + { + prim: "Pair", + args: + [{ int: "5000000" }, + { + prim: "Pair", + args: + [{ int: "1000000000" }, { prim: "Unit" }] + }] + } + } + }] + }, + }, ]; diff --git a/integration-tests/known-contracts-ProxfordY.ts b/integration-tests/known-contracts-ProxfordY.ts deleted file mode 100644 index 552641d1ec..0000000000 --- a/integration-tests/known-contracts-ProxfordY.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { KnownContracts } from './known-contracts'; -export const knownContractsProxfordY: KnownContracts = { - contract: "KT1UTWPed6L8pNmWJJhPgwLELxmpua18nvZB", - bigMapContract: "KT1TpJY5K5wg9dYgMhLpcvmPnreE4trxkCdh", - tzip12BigMapOffChainContract: "KT1PxJcsmPm365VGCbopTz7411kwF7u1mFkv", - saplingContract: "KT1PPnjL9TudMnZ23UmnGkCLbZ7TiMjNUVhe", - onChainViewContractAddress: "KT1Mc9DhvGtZPCg5TobjZdgHheCmDERUYCTj", -}; diff --git a/integration-tests/package.json b/integration-tests/package.json index 0282d31a4b..884f514232 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -3,8 +3,6 @@ "scripts": { "test": "jest", "test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand", - "test:oxfordnet": "OXFORDNET=true jest", - "test:oxfordnet-secret-key": "RUN_OXFORDNET_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", diff --git a/packages/taquito-local-forging/src/taquito-local-forging.ts b/packages/taquito-local-forging/src/taquito-local-forging.ts index b819c7515c..6fefd5e487 100644 --- a/packages/taquito-local-forging/src/taquito-local-forging.ts +++ b/packages/taquito-local-forging/src/taquito-local-forging.ts @@ -22,7 +22,7 @@ export * from './interface'; export { VERSION } from './version'; export { ProtocolsHash } from './protocols'; -const PROTOCOL_CURRENT = ProtocolsHash.ProxfordY; +const PROTOCOL_CURRENT = ProtocolsHash.PtParisBQ; export function getCodec(codec: CODEC, _proto: ProtocolsHash) { return { From d990528649f05582a36942e90de29cb74fe2da63 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 14 May 2024 11:20:20 -0700 Subject: [PATCH 22/35] updated beacon wallet with new event sub (#2961) --- .../src/taquito-beacon-wallet.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts b/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts index c725124970..d856d1b1fb 100644 --- a/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts +++ b/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts @@ -10,6 +10,8 @@ import { PermissionScope, getDAppClientInstance, SigningType, + AccountInfo, + BeaconEvent, } from '@airgap/beacon-dapp'; import { BeaconWalletNotInitialized, MissingRequiredScopes } from './errors'; import toBuffer from 'typedarray-to-buffer'; @@ -35,9 +37,13 @@ export { BeaconWalletNotInitialized, MissingRequiredScopes } from './errors'; export class BeaconWallet implements WalletProvider { public client: DAppClient; + public account: AccountInfo | undefined; constructor(options: DAppClientOptions) { this.client = getDAppClientInstance(options); + this.client.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, async (data) => { + this.account = data; + }); } private validateRequiredScopesOrFail( @@ -62,19 +68,17 @@ export class BeaconWallet implements WalletProvider { } async getPKH() { - const account = await this.client.getActiveAccount(); - if (!account) { + if (!this.account) { throw new BeaconWalletNotInitialized(); } - return account.address; + return this.account.address; } async getPK() { - const account = await this.client.getActiveAccount(); - if (!account) { + if (!this.account) { throw new BeaconWalletNotInitialized(); } - return account.publicKey ?? ''; + return this.account.publicKey ?? ''; } async mapTransferParamsToWalletParams(params: () => Promise) { @@ -221,11 +225,10 @@ export class BeaconWallet implements WalletProvider { } async sendOperations(params: any[]) { - const account = await this.client.getActiveAccount(); - if (!account) { + if (!this.account) { throw new BeaconWalletNotInitialized(); } - const permissions = account.scopes; + const permissions = this.account.scopes; this.validateRequiredScopesOrFail(permissions, [PermissionScope.OPERATION_REQUEST]); const { transactionHash } = await this.client.requestOperation({ operationDetails: params }); From 7dfd0586c0e2578244387b612cd28d80f0a5da7e Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 14 May 2024 12:33:22 -0700 Subject: [PATCH 23/35] added comment and trigger ci --- packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts b/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts index d856d1b1fb..1bc77474a4 100644 --- a/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts +++ b/packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts @@ -41,6 +41,7 @@ export class BeaconWallet implements WalletProvider { constructor(options: DAppClientOptions) { this.client = getDAppClientInstance(options); + // Subscribe to the active account set event, this will update when there are account changes happening in the dApp this.client.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, async (data) => { this.account = data; }); From 55491dbb67866d3196843b167ca9303f803b1a99 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 14 May 2024 13:14:35 -0700 Subject: [PATCH 24/35] chore(releng) bump version to 20.0.0-beta.1 --- apps/taquito-test-dapp/package.json | 10 +- example/package.json | 22 +- integration-tests/package.json | 30 +-- lerna.json | 2 +- package-lock.json | 204 +++++++++--------- packages/taquito-beacon-wallet/package.json | 6 +- packages/taquito-beacon-wallet/src/version.ts | 4 +- .../taquito-contracts-library/package.json | 10 +- .../taquito-contracts-library/src/version.ts | 4 +- packages/taquito-core/package.json | 2 +- packages/taquito-core/src/version.ts | 4 +- packages/taquito-http-utils/package.json | 4 +- packages/taquito-http-utils/src/version.ts | 4 +- packages/taquito-ledger-signer/package.json | 8 +- packages/taquito-ledger-signer/src/version.ts | 4 +- packages/taquito-local-forging/package.json | 8 +- packages/taquito-local-forging/src/version.ts | 4 +- .../pack-test-tool/package.json | 4 +- packages/taquito-michel-codec/package.json | 4 +- packages/taquito-michel-codec/src/version.ts | 4 +- .../taquito-michelson-encoder/package.json | 8 +- .../taquito-michelson-encoder/src/version.ts | 4 +- packages/taquito-remote-signer/package.json | 10 +- packages/taquito-remote-signer/src/version.ts | 4 +- packages/taquito-rpc/package.json | 8 +- packages/taquito-rpc/src/version.ts | 4 +- packages/taquito-sapling/package.json | 10 +- packages/taquito-sapling/src/version.ts | 4 +- packages/taquito-signer/package.json | 8 +- packages/taquito-signer/src/version.ts | 4 +- packages/taquito-timelock/package.json | 8 +- packages/taquito-timelock/src/version.ts | 4 +- packages/taquito-tzip12/package.json | 10 +- packages/taquito-tzip12/src/version.ts | 4 +- packages/taquito-tzip16/package.json | 14 +- packages/taquito-tzip16/src/version.ts | 4 +- packages/taquito-utils/package.json | 4 +- packages/taquito-utils/src/version.ts | 4 +- packages/taquito/README.md | 2 +- packages/taquito/assets-manifest.json | 2 +- packages/taquito/package.json | 16 +- packages/taquito/src/version.ts | 4 +- 42 files changed, 241 insertions(+), 241 deletions(-) diff --git a/apps/taquito-test-dapp/package.json b/apps/taquito-test-dapp/package.json index 7f7712acf5..79ed2ac601 100644 --- a/apps/taquito-test-dapp/package.json +++ b/apps/taquito-test-dapp/package.json @@ -1,7 +1,7 @@ { "name": "taquito-test-dapp-vite", "private": true, - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "type": "module", "scripts": { "dev": "vite", @@ -26,10 +26,10 @@ "dependencies": { "@airgap/beacon-sdk": "^4.2.2-beta.4", "@airgap/beacon-types": "^4.2.2-beta.4", - "@taquito/beacon-wallet": "^20.0.0-beta.0", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/beacon-wallet": "^20.0.0-beta.1", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "buffer": "^6.0.3", "svelte-select": "^5.7.0", "vite-compatible-readable-stream": "^3.6.1" diff --git a/example/package.json b/example/package.json index b597447708..52229a1bb1 100644 --- a/example/package.json +++ b/example/package.json @@ -1,7 +1,7 @@ { "name": "@taquito/example", "private": true, - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "scripts": { "example": "node -r ts-node/register --preserve-symlinks example-node.ts", "example:activation": "node -r ts-node/register --preserve-symlinks example-activate.ts", @@ -42,16 +42,16 @@ }, "dependencies": { "@ledgerhq/hw-transport-node-hid": "^6.28.5", - "@taquito/ledger-signer": "^20.0.0-beta.0", - "@taquito/local-forging": "^20.0.0-beta.0", - "@taquito/michel-codec": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/sapling": "^20.0.0-beta.0", - "@taquito/signer": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/tzip16": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/ledger-signer": "^20.0.0-beta.1", + "@taquito/local-forging": "^20.0.0-beta.1", + "@taquito/michel-codec": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/sapling": "^20.0.0-beta.1", + "@taquito/signer": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/tzip16": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/integration-tests/package.json b/integration-tests/package.json index 884f514232..626313bd51 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -13,26 +13,26 @@ "originate-known-contracts": "node -r ts-node/register originate-known-contracts.ts", "originate-known-contracts-and-run-test": "node -r ts-node/register originate-known-contracts.ts && jest" }, - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "dependencies": { "@ledgerhq/devices": "8.2.2", "@ledgerhq/hw-transport": "6.30.5", "@ledgerhq/hw-transport-node-hid": "6.28.5", "@ledgerhq/hw-transport-node-hid-noevents": "6.29.5", - "@taquito/contracts-library": "^20.0.0-beta.0", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/local-forging": "^20.0.0-beta.0", - "@taquito/michel-codec": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/remote-signer": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/sapling": "^20.0.0-beta.0", - "@taquito/signer": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/tzip12": "^20.0.0-beta.0", - "@taquito/tzip16": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/contracts-library": "^20.0.0-beta.1", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/local-forging": "^20.0.0-beta.1", + "@taquito/michel-codec": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/remote-signer": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/sapling": "^20.0.0-beta.1", + "@taquito/signer": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/tzip12": "^20.0.0-beta.1", + "@taquito/tzip16": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1" diff --git a/lerna.json b/lerna.json index 52f59785cc..fa980a3239 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "useNx": true, - "version": "20.0.0-beta.0" + "version": "20.0.0-beta.1" } diff --git a/package-lock.json b/package-lock.json index 1dc1a903b2..fa47890391 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,14 +56,14 @@ }, "apps/taquito-test-dapp": { "name": "taquito-test-dapp-vite", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "dependencies": { "@airgap/beacon-sdk": "^4.2.2-beta.4", "@airgap/beacon-types": "^4.2.2-beta.4", - "@taquito/beacon-wallet": "^20.0.0-beta.0", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/beacon-wallet": "^20.0.0-beta.1", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "buffer": "^6.0.3", "svelte-select": "^5.7.0", "vite-compatible-readable-stream": "^3.6.1" @@ -85,19 +85,19 @@ }, "example": { "name": "@taquito/example", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "dependencies": { "@ledgerhq/hw-transport-node-hid": "^6.28.5", - "@taquito/ledger-signer": "^20.0.0-beta.0", - "@taquito/local-forging": "^20.0.0-beta.0", - "@taquito/michel-codec": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/sapling": "^20.0.0-beta.0", - "@taquito/signer": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/tzip16": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/ledger-signer": "^20.0.0-beta.1", + "@taquito/local-forging": "^20.0.0-beta.1", + "@taquito/michel-codec": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/sapling": "^20.0.0-beta.1", + "@taquito/signer": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/tzip16": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -106,26 +106,26 @@ } }, "integration-tests": { - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "dependencies": { "@ledgerhq/devices": "8.2.2", "@ledgerhq/hw-transport": "6.30.5", "@ledgerhq/hw-transport-node-hid": "6.28.5", "@ledgerhq/hw-transport-node-hid-noevents": "6.29.5", - "@taquito/contracts-library": "^20.0.0-beta.0", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/local-forging": "^20.0.0-beta.0", - "@taquito/michel-codec": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/remote-signer": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/sapling": "^20.0.0-beta.0", - "@taquito/signer": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/tzip12": "^20.0.0-beta.0", - "@taquito/tzip16": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/contracts-library": "^20.0.0-beta.1", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/local-forging": "^20.0.0-beta.1", + "@taquito/michel-codec": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/remote-signer": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/sapling": "^20.0.0-beta.1", + "@taquito/signer": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/tzip12": "^20.0.0-beta.1", + "@taquito/tzip16": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1" @@ -23400,17 +23400,17 @@ }, "packages/taquito": { "name": "@taquito/taquito", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/local-forging": "^20.0.0-beta.0", - "@taquito/michel-codec": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/local-forging": "^20.0.0-beta.1", + "@taquito/michel-codec": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -23458,12 +23458,12 @@ }, "packages/taquito-beacon-wallet": { "name": "@taquito/beacon-wallet", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "@airgap/beacon-dapp": "^4.2.2-beta.4", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0" + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -23503,13 +23503,13 @@ }, "packages/taquito-contracts-library": { "name": "@taquito/contracts-library", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -23546,7 +23546,7 @@ }, "packages/taquito-core": { "name": "@taquito/core", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "json-stringify-safe": "^5.0.1" @@ -23562,10 +23562,10 @@ }, "packages/taquito-http-utils": { "name": "@taquito/http-utils", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", "node-fetch": "^2.7.0" }, "devDependencies": { @@ -23622,14 +23622,14 @@ }, "packages/taquito-ledger-signer": { "name": "@taquito/ledger-signer", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "@ledgerhq/hw-transport": "^6.30.5", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "buffer": "^6.0.3" }, "devDependencies": { @@ -23666,15 +23666,15 @@ }, "packages/taquito-local-forging": { "name": "@taquito/local-forging", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { - "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.1", "@types/bluebird": "^3.5.40", "@types/estree": "^1.0.2", "@types/jest": "^29.5.5", @@ -23712,10 +23712,10 @@ }, "packages/taquito-michel-codec": { "name": "@taquito/michel-codec", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "MIT", "dependencies": { - "@taquito/core": "^20.0.0-beta.0" + "@taquito/core": "^20.0.0-beta.1" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -23744,21 +23744,21 @@ } }, "packages/taquito-michel-codec/pack-test-tool": { - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.1", "yargs": "^17.7.2" } }, "packages/taquito-michelson-encoder": { "name": "@taquito/michelson-encoder", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -23795,15 +23795,15 @@ }, "packages/taquito-remote-signer": { "name": "@taquito/remote-signer", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { @@ -23840,12 +23840,12 @@ }, "packages/taquito-rpc": { "name": "@taquito/rpc", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { @@ -23881,17 +23881,17 @@ }, "packages/taquito-sapling": { "name": "@taquito/sapling", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@airgap/sapling-wasm": "0.0.9", "@stablelib/nacl": "^1.0.4", "@stablelib/random": "^1.0.2", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1", @@ -23951,7 +23951,7 @@ }, "packages/taquito-signer": { "name": "@taquito/signer", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -23960,9 +23960,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -24005,7 +24005,7 @@ }, "packages/taquito-timelock": { "name": "@taquito/timelock", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -24013,9 +24013,9 @@ "big-integer": "^1.6.52" }, "devDependencies": { - "@taquito/signer": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/signer": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", @@ -24059,13 +24059,13 @@ }, "packages/taquito-tzip12": { "name": "@taquito/tzip12", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/tzip16": "^20.0.0-beta.0" + "@taquito/core": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/tzip16": "^20.0.0-beta.1" }, "devDependencies": { "@types/bluebird": "^3.5.40", @@ -24101,15 +24101,15 @@ }, "packages/taquito-tzip16": { "name": "@taquito/tzip16", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, @@ -24148,12 +24148,12 @@ }, "packages/taquito-utils": { "name": "@taquito/utils", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "license": "Apache-2.0", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/packages/taquito-beacon-wallet/package.json b/packages/taquito-beacon-wallet/package.json index 6b61fd82c3..b6c46623f2 100644 --- a/packages/taquito-beacon-wallet/package.json +++ b/packages/taquito-beacon-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/beacon-wallet", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Beacon wallet provider", "keywords": [ "tezos", @@ -68,8 +68,8 @@ }, "dependencies": { "@airgap/beacon-dapp": "^4.2.2-beta.4", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0" + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-beacon-wallet/src/version.ts b/packages/taquito-beacon-wallet/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-beacon-wallet/src/version.ts +++ b/packages/taquito-beacon-wallet/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-contracts-library/package.json b/packages/taquito-contracts-library/package.json index 30c3ade5f8..eca64112b7 100644 --- a/packages/taquito-contracts-library/package.json +++ b/packages/taquito-contracts-library/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/contracts-library", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Can be used as an extension on the TezosToolkit to provide contracts data", "keywords": [ "tezos" @@ -67,10 +67,10 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/packages/taquito-contracts-library/src/version.ts b/packages/taquito-contracts-library/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-contracts-library/src/version.ts +++ b/packages/taquito-contracts-library/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-core/package.json b/packages/taquito-core/package.json index 5a97575ffa..1e0b8e93aa 100644 --- a/packages/taquito-core/package.json +++ b/packages/taquito-core/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/core", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Classes, interfaces, and types shared across Taquito packages", "keywords": [ "tezos", diff --git a/packages/taquito-core/src/version.ts b/packages/taquito-core/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-core/src/version.ts +++ b/packages/taquito-core/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-http-utils/package.json b/packages/taquito-http-utils/package.json index ed581088b9..f835098d86 100644 --- a/packages/taquito-http-utils/package.json +++ b/packages/taquito-http-utils/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/http-utils", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "", "keywords": [ "tezos" @@ -58,7 +58,7 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", "node-fetch": "^2.7.0" }, "devDependencies": { diff --git a/packages/taquito-http-utils/src/version.ts b/packages/taquito-http-utils/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-http-utils/src/version.ts +++ b/packages/taquito-http-utils/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-ledger-signer/package.json b/packages/taquito-ledger-signer/package.json index f22f0367e9..f8fd0b8e64 100644 --- a/packages/taquito-ledger-signer/package.json +++ b/packages/taquito-ledger-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/ledger-signer", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Ledger signer provider", "keywords": [ "tezos", @@ -59,9 +59,9 @@ "dependencies": { "@ledgerhq/hw-transport": "^6.30.5", "@stablelib/blake2b": "^1.0.1", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "buffer": "^6.0.3" }, "devDependencies": { diff --git a/packages/taquito-ledger-signer/src/version.ts b/packages/taquito-ledger-signer/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-ledger-signer/src/version.ts +++ b/packages/taquito-ledger-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-local-forging/package.json b/packages/taquito-local-forging/package.json index 797f9f5e6e..b25540415f 100644 --- a/packages/taquito-local-forging/package.json +++ b/packages/taquito-local-forging/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/local-forging", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Provide local forging functionality to be with taquito", "keywords": [ "tezos", @@ -67,12 +67,12 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { - "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.1", "@types/bluebird": "^3.5.40", "@types/estree": "^1.0.2", "@types/jest": "^29.5.5", diff --git a/packages/taquito-local-forging/src/version.ts b/packages/taquito-local-forging/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-local-forging/src/version.ts +++ b/packages/taquito-local-forging/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-michel-codec/pack-test-tool/package.json b/packages/taquito-michel-codec/pack-test-tool/package.json index 76a6472cda..fb96d3bf60 100644 --- a/packages/taquito-michel-codec/pack-test-tool/package.json +++ b/packages/taquito-michel-codec/pack-test-tool/package.json @@ -1,6 +1,6 @@ { "name": "pack-test-tool", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Generate pack test data via Tezos RPC", "main": "pack-test-tool.js", "private": true, @@ -8,7 +8,7 @@ "author": "Eugene Zagidullin ", "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^20.0.0-beta.0", + "@taquito/rpc": "^20.0.0-beta.1", "yargs": "^17.7.2" } } diff --git a/packages/taquito-michel-codec/package.json b/packages/taquito-michel-codec/package.json index 426af16a70..a0b2bca244 100644 --- a/packages/taquito-michel-codec/package.json +++ b/packages/taquito-michel-codec/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/michel-codec", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Michelson parser/validator/formatter", "keywords": [ "tezos", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0" + "@taquito/core": "^20.0.0-beta.1" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-michel-codec/src/version.ts b/packages/taquito-michel-codec/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-michel-codec/src/version.ts +++ b/packages/taquito-michel-codec/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-michelson-encoder/package.json b/packages/taquito-michelson-encoder/package.json index 66a5182228..747bc6c39c 100644 --- a/packages/taquito-michelson-encoder/package.json +++ b/packages/taquito-michelson-encoder/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/michelson-encoder", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "converts michelson data and types into convenient JS/TS objects", "keywords": [ "tezos", @@ -67,9 +67,9 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, diff --git a/packages/taquito-michelson-encoder/src/version.ts b/packages/taquito-michelson-encoder/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-michelson-encoder/src/version.ts +++ b/packages/taquito-michelson-encoder/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-remote-signer/package.json b/packages/taquito-remote-signer/package.json index 28539ec87f..d7e1278901 100644 --- a/packages/taquito-remote-signer/package.json +++ b/packages/taquito-remote-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/remote-signer", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Remote signer provider", "keywords": [ "tezos", @@ -62,10 +62,10 @@ "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { diff --git a/packages/taquito-remote-signer/src/version.ts b/packages/taquito-remote-signer/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-remote-signer/src/version.ts +++ b/packages/taquito-remote-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-rpc/package.json b/packages/taquito-rpc/package.json index 57f0780bce..a14928c319 100644 --- a/packages/taquito-rpc/package.json +++ b/packages/taquito-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/rpc", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Provides low level methods, and types to invoke RPC calls from a Nomadic Tezos RPC node", "keywords": [ "tezos", @@ -66,9 +66,9 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2" }, "devDependencies": { diff --git a/packages/taquito-rpc/src/version.ts b/packages/taquito-rpc/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-rpc/src/version.ts +++ b/packages/taquito-rpc/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-sapling/package.json b/packages/taquito-sapling/package.json index 1bc3279acf..5908565e40 100644 --- a/packages/taquito-sapling/package.json +++ b/packages/taquito-sapling/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/sapling", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Allows reading and preparing sapling transactions", "keywords": [ "tezos", @@ -68,10 +68,10 @@ "@airgap/sapling-wasm": "0.0.9", "@stablelib/nacl": "^1.0.4", "@stablelib/random": "^1.0.2", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "bip39": "3.1.0", "blakejs": "^1.2.1", diff --git a/packages/taquito-sapling/src/version.ts b/packages/taquito-sapling/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-sapling/src/version.ts +++ b/packages/taquito-sapling/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-signer/package.json b/packages/taquito-signer/package.json index 0a01a2504e..4262974576 100644 --- a/packages/taquito-signer/package.json +++ b/packages/taquito-signer/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/signer", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Provide signing functionality to be with taquito", "keywords": [ "tezos", @@ -72,9 +72,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", diff --git a/packages/taquito-signer/src/version.ts b/packages/taquito-signer/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-signer/src/version.ts +++ b/packages/taquito-signer/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-timelock/package.json b/packages/taquito-timelock/package.json index 2400995295..288586d686 100644 --- a/packages/taquito-timelock/package.json +++ b/packages/taquito-timelock/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/timelock", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "TypeScript implementation of the Timelock feature in Tezos", "main": "./dist/taquito-timelock.umd.js", "module": "./dist/taquito-timelock.es6.js", @@ -68,9 +68,9 @@ "big-integer": "^1.6.52" }, "devDependencies": { - "@taquito/signer": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/signer": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", diff --git a/packages/taquito-timelock/src/version.ts b/packages/taquito-timelock/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-timelock/src/version.ts +++ b/packages/taquito-timelock/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-tzip12/package.json b/packages/taquito-tzip12/package.json index f594e81564..8569dd74bc 100644 --- a/packages/taquito-tzip12/package.json +++ b/packages/taquito-tzip12/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/tzip12", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Tzip12", "keywords": [ "tezos", @@ -62,10 +62,10 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/tzip16": "^20.0.0-beta.0" + "@taquito/core": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/tzip16": "^20.0.0-beta.1" }, "devDependencies": { "@types/bluebird": "^3.5.40", diff --git a/packages/taquito-tzip12/src/version.ts b/packages/taquito-tzip12/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-tzip12/src/version.ts +++ b/packages/taquito-tzip12/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-tzip16/package.json b/packages/taquito-tzip16/package.json index f22497f09a..825215d08b 100644 --- a/packages/taquito-tzip16/package.json +++ b/packages/taquito-tzip16/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/tzip16", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "Tzip16", "keywords": [ "tezos", @@ -61,12 +61,12 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/taquito": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/taquito": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "crypto-js": "^4.2.0" }, diff --git a/packages/taquito-tzip16/src/version.ts b/packages/taquito-tzip16/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-tzip16/src/version.ts +++ b/packages/taquito-tzip16/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito-utils/package.json b/packages/taquito-utils/package.json index 57b2c2b3ea..61ac706989 100644 --- a/packages/taquito-utils/package.json +++ b/packages/taquito-utils/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/utils", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "converts michelson data and types into convenient JS/TS objects", "keywords": [ "tezos", @@ -64,7 +64,7 @@ "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", diff --git a/packages/taquito-utils/src/version.ts b/packages/taquito-utils/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito-utils/src/version.ts +++ b/packages/taquito-utils/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; diff --git a/packages/taquito/README.md b/packages/taquito/README.md index b58f419f79..510bf16fbd 100644 --- a/packages/taquito/README.md +++ b/packages/taquito/README.md @@ -7,7 +7,7 @@ The `@taquito/taquito` package contains higher-level functionality that builds u ## CDN Bundle ```html - ``` diff --git a/packages/taquito/assets-manifest.json b/packages/taquito/assets-manifest.json index 20728d3a47..f3173a3364 100644 --- a/packages/taquito/assets-manifest.json +++ b/packages/taquito/assets-manifest.json @@ -5,6 +5,6 @@ }, "main.js": { "src": "dist/taquito.min.js", - "integrity": "sha256-rVK1f5P5V7CfiSgRvlkiOOQNfW0NzyJmiwvrrhacp+4= sha384-XGIZ8FBP7rHqz4ZSz9zvYS3z3kgz4Cds0yo28rzGKTzghLLocRMXN1XkyA4XpY0B sha512-W42Dvr4p//vRwUCuvKzcByEsprNTM6On7fCUOnB1C17fjAD197UlUuAtyolMVu6me3ths2YqGzFABLkGDN94dQ==" + "integrity": "sha256-aGqNWI3630k5cUbcg10yNNT1mSeGIL+4QLKF9ALAMKY= sha384-bdQGpHqriUMV1+pFZrPW440QZya4s1TO0O4ihu9GfJrARK7a70u+oMtY7Z6Z+c70 sha512-AJZrw8QXULqY7nJ3/IZ8WC1qkXsWGBmTC5+7Hl+FTFUSGdzuwKxcOu6WqV6ULUJJZL0a4c+BbT9Y2njJ8V5ucg==" } } \ No newline at end of file diff --git a/packages/taquito/package.json b/packages/taquito/package.json index 45887acfd8..f085e62b7e 100644 --- a/packages/taquito/package.json +++ b/packages/taquito/package.json @@ -1,6 +1,6 @@ { "name": "@taquito/taquito", - "version": "20.0.0-beta.0", + "version": "20.0.0-beta.1", "description": "High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.", "keywords": [ "tezos", @@ -77,13 +77,13 @@ ] }, "dependencies": { - "@taquito/core": "^20.0.0-beta.0", - "@taquito/http-utils": "^20.0.0-beta.0", - "@taquito/local-forging": "^20.0.0-beta.0", - "@taquito/michel-codec": "^20.0.0-beta.0", - "@taquito/michelson-encoder": "^20.0.0-beta.0", - "@taquito/rpc": "^20.0.0-beta.0", - "@taquito/utils": "^20.0.0-beta.0", + "@taquito/core": "^20.0.0-beta.1", + "@taquito/http-utils": "^20.0.0-beta.1", + "@taquito/local-forging": "^20.0.0-beta.1", + "@taquito/michel-codec": "^20.0.0-beta.1", + "@taquito/michelson-encoder": "^20.0.0-beta.1", + "@taquito/rpc": "^20.0.0-beta.1", + "@taquito/utils": "^20.0.0-beta.1", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, diff --git a/packages/taquito/src/version.ts b/packages/taquito/src/version.ts index 344ce1130b..a8973059f3 100644 --- a/packages/taquito/src/version.ts +++ b/packages/taquito/src/version.ts @@ -1,5 +1,5 @@ // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! export const VERSION = { - commitHash: '0ef631853ccfda5c5faed584f16069f34085817e', - version: '20.0.0-beta.0', + commitHash: '4c6e079465fdb978c1627dfdcced0435c9ef87fc', + version: '20.0.0-beta.1', }; From 9040b8301143f0da972251a55d7b8a24e0af9cac Mon Sep 17 00:00:00 2001 From: hui-an-yang <106410553+hui-an-yang@users.noreply.github.com> Date: Tue, 21 May 2024 11:20:02 -0700 Subject: [PATCH 25/35] 2953 dapp staking (#2959) * feat: implement test-dapp set-delegate * feat: implement test-dapp stake/unstake/finalize-unstake * ci: removed pr test-dapp preview restirction * feat: support parisnet on test-dapp * feat: modified testnet specific test names --- .github/workflows/deploy_test_dapp.yml | 1 - apps/taquito-test-dapp/src/App.svelte | 4 + apps/taquito-test-dapp/src/config.ts | 5 +- .../src/lib/TestContainer.svelte | 26 +++- apps/taquito-test-dapp/src/tests.ts | 123 +++++++++++++++++- apps/taquito-test-dapp/src/types.ts | 12 +- 6 files changed, 154 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy_test_dapp.yml b/.github/workflows/deploy_test_dapp.yml index 83686419fd..1860065633 100644 --- a/.github/workflows/deploy_test_dapp.yml +++ b/.github/workflows/deploy_test_dapp.yml @@ -4,7 +4,6 @@ on: push: branches: [master] pull_request: - branches: [master] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }} diff --git a/apps/taquito-test-dapp/src/App.svelte b/apps/taquito-test-dapp/src/App.svelte index e2aa3be199..c3447e11a2 100644 --- a/apps/taquito-test-dapp/src/App.svelte +++ b/apps/taquito-test-dapp/src/App.svelte @@ -14,6 +14,7 @@ let availableNetworks = [ { value: "ghostnet", label: "Ghostnet", group: "current testnets" }, { value: "oxfordnet", label: "Oxfordnet", group: "current testnets" }, + { value: "parisnet", label: "Parisnet", group: "current testnets" }, { value: "mainnet", label: "Mainnet", group: "mainnet" }, { value: "dailynet", label: "Dailynet", group: "other testnets" }, { value: "weeklynet", label: "Weeklynet", group: "other testnets" }, @@ -42,6 +43,9 @@ case "oxfordnet": store.updateNetworkType(NetworkType.OXFORDNET); break; + case "parisnet": + store.updateNetworkType(NetworkType.PARISNET); + break; case "custom": //TODO: input custom RPC URL showCustomNetworkInput = true; diff --git a/apps/taquito-test-dapp/src/config.ts b/apps/taquito-test-dapp/src/config.ts index 117c774a2f..930ec83c5e 100644 --- a/apps/taquito-test-dapp/src/config.ts +++ b/apps/taquito-test-dapp/src/config.ts @@ -1,11 +1,12 @@ import { NetworkType } from '@airgap/beacon-types'; -export type SupportedNetworks = NetworkType.OXFORDNET | NetworkType.GHOSTNET | NetworkType.MAINNET | NetworkType.CUSTOM; +export type SupportedNetworks = NetworkType.PARISNET | NetworkType.OXFORDNET | NetworkType.GHOSTNET | NetworkType.MAINNET | NetworkType.CUSTOM; const rpcUrls: Record = { [NetworkType.MAINNET]: "https://mainnet.ecadinfra.com", [NetworkType.GHOSTNET]: "https://ghostnet.ecadinfra.com/", [NetworkType.OXFORDNET]: "https://oxfordnet.ecadinfra.com/", + [NetworkType.PARISNET]: "https://rpc.parisnet.teztnets.com/", [NetworkType.CUSTOM]: "https://ghostnet.ecadinfra.com/", }; @@ -21,6 +22,8 @@ export const getTzKtUrl = (networkType: SupportedNetworks): string | undefined = return "https://ghostnet.tzkt.io"; case NetworkType.OXFORDNET: return "https://oxfordnet.tzkt.io"; + case NetworkType.PARISNET: + return "https://parisnet.tzkt.io"; case NetworkType.CUSTOM: return undefined; } diff --git a/apps/taquito-test-dapp/src/lib/TestContainer.svelte b/apps/taquito-test-dapp/src/lib/TestContainer.svelte index d748260eef..89c466b26f 100644 --- a/apps/taquito-test-dapp/src/lib/TestContainer.svelte +++ b/apps/taquito-test-dapp/src/lib/TestContainer.svelte @@ -11,7 +11,7 @@ let loading = false; let success: boolean | undefined; let opHash = ""; - let input = { text: "", fee: 400, storageLimit: 400, gasLimit: 1320, amount: 0, address: "" }; + let input = { text: "", fee: 400, storageLimit: 400, gasLimit: 1320, amount: 0, address: "", delegate: "", stake: 0, unstake: 0 }; let testResult: { id: string; title: string; body: any }; const run = async () => { @@ -28,6 +28,9 @@ test.id === "sign-payload-and-send" || test.id === "sign-failingNoop" || test.id === "verify-signature" || + test.id === "set-delegate" || + test.id === "stake" || + test.id === "unstake" || test.id === "send-tez-to-etherlink" || test.id === "set-transaction-limits" ) { @@ -303,6 +306,27 @@ bind:value={input.text} /> + {:else if test.inputRequired && test.inputType === "delegate"} +
+ +
+ {:else if test.inputRequired && test.inputType === "stake"} +
+ +
+ {:else if test.inputRequired && test.inputType === "unstake"} +
+ +
{:else if test.inputRequired && test.inputType === "etherlink"}