Skip to content

Commit

Permalink
2270 support new rpc endpoint ticket balance and all ticket balance (#…
Browse files Browse the repository at this point in the history
…2313)

* feat: support new rpc endpoint ticket_balance

re #2270

* feat: support new rpc endpoint all_ticket_balances

re #2270

* fix: changed http method of all_ticket_balances to get

re #2270

* fix: type definition mistake

re #2270

* docs: updated docs for getTicketBalance rpc endpoint

#2270

* fix: remove // in formatCacheKey when passed rpcMethodData and updated doc

re #2270

* test: added rpc endpoint ticketBalance and allTicketBalances unit test

re #2270

* test: added rpc endpoint ticketBalance and allTicketBalances integration test

re #2270

* fix: added mumbai protocol to have empty txRollupAddress in known-contracts file

* fix: correct misused of rpcMethodParams in RpcClientCache

* style: address comment to keep type names uppercase

re #2270

* test: removed not needed contract code and use code_with_ticket.ts instead

re #2270

* test: removed console.log

re #2270

* test: added try catch when originating contract and removed non-null assertion

re #2270

* test: removed all tx_rollup references out of integration-tests

* test: removed more tx rollup references in integration tests and some styles and doc update

re #2270

* style: addressed comments regard style and docs

* style: fixed ci run error

* test: added more assertion to integration test

* test: added array assertion for getAllTicketBalances result

re #2270

* ci: added flextesa mumbaibox to ci run

* fix: fix ci run

* revert: revert ci changes and update integration test to target correct testnet
  • Loading branch information
hui-an-yang authored Feb 15, 2023
1 parent 82921b8 commit 009c7ef
Show file tree
Hide file tree
Showing 22 changed files with 297 additions and 502 deletions.
41 changes: 4 additions & 37 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { HttpBackend } from '@taquito/http-utils';
import { b58cencode, Prefix, prefix } from '@taquito/utils';
import { importKey, InMemorySigner } from '@taquito/signer';
import { RpcClient, RpcClientCache } from '@taquito/rpc';
import { knownBigMapContractProtoALph, knownContractProtoALph, knownOnChainViewContractAddressProtoALph, knownSaplingContractProtoALph, knownTzip12BigMapOffChainContractProtoALph, txRollupAddressProtoALph } from './known-contracts-ProtoALph';
import { knownContractPtLimaPtL, knownBigMapContractPtLimaPtL, knownTzip12BigMapOffChainContractPtLimaPtL, knownSaplingContractPtLimaPtL, knownOnChainViewContractAddressPtLimaPtL, txRollupAddressPtLimaPtL } from './known-contracts-PtLimaPtL';
import { knownContractPtGhostnet, knownBigMapContractPtGhostnet, knownTzip12BigMapOffChainContractPtGhostnet, knownSaplingContractPtGhostnet, knownOnChainViewContractAddressPtGhostnet, txRollupAddressPtGhostnet } from './known-contracts-PtGhostnet';
import { knownContractPtMumbaii, knownBigMapContractPtMumbaii, knownTzip12BigMapOffChainContractPtMumbaii, knownSaplingContractPtMumbaii, knownOnChainViewContractAddressPtMumbaii, txRollupAddressPtMumbaii } from './known-contracts-PtMumbaii';
import { knownBigMapContractProtoALph, knownContractProtoALph, knownOnChainViewContractAddressProtoALph, knownSaplingContractProtoALph, knownTzip12BigMapOffChainContractProtoALph } from './known-contracts-ProtoALph';
import { knownContractPtLimaPtL, knownBigMapContractPtLimaPtL, knownTzip12BigMapOffChainContractPtLimaPtL, knownSaplingContractPtLimaPtL, knownOnChainViewContractAddressPtLimaPtL } from './known-contracts-PtLimaPtL';
import { knownContractPtGhostnet, knownBigMapContractPtGhostnet, knownTzip12BigMapOffChainContractPtGhostnet, knownSaplingContractPtGhostnet, knownOnChainViewContractAddressPtGhostnet } from './known-contracts-PtGhostnet';
import { knownContractPtMumbaii, knownBigMapContractPtMumbaii, knownTzip12BigMapOffChainContractPtMumbaii, knownSaplingContractPtMumbaii, knownOnChainViewContractAddressPtMumbaii } from './known-contracts-PtMumbaii';

const nodeCrypto = require('crypto');

Expand Down Expand Up @@ -35,9 +35,6 @@ interface Config {
knownTzip1216Contract: string;
knownSaplingContract: string;
knownViewContract: string;
txRollupWithdrawContract: string;
txRollupDepositContract: string;
txRollupAddress: string;
protocol: Protocols;
signerConfig: EphemeralConfig | SecretKeyConfig;
}
Expand Down Expand Up @@ -85,10 +82,7 @@ const limanetEphemeral = {
knownBigMapContract: process.env['TEZOS_LIMANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtLimaPtL,
knownTzip1216Contract: process.env['TEZOS_LIMANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtLimaPtL,
knownSaplingContract: process.env['TEZOS_LIMANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtLimaPtL,
txRollupWithdrawContract: process.env['TEZOS_LIMANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_LIMANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_LIMANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtLimaPtL,
txRollupAddress: process.env['TEZOS_LIMANET_TXROLLUP_ADDRESS'] || txRollupAddressPtLimaPtL,
protocol: Protocols.PtLimaPtL,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
Expand All @@ -106,10 +100,7 @@ const mumbainetEphemeral = {
knownBigMapContract: process.env['TEZOS_MUMBAINET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtMumbaii,
knownTzip1216Contract: process.env['TEZOS_MUMBAINET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtMumbaii,
knownSaplingContract: process.env['TEZOS_MUMBAINET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtMumbaii,
txRollupWithdrawContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_MUMBAINET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtMumbaii,
txRollupAddress: process.env['TEZOS_MUMBAINET_TXROLLUP_ADDRESS'] || txRollupAddressPtMumbaii,
protocol: Protocols.PtMumbaii,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
Expand All @@ -127,10 +118,7 @@ const ghostnetEphemeral = {
knownBigMapContract: process.env['TEZOS_GHOSTNET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtGhostnet,
knownTzip1216Contract: process.env['TEZOS_GHOSTNET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtGhostnet,
knownSaplingContract: process.env['TEZOS_GHOSTNET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtGhostnet,
txRollupWithdrawContract: process.env['TEZOS_GHOSTNET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_GHOSTNET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_GHOSTNET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtGhostnet,
txRollupAddress: process.env['TEZOS_GHOSTANET_TXROLLUP_ADDRESS'] || txRollupAddressPtGhostnet,
protocol: Protocols.PtLimaPtL,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
Expand All @@ -148,10 +136,7 @@ const mondaynetEphemeral = {
knownBigMapContract: process.env['TEZOS_MONDAYNET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractProtoALph,
knownTzip1216Contract: process.env['TEZOS_MONDAYNET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractProtoALph,
knownSaplingContract: process.env['TEZOS_MONDAYNET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractProtoALph,
txRollupWithdrawContract: process.env['TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_MONDAYNET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressProtoALph,
txRollupAddress: process.env['TEZOS_MONDAYNET_TXROLLUP_ADDRESS'] || txRollupAddressProtoALph,
protocol: Protocols.ProtoALpha,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
Expand All @@ -169,10 +154,7 @@ const limanetSecretKey = {
knownBigMapContract: process.env['TEZOS_LIMANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtLimaPtL,
knownTzip1216Contract: process.env['TEZOS_LIMANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtLimaPtL,
knownSaplingContract: process.env['TEZOS_LIMANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtLimaPtL,
txRollupWithdrawContract: process.env['TEZOS_LIMANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_LIMANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_LIMANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtLimaPtL,
txRollupAddress: process.env['TEZOS_LIMANET_TXROLLUP_ADDRESS'] || txRollupAddressPtLimaPtL,
protocol: Protocols.PtLimaPtL,
signerConfig: defaultSecretKey
};
Expand All @@ -186,10 +168,7 @@ const mumbainetSecretKey = {
knownBigMapContract: process.env['TEZOS_MUMBAINET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtMumbaii,
knownTzip1216Contract: process.env['TEZOS_MUMBAINET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtMumbaii,
knownSaplingContract: process.env['TEZOS_MUMBAINET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtMumbaii,
txRollupWithdrawContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_MUMBAINET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtMumbaii,
txRollupAddress: process.env['TEZOS_MUMBAINET_TXROLLUP_ADDRESS'] || txRollupAddressPtMumbaii,
protocol: Protocols.PtMumbaii,
signerConfig: defaultSecretKey
};
Expand All @@ -203,10 +182,7 @@ const ghostnetSecretKey = {
knownBigMapContract: process.env['TEZOS_GHOSTNET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtGhostnet,
knownTzip1216Contract: process.env['TEZOS_GHOSTNET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtGhostnet,
knownSaplingContract: process.env['TEZOS_GHOSTNET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtGhostnet,
txRollupWithdrawContract: process.env['TEZOS_GHOSTNET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_GHOSTNET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_GHOSTNET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtGhostnet,
txRollupAddress: process.env['TEZOS_GHOSTNET_TXROLLUP_ADDRESS'] || txRollupAddressPtGhostnet,
protocol: Protocols.PtLimaPtL,
signerConfig: defaultSecretKey
};
Expand All @@ -220,10 +196,7 @@ const mondaynetSecretKey = {
knownBigMapContract: process.env['TEZOS_MONDAYNET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractProtoALph,
knownTzip1216Contract: process.env['TEZOS_MONDAYNET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractProtoALph,
knownSaplingContract: process.env['TEZOS_MONDAYNET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractProtoALph,
txRollupWithdrawContract: process.env['TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_MONDAYNET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressProtoALph,
txRollupAddress: process.env['TEZOS_MONDAYNET_TXROLLUP_ADDRESS'] || txRollupAddressProtoALph,
protocol: Protocols.ProtoALpha,
signerConfig: defaultSecretKey
};
Expand Down Expand Up @@ -338,10 +311,7 @@ export const CONFIGS = () => {
knownTzip1216Contract,
knownSaplingContract,
knownViewContract,
txRollupAddress,
signerConfig,
txRollupDepositContract,
txRollupWithdrawContract,
}) => {
const Tezos = configureRpcCache(rpc, rpcCacheMilliseconds);

Expand All @@ -362,10 +332,7 @@ export const CONFIGS = () => {
knownTzip1216Contract,
knownSaplingContract,
knownViewContract,
txRollupAddress,
signerConfig,
txRollupDepositContract,
txRollupWithdrawContract,
setup: async (preferFreshKey: boolean = false) => {
if (signerConfig.type === SignerType.SECRET_KEY) {
setupWithSecretKey(Tezos, signerConfig);
Expand Down
73 changes: 0 additions & 73 deletions integration-tests/contract-tx-rollup-batch-operation.spec.ts

This file was deleted.

65 changes: 0 additions & 65 deletions integration-tests/contract-tx-rollup-origination-operation.spec.ts

This file was deleted.

24 changes: 0 additions & 24 deletions integration-tests/contract-tx-wait-2-confirmations.spec.ts

This file was deleted.

54 changes: 0 additions & 54 deletions integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,60 +1196,6 @@ export const commonCases: TestCase[] = [
],
},
},
{
name: `Tx rollup origination`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.TX_ROLLUP_ORIGINATION,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
tx_rollup_origination: {},
},
],
},
},
{
name: `Tx rollup submit batch`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.TX_ROLLUP_SUBMIT_BATCH,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w',
content: 'abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd',
burn_limit: '1000000',
},
],
},
},
{
name: `Tx rollup submit batch no burn limit`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.TX_ROLLUP_SUBMIT_BATCH,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w',
content: '1234',
},
],
},
},
{
name: `Origination of a contract that contains the instructions EMIT`,
operation: {
Expand Down
Loading

0 comments on commit 009c7ef

Please sign in to comment.