Skip to content

Commit

Permalink
v1.3.1: Added PoolInfo export
Browse files Browse the repository at this point in the history
  • Loading branch information
evias committed Jul 28, 2021
1 parent 5bcf3b1 commit f5c2bd8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export { AssetSource } from './src/models/AssetSource'
export { AssetIdentifier } from './src/models/AssetIdentifier'
export { CommandOption } from './src/models/CommandOption'
export { TransactionParameters } from './src/models/TransactionParameters'
export { PoolInfo } from './src/services/PoolService'

// contracts
export { Context } from './src/contracts/Context'
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ubcdigital/swapable",
"version": "1.3.0",
"version": "1.3.1",
"license": "LGPL-3.0-only",
"description": "Swapable: Automated Liquidity Pools",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions src/Swapable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import {
Reader as ReaderImpl,
} from './adapters/Symbol'
import { PoolService, PoolImpl } from './services/PoolService'
import { PoolService, PoolInfo } from './services/PoolService'

/**
* @type Swapable.CommandFn
Expand Down Expand Up @@ -151,7 +151,7 @@ export class Registry {
*/
public async getPools(
revision?: number,
): Promise<PoolImpl[]> {
): Promise<PoolInfo[]> {
// initialize pool service
const service = new PoolService(this.context)

Expand Down
14 changes: 7 additions & 7 deletions src/services/PoolService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ type KeyValueDictionary = {
}

/**
* @type PoolImpl
* @type PoolInfo
* @package Swapable
* @subpackage Services
* @since v1.2.1
* @description Class that describes a specific pool implementation.
*/
export type PoolImpl = {
export type PoolInfo = {
/**
* The target public account that owns the liquidity pool's tradeable
* token pairs and the liquidity provider share mosaics.
Expand Down Expand Up @@ -126,7 +126,7 @@ export class PoolService extends Service {
public async getPools(
authority: PublicAccount | Address,
revision: number = 0
): Promise<PoolImpl[]> {
): Promise<PoolInfo[]> {
const registryAddress = authority instanceof PublicAccount
? authority.address
: authority as Address
Expand Down Expand Up @@ -165,7 +165,7 @@ export class PoolService extends Service {
})

// read metadata values to find X, Y and LP
const readMetadataObservables: Promise<PoolImpl>[] = [];
const readMetadataObservables: Promise<PoolInfo>[] = [];
mosaics.map(m => readMetadataObservables.push(this.getInfo(
m.owner,
m.mosaicId,
Expand All @@ -182,12 +182,12 @@ export class PoolService extends Service {
* @async
* @access public
* @param {MosaicId} lpSharesMosaic The mosaic id of liquidity provider shares.
* @return {PoolImpl}
* @return {PoolInfo}
*/
public async getInfo(
targetAddress: Address,
lpSharesMosaic: MosaicId,
): Promise<PoolImpl> {
): Promise<PoolInfo> {

// read all metadata values from network
const entries = await this.networkReader.factoryHttp
Expand Down Expand Up @@ -215,7 +215,7 @@ export class PoolService extends Service {
pMosaic: lpSharesMosaic,
xMosaic: new MosaicId(poolData['x_mosaic_id']),
yMosaic: new MosaicId(poolData['y_mosaic_id']),
} as PoolImpl
} as PoolInfo
}

/**
Expand Down

0 comments on commit f5c2bd8

Please sign in to comment.