Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

feat: remove getTips() api #483

Merged
merged 5 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ For details on all available API methods, see the [reference page](api_reference

* [.getNodeInfo([callback])](api_reference.md#module_core.getNodeInfo)

* [getTips([callback])](api_reference.md#module_core.getTips)

* [getTransactionObjects(hashes, [callback])](api_reference.md#module_core.getTransactionObjects)

* [.getTransactionsToApprove(depth, [reference], [callback])](api_reference.md#module_core.getTransactionsToApprove)
Expand Down
36 changes: 0 additions & 36 deletions api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,6 @@ Converts an integer value to trits

* [.getNodeInfo([callback])](#module_core.getNodeInfo)

* [.createGetTips(provider)](#module_core.createGetTips)

* [.getTips([callback])](#module_core.getTips)

* [.createGetTransactionObjects(provider)](#module_core.createGetTransactionObjects)

* [.getTransactionObjects(hashes, [callback])](#module_core.getTransactionObjects)
Expand Down Expand Up @@ -1083,39 +1079,7 @@ getNodeInfo()
// ...
})
```
<a name="module_core.createGetTips"></a>

### *core*.createGetTips(provider)

| Param | Type | Description |
| --- | --- | --- |
| provider | <code>Provider</code> | Network provider |

**Returns**: <code>function</code> - [`getTips`](#module_core.getTips)
<a name="module_core.getTips"></a>

### *core*.getTips([callback])
**Fulfil**: <code>Hash[]</code> List of tip hashes
**Reject**: <code>Error</code>
- Fetch error

| Param | Type | Description |
| --- | --- | --- |
| [callback] | <code>Callback</code> | Optional callback |

Returns a list of tips (transactions not referenced by other transactions),
as seen by the connected node.

**Example**
```js
getTips()
.then(tips => {
// ...
})
.catch(err => {
// ...
})
```
<a name="module_core.createGetTransactionObjects"></a>
rajivshah3 marked this conversation as resolved.
Show resolved Hide resolved

### *core*.createGetTransactionObjects(provider)
Expand Down
31 changes: 0 additions & 31 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ yarn add @iota/core

* [.getNodeInfo([callback])](#module_core.getNodeInfo)

* [.getTips([callback])](#module_core.getTips)

* [.getTransactionObjects(hashes, [callback])](#module_core.getTransactionObjects)

* [.getTransactionsToApprove(depth, [reference], [callback])](#module_core.getTransactionsToApprove)
Expand Down Expand Up @@ -807,35 +805,6 @@ getNodeInfo()
console.log(`Something went wrong: ${error}`);
})
```
<a name="module_core.getTips"></a>

### *core*.getTips([callback])
**Summary**: Searches the Tangle for tip transactions.
**Fulfil**: <code>Hash[]</code> tips - Array of tip transaction hashes
**Reject**: <code>Error</code> error - Fetch error: The connected IOTA node's API returned an error. See the [list of error messages](https://docs.iota.org/docs/node-software/0.1/iri/references/api-errors)

| Param | Type | Description |
| --- | --- | --- |
| [callback] | <code>Callback</code> | Optional callback function |

This method finds all transactions that aren't referenced by other transactions in the Tangle
by calling the connected IRI node's [`getTips`](https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference#gettips) endpoint.

## Related methods

To find two consistent tip transactions to use as branch and trunk transactions, use the [`getTransactionsToApprove()`](#module_core.getTransactionsToApprove) method.

**Example**
```js
getTips()
.then(tips => {
console.log('Found the following tip transactions:');
console.log(JSON.stringify(tips));
})
.catch(error => {
console.log(`Something went wrong: ${error}`);
})
```
<a name="module_core.getTransactionObjects"></a>

### *core*.getTransactionObjects(hashes, [callback])
Expand Down
20 changes: 9 additions & 11 deletions packages/core/src/composeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
createGetNeighbors,
createGetNewAddress,
createGetNodeInfo,
createGetTips,
createGetTransactionObjects,
createGetTransactionsToApprove,
createGetTrytes,
Expand Down Expand Up @@ -74,7 +73,7 @@ export function returnType<T>(func: Func<T>) {

/**
* @method composeApi
*
*
* @summary Creates an API object that's used to send requests to an IRI node.
*
* @memberof module:core
Expand All @@ -89,12 +88,12 @@ export function returnType<T>(func: Func<T>) {
* @example
* ```js
* const Iota = require('@iota/core`);
*
*
* const iota = Iota.composeAPI({
* provider: 'https://nodes.devnet.thetangle.org:443'
* });
* ```
*
*
* @return {API} iota - API object to use to interact with an IRI node.
*/
export const composeAPI = (settings: Partial<Settings> = {}) => {
Expand All @@ -103,7 +102,7 @@ export const composeAPI = (settings: Partial<Settings> = {}) => {

/**
* @method setSettings
*
*
* @summary Defines network provider configuration and [`attachToTangle`]{@link #module_core.attachToTangle} method.
*
* @memberof API
Expand All @@ -126,13 +125,13 @@ export const composeAPI = (settings: Partial<Settings> = {}) => {
}

/**
*
*
* @method overrideNetwork
*
*
* @summary Overrides the default provider
*
* @memberof API
*
*
* @ignore
*
* @param {Provider} network - Provider instance to use to override the existing network settings
Expand All @@ -145,11 +144,11 @@ export const composeAPI = (settings: Partial<Settings> = {}) => {
/**
*
* @method overrideAttachToTangle
*
*
* @summary Overrides the default [`attachToTangle`]{@link #module_core.attachToTangle} method
*
* @memberof API
*
*
* @ignore
*
* @param {function} attachToTangle - Function that overrides the
Expand All @@ -171,7 +170,6 @@ export const composeAPI = (settings: Partial<Settings> = {}) => {
getInclusionStates: createGetInclusionStates(provider),
getNeighbors: createGetNeighbors(provider),
getNodeInfo: createGetNodeInfo(provider),
getTips: createGetTips(provider),
getTransactionsToApprove: createGetTransactionsToApprove(provider),
getTrytes: createGetTrytes(provider),
interruptAttachingToTangle: createInterruptAttachingToTangle(provider),
Expand Down
56 changes: 0 additions & 56 deletions packages/core/src/createGetTips.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export {
GetNeighborsResponse,
GetNodeInfoCommand,
GetNodeInfoResponse,
GetTipsCommand,
GetTipsResponse,
GetTransactionsToApproveCommand,
GetTransactionsToApproveResponse,
TransactionsToApprove,
Expand Down Expand Up @@ -68,8 +66,6 @@ export { createGetNeighbors } from './createGetNeighbors'

export { createGetNodeInfo } from './createGetNodeInfo'

export { createGetTips } from './createGetTips'

export { createGetTransactionsToApprove } from './createGetTransactionsToApprove'

export { createGetTrytes } from './createGetTrytes'
Expand Down
28 changes: 0 additions & 28 deletions packages/core/test/integration/getTips.test.ts

This file was deleted.

17 changes: 0 additions & 17 deletions packages/core/test/integration/nocks/getTips.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/http-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export {
GetNeighborsResponse,
GetNodeInfoCommand,
GetNodeInfoResponse,
GetTipsCommand,
GetTipsResponse,
GetTransactionsToApproveCommand,
GetTransactionsToApproveResponse,
TransactionsToApprove,
Expand Down
10 changes: 0 additions & 10 deletions packages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export enum IRICommand {
GET_NEIGHBORS = 'getNeighbors',
ADD_NEIGHBORS = 'addNeighbors',
REMOVE_NEIGHBORS = 'removeNeighbors',
GET_TIPS = 'getTips',
FIND_TRANSACTIONS = 'findTransactions',
GET_TRYTES = 'getTrytes',
GET_INCLUSION_STATES = 'getInclusionStates',
Expand Down Expand Up @@ -225,15 +224,6 @@ export interface GetNodeInfoResponse {
readonly transactionsToRequest: number
}

export interface GetTipsCommand extends BaseCommand {
command: IRICommand.GET_TIPS
}

export interface GetTipsResponse {
readonly hashes: ReadonlyArray<Hash>
readonly duration: number
}

export interface TransactionsToApprove {
readonly trunkTransaction: Hash
readonly branchTransaction: Hash
Expand Down