@oceanprotocol/lib 1.0.0-next.5 → 1.0.0-next.9

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/lib.js +1 -1
  3. package/dist/lib.js.map +1 -1
  4. package/dist/lib.modern.js +1 -1
  5. package/dist/lib.modern.js.map +1 -1
  6. package/dist/lib.module.js +1 -1
  7. package/dist/lib.module.js.map +1 -1
  8. package/dist/lib.umd.js +1 -1
  9. package/dist/lib.umd.js.map +1 -1
  10. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  11. package/dist/src/@types/FileMetadata.d.ts +1 -0
  12. package/dist/src/@types/Provider.d.ts +3 -2
  13. package/dist/src/aquarius/Aquarius.d.ts +3 -3
  14. package/dist/src/factories/NFTFactory.d.ts +6 -9
  15. package/dist/src/interfaces/Erc721Interface.d.ts +12 -0
  16. package/dist/src/interfaces/FixedRateInterface.d.ts +1 -1
  17. package/dist/src/interfaces/PoolInterface.d.ts +4 -4
  18. package/dist/src/models/Config.d.ts +4 -0
  19. package/dist/src/pools/Router.d.ts +7 -6
  20. package/dist/src/pools/balancer/Pool.d.ts +8 -11
  21. package/dist/src/pools/dispenser/Dispenser.d.ts +4 -3
  22. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +14 -13
  23. package/dist/src/pools/ssContracts/SideStaking.d.ts +7 -5
  24. package/dist/src/provider/Provider.d.ts +15 -11
  25. package/dist/src/tokens/Datatoken.d.ts +9 -12
  26. package/dist/src/tokens/NFT.d.ts +8 -3
  27. package/dist/src/utils/ConfigHelper.d.ts +1 -1
  28. package/dist/src/utils/Constants.d.ts +1 -0
  29. package/dist/src/utils/ContractUtils.d.ts +11 -0
  30. package/dist/src/utils/FetchHelper.d.ts +3 -2
  31. package/dist/src/utils/TokenUtils.d.ts +7 -0
  32. package/dist/src/utils/index.d.ts +2 -2
  33. package/dist/src/utils/minAbi.d.ts +2 -0
  34. package/docs/beginners_guide.md +4 -4
  35. package/docs/overview.md +100 -9
  36. package/docs/quickstart_marketplace.md +34 -33
  37. package/docs/quickstart_simple.md +18 -16
  38. package/package.json +5 -4
  39. package/dist/src/utils/ContractParams.d.ts +0 -4
  40. package/dist/src/utils/GasUtils.d.ts +0 -2
@@ -0,0 +1,4 @@
1
+ export interface DownloadResponse {
2
+ data: ArrayBuffer;
3
+ filename: string;
4
+ }
@@ -5,4 +5,5 @@ export interface FileMetadata {
5
5
  index?: number;
6
6
  url?: string;
7
7
  method?: string;
8
+ valid?: boolean;
8
9
  }
@@ -2,13 +2,14 @@ export interface ProviderFees {
2
2
  providerFeeAddress: string;
3
3
  providerFeeToken: string;
4
4
  providerFeeAmount: string;
5
- providerData: string;
6
5
  v: string;
7
6
  r: string;
8
7
  s: string;
8
+ providerData: string;
9
+ validUntil: string;
9
10
  }
10
11
  export interface ProviderInitialize {
11
- dataToken: string;
12
+ datatoken: string;
12
13
  nonce: string;
13
14
  computeAddress: string;
14
15
  providerFee: ProviderFees;
@@ -2,9 +2,9 @@ import { Asset, DDO, ValidateMetadata } from '../@types/';
2
2
  export declare class Aquarius {
3
3
  aquariusURL: any;
4
4
  constructor(aquariusURL: string);
5
- resolve(did: string, fetchMethod: any): Promise<DDO>;
5
+ resolve(did: string, signal?: AbortSignal): Promise<Asset>;
6
6
  sleep(ms: number): Promise<unknown>;
7
- waitForAqua(fetchMethod: any, did: string, txid?: string): Promise<Asset>;
8
- validate(fetchMethod: any, ddo: DDO): Promise<ValidateMetadata>;
7
+ waitForAqua(did: string, txid?: string, signal?: AbortSignal): Promise<Asset>;
8
+ validate(ddo: DDO, signal?: AbortSignal): Promise<ValidateMetadata>;
9
9
  }
10
10
  export default Aquarius;
@@ -3,6 +3,8 @@ import Web3 from 'web3';
3
3
  import { TransactionReceipt } from 'web3-core';
4
4
  import { AbiItem } from 'web3-utils';
5
5
  import { FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams } from '../interfaces';
6
+ import { Config } from '../models/index.js';
7
+ import { ProviderFees } from '../@types/index.js';
6
8
  interface Template {
7
9
  templateAddress: string;
8
10
  isActive: boolean;
@@ -10,14 +12,9 @@ interface Template {
10
12
  export interface TokenOrder {
11
13
  tokenAddress: string;
12
14
  consumer: string;
15
+ ammount: string;
13
16
  serviceIndex: number;
14
- providerFeeAddress: string;
15
- providerFeeToken: string;
16
- providerFeeAmount: string;
17
- v: string;
18
- r: string;
19
- s: string;
20
- providerData: string;
17
+ _providerFees: ProviderFees;
21
18
  }
22
19
  export interface NftCreateData {
23
20
  name: string;
@@ -30,9 +27,9 @@ export declare class NftFactory {
30
27
  factory721Address: string;
31
28
  factory721Abi: AbiItem | AbiItem[];
32
29
  web3: Web3;
33
- startBlock: number;
30
+ config: Config;
34
31
  factory721: Contract;
35
- constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[], startBlock?: number);
32
+ constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[], config?: Config);
36
33
  estGasCreateNFT(address: string, nftData: NftCreateData): Promise<string>;
37
34
  createNFT(address: string, nftData: NftCreateData): Promise<string>;
38
35
  getCurrentNFTCount(): Promise<number>;
@@ -0,0 +1,12 @@
1
+ import { MetadataProof } from '../@types';
2
+ export interface MetadataAndTokenURI {
3
+ metaDataState: number;
4
+ metaDataDecryptorUrl: string;
5
+ metaDataDecryptorAddress: string;
6
+ flags: string;
7
+ data: string;
8
+ metaDataHash: string;
9
+ tokenId: number;
10
+ tokenURI: string;
11
+ metadataProofs: MetadataProof[];
12
+ }
@@ -4,7 +4,7 @@ export interface FreCreationParams {
4
4
  owner: string;
5
5
  marketFeeCollector: string;
6
6
  baseTokenDecimals: number;
7
- dataTokenDecimals: number;
7
+ datatokenDecimals: number;
8
8
  fixedRate: string;
9
9
  marketFee: number;
10
10
  withMint?: boolean;
@@ -1,15 +1,15 @@
1
1
  export interface PoolCreationParams {
2
2
  ssContract: string;
3
- basetokenAddress: string;
4
- basetokenSender: string;
3
+ baseTokenAddress: string;
4
+ baseTokenSender: string;
5
5
  publisherAddress: string;
6
6
  marketFeeCollector: string;
7
7
  poolTemplateAddress: string;
8
8
  rate: string;
9
- basetokenDecimals: number;
9
+ baseTokenDecimals: number;
10
10
  vestingAmount: string;
11
11
  vestedBlocks: number;
12
- initialBasetokenLiquidity: string;
12
+ initialBaseTokenLiquidity: string;
13
13
  swapFeeLiquidityProvider: number;
14
14
  swapFeeMarketRunner: number;
15
15
  }
@@ -30,5 +30,9 @@ export declare class Config {
30
30
  subgraphUri: string;
31
31
  explorerUri: string;
32
32
  oceanTokenSymbol: string;
33
+ transactionBlockTimeout: number;
34
+ transactionConfirmationBlocks: number;
35
+ transactionPollingTimeout: number;
36
+ gasFeeMultiplier: number;
33
37
  }
34
38
  export default Config;
@@ -3,14 +3,15 @@ import Web3 from 'web3';
3
3
  import { TransactionReceipt } from 'web3-core';
4
4
  import { AbiItem } from 'web3-utils';
5
5
  import { Operation } from '../interfaces/RouterInterface';
6
+ import { Config } from '../models/index.js';
6
7
  export declare class Router {
7
8
  GASLIMIT_DEFAULT: number;
8
9
  routerAddress: string;
9
10
  RouterAbi: AbiItem | AbiItem[];
10
11
  web3: Web3;
11
- startBlock: number;
12
+ config: Config;
12
13
  router: Contract;
13
- constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], startBlock?: number);
14
+ constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], config?: Config);
14
15
  estGasBuyDTBatch(address: string, operations: Operation[]): Promise<any>;
15
16
  buyDTBatch(address: string, operations: Operation[]): Promise<TransactionReceipt>;
16
17
  isOceanTokens(address: string): Promise<boolean>;
@@ -35,10 +36,10 @@ export declare class Router {
35
36
  addDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
36
37
  estGasRemoveDispenserContract(address: string, tokenAddress: string): Promise<any>;
37
38
  removeDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
38
- getOPFFee(baseToken: string): Promise<number>;
39
- getCurrentOPFFee(): Promise<number>;
40
- estGasUpdateOPFFee(address: string, newFee: number): Promise<any>;
41
- updateOPFFee(address: string, newFee: number): Promise<TransactionReceipt>;
39
+ getOPCFee(baseToken: string): Promise<number>;
40
+ getCurrentOPCFee(): Promise<number>;
41
+ estGasUpdateOPCFee(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<any>;
42
+ updateOPCFee(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<TransactionReceipt>;
42
43
  estGasAddPoolTemplate(address: string, templateAddress: string): Promise<any>;
43
44
  addPoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
44
45
  estGasRemovePoolTemplate(address: string, templateAddress: string): Promise<any>;
@@ -4,15 +4,14 @@ import { TransactionReceipt } from 'web3-core';
4
4
  import { Contract } from 'web3-eth-contract';
5
5
  import { Logger } from '../../utils';
6
6
  import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee } from '../../interfaces';
7
+ import { Config } from '../../models';
7
8
  export declare class Pool {
8
9
  poolAbi: AbiItem | AbiItem[];
9
10
  web3: Web3;
10
11
  GASLIMIT_DEFAULT: number;
11
12
  private logger;
12
- constructor(web3: Web3, logger: Logger, poolAbi?: AbiItem | AbiItem[]);
13
- estApprove(account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
14
- allowance(tokenAddress: string, owner: string, spender: string): Promise<string>;
15
- approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
13
+ private config;
14
+ constructor(web3: Web3, logger: Logger, poolAbi?: AbiItem | AbiItem[], config?: Config);
16
15
  sharesBalance(account: string, poolAddress: string): Promise<string>;
17
16
  estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
18
17
  setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
@@ -21,10 +20,10 @@ export declare class Pool {
21
20
  getCurrentTokens(poolAddress: string): Promise<string[]>;
22
21
  getFinalTokens(poolAddress: string): Promise<string[]>;
23
22
  getController(poolAddress: string): Promise<string>;
24
- getBasetoken(poolAddress: string): Promise<string>;
23
+ getBaseToken(poolAddress: string): Promise<string>;
25
24
  getDatatoken(poolAddress: string): Promise<string>;
26
25
  getMarketFeeCollector(poolAddress: string): Promise<string>;
27
- getOPFCollector(poolAddress: string): Promise<string>;
26
+ getOPCCollector(poolAddress: string): Promise<string>;
28
27
  isBound(poolAddress: string, token: string): Promise<boolean>;
29
28
  getReserve(poolAddress: string, token: string): Promise<string>;
30
29
  isFinalized(poolAddress: string): Promise<boolean>;
@@ -34,16 +33,14 @@ export declare class Pool {
34
33
  getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
35
34
  getMarketFees(poolAddress: string, token: string): Promise<string>;
36
35
  getCurrentMarketFees(poolAddress: string): Promise<CurrentFees>;
37
- getCurrentOPFFees(poolAddress: string): Promise<CurrentFees>;
36
+ getCurrentOPCFees(poolAddress: string): Promise<CurrentFees>;
38
37
  getCommunityFees(poolAddress: string, token: string): Promise<string>;
39
- estCollectOPF(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
40
- collectOPF(address: string, poolAddress: string): Promise<TransactionReceipt>;
38
+ estCollectOPC(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
39
+ collectOPC(address: string, poolAddress: string): Promise<TransactionReceipt>;
41
40
  estCollectMarketFee(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
42
41
  collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
43
42
  estUpdateMarketFeeCollector(address: string, poolAddress: string, newCollector: string, contractInstance?: Contract): Promise<number>;
44
43
  updateMarketFeeCollector(address: string, poolAddress: string, newCollector: string): Promise<TransactionReceipt>;
45
- amountToUnits(token: string, amount: string): Promise<string>;
46
- unitsToAmount(token: string, amount: string): Promise<string>;
47
44
  estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
48
45
  swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
49
46
  estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
@@ -3,6 +3,7 @@ import { AbiItem } from 'web3-utils';
3
3
  import { Contract } from 'web3-eth-contract';
4
4
  import { TransactionReceipt } from 'web3-eth';
5
5
  import { Datatoken } from '../../tokens';
6
+ import { Config } from '../../models/index.js';
6
7
  export interface DispenserToken {
7
8
  active: boolean;
8
9
  owner: string;
@@ -16,10 +17,10 @@ export declare class Dispenser {
16
17
  GASLIMIT_DEFAULT: number;
17
18
  web3: Web3;
18
19
  dispenserAddress: string;
19
- startBlock: number;
20
+ config: Config;
20
21
  dispenserAbi: AbiItem | AbiItem[];
21
22
  dispenserContract: Contract;
22
- constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], startBlock?: number);
23
+ constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
23
24
  status(dtAdress: string): Promise<DispenserToken>;
24
25
  estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
25
26
  create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
@@ -33,5 +34,5 @@ export declare class Dispenser {
33
34
  dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
34
35
  estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
35
36
  ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
36
- isDispensable(dtAddress: string, dataToken: Datatoken, address: string, amount?: string): Promise<Boolean>;
37
+ isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
37
38
  }
@@ -2,10 +2,11 @@ import { TransactionReceipt } from 'web3-core';
2
2
  import { Contract } from 'web3-eth-contract';
3
3
  import { AbiItem } from 'web3-utils/types';
4
4
  import Web3 from 'web3';
5
+ import { Config } from '../../models/index.js';
5
6
  export interface FixedPriceExchange {
6
7
  active: boolean;
7
8
  exchangeOwner: string;
8
- dataToken: string;
9
+ datatoken: string;
9
10
  baseToken: string;
10
11
  fixedRate: string;
11
12
  dtDecimals: string;
@@ -19,7 +20,7 @@ export interface FixedPriceExchange {
19
20
  exchangeId?: string;
20
21
  }
21
22
  export interface FeesInfo {
22
- opfFee: string;
23
+ opcFee: string;
23
24
  marketFee: string;
24
25
  marketFeeCollector: string;
25
26
  marketFeeAvailable: string;
@@ -30,7 +31,7 @@ export interface FixedPriceSwap {
30
31
  exchangeId: string;
31
32
  caller: string;
32
33
  baseTokenAmount: string;
33
- dataTokenAmount: string;
34
+ datatokenAmount: string;
34
35
  }
35
36
  export declare enum FixedRateCreateProgressStep {
36
37
  CreatingExchange = 0,
@@ -44,16 +45,16 @@ export declare class FixedRateExchange {
44
45
  fixedRateContract: Contract;
45
46
  web3: Web3;
46
47
  contract: Contract;
47
- startBlock: number;
48
+ config: Config;
48
49
  ssAbi: AbiItem | AbiItem[];
49
- constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, startBlock?: number);
50
+ constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
50
51
  amountToUnits(token: string, amount: string): Promise<string>;
51
52
  unitsToAmount(token: string, amount: string): Promise<string>;
52
- generateExchangeId(basetoken: string, dataToken: string, owner: string): Promise<string>;
53
- estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBasetokenAmount: string, contractInstance?: Contract): Promise<number>;
54
- buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBasetokenAmount: string): Promise<TransactionReceipt>;
55
- estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBasetokenAmount: string, contractInstance?: Contract): Promise<number>;
56
- sellDT(address: string, exchangeId: string, datatokenAmount: string, minBasetokenAmount: string): Promise<TransactionReceipt>;
53
+ generateExchangeId(baseToken: string, datatoken: string, owner: string): Promise<string>;
54
+ estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, contractInstance?: Contract): Promise<number>;
55
+ buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string): Promise<TransactionReceipt>;
56
+ estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, contractInstance?: Contract): Promise<number>;
57
+ sellDT(address: string, exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string): Promise<TransactionReceipt>;
57
58
  getNumberOfExchanges(): Promise<number>;
58
59
  estSetRate(account: string, exchangeId: string, newRate: string, contractInstance?: Contract): Promise<number>;
59
60
  setRate(address: string, exchangeId: string, newRate: string): Promise<TransactionReceipt>;
@@ -67,8 +68,8 @@ export declare class FixedRateExchange {
67
68
  getDTSupply(exchangeId: string): Promise<string>;
68
69
  getBTSupply(exchangeId: string): Promise<string>;
69
70
  getAllowedSwapper(exchangeId: string): Promise<string>;
70
- getAmountBTIn(exchangeId: string, dataTokenAmount: string): Promise<string>;
71
- getAmountBTOut(exchangeId: string, dataTokenAmount: string): Promise<string>;
71
+ getAmountBTIn(exchangeId: string, datatokenAmount: string): Promise<string>;
72
+ getAmountBTOut(exchangeId: string, datatokenAmount: string): Promise<string>;
72
73
  getExchange(exchangeId: string): Promise<FixedPriceExchange>;
73
74
  getFeesInfo(exchangeId: string): Promise<FeesInfo>;
74
75
  getExchanges(): Promise<string[]>;
@@ -85,7 +86,7 @@ export declare class FixedRateExchange {
85
86
  collectMarketFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
86
87
  estCollectOceanFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
87
88
  collectOceanFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
88
- getOPFCollector(): Promise<string>;
89
+ getOPCCollector(): Promise<string>;
89
90
  getRouter(): Promise<string>;
90
91
  getExchangeOwner(exchangeId: string): Promise<string>;
91
92
  estUpdateMarketFee(account: string, exchangeId: string, newMarketFee: string, contractInstance?: Contract): Promise<number>;
@@ -2,19 +2,21 @@ import Web3 from 'web3';
2
2
  import { AbiItem } from 'web3-utils/types';
3
3
  import { TransactionReceipt } from 'web3-core';
4
4
  import { Contract } from 'web3-eth-contract';
5
+ import { Config } from '../../models';
5
6
  export declare class SideStaking {
6
7
  ssAbi: AbiItem | AbiItem[];
7
8
  web3: Web3;
8
9
  GASLIMIT_DEFAULT: number;
9
- constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[]);
10
+ config: Config;
11
+ constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[], config?: Config);
10
12
  amountToUnits(token: string, amount: string): Promise<string>;
11
13
  unitsToAmount(token: string, amount: string): Promise<string>;
12
- getDataTokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
13
- getDataTokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
14
+ getDatatokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
15
+ getDatatokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
14
16
  getPublisherAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
15
- getBasetoken(ssAddress: string, datatokenAddress: string): Promise<string>;
17
+ getBaseToken(ssAddress: string, datatokenAddress: string): Promise<string>;
16
18
  getPoolAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
17
- getBasetokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
19
+ getBaseTokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
18
20
  getDatatokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
19
21
  getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
20
22
  getvestingAmount(ssAddress: string, datatokenAddress: string): Promise<string>;
@@ -1,5 +1,9 @@
1
1
  import Web3 from 'web3';
2
2
  import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ProviderInitialize } from '../@types/';
3
+ import { DownloadResponse } from '../@types/DownloadResponse';
4
+ export interface HttpCallback {
5
+ (httpMethod: string, url: string, body: string, header: any): Promise<any>;
6
+ }
3
7
  export interface ServiceEndpoint {
4
8
  serviceName: string;
5
9
  method: string;
@@ -12,20 +16,20 @@ export declare class Provider {
12
16
  getEndpoints(providerUri: string): Promise<any>;
13
17
  getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
14
18
  getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
15
- getNonce(providerUri: string, consumerAddress: string, fetchMethod: any, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
19
+ getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
16
20
  createSignature(web3: Web3, accountId: string, agreementId: string): Promise<string>;
17
21
  createHashSignature(web3: Web3, accountId: string, message: string): Promise<string>;
18
- encrypt(data: any, providerUri: string, postMethod: any): Promise<any>;
19
- checkDidFiles(did: string, serviceId: number, providerUri: string, fetchMethod: any): Promise<FileMetadata[]>;
20
- checkFileUrl(url: string, providerUri: string, fetchMethod: any): Promise<FileMetadata[]>;
21
- initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, getMethod: any, userCustomParameters?: UserCustomParameters, computeEnv?: string): Promise<ProviderInitialize>;
22
+ encrypt(data: any, providerUri: string, signal?: AbortSignal): Promise<string>;
23
+ checkDidFiles(did: string, serviceId: number, providerUri: string, signal?: AbortSignal): Promise<FileMetadata[]>;
24
+ checkFileUrl(url: string, providerUri: string, signal?: AbortSignal): Promise<FileMetadata[]>;
25
+ initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
22
26
  getDownloadUrl(did: string, accountId: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, web3: Web3, userCustomParameters?: UserCustomParameters): Promise<any>;
23
- computeStart(providerUri: string, web3: Web3, fetchMethod: any, consumerAddress: string, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
24
- computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, fetchMethod: any): Promise<ComputeJob | ComputeJob[]>;
25
- computeStatus(providerUri: string, fetchMethod: any, jobId?: string, did?: string, consumerAddress?: string): Promise<ComputeJob | ComputeJob[]>;
26
- computeResult(jobId: string, index: number, destination: string, accountId: string, providerUri: string, web3: Web3, fetchMethod: any): Promise<any>;
27
- computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, fetchMethod: any): Promise<ComputeJob | ComputeJob[]>;
28
- isValidProvider(url: string, fetchMethod: any): Promise<boolean>;
27
+ computeStart(providerUri: string, web3: Web3, consumerAddress: string, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
28
+ computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
29
+ computeStatus(providerUri: string, signal?: AbortSignal, jobId?: string, did?: string, consumerAddress?: string): Promise<ComputeJob | ComputeJob[]>;
30
+ computeResult(jobId: string, index: number, accountId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<DownloadResponse | void>;
31
+ computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
32
+ isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
29
33
  }
30
34
  export declare const ProviderInstance: Provider;
31
35
  export default ProviderInstance;
@@ -4,6 +4,8 @@ import { TransactionReceipt } from 'web3-eth';
4
4
  import { Contract } from 'web3-eth-contract';
5
5
  import { FreOrderParams, FreCreationParams } from '../interfaces';
6
6
  import { Nft } from './NFT';
7
+ import { Config } from '../models/index.js';
8
+ import { ProviderFees } from '../@types/Provider.js';
7
9
  interface Roles {
8
10
  minter: boolean;
9
11
  paymentManager: boolean;
@@ -11,13 +13,8 @@ interface Roles {
11
13
  export interface OrderParams {
12
14
  consumer: string;
13
15
  serviceIndex: number;
14
- providerFeeAddress: string;
15
- providerFeeToken: string;
16
- providerFeeAmount: string;
17
- v: string;
18
- r: string;
19
- s: string;
20
- providerData: string;
16
+ ammount: string;
17
+ _providerFees: ProviderFees;
21
18
  }
22
19
  export interface DispenserParams {
23
20
  maxTokens: string;
@@ -32,9 +29,9 @@ export declare class Datatoken {
32
29
  datatokensAbi: AbiItem | AbiItem[];
33
30
  datatokensEnterpriseAbi: AbiItem | AbiItem[];
34
31
  web3: Web3;
35
- startBlock: number;
32
+ config: Config;
36
33
  nft: Nft;
37
- constructor(web3: Web3, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], startBlock?: number);
34
+ constructor(web3: Web3, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], config?: Config);
38
35
  estGasApprove(dtAddress: string, spender: string, amount: string, address: string, contractInstance?: Contract): Promise<any>;
39
36
  approve(dtAddress: string, spender: string, amount: string, address: string): Promise<TransactionReceipt>;
40
37
  estGasMint(dtAddress: string, address: string, amount: string, toAddress?: string, contractInstance?: Contract): Promise<any>;
@@ -57,8 +54,8 @@ export declare class Datatoken {
57
54
  transfer(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
58
55
  estGasTransfer(dtAddress: string, toAddress: string, amount: string, address: string, contractInstance?: Contract): Promise<any>;
59
56
  transferWei(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
60
- estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFeeAddress: string, providerFeeToken: string, providerFeeAmount: string, v: string, r: string, s: string, providerDatas: string, contractInstance?: Contract): Promise<any>;
61
- startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFeeAddress: string, providerFeeToken: string, providerFeeAmount: string, v: string, r: string, s: string, providerDatas: string): Promise<TransactionReceipt>;
57
+ estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, contractInstance?: Contract): Promise<any>;
58
+ startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees): Promise<TransactionReceipt>;
62
59
  estGasBuyFromFreAndOrder(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams, contractInstance?: Contract): Promise<any>;
63
60
  buyFromFreAndOrder(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams): Promise<TransactionReceipt>;
64
61
  estGasBuyFromDispenserAndOrder(dtAddress: string, address: string, orderParams: OrderParams, dispenserContract: string, contractInstance?: Contract): Promise<any>;
@@ -72,6 +69,6 @@ export declare class Datatoken {
72
69
  getDecimals(dtAddress: string): Promise<string>;
73
70
  getNFTAddress(dtAddress: string): Promise<string>;
74
71
  isERC20Deployer(dtAddress: string, address: string): Promise<boolean>;
75
- balance(dataTokenAddress: string, address: string): Promise<string>;
72
+ balance(datatokenAddress: string, address: string): Promise<string>;
76
73
  }
77
74
  export {};
@@ -3,6 +3,8 @@ import { AbiItem } from 'web3-utils';
3
3
  import { TransactionReceipt } from 'web3-eth';
4
4
  import { Contract } from 'web3-eth-contract';
5
5
  import { MetadataProof } from '../../src/@types';
6
+ import { Config } from '../models/index.js';
7
+ import { MetadataAndTokenURI } from '../interfaces/Erc721Interface';
6
8
  interface Roles {
7
9
  manager: boolean;
8
10
  deployERC20: boolean;
@@ -16,7 +18,8 @@ export declare class Nft {
16
18
  nftAbi: AbiItem | AbiItem[];
17
19
  web3: Web3;
18
20
  startBlock: number;
19
- constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], startBlock?: number);
21
+ config: Config;
22
+ constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], config?: Config);
20
23
  estGasCreateErc20(nftAddress: string, address: string, minter: string, feeManager: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, contractInstance?: Contract): Promise<any>;
21
24
  createErc20(nftAddress: string, address: string, minter: string, feeManager: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number): Promise<string>;
22
25
  estGasAddManager(nftAddress: string, address: string, manager: string, contractInstance?: Contract): Promise<any>;
@@ -41,8 +44,10 @@ export declare class Nft {
41
44
  transferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
42
45
  estGasSafeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId: number, contractInstance?: Contract): Promise<any>;
43
46
  safeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
44
- estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number, metaDataDecryptorUrl: string, metaDataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], contractInstance?: Contract): Promise<any>;
45
- setMetadata(nftAddress: string, address: string, metadataState: number, metaDataDecryptorUrl: string, metaDataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[]): Promise<TransactionReceipt>;
47
+ estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], contractInstance?: Contract): Promise<any>;
48
+ setMetadata(nftAddress: string, address: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[]): Promise<TransactionReceipt>;
49
+ estGasSetMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI, contractInstance?: Contract): Promise<any>;
50
+ setMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI): Promise<TransactionReceipt>;
46
51
  estGasSetMetadataState(nftAddress: string, metadataUpdater: string, metadataState: number, contractInstance?: Contract): Promise<any>;
47
52
  setMetadataState(nftAddress: string, address: string, metadataState: number): Promise<TransactionReceipt>;
48
53
  estSetTokenURI(nftAddress: string, address: string, data: string): Promise<any>;
@@ -1,6 +1,6 @@
1
1
  import Config from '../models/Config';
2
2
  export declare const configHelperNetworks: Config[];
3
3
  export declare class ConfigHelper {
4
- getAddressesFromEnv(network: string): Partial<Config>;
4
+ getAddressesFromEnv(network: string, customAddresses?: any): Partial<Config>;
5
5
  getConfig(network: string | number, infuraProjectId?: string): Config;
6
6
  }
@@ -1 +1,2 @@
1
1
  export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
2
+ export declare const GASLIMIT_DEFAULT = 1000000;
@@ -0,0 +1,11 @@
1
+ import Web3 from 'web3';
2
+ import { Contract } from 'web3-eth-contract';
3
+ import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../interfaces';
4
+ import { Config } from '../models';
5
+ export declare function setContractDefaults(contract: Contract, config: Config): Contract;
6
+ export declare function getFairGasPrice(web3: Web3, config: Config): Promise<string>;
7
+ export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
8
+ export declare function getFreCreationParams(freParams: FreCreationParams): any;
9
+ export declare function getPoolCreationParams(poolParams: PoolCreationParams): any;
10
+ export declare function unitsToAmount(web3: Web3, token: string, amount: string): Promise<string>;
11
+ export declare function amountToUnits(web3: Web3, token: string, amount: string): Promise<string>;
@@ -1,5 +1,6 @@
1
+ import { DownloadResponse } from '../@types/DownloadResponse';
1
2
  export declare function fetchData(url: string, opts: RequestInit): Promise<Response>;
2
- export declare function downloadFile(url: string, destination?: string, index?: number): Promise<string>;
3
+ export declare function downloadFileBrowser(url: string): Promise<void>;
4
+ export declare function downloadFile(url: string, index?: number): Promise<DownloadResponse>;
3
5
  export declare function getData(url: string): Promise<Response>;
4
6
  export declare function postData(url: string, payload: BodyInit): Promise<Response>;
5
- export declare function crossFetchGeneric(method: string, url: string, body: string, headers: any): Promise<Response>;
@@ -0,0 +1,7 @@
1
+ import { Contract } from 'web3-eth-contract';
2
+ import { TransactionReceipt } from 'web3-core';
3
+ import Web3 from 'web3';
4
+ export declare function estApprove(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
5
+ export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
6
+ export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string): Promise<string>;
7
+ export declare function balance(web3: Web3, tokenAddress: string, account: string): Promise<string>;
@@ -1,9 +1,9 @@
1
1
  export * from './Logger';
2
- export * from './GasUtils';
3
2
  export * from './DatatokenName';
4
- export * from './ContractParams';
3
+ export * from './ContractUtils';
5
4
  export * from './FetchHelper';
6
5
  export * from './ConfigHelper';
7
6
  export * from './DdoHelpers';
8
7
  export * from './Constants';
9
8
  export * from './SignatureUtils';
9
+ export * from './TokenUtils';
@@ -0,0 +1,2 @@
1
+ import { AbiItem } from 'web3-utils/types';
2
+ export declare const minAbi: AbiItem[];
@@ -166,10 +166,10 @@ The process of creating and deploying the ERC20 datatokens has been automated by
166
166
 
167
167
  ```Javascript
168
168
  const Web3 = require("web3");
169
- const { Ocean, DataTokens } = require("@oceanprotocol/lib");
169
+ const { Ocean, Datatokens } = require("@oceanprotocol/lib");
170
170
 
171
- const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
172
- const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json");
171
+ const { factoryABI } = require("@oceanprotocol/contracts/artifacts/contracts/DTFactory.json");
172
+ const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/contracts/DatatokenTemplate.json");
173
173
  const { config, contracts, urls } = require("./config");
174
174
 
175
175
  const init = async () => {
@@ -180,7 +180,7 @@ const init = async () => {
180
180
  const alice = accounts[0].id;
181
181
  console.log('Alice account address:', alice)
182
182
 
183
- const datatoken = new DataTokens(
183
+ const datatoken = new Datatokens(
184
184
  contracts.DTFactory,
185
185
  factoryABI,
186
186
  datatokensABI,