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:
parent
9ea7ed70bd
commit
6be945d05e
@ -20,7 +20,7 @@ export class OceanPool extends Pool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create DataToken pool
|
* Create DataToken pool
|
||||||
@param {String} account
|
@param {String} account
|
||||||
* @param {String} token Data Token address
|
* @param {String} token Data Token address
|
||||||
* @param {String} amount Data Token amount
|
* @param {String} amount Data Token amount
|
||||||
@ -33,7 +33,7 @@ export class OceanPool extends Pool {
|
|||||||
amount: string,
|
amount: string,
|
||||||
weight: string,
|
weight: string,
|
||||||
fee: string,
|
fee: string,
|
||||||
finalize: boolean = true
|
finalize = true
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
if (this.oceanAddress == null) {
|
if (this.oceanAddress == null) {
|
||||||
console.error('oceanAddress is not defined')
|
console.error('oceanAddress is not defined')
|
||||||
|
@ -232,7 +232,7 @@ export class Pool extends PoolFactory {
|
|||||||
* Get tokens composing this pool
|
* Get tokens composing this pool
|
||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @return {Array}
|
* @return {String[]}
|
||||||
*/
|
*/
|
||||||
async getCurrentTokens(account: string, poolAddress: string): Promise<string[]> {
|
async getCurrentTokens(account: string, poolAddress: string): Promise<string[]> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
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
|
* Get the final tokens composing this pool
|
||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @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, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
@ -272,7 +272,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @return {String}
|
* @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, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
@ -296,7 +296,7 @@ export class Pool extends PoolFactory {
|
|||||||
account: string,
|
account: string,
|
||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
controllerAddress: string
|
controllerAddress: string
|
||||||
): Promise<any> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
@ -318,7 +318,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} token Address of the token
|
* @param {String} token Address of the token
|
||||||
* @return {Boolean}
|
* @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, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
@ -336,7 +336,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @param {String} token Address of the token
|
* @param {String} token Address of the token
|
||||||
* @return {Boolean}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getReserve(account: string, poolAddress: string, token: string): Promise<string> {
|
async getReserve(account: string, poolAddress: string, token: string): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
@ -358,7 +358,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @return {Boolean}
|
* @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, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
@ -396,7 +396,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @param {String} token
|
* @param {String} token
|
||||||
* @return {Number}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getNormalizedWeight(
|
async getNormalizedWeight(
|
||||||
account: string,
|
account: string,
|
||||||
@ -421,7 +421,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @param {String} token
|
* @param {String} token
|
||||||
* @return {Number}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getDenormalizedWeight(
|
async getDenormalizedWeight(
|
||||||
account: string,
|
account: string,
|
||||||
@ -549,14 +549,14 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @param {String} poolAmountOut will be converted to wei
|
* @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}
|
* @return {any}
|
||||||
*/
|
*/
|
||||||
async joinPool(
|
async joinPool(
|
||||||
account: string,
|
account: string,
|
||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
poolAmountOut: string,
|
poolAmountOut: string,
|
||||||
maxAmountsIn: any
|
maxAmountsIn: string[]
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
@ -586,7 +586,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @param {String} poolAmountIn will be converted to wei
|
* @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}
|
* @return {any}
|
||||||
*/
|
*/
|
||||||
async exitPool(
|
async exitPool(
|
||||||
@ -783,14 +783,14 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @param {String} tokenIn
|
* @param {String} tokenIn
|
||||||
* @param {String} tokenOut
|
* @param {String} tokenOut
|
||||||
* @return {any}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getSpotPriceSansFee(
|
async getSpotPriceSansFee(
|
||||||
account: string,
|
account: string,
|
||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
tokenIn: string,
|
tokenIn: string,
|
||||||
tokenOut: string
|
tokenOut: string
|
||||||
): Promise<any> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,7 @@ import Web3 from 'web3'
|
|||||||
import * as jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
|
import * as jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
|
||||||
|
|
||||||
export class PoolFactory {
|
export class PoolFactory {
|
||||||
public GASLIMIT_DEFAULT: number = 5000000
|
public GASLIMIT_DEFAULT = 5000000
|
||||||
public web3: any = null
|
public web3: any = null
|
||||||
public FactoryABI: any
|
public FactoryABI: any
|
||||||
public factoryAddress: any
|
public factoryAddress: any
|
||||||
|
Loading…
x
Reference in New Issue
Block a user