diff --git a/CHANGELOG.md b/CHANGELOG.md index f0be233699..267ea38a6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [4.1.22] - 2023.11.2 +### Updated +- Naming of the Tezos RPC methods + ## [4.1.21] - 2023.11.2 ### Added - Added RPC support for the TEZOS network. Users can now make RPC calls to these network using the `Network.TEZOS` network. diff --git a/package.json b/package.json index fdbd954d41..cc5bf48b24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumio/tatum", - "version": "4.1.21", + "version": "4.1.22", "description": "Tatum JS SDK", "author": "Tatum", "repository": "https://github.com/tatumio/tatum-js", diff --git a/src/dto/rpc/TezosRpcSuite.ts b/src/dto/rpc/TezosRpcSuite.ts index 9d8f81d7b7..7138f079f5 100644 --- a/src/dto/rpc/TezosRpcSuite.ts +++ b/src/dto/rpc/TezosRpcSuite.ts @@ -24,7 +24,7 @@ export interface GetContractBase extends GetBlock { contractId: string } -export interface GetContractsBigMapGet extends GetContractBase { +export interface GetContractBigMapValue extends GetContractBase { key: any type: any } @@ -78,25 +78,27 @@ export interface TezosRpcInterface { getBlockHashes(params: GetBlockHashes): Promise - getContracts(params: GetContract): Promise + getContract(params: GetContract): Promise - getContractsTickets(params: GetContractBase): Promise + getContractTickets(params: GetContractBase): Promise - getContractsBalance(params: GetContractBase): Promise + getContractBalance(params: GetContractBase): Promise - getContractsBalanceAndFrozenBonds(params: GetContractBase): Promise + getContractBalanceAndFrozenBonds(params: GetContractBase): Promise - getContractsBigMapGet(params: GetContractsBigMapGet): Promise + getContractBigMapValue(params: GetContractBigMapValue): Promise - getContractsCounter(params: GetContractBase): Promise + getContractCounter(params: GetContractBase): Promise getContractDelegate(params: GetContractBase): Promise - getContractsEntrypoints(params: GetContract): Promise + getContractEntrypoints(params: GetContract): Promise - getContractsEntrypoint(params: GetContractsEntrypoints): Promise + getContractEntrypoint(params: GetContractsEntrypoints): Promise - getContractsManagerKey(params: GetContractBase): Promise + getContractManagerKey(params: GetContractBase): Promise + + getContracts(params: GetBlock): Promise getBlock(params: GetBlock): Promise diff --git a/src/e2e/rpc/other/tatum.rpc.tezos.spec.ts b/src/e2e/rpc/other/tatum.rpc.tezos.spec.ts index 91616a95ab..fa43dacf17 100644 --- a/src/e2e/rpc/other/tatum.rpc.tezos.spec.ts +++ b/src/e2e/rpc/other/tatum.rpc.tezos.spec.ts @@ -38,7 +38,7 @@ const getTezosRpc = async (testnet?: boolean) => if (!testnet) { it('getContract', async () => { const tatum = await getTezosRpc(testnet) - const result = await tatum.rpc.getContracts({ + const result = await tatum.rpc.getContract({ chainId: 'main', contractId: 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9', block: '3000000' @@ -49,7 +49,7 @@ const getTezosRpc = async (testnet?: boolean) => it('getContractBalanceAndFrozenBonds', async () => { const tatum = await getTezosRpc(testnet) - const result = await tatum.rpc.getContractsBalanceAndFrozenBonds({ + const result = await tatum.rpc.getContractBalanceAndFrozenBonds({ chainId: 'main', contractId: 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9', block: '3000000' @@ -60,7 +60,7 @@ const getTezosRpc = async (testnet?: boolean) => it('getContractsEntrypoints', async () => { const tatum = await getTezosRpc(testnet) - const result = await tatum.rpc.getContractsEntrypoints({ + const result = await tatum.rpc.getContractEntrypoints({ chainId: 'main', contractId: 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9', block: '3000000' diff --git a/src/service/rpc/other/AbstractTezosRpc.ts b/src/service/rpc/other/AbstractTezosRpc.ts index 3057b5298e..57f053ec77 100644 --- a/src/service/rpc/other/AbstractTezosRpc.ts +++ b/src/service/rpc/other/AbstractTezosRpc.ts @@ -8,7 +8,7 @@ import { GetChainId, GetContract, GetContractBase, - GetContractsBigMapGet, + GetContractBigMapValue, GetContractsEntrypoints, GetInvalidBlocks, GetProtocol, InjectBlock, @@ -116,51 +116,56 @@ export abstract class AbstractTezosRpc implements TezosRpcInterface { return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/delegate`}) } - getContracts(params: GetContract): Promise { + getContract(params: GetContract): Promise { const { chainId, contractId, block, ...rest } = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}`, queryParams: rest }) } - getContractsBalance(params: GetContractBase): Promise { + getContractBalance(params: GetContractBase): Promise { const { chainId, block, contractId } = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/balance`}) } - getContractsBalanceAndFrozenBonds(params: GetContractBase): Promise { + getContractBalanceAndFrozenBonds(params: GetContractBase): Promise { const { chainId, block, contractId } = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/balance_and_frozen_bonds`}) } - getContractsBigMapGet(params: GetContractsBigMapGet): Promise { + getContractBigMapValue(params: GetContractBigMapValue): Promise { const { chainId, block, contractId, ...rest } = params return this.sendPost({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/big_map_get`, body: rest }) } - getContractsCounter(params: GetContractBase): Promise { + getContractCounter(params: GetContractBase): Promise { const { chainId, block, contractId} = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/counter`}) } - getContractsEntrypoint(params: GetContractsEntrypoints): Promise { + getContractEntrypoint(params: GetContractsEntrypoints): Promise { const { chainId, block, contractId, entrypoint, ...rest} = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/entrypoints/${entrypoint}`, queryParams: rest }) } - getContractsEntrypoints(params: GetContract): Promise { + getContractEntrypoints(params: GetContract): Promise { const { chainId, block, contractId, ...rest} = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/entrypoints`, queryParams: rest }) } - getContractsManagerKey(params: GetContractBase): Promise { + getContractManagerKey(params: GetContractBase): Promise { const { chainId, block, contractId} = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/manager_key`}) } - getContractsTickets(params: GetContractBase): Promise { + getContractTickets(params: GetContractBase): Promise { const { chainId, block, contractId} = params return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts/${contractId}/all_ticket_balances` }) } + getContracts(params: GetBlock): Promise { + const { chainId, block } = params + return this.sendGet({ path: `/chains/${chainId}/blocks/${block}/context/contracts`}) + } + getErrorsSchema(): Promise { return this.sendGet({ path: `/errors/` }) }