# Class: ChainlinkTopup

## ChainlinkTopup(options)

Service class to handle interacting with the Cask ChainlinkTopup system

## Constructor

#### new ChainlinkTopup(options)

Create an instance of the ChainlinkTopup service.

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` |  | See CaskSDK configuration.

See:
  - CaskSDK

### Methods

#### (async) cancel(chainlinkTopupId) → {Promise.<{tx: *}>}

Cancel a ChainlinkTopup.

##### Parameters:

Name | Type | Description
--- | --- | ---
`chainlinkTopupId` | string | ChainlinkTopup ID

##### Returns:

Type
  Promise.<{tx: *}>

#### (async) create(args) → {ChainlinkTopup.CreateChainlinkTopupResult}

Create a new ChainlinkTopup.

##### Parameters:

Name | Type | Description
--- | --- | ---
`args` | Object | Function arguments ###### Properties
Name | Type | Description
--- | --- | ---
`asset` | string | Address of asset to ChainlinkTopup

##### Returns:

Type
  ChainlinkTopup.CreateChainlinkTopupResult

#### (async) get(chainlinkTopupId) → {Promise.<ChainlinkTopup.ChainlinkTopupDetail>}

Get the details of a specific ChainlinkTopup.

##### Parameters:

Name | Type | Description
--- | --- | ---
`chainlinkTopupId` |  |

See:
  - The SDK guide for more details on unit formatting at https://docs.cask.fi/developer-docs/javascript-sdk

##### Returns:

Type
  Promise.<ChainlinkTopup.ChainlinkTopupDetail>

#### (async) history(chainlinkTopupId, queryoptsopt) → {Promise.<*>}

Get history for a chainlink topup flow

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`chainlinkTopupId` | string |  | Chainlink Topup ID
`queryopts` |  | <optional> | Optional query options ###### Properties
Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`limit` |  | <optional> | 10 | Limit
`offset` |  | <optional> | 0 | Offset
`orderBy` |  | <optional> | timestamp | Order by
`orderDirection` |  | <optional> | desc | Order direction, one of asc or desc
`options` |  | <optional> | asc | Optional options to pass to apollo for graphQL

##### Returns:

Type
  Promise.<*>

#### (async) init(args)

Initialize the ChainlinkTopup service.

##### Parameters:

Name | Type | Description
--- | --- | ---
`args` | Object | Function arguments ###### Properties
Name | Type | Attributes | Description
--- | --- | --- | ---
`ethersConnection` | EthersConnection | <optional> | EthersConnection instance

#### (async) linkBalance(chainlinkTopupId) → {Promise.<{tx: *}>}

Get the link balance for the underlying service from a ChainlinkTopup.

##### Parameters:

Name | Type | Description
--- | --- | ---
`chainlinkTopupId` | string | ChainlinkTopup ID

##### Returns:

Type
  Promise.<{tx: *}>

#### (async) linkToken() → {Promise.<{*}>}

Get the LINK token used by the ChainlinkTopup service.

##### Returns:

Type
  Promise.<{*}>

#### (async) pause(chainlinkTopupId) → {Promise.<{tx: *}>}

Pause an active ChainlinkTopup

##### Parameters:

Name | Type | Description
--- | --- | ---
`chainlinkTopupId` | string | ChainlinkTopup ID

##### Returns:

Type
  Promise.<{tx: *}>

#### (async) resume(chainlinkTopupId) → {Promise.<{tx: *}>}

Resume a paused ChainlinkTopup.

##### Parameters:

Name | Type | Description
--- | --- | ---
`chainlinkTopupId` | string | ChainlinkTopup ID

##### Returns:

Type
  Promise.<{tx: *}>

### Type Definitions

#### ChainlinkTopupDetail

##### Properties:

Name | Type | Description
--- | --- | ---
`chainlinkTopupId` | string | ChainlinkTopup ID
`status` | number | ChainlinkTopup status
`createdAt` | number | Unix timestamp of ChainlinkTopup creation time

#### CreateChainlinkTopupResult

##### Properties:

Name | Type | Description
--- | --- | ---
`tx` | Object | Create Transaction
`chainId` | number | Chain ID that the transaction took place on
`chainlinkTopupId` | string | ID of newly created ChainlinkTopup