1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

more pool docs & typing updates

This commit is contained in:
Matthias Kretschmann 2020-08-19 12:34:04 +02:00
parent 9ea7ed70bd
commit 6be945d05e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 19 additions and 19 deletions

View File

@ -20,7 +20,7 @@ export class OceanPool extends Pool {
}
/**
* create DataToken pool
* Create DataToken pool
@param {String} account
* @param {String} token Data Token address
* @param {String} amount Data Token amount
@ -33,7 +33,7 @@ export class OceanPool extends Pool {
amount: string,
weight: string,
fee: string,
finalize: boolean = true
finalize = true
): Promise<any> {
if (this.oceanAddress == null) {
console.error('oceanAddress is not defined')
@ -107,7 +107,7 @@ export class OceanPool extends Pool {
}
/**
* Buy Data Token from a pool
* Buy Data Token from a pool
* @param {String} account
* @param {String} poolAddress
* @param {String} amount Data Token amount

View File

@ -232,7 +232,7 @@ export class Pool extends PoolFactory {
* Get tokens composing this pool
* @param {String} account
* @param {String} poolAddress
* @return {Array}
* @return {String[]}
*/
async getCurrentTokens(account: string, poolAddress: string): Promise<string[]> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
@ -251,9 +251,9 @@ export class Pool extends PoolFactory {
* Get the final tokens composing this pool
* @param {String} account
* @param {String} poolAddress
* @return {Array}
* @return {String[]}
*/
async getFinalTokens(account: string, poolAddress: string): Promise<any> {
async getFinalTokens(account: string, poolAddress: string): Promise<string[]> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
})
@ -272,7 +272,7 @@ export class Pool extends PoolFactory {
* @param {String} poolAddress
* @return {String}
*/
async getController(account: string, poolAddress: string): Promise<any> {
async getController(account: string, poolAddress: string): Promise<string> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
})
@ -296,7 +296,7 @@ export class Pool extends PoolFactory {
account: string,
poolAddress: string,
controllerAddress: string
): Promise<any> {
): Promise<string> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
})
@ -318,7 +318,7 @@ export class Pool extends PoolFactory {
* @param {String} token Address of the token
* @return {Boolean}
*/
async isBound(account: string, poolAddress: string, token: string): Promise<any> {
async isBound(account: string, poolAddress: string, token: string): Promise<boolean> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
})
@ -336,7 +336,7 @@ export class Pool extends PoolFactory {
* @param {String} account
* @param {String} poolAddress
* @param {String} token Address of the token
* @return {Boolean}
* @return {String}
*/
async getReserve(account: string, poolAddress: string, token: string): Promise<string> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
@ -358,7 +358,7 @@ export class Pool extends PoolFactory {
* @param {String} poolAddress
* @return {Boolean}
*/
async isFinalized(account: string, poolAddress: string): Promise<any> {
async isFinalized(account: string, poolAddress: string): Promise<boolean> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
})
@ -396,7 +396,7 @@ export class Pool extends PoolFactory {
* @param {String} account
* @param {String} poolAddress
* @param {String} token
* @return {Number}
* @return {String}
*/
async getNormalizedWeight(
account: string,
@ -421,7 +421,7 @@ export class Pool extends PoolFactory {
* @param {String} account
* @param {String} poolAddress
* @param {String} token
* @return {Number}
* @return {String}
*/
async getDenormalizedWeight(
account: string,
@ -549,14 +549,14 @@ export class Pool extends PoolFactory {
* @param {String} account
* @param {String} poolAddress
* @param {String} poolAmountOut will be converted to wei
* @param {String} maxAmountsIn array holding maxAmount per each token, will be converted to wei
* @param {String[]} maxAmountsIn array holding maxAmount per each token, will be converted to wei
* @return {any}
*/
async joinPool(
account: string,
poolAddress: string,
poolAmountOut: string,
maxAmountsIn: any
maxAmountsIn: string[]
): Promise<any> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
@ -586,7 +586,7 @@ export class Pool extends PoolFactory {
* @param {String} account
* @param {String} poolAddress
* @param {String} poolAmountIn will be converted to wei
* @param {String} maxAmountsIn array holding maxAmount per each token, will be converted to wei
* @param {String[]} minAmountsOut array holding minAmount per each token, will be converted to wei
* @return {any}
*/
async exitPool(
@ -783,14 +783,14 @@ export class Pool extends PoolFactory {
* @param {String} poolAddress
* @param {String} tokenIn
* @param {String} tokenOut
* @return {any}
* @return {String}
*/
async getSpotPriceSansFee(
account: string,
poolAddress: string,
tokenIn: string,
tokenOut: string
): Promise<any> {
): Promise<string> {
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
from: account
})

View File

@ -2,7 +2,7 @@ import Web3 from 'web3'
import * as jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
export class PoolFactory {
public GASLIMIT_DEFAULT: number = 5000000
public GASLIMIT_DEFAULT = 5000000
public web3: any = null
public FactoryABI: any
public factoryAddress: any