@oceanprotocol/lib 1.0.0-next.41 → 1.0.0-next.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,3 +14,12 @@ export interface ProviderInitialize {
14
14
  computeAddress: string;
15
15
  providerFee: ProviderFees;
16
16
  }
17
+ export interface ProviderComputeInitialize {
18
+ datatoken?: string;
19
+ validOrder?: string;
20
+ providerFee?: ProviderFees;
21
+ }
22
+ export interface ProviderComputeInitializeResults {
23
+ algorithm?: ProviderComputeInitialize;
24
+ datasets?: ProviderComputeInitialize[];
25
+ }
@@ -27,7 +27,6 @@ export interface NftCreateData {
27
27
  * Provides an interface for NFT Factory contract
28
28
  */
29
29
  export declare class NftFactory {
30
- GASLIMIT_DEFAULT: number;
31
30
  factory721Address: string;
32
31
  factory721Abi: AbiItem | AbiItem[];
33
32
  web3: Web3;
@@ -8,7 +8,6 @@ import { Config } from '../models/index.js';
8
8
  * Provides an interface for FactoryRouter contract
9
9
  */
10
10
  export declare class Router {
11
- GASLIMIT_DEFAULT: number;
12
11
  routerAddress: string;
13
12
  RouterAbi: AbiItem | AbiItem[];
14
13
  web3: Web3;
@@ -10,7 +10,6 @@ import { Config } from '../../models';
10
10
  export declare class Pool {
11
11
  poolAbi: AbiItem | AbiItem[];
12
12
  web3: Web3;
13
- GASLIMIT_DEFAULT: number;
14
13
  private config;
15
14
  constructor(web3: Web3, network?: string | number, poolAbi?: AbiItem | AbiItem[], config?: Config);
16
15
  amountToUnits(token: string, amount: string, tokenDecimals?: number): Promise<string>;
@@ -96,12 +95,6 @@ export declare class Pool {
96
95
  * @return {String}
97
96
  */
98
97
  getMarketFeeCollector(poolAddress: string): Promise<string>;
99
- /**
100
- * Get OPC Collector of this pool
101
- * @param {String} poolAddress
102
- * @return {String}
103
- */
104
- getOPCCollector(poolAddress: string): Promise<string>;
105
98
  /**
106
99
  * Get if a token is bounded to a pool
107
100
  * Returns true if token is bound
@@ -294,9 +287,10 @@ export declare class Pool {
294
287
  * @param {String} poolAddress
295
288
  * @param {String} tokenAmountIn exact number of base tokens to spend
296
289
  * @param {String} minPoolAmountOut minimum of pool shares expectex
290
+ * @param {number} tokenInDecimals optional number of decimals of the token
297
291
  * @return {TransactionReceipt}
298
292
  */
299
- joinswapExternAmountIn(account: string, poolAddress: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
293
+ joinswapExternAmountIn(account: string, poolAddress: string, tokenAmountIn: string, minPoolAmountOut: string, tokenInDecimals?: number): Promise<TransactionReceipt>;
300
294
  /**
301
295
  * Estimate gas cost for exitswapPoolAmountIn
302
296
  * @param {String} address
@@ -315,9 +309,10 @@ export declare class Pool {
315
309
  * @param {String} poolAddress
316
310
  * @param {String} poolAmountIn exact number of pool shares to spend
317
311
  * @param {String} minTokenAmountOut minimum amount of basetokens expected
312
+ * @param {number} poolDecimals optional number of decimals of the poool
318
313
  * @return {TransactionReceipt}
319
314
  */
320
- exitswapPoolAmountIn(account: string, poolAddress: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
315
+ exitswapPoolAmountIn(account: string, poolAddress: string, poolAmountIn: string, minTokenAmountOut: string, poolDecimals?: number): Promise<TransactionReceipt>;
321
316
  /**
322
317
  * Return the spot price of swapping tokenIn to tokenOut
323
318
  * @param {String} poolAddress
@@ -14,7 +14,6 @@ export interface DispenserToken {
14
14
  allowedSwapper: string;
15
15
  }
16
16
  export declare class Dispenser {
17
- GASLIMIT_DEFAULT: number;
18
17
  web3: Web3;
19
18
  dispenserAddress: string;
20
19
  config: Config;
@@ -39,7 +39,6 @@ export declare enum FixedRateCreateProgressStep {
39
39
  ApprovingDatatoken = 1
40
40
  }
41
41
  export declare class FixedRateExchange {
42
- GASLIMIT_DEFAULT: number;
43
42
  /** Ocean related functions */
44
43
  oceanAddress: string;
45
44
  fixedRateAddress: string;
@@ -337,11 +336,6 @@ export declare class FixedRateExchange {
337
336
  * @return {Promise<TransactionReceipt>} transaction receipt
338
337
  */
339
338
  collectOceanFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
340
- /**
341
- * Get OPF Collector of fixed rate contract
342
- * @return {String}
343
- */
344
- getOPCCollector(): Promise<string>;
345
339
  /**
346
340
  * Get Router address set in fixed rate contract
347
341
  * @return {String}
@@ -6,7 +6,6 @@ import { Config } from '../../models';
6
6
  export declare class SideStaking {
7
7
  ssAbi: AbiItem | AbiItem[];
8
8
  web3: Web3;
9
- GASLIMIT_DEFAULT: number;
10
9
  config: Config;
11
10
  constructor(web3: Web3, network?: string | number, ssAbi?: AbiItem | AbiItem[], config?: Config);
12
11
  unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import Web3 from 'web3';
2
- import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize } from '../@types/';
2
+ import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults } from '../@types/';
3
3
  export interface HttpCallback {
4
4
  (httpMethod: string, url: string, body: string, header: any): Promise<any>;
5
5
  }
@@ -71,6 +71,17 @@ export declare class Provider {
71
71
  * @return {Promise<ProviderInitialize>} ProviderInitialize data
72
72
  */
73
73
  initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
74
+ /** Initialize a compute request.
75
+ * @param {ComputeAsset} assets
76
+ * @param {ComputeAlgorithmber} algorithm
77
+ * @param {string} computeEnv
78
+ * @param {number} validUntil
79
+ * @param {string} providerUri Identifier of the asset to be registered in ocean
80
+ * @param {string} accountId
81
+ * @param {AbortSignal} signal abort signal
82
+ * @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
83
+ */
84
+ initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, accountId: string, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
74
85
  /** Gets fully signed URL for download
75
86
  * @param {string} did
76
87
  * @param {string} accountId
@@ -25,7 +25,6 @@ export interface DispenserParams {
25
25
  allowedSwapper?: string;
26
26
  }
27
27
  export declare class Datatoken {
28
- GASLIMIT_DEFAULT: number;
29
28
  factoryAddress: string;
30
29
  factoryABI: AbiItem | AbiItem[];
31
30
  datatokensAbi: AbiItem | AbiItem[];
@@ -15,7 +15,6 @@ interface Roles {
15
15
  store: boolean;
16
16
  }
17
17
  export declare class Nft {
18
- GASLIMIT_DEFAULT: number;
19
18
  factory721Address: string;
20
19
  factory721Abi: AbiItem | AbiItem[];
21
20
  nftAbi: AbiItem | AbiItem[];
@@ -10,3 +10,11 @@ export declare function getFreCreationParams(freParams: FreCreationParams): any;
10
10
  export declare function getPoolCreationParams(web3: Web3, poolParams: PoolCreationParams): Promise<any>;
11
11
  export declare function unitsToAmount(web3: Web3, token: string, amount: string, tokenDecimals?: number): Promise<string>;
12
12
  export declare function amountToUnits(web3: Web3, token: string, amount: string, tokenDecimals?: number): Promise<string>;
13
+ /**
14
+ * Estimates the gas used when a function would be executed on chain
15
+ * @param {string} from account that calls the function
16
+ * @param {Function} functionToEstimateGas function that we need to estimate the gas
17
+ * @param {...any[]} args arguments of the function
18
+ * @return {Promise<number>} gas cost of the function
19
+ */
20
+ export declare function estimateGas(from: string, functionToEstimateGas: Function, ...args: any[]): Promise<any>;
@@ -17,11 +17,31 @@ export declare function estApprove(web3: Web3, account: string, tokenAddress: st
17
17
  * @param {String} account
18
18
  * @param {String} tokenAddress
19
19
  * @param {String} spender
20
- * @param {String} amount (always expressed as wei)
20
+ * @param {String} amount amount of ERC20 tokens (always expressed as wei)
21
21
  * @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
22
22
  * @param {number} tokenDecimals optional number of decimals of the token
23
23
  */
24
24
  export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, tokenDecimals?: number): Promise<TransactionReceipt | string>;
25
+ /**
26
+ * Estimate gas cost for transfer function
27
+ * @param {String} account
28
+ * @param {String} tokenAddress
29
+ * @param {String} recipient
30
+ * @param {String} amount
31
+ * @param {String} force
32
+ * @param {Contract} contractInstance optional contract instance
33
+ * @return {Promise<number>}
34
+ */
35
+ export declare function estTransfer(web3: Web3, account: string, tokenAddress: string, recipient: string, amount: string, contractInstance?: Contract): Promise<number>;
36
+ /**
37
+ * Moves amount tokens from the caller’s account to recipient.
38
+ * @param {String} account
39
+ * @param {String} tokenAddress
40
+ * @param {String} recipient
41
+ * @param {String} amount amount of ERC20 tokens (not as wei)
42
+ * @param {String} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
43
+ */
44
+ export declare function transfer(web3: Web3, account: string, tokenAddress: string, recipient: string, amount: string): Promise<TransactionReceipt | string>;
25
45
  /**
26
46
  * Get Allowance for any erc20
27
47
  * @param {Web3} web3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "1.0.0-next.41",
4
+ "version": "1.0.0-next.44",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.js",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -58,7 +58,7 @@
58
58
  "web3": "^1.7.3"
59
59
  },
60
60
  "dependencies": {
61
- "@oceanprotocol/contracts": "^1.0.0-alpha.31",
61
+ "@oceanprotocol/contracts": "^1.0.0-alpha.34",
62
62
  "bignumber.js": "^9.0.2",
63
63
  "cross-fetch": "^3.1.5",
64
64
  "crypto-js": "^4.1.1",
@@ -73,7 +73,7 @@
73
73
  "@types/chai-spies": "^1.0.3",
74
74
  "@types/crypto-js": "^4.1.1",
75
75
  "@types/mocha": "^9.1.1",
76
- "@types/node": "^17.0.31",
76
+ "@types/node": "^17.0.34",
77
77
  "@types/node-fetch": "^3.0.3",
78
78
  "@typescript-eslint/eslint-plugin": "^4.33.0",
79
79
  "@typescript-eslint/parser": "^4.33.0",