@oceanprotocol/lib 1.1.7 → 2.0.0-next.2

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 (81) hide show
  1. package/CHANGELOG.md +47 -16
  2. package/CodeExamples.md +28 -315
  3. package/README.md +4 -7
  4. package/dist/lib.js +1 -1
  5. package/dist/lib.js.map +1 -1
  6. package/dist/lib.modern.js +1 -1
  7. package/dist/lib.modern.js.map +1 -1
  8. package/dist/lib.module.js +1 -1
  9. package/dist/lib.module.js.map +1 -1
  10. package/dist/lib.umd.js +1 -1
  11. package/dist/lib.umd.js.map +1 -1
  12. package/dist/src/@types/Asset.d.ts +4 -4
  13. package/dist/src/@types/Compute.d.ts +1 -1
  14. package/dist/src/@types/DDO/DDO.d.ts +2 -5
  15. package/dist/src/@types/{Erc20.d.ts → Datatoken.d.ts} +18 -1
  16. package/dist/src/@types/Dispenser.d.ts +9 -0
  17. package/dist/src/@types/FixedPrice.d.ts +24 -0
  18. package/dist/src/@types/{Erc721.d.ts → NFT.d.ts} +6 -0
  19. package/dist/src/@types/NFTFactory.d.ts +20 -0
  20. package/dist/src/@types/Provider.d.ts +8 -0
  21. package/dist/src/@types/ReturnTypes.d.ts +2 -0
  22. package/dist/src/@types/Router.d.ts +1 -1
  23. package/dist/src/@types/index.d.ts +11 -8
  24. package/dist/src/{models → config}/Config.d.ts +2 -23
  25. package/dist/src/{utils → config}/ConfigHelper.d.ts +1 -1
  26. package/dist/src/config/index.d.ts +2 -0
  27. package/dist/src/contracts/Datatoken.d.ts +232 -0
  28. package/dist/src/contracts/Dispenser.d.ts +73 -0
  29. package/dist/src/contracts/FixedRateExchange.d.ts +212 -0
  30. package/dist/src/contracts/NFT.d.ts +197 -0
  31. package/dist/src/contracts/NFTFactory.d.ts +144 -0
  32. package/dist/src/contracts/Router.d.ts +92 -0
  33. package/dist/src/contracts/SmartContract.d.ts +22 -0
  34. package/dist/src/contracts/SmartContractWithAddress.d.ts +18 -0
  35. package/dist/src/contracts/index.d.ts +11 -0
  36. package/dist/src/contracts/ve/VeAllocate.d.ts +41 -0
  37. package/dist/src/contracts/ve/VeFeeDistributor.d.ts +30 -0
  38. package/dist/src/contracts/ve/VeOcean.d.ts +69 -0
  39. package/dist/src/index.d.ts +4 -7
  40. package/dist/src/{aquarius → services}/Aquarius.d.ts +4 -14
  41. package/dist/src/{provider → services}/Provider.d.ts +5 -13
  42. package/dist/src/services/index.d.ts +2 -0
  43. package/dist/src/utils/Constants.d.ts +2 -0
  44. package/dist/src/utils/ContractUtils.d.ts +14 -8
  45. package/dist/src/utils/DdoHelpers.d.ts +1 -1
  46. package/dist/src/utils/FetchHelper.d.ts +1 -4
  47. package/dist/src/utils/Logger.d.ts +0 -1
  48. package/dist/src/utils/TokenUtils.d.ts +17 -39
  49. package/dist/src/utils/index.d.ts +6 -7
  50. package/dist/test/TestContractHandler.d.ts +4 -4
  51. package/dist/test/config.d.ts +1 -1
  52. package/dist/test/unit/{tokens/Datatoken.test.d.ts → Datatoken.test.d.ts} +0 -0
  53. package/dist/test/unit/{pools/dispenser/Dispenser.test.d.ts → Dispenser.test.d.ts} +0 -0
  54. package/dist/test/unit/{pools/fixedRate/FixedRateExchange.test.d.ts → FixedRateExchange.test.d.ts} +0 -0
  55. package/dist/test/unit/{tokens/Nft.test.d.ts → Nft.test.d.ts} +0 -0
  56. package/dist/test/unit/{factories/NftFactory.test.d.ts → NftFactory.test.d.ts} +0 -0
  57. package/dist/test/unit/{pools/Router.test.d.ts → Router.test.d.ts} +0 -0
  58. package/dist/test/unit/{pools/balancer/Pool.test.d.ts → veOcean.test.d.ts} +0 -0
  59. package/package.json +6 -19
  60. package/dist/src/@types/Pool.d.ts +0 -45
  61. package/dist/src/aquarius/index.d.ts +0 -1
  62. package/dist/src/factories/NFTFactory.d.ts +0 -275
  63. package/dist/src/factories/index.d.ts +0 -1
  64. package/dist/src/models/index.d.ts +0 -1
  65. package/dist/src/pools/Router.d.ts +0 -228
  66. package/dist/src/pools/balancer/Pool.d.ts +0 -395
  67. package/dist/src/pools/balancer/index.d.ts +0 -1
  68. package/dist/src/pools/dispenser/Dispenser.d.ts +0 -145
  69. package/dist/src/pools/dispenser/index.d.ts +0 -1
  70. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +0 -388
  71. package/dist/src/pools/fixedRate/index.d.ts +0 -1
  72. package/dist/src/pools/index.d.ts +0 -5
  73. package/dist/src/pools/ssContracts/SideStaking.d.ts +0 -133
  74. package/dist/src/pools/ssContracts/index.d.ts +0 -1
  75. package/dist/src/provider/index.d.ts +0 -1
  76. package/dist/src/tokens/Datatoken.d.ts +0 -413
  77. package/dist/src/tokens/NFT.d.ts +0 -364
  78. package/dist/src/tokens/index.d.ts +0 -2
  79. package/dist/src/utils/ConversionTypeHelper.d.ts +0 -3
  80. package/dist/src/utils/PoolHelpers.d.ts +0 -8
  81. package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +0 -1
@@ -1,4 +1,4 @@
1
- import { DDO } from './DDO/DDO';
1
+ import { DDO } from '.';
2
2
  export interface AssetNft {
3
3
  /**
4
4
  * Contract address of the deployed ERC721 NFT contract.
@@ -55,7 +55,7 @@ export interface Purgatory {
55
55
  }
56
56
  export interface AssetDatatoken {
57
57
  /**
58
- * Contract address of the deployed ERC20 contract.
58
+ * Contract address of the deployed Datatoken contract.
59
59
  * @type {string}
60
60
  */
61
61
  address: string;
@@ -89,7 +89,7 @@ export interface Asset extends DDO {
89
89
  */
90
90
  nft: AssetNft;
91
91
  /**
92
- * Contains information about the ERC20 datatokens attached to asset services.
92
+ * Contains information about the ERC20 Datatokens attached to asset services.
93
93
  * @type {string}
94
94
  */
95
95
  datatokens: AssetDatatoken[];
@@ -112,7 +112,7 @@ export interface Asset extends DDO {
112
112
  /**
113
113
  * Contains information about an asset's purgatory status defined in
114
114
  * [`list-purgatory`](https://github.com/oceanprotocol/list-purgatory).
115
- * Marketplace interfaces are encouraged to prevent certain user actions like adding liquidity on assets in purgatory.
115
+ * Marketplace interfaces are encouraged to prevent certain user actions like downloading on assets in purgatory.
116
116
  * @type {Purgatory}
117
117
  */
118
118
  purgatory: Purgatory;
@@ -1,4 +1,4 @@
1
- import { Metadata, MetadataAlgorithm } from './DDO/Metadata';
1
+ import { Metadata, MetadataAlgorithm } from '.';
2
2
  export declare type ComputeResultType = 'algorithmLog' | 'output' | 'configrationLog' | 'publishLog';
3
3
  export interface ComputeEnvironment {
4
4
  id: string;
@@ -1,7 +1,4 @@
1
- import { Service } from './Service';
2
- import { Metadata } from './Metadata';
3
- import { Credentials } from './Credentials';
4
- import { Event } from './Event';
1
+ import { Service, Metadata, Credentials, Event } from '..';
5
2
  /**
6
3
  * DID Descriptor Object.
7
4
  * Contains metadata about the asset, and define access in at least one service.
@@ -14,7 +11,7 @@ export interface DDO {
14
11
  '@context': string[];
15
12
  /**
16
13
  * DID, descentralized ID.
17
- * Computed as sha256(address of ERC721 contract + chainId)
14
+ * Computed as sha256(address of NFT contract + chainId)
18
15
  * @type {string}
19
16
  */
20
17
  id: string;
@@ -1,4 +1,5 @@
1
- export interface Erc20CreateParams {
1
+ import { ProviderFees } from '.';
2
+ export interface DatatokenCreateParams {
2
3
  templateIndex: number;
3
4
  minter: string;
4
5
  paymentCollector: string;
@@ -19,3 +20,19 @@ export interface PublishingMarketFee {
19
20
  publishMarketFeeToken: string;
20
21
  publishMarketFeeAmount: string;
21
22
  }
23
+ export interface DatatokenRoles {
24
+ minter: boolean;
25
+ paymentManager: boolean;
26
+ }
27
+ export interface OrderParams {
28
+ consumer: string;
29
+ serviceIndex: number;
30
+ _providerFee: ProviderFees;
31
+ _consumeMarketFee: ConsumeMarketFee;
32
+ }
33
+ export interface DispenserParams {
34
+ maxTokens: string;
35
+ maxBalance: string;
36
+ withMint?: boolean;
37
+ allowedSwapper?: string;
38
+ }
@@ -5,3 +5,12 @@ export interface DispenserCreationParams {
5
5
  withMint?: boolean;
6
6
  allowedSwapper?: string;
7
7
  }
8
+ export interface DispenserToken {
9
+ active: boolean;
10
+ owner: string;
11
+ maxTokens: string;
12
+ maxBalance: string;
13
+ balance: string;
14
+ isMinter: boolean;
15
+ allowedSwapper: string;
16
+ }
@@ -25,3 +25,27 @@ export interface PriceAndFees {
25
25
  marketFeeAmount: string;
26
26
  consumeMarketFeeAmount: string;
27
27
  }
28
+ export interface FixedPriceExchange {
29
+ active: boolean;
30
+ exchangeOwner: string;
31
+ datatoken: string;
32
+ baseToken: string;
33
+ fixedRate: string;
34
+ dtDecimals: string;
35
+ btDecimals: string;
36
+ dtBalance: string;
37
+ btBalance: string;
38
+ dtSupply: string;
39
+ btSupply: string;
40
+ withMint: boolean;
41
+ allowedSwapper: string;
42
+ exchangeId?: string;
43
+ }
44
+ export interface FeesInfo {
45
+ opcFee: string;
46
+ marketFee: string;
47
+ marketFeeCollector: string;
48
+ marketFeeAvailable: string;
49
+ oceanFeeAvailable: string;
50
+ exchangeId: string;
51
+ }
@@ -10,3 +10,9 @@ export interface MetadataAndTokenURI {
10
10
  tokenURI: string;
11
11
  metadataProofs?: MetadataProof[];
12
12
  }
13
+ export interface NftRoles {
14
+ manager: boolean;
15
+ deployERC20: boolean;
16
+ updateMetadata: boolean;
17
+ store: boolean;
18
+ }
@@ -0,0 +1,20 @@
1
+ import { ConsumeMarketFee, ProviderFees } from '.';
2
+ export interface Template {
3
+ templateAddress: string;
4
+ isActive: boolean;
5
+ }
6
+ export interface TokenOrder {
7
+ tokenAddress: string;
8
+ consumer: string;
9
+ serviceIndex: number;
10
+ _providerFee: ProviderFees;
11
+ _consumeMarketFee: ConsumeMarketFee;
12
+ }
13
+ export interface NftCreateData {
14
+ name: string;
15
+ symbol: string;
16
+ templateIndex: number;
17
+ tokenURI: string;
18
+ transferable: boolean;
19
+ owner: string;
20
+ }
@@ -23,3 +23,11 @@ export interface ProviderComputeInitializeResults {
23
23
  algorithm?: ProviderComputeInitialize;
24
24
  datasets?: ProviderComputeInitialize[];
25
25
  }
26
+ export interface ServiceEndpoint {
27
+ serviceName: string;
28
+ method: string;
29
+ urlPath: string;
30
+ }
31
+ export interface UserCustomParameters {
32
+ [key: string]: any;
33
+ }
@@ -0,0 +1,2 @@
1
+ import { TransactionReceipt } from 'web3-core';
2
+ export declare type ReceiptOrEstimate<G extends boolean = false> = G extends false ? TransactionReceipt : number;
@@ -1,6 +1,6 @@
1
1
  export interface Operation {
2
2
  /**
3
- * used only for FixedRate or Dispenser, but needs to be filled even for pool
3
+ * used for FixedRate or Dispenser
4
4
  * @type {string}
5
5
  */
6
6
  exchangeIds: string;
@@ -1,15 +1,18 @@
1
- export * from './DDO/DDO';
2
- export * from './Asset';
3
- export * from './DDO/Service';
4
1
  export * from './DDO/Credentials';
2
+ export * from './DDO/DDO';
3
+ export * from './DDO/Event';
5
4
  export * from './DDO/Metadata';
5
+ export * from './DDO/Service';
6
+ export * from './Asset';
6
7
  export * from './File';
7
8
  export * from './FileInfo';
8
9
  export * from './Compute';
9
- export * from './Provider';
10
- export * from './FixedPrice';
11
- export * from './Pool';
12
- export * from './Erc20';
13
- export * from './Erc721';
10
+ export * from './Datatoken';
14
11
  export * from './Dispenser';
12
+ export * from './DownloadResponse';
13
+ export * from './FixedPrice';
14
+ export * from './NFT';
15
+ export * from './NFTFactory';
16
+ export * from './Provider';
15
17
  export * from './Router';
18
+ export * from './ReturnTypes';
@@ -1,5 +1,5 @@
1
- import { LogLevel } from '../utils/Logger';
2
1
  import { AbiItem } from 'web3-utils/types';
2
+ import { LogLevel } from '../utils';
3
3
  export declare class Config {
4
4
  /**
5
5
  * Ethereum node URL.
@@ -35,32 +35,12 @@ export declare class Config {
35
35
  * Factory address
36
36
  * @type {string}
37
37
  */
38
- erc721FactoryAddress?: string;
39
- /**
40
- * Factory ABI
41
- * @type {string}
42
- */
43
- erc721FFactoryABI?: AbiItem | AbiItem[];
38
+ nftFactoryAddress?: string;
44
39
  /**
45
40
  * datatokens ABI
46
41
  * @type {string}
47
42
  */
48
43
  datatokensABI?: AbiItem | AbiItem[];
49
- /**
50
- * Pool Template address
51
- * @type {string}
52
- */
53
- poolTemplateAddress?: string;
54
- /**
55
- * Pool Factory ABI
56
- * @type {string}
57
- */
58
- poolFactoryABI?: AbiItem | AbiItem[];
59
- /**
60
- * Pool ABI
61
- * @type {string}
62
- */
63
- poolABI?: AbiItem | AbiItem[];
64
44
  /**
65
45
  * FixedRateExchangeAddress
66
46
  * @type {string}
@@ -163,4 +143,3 @@ export declare class Config {
163
143
  */
164
144
  gasFeeMultiplier: number;
165
145
  }
166
- export default Config;
@@ -1,4 +1,4 @@
1
- import Config from '../models/Config';
1
+ import { Config } from '.';
2
2
  export declare const configHelperNetworks: Config[];
3
3
  export declare class ConfigHelper {
4
4
  getAddressesFromEnv(network: string, customAddresses?: any): Partial<Config>;
@@ -0,0 +1,2 @@
1
+ export * from './Config';
2
+ export * from './ConfigHelper';
@@ -0,0 +1,232 @@
1
+ import Web3 from 'web3';
2
+ import { AbiItem } from 'web3-utils';
3
+ import { TransactionReceipt } from 'web3-eth';
4
+ import { ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees, PublishingMarketFee, DispenserParams, OrderParams, DatatokenRoles, ReceiptOrEstimate } from '../@types';
5
+ import { Nft } from './NFT';
6
+ import { Config } from '../config';
7
+ import { SmartContract } from './SmartContract';
8
+ export declare class Datatoken extends SmartContract {
9
+ abiEnterprise: AbiItem | AbiItem[];
10
+ nft: Nft;
11
+ getDefaultAbi(): AbiItem | AbiItem[];
12
+ /**
13
+ * Instantiate ERC20 Datatokens
14
+ * @param {AbiItem | AbiItem[]} datatokensAbi
15
+ * @param {Web3} web3
16
+ */
17
+ constructor(web3: Web3, network?: string | number, config?: Config, abi?: AbiItem | AbiItem[], abiEnterprise?: AbiItem | AbiItem[]);
18
+ /**
19
+ * Approve
20
+ * @param {String} dtAddress Datatoken address
21
+ * @param {String} spender Spender address
22
+ * @param {string} amount Number of datatokens, as number. Will be converted to wei
23
+ * @param {String} address User adress
24
+ * @return {Promise<ReceiptOrEstimate>} trxReceipt
25
+ */
26
+ approve<G extends boolean = false>(dtAddress: string, spender: string, amount: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
27
+ /**
28
+ * Creates a new FixedRateExchange setup.
29
+ * @param {String} dtAddress Datatoken address
30
+ * @param {String} address Caller address
31
+ * @param {String} fixedPriceAddress
32
+ * @param {FixedRateParams} fixedRateParams
33
+ * @return {Promise<ReceiptOrEstimate>} transactionId
34
+ */
35
+ createFixedRate<G extends boolean = false>(dtAddress: string, address: string, fixedRateParams: FreCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
36
+ /**
37
+ * Creates a new Dispenser
38
+ * @param {String} dtAddress Datatoken address
39
+ * @param {String} address Caller address
40
+ * @param {String} dispenserAddress ispenser contract address
41
+ * @param {String} dispenserParams
42
+ * @return {Promise<ReceiptOrEstimate>} transactionId
43
+ */
44
+ createDispenser<G extends boolean = false>(dtAddress: string, address: string, dispenserAddress: string, dispenserParams: DispenserParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
45
+ /**
46
+ * Mint
47
+ * @param {String} dtAddress Datatoken address
48
+ * @param {String} address Minter address
49
+ * @param {String} amount Number of datatokens, as number. Will be converted to wei
50
+ * @param {String} toAddress only if toAddress is different from the minter
51
+ * @return {Promise<ReceiptOrEstimate>} transactionId
52
+ */
53
+ mint<G extends boolean = false>(dtAddress: string, address: string, amount: string, toAddress?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
54
+ /**
55
+ * Add Minter for an ERC20 Datatoken
56
+ * only DatatokenDeployer can succeed
57
+ * @param {String} dtAddress Datatoken address
58
+ * @param {String} address User address
59
+ * @param {String} minter User which is going to be a Minter
60
+ * @return {Promise<ReceiptOrEstimate>} transactionId
61
+ */
62
+ addMinter<G extends boolean = false>(dtAddress: string, address: string, minter: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
63
+ /**
64
+ * Revoke Minter permission for an ERC20 Datatoken
65
+ * only DatatokenDeployer can succeed
66
+ * @param {String} dtAddress Datatoken address
67
+ * @param {String} address User address
68
+ * @param {String} minter User which will be removed from Minter permission
69
+ * @param {Contract} contractInstance optional contract instance
70
+ * @return {Promise<any>}
71
+ */
72
+ removeMinter<G extends boolean = false>(dtAddress: string, address: string, minter: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
73
+ /**
74
+ * Add addPaymentManager (can set who's going to collect fee when consuming orders)
75
+ * only DatatokenDeployer can succeed
76
+ * @param {String} dtAddress Datatoken address
77
+ * @param {String} address User address
78
+ * @param {String} paymentManager User which is going to be a Minter
79
+ * @return {Promise<ReceiptOrEstimate>} transactionId
80
+ */
81
+ addPaymentManager<G extends boolean = false>(dtAddress: string, address: string, paymentManager: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
82
+ /**
83
+ * Revoke paymentManager permission for an ERC20 Datatoken
84
+ * only DatatokenDeployer can succeed
85
+ * @param {String} dtAddress Datatoken address
86
+ * @param {String} address User address
87
+ * @param {String} paymentManager User which will be removed from paymentManager permission
88
+ * @return {Promise<ReceiptOrEstimate>} trxReceipt
89
+ */
90
+ removePaymentManager<G extends boolean = false>(dtAddress: string, address: string, paymentManager: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
91
+ /**
92
+ * This function allows to set a new PaymentCollector (receives DT when consuming)
93
+ * If not set the paymentCollector is the NFT Owner
94
+ * only NFT owner can call
95
+ * @param dtAddress datatoken address
96
+ * @param address Caller address
97
+ * @param paymentCollector User to be set as new payment collector
98
+ * @return {Promise<ReceiptOrEstimate>} trxReceipt
99
+ */
100
+ setPaymentCollector<G extends boolean = false>(dtAddress: string, address: string, paymentCollector: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
101
+ /** getPaymentCollector - It returns the current paymentCollector
102
+ * @param dtAddress datatoken address
103
+ * @return {Promise<string>}
104
+ */
105
+ getPaymentCollector(dtAddress: string): Promise<string>;
106
+ /**
107
+ * Transfer as number from address to toAddress
108
+ * @param {String} dtAddress Datatoken address
109
+ * @param {String} toAddress Receiver address
110
+ * @param {String} amount Number of datatokens, as number. To be converted to wei.
111
+ * @param {String} address User adress
112
+ * @return {Promise<ReceiptOrEstimate>} transactionId
113
+ */
114
+ transfer(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
115
+ /**
116
+ * Transfer in wei from address to toAddress
117
+ * @param {String} dtAddress Datatoken address
118
+ * @param {String} toAddress Receiver address
119
+ * @param {String} amount Number of datatokens, as number. Expressed as wei
120
+ * @param {String} address User adress
121
+ * @return {Promise<ReceiptOrEstimate>} transactionId
122
+ */
123
+ transferWei<G extends boolean = false>(dtAddress: string, toAddress: string, amount: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
124
+ /** Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
125
+ * @param {String} dtAddress Datatoken address
126
+ * @param {String} address User address which calls
127
+ * @param {String} consumer Consumer Address
128
+ * @param {Number} serviceIndex Service index in the metadata
129
+ * @param {providerFees} providerFees provider fees
130
+ * @param {consumeMarketFee} ConsumeMarketFee consume market fees
131
+ * @return {Promise<ReceiptOrEstimate>} string
132
+ */
133
+ startOrder<G extends boolean = false>(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
134
+ /** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
135
+ * Pays the provider fee again, but it will not require a new datatoken payment
136
+ * Requires previous approval of provider fee.
137
+ * @param {String} dtAddress Datatoken address
138
+ * @param {String} address User address which calls
139
+ * @param {String} orderTxId previous valid order
140
+ * @param {providerFees} providerFees provider fees
141
+ * @return {Promise<ReceiptOrEstimate>} string
142
+ */
143
+ reuseOrder<G extends boolean = false>(dtAddress: string, address: string, orderTxId: string, providerFees: ProviderFees, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
144
+ /** Buys 1 DT from the FRE and then startsOrder, while burning that DT
145
+ * @param {String} dtAddress Datatoken address
146
+ * @param {String} address User address which calls
147
+ * @param {OrderParams} orderParams Consumer Address
148
+ * @param {FreParams} freParams Amount of tokens that is going to be transfered
149
+ * @return {Promise<ReceiptOrEstimate>}
150
+ */
151
+ buyFromFreAndOrder<G extends boolean = false>(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
152
+ /** Gets DT from dispenser and then startsOrder, while burning that DT
153
+ * @param {String} dtAddress Datatoken address
154
+ * @param {String} address User address which calls
155
+ * @param {OrderParams} orderParams
156
+ * @param {String} dispenserContract
157
+ * @return {Promise<ReceiptOrEstimate>}
158
+ */
159
+ buyFromDispenserAndOrder<G extends boolean = false>(dtAddress: string, address: string, orderParams: OrderParams, dispenserContract: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
160
+ /** setData
161
+ * This function allows to store data with a preset key (keccak256(dtAddress)) into NFT 725 Store
162
+ * only DatatokenDeployer can succeed
163
+ * @param {String} dtAddress Datatoken address
164
+ * @param {String} address User address
165
+ * @param {String} value Data to be stored into 725Y standard
166
+ * @return {Promise<ReceiptOrEstimate>} transactionId
167
+ */
168
+ setData<G extends boolean = false>(dtAddress: string, address: string, value: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
169
+ /**
170
+ * Clean Datatoken level Permissions (minters, paymentManager and reset the paymentCollector) for an ERC20 Datatoken
171
+ * Only NFT Owner (at 721 level) can call it.
172
+ * @param dtAddress Datatoken address where we want to clean permissions
173
+ * @param address User adress
174
+ * @return {Promise<ReceiptOrEstimate>} transactionId
175
+ */
176
+ cleanPermissions<G extends boolean = false>(dtAddress: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
177
+ /** Returns ERC20 Datatoken user's permissions for a datatoken
178
+ * @param {String} dtAddress Datatoken adress
179
+ * @param {String} address user adress
180
+ * @return {Promise<DatatokenRoles>}
181
+ */
182
+ getPermissions(dtAddress: string, address: string): Promise<DatatokenRoles>;
183
+ /** Returns the Datatoken capital
184
+ * @param {String} dtAddress Datatoken adress
185
+ * @return {Promise<string>}
186
+ */
187
+ getCap(dtAddress: string): Promise<string>;
188
+ /** It returns the token decimals, how many supported decimal points
189
+ * @param {String} dtAddress Datatoken adress
190
+ * @return {Promise<number>}
191
+ */
192
+ getDecimals(dtAddress: string): Promise<string>;
193
+ /** It returns the token decimals, how many supported decimal points
194
+ * @param {String} dtAddress Datatoken adress
195
+ * @return {Promise<number>}
196
+ */
197
+ getNFTAddress(dtAddress: string): Promise<string>;
198
+ /** Returns true if address has deployERC20 role
199
+ * @param {String} dtAddress Datatoken adress
200
+ * @param {String} dtAddress Datatoken adress
201
+ * @return {Promise<boolean>}
202
+ */
203
+ isDatatokenDeployer(dtAddress: string, address: string): Promise<boolean>;
204
+ /**
205
+ * Get Address Balance for datatoken
206
+ * @param {String} dtAddress Datatoken adress
207
+ * @param {String} address user adress
208
+ * @return {Promise<String>} balance Number of datatokens. Will be converted from wei
209
+ */
210
+ balance(datatokenAddress: string, address: string): Promise<string>;
211
+ /**
212
+ * @dev setPublishingMarketFee
213
+ * Only publishMarketFeeAddress can call it
214
+ * This function allows to set the fee required by the publisherMarket
215
+ * @param {string} datatokenAddress Datatoken adress
216
+ * @param {string} publishMarketFeeAddress new publish Market Fee Address
217
+ * @param {string} publishMarketFeeToken new publish Market Fee Token
218
+ * @param {string} publishMarketFeeAmount new fee amount
219
+ * @param {String} address user adress
220
+ */
221
+ setPublishingMarketFee<G extends boolean = false>(datatokenAddress: string, publishMarketFeeAddress: string, publishMarketFeeToken: string, publishMarketFeeAmount: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
222
+ /**
223
+ * @dev getPublishingMarketFee
224
+ * Get publishingMarket Fee
225
+ * This function allows to get the current fee set by the publishing market
226
+ * @param {String} datatokenAddress Datatoken adress
227
+ * @param {String} address user adress
228
+ * @return {Promise<PublishingMarketFee>} Current fee set by the publishing market
229
+ */
230
+ getPublishingMarketFee(datatokenAddress: string, address: string): Promise<PublishingMarketFee>;
231
+ private getFreOrderParams;
232
+ }
@@ -0,0 +1,73 @@
1
+ import { AbiItem } from 'web3-utils';
2
+ import { Datatoken } from './Datatoken';
3
+ import { SmartContractWithAddress } from './SmartContractWithAddress';
4
+ import { DispenserToken, ReceiptOrEstimate } from '../@types';
5
+ export declare class Dispenser extends SmartContractWithAddress {
6
+ getDefaultAbi(): AbiItem | AbiItem[];
7
+ /**
8
+ * Get information about a datatoken dispenser
9
+ * @param {String} dtAddress
10
+ * @return {Promise<FixedPricedExchange>} Exchange details
11
+ */
12
+ status(dtAdress: string): Promise<DispenserToken>;
13
+ /**
14
+ * Creates a new Dispenser
15
+ * @param {String} dtAddress Datatoken address
16
+ * @param {String} address Owner address
17
+ * @param {String} maxTokens max tokens to dispense
18
+ * @param {String} maxBalance max balance of requester
19
+ * @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
20
+ * @return {Promise<ReceiptOrEstimate>} transactionId
21
+ */
22
+ create<G extends boolean = false>(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
23
+ /**
24
+ * Activates a new dispener.
25
+ * @param {String} dtAddress refers to datatoken address.
26
+ * @param {Number} maxTokens max amount of tokens to dispense
27
+ * @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
28
+ * @param {String} address User address (must be owner of the datatoken)
29
+ * @return {Promise<ReceiptOrEstimate>} TransactionReceipt
30
+ */
31
+ activate<G extends boolean = false>(dtAddress: string, maxTokens: string, maxBalance: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
32
+ /**
33
+ * Deactivate an existing dispenser.
34
+ * @param {String} dtAddress refers to datatoken address.
35
+ * @param {String} address User address (must be owner of the datatoken)
36
+ * @return {Promise<ReceiptOrEstimate>} TransactionReceipt
37
+ */
38
+ deactivate<G extends boolean = false>(dtAddress: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
39
+ /**
40
+ * Sets a new allowedSwapper.
41
+ * @param {String} dtAddress refers to datatoken address.
42
+ * @param {String} address User address (must be owner of the datatoken)
43
+ * @param {String} newAllowedSwapper refers to the new allowedSwapper
44
+ * @return {Promise<ReceiptOrEstimate>} TransactionReceipt
45
+ */
46
+ setAllowedSwapper<G extends boolean = false>(dtAddress: string, address: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
47
+ /**
48
+ * Dispense datatokens to caller.
49
+ * The dispenser must be active, hold enough DT (or be able to mint more)
50
+ * and respect maxTokens/maxBalance requirements
51
+ * @param {String} dtAddress refers to datatoken address.
52
+ * @param {String} address User address
53
+ * @param {String} amount amount of datatokens required.
54
+ * @param {String} destination who will receive the tokens
55
+ * @return {Promise<ReceiptOrEstimate>} TransactionReceipt
56
+ */
57
+ dispense<G extends boolean = false>(dtAddress: string, address: string, amount: string, destination: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
58
+ /**
59
+ * Withdraw all tokens from the dispenser
60
+ * @param {String} dtAddress refers to datatoken address.
61
+ * @param {String} address User address (must be owner of the dispenser)
62
+ * @return {Promise<ReceiptOrEstimate>} TransactionReceipt
63
+ */
64
+ ownerWithdraw<G extends boolean = false>(dtAddress: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
65
+ /**
66
+ * Check if tokens can be dispensed
67
+ * @param {String} dtAddress
68
+ * @param {String} address User address that will receive datatokens
69
+ * @param {String} amount amount of datatokens required.
70
+ * @return {Promise<Boolean>}
71
+ */
72
+ isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
73
+ }