@oceanprotocol/lib 0.20.2 → 1.0.0-next.11

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 (152) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +1 -1
  3. package/dist/lib.js +2 -0
  4. package/dist/lib.js.map +1 -0
  5. package/dist/lib.modern.js +2 -0
  6. package/dist/lib.modern.js.map +1 -0
  7. package/dist/lib.module.js +2 -0
  8. package/dist/lib.module.js.map +1 -0
  9. package/dist/lib.umd.js +2 -0
  10. package/dist/lib.umd.js.map +1 -0
  11. package/dist/src/@types/Asset.d.ts +119 -0
  12. package/dist/{node/ocean/interfaces → src/@types}/Compute.d.ts +13 -12
  13. package/dist/src/@types/DDO/Credentials.d.ts +8 -0
  14. package/dist/src/@types/DDO/DDO.d.ts +58 -0
  15. package/dist/src/@types/DDO/Event.d.ts +27 -0
  16. package/dist/src/@types/DDO/Metadata.d.ts +126 -0
  17. package/dist/src/@types/DDO/Service.d.ts +124 -0
  18. package/dist/src/@types/Dispenser.d.ts +7 -0
  19. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  20. package/dist/src/@types/Erc20.d.ts +11 -0
  21. package/dist/src/@types/Erc721.d.ts +12 -0
  22. package/dist/src/@types/FileMetadata.d.ts +38 -0
  23. package/dist/src/@types/FixedPrice.d.ts +19 -0
  24. package/dist/src/@types/Pool.d.ts +36 -0
  25. package/dist/src/@types/Provider.d.ts +16 -0
  26. package/dist/src/@types/Router.d.ts +59 -0
  27. package/dist/src/@types/index.d.ts +14 -0
  28. package/dist/src/aquarius/Aquarius.d.ts +36 -0
  29. package/dist/src/aquarius/index.d.ts +1 -0
  30. package/dist/src/factories/NFTFactory.d.ts +273 -0
  31. package/dist/src/factories/index.d.ts +1 -0
  32. package/dist/src/index.d.ts +7 -0
  33. package/dist/src/models/Config.d.ts +166 -0
  34. package/dist/src/models/index.d.ts +1 -0
  35. package/dist/src/pools/Router.d.ts +229 -0
  36. package/dist/src/pools/balancer/Pool.d.ts +408 -0
  37. package/dist/src/pools/balancer/index.d.ts +1 -0
  38. package/dist/src/pools/dispenser/Dispenser.d.ts +146 -0
  39. package/dist/src/pools/dispenser/index.d.ts +1 -0
  40. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +375 -0
  41. package/dist/src/pools/fixedRate/index.d.ts +1 -0
  42. package/dist/src/pools/index.d.ts +3 -0
  43. package/dist/src/pools/ssContracts/SideStaking.d.ts +132 -0
  44. package/dist/src/pools/ssContracts/index.d.ts +1 -0
  45. package/dist/src/provider/Provider.d.ts +142 -0
  46. package/dist/src/provider/index.d.ts +1 -0
  47. package/dist/src/tokens/Datatoken.d.ts +362 -0
  48. package/dist/src/tokens/NFT.d.ts +355 -0
  49. package/dist/src/tokens/index.d.ts +2 -0
  50. package/dist/src/utils/ConfigHelper.d.ts +6 -0
  51. package/dist/src/utils/Constants.d.ts +2 -0
  52. package/dist/src/utils/ContractUtils.d.ts +11 -0
  53. package/dist/src/utils/ConversionTypeHelper.d.ts +3 -0
  54. package/dist/src/utils/DatatokenName.d.ts +11 -0
  55. package/dist/src/utils/DdoHelpers.d.ts +2 -0
  56. package/dist/src/utils/FetchHelper.d.ts +6 -0
  57. package/dist/{node → src}/utils/Logger.d.ts +0 -0
  58. package/dist/src/utils/SignatureUtils.d.ts +8 -0
  59. package/dist/src/utils/TokenUtils.d.ts +39 -0
  60. package/dist/src/utils/index.d.ts +9 -0
  61. package/dist/src/utils/minAbi.d.ts +2 -0
  62. package/dist/test/TestContractHandler.d.ts +44 -0
  63. package/dist/test/integration/ComputeFlow.test.d.ts +1 -0
  64. package/dist/test/integration/Provider.test.d.ts +1 -0
  65. package/dist/test/integration/PublishFlows.test.d.ts +1 -0
  66. package/dist/test/integration/SimplePublishConsumeFlow.test.d.ts +1 -0
  67. package/dist/test/integration/config.d.ts +3 -0
  68. package/dist/test/unit/NftFactory.test.d.ts +1 -0
  69. package/dist/test/unit/config.d.ts +3 -0
  70. package/dist/test/unit/pools/Router.test.d.ts +1 -0
  71. package/dist/test/unit/pools/balancer/Pool.test.d.ts +1 -0
  72. package/dist/test/unit/pools/dispenser/Dispenser.test.d.ts +1 -0
  73. package/dist/test/unit/pools/fixedRate/FixedRateExchange.test.d.ts +1 -0
  74. package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +1 -0
  75. package/dist/test/unit/tokens/Datatoken.test.d.ts +1 -0
  76. package/dist/test/unit/tokens/Nft.test.d.ts +1 -0
  77. package/docs/beginners_guide.md +4 -4
  78. package/docs/overview.md +100 -9
  79. package/docs/quickstart_marketplace.md +34 -33
  80. package/docs/quickstart_simple.md +18 -16
  81. package/package.json +41 -33
  82. package/dist/node/Instantiable.abstract.d.ts +0 -25
  83. package/dist/node/balancer/OceanPool.d.ts +0 -95
  84. package/dist/node/balancer/Pool.d.ts +0 -56
  85. package/dist/node/balancer/PoolFactory.d.ts +0 -15
  86. package/dist/node/datatokens/ContractEvent.d.ts +0 -19
  87. package/dist/node/datatokens/ContractHandler.d.ts +0 -12
  88. package/dist/node/datatokens/Datatokens.d.ts +0 -44
  89. package/dist/node/datatokens/EventHandler.d.ts +0 -19
  90. package/dist/node/datatokens/Network.d.ts +0 -5
  91. package/dist/node/datatokens/Web3Provider.d.ts +0 -5
  92. package/dist/node/datatokens/contracts/ContractBase.d.ts +0 -27
  93. package/dist/node/ddo/DDO.d.ts +0 -36
  94. package/dist/node/ddo/interfaces/AdditionalInformation.d.ts +0 -16
  95. package/dist/node/ddo/interfaces/Authentication.d.ts +0 -4
  96. package/dist/node/ddo/interfaces/BestPrice.d.ts +0 -10
  97. package/dist/node/ddo/interfaces/Consumable.d.ts +0 -5
  98. package/dist/node/ddo/interfaces/Credentials.d.ts +0 -9
  99. package/dist/node/ddo/interfaces/Curation.d.ts +0 -6
  100. package/dist/node/ddo/interfaces/DataTokenInfo.d.ts +0 -10
  101. package/dist/node/ddo/interfaces/EditableMetadata.d.ts +0 -9
  102. package/dist/node/ddo/interfaces/EditableMetadataLinks.d.ts +0 -5
  103. package/dist/node/ddo/interfaces/Event.d.ts +0 -7
  104. package/dist/node/ddo/interfaces/File.d.ts +0 -13
  105. package/dist/node/ddo/interfaces/Metadata.d.ts +0 -15
  106. package/dist/node/ddo/interfaces/MetadataAlgorithm.d.ts +0 -12
  107. package/dist/node/ddo/interfaces/MetadataMain.d.ts +0 -12
  108. package/dist/node/ddo/interfaces/Proof.d.ts +0 -6
  109. package/dist/node/ddo/interfaces/PublicKey.d.ts +0 -8
  110. package/dist/node/ddo/interfaces/PurgatoryData.d.ts +0 -4
  111. package/dist/node/ddo/interfaces/Service.d.ts +0 -99
  112. package/dist/node/ddo/interfaces/ServicePrices.d.ts +0 -4
  113. package/dist/node/ddo/interfaces/Status.d.ts +0 -5
  114. package/dist/node/ddo/interfaces/index.d.ts +0 -17
  115. package/dist/node/dispenser/Dispenser.d.ts +0 -44
  116. package/dist/node/exchange/FixedRateExchange.d.ts +0 -59
  117. package/dist/node/index.d.ts +0 -1
  118. package/dist/node/lib.d.ts +0 -15
  119. package/dist/node/lib.js +0 -2
  120. package/dist/node/lib.js.map +0 -1
  121. package/dist/node/lib.module.js +0 -2
  122. package/dist/node/lib.module.js.map +0 -1
  123. package/dist/node/lib.umd.js +0 -2
  124. package/dist/node/lib.umd.js.map +0 -1
  125. package/dist/node/metadatacache/MetadataCache.d.ts +0 -41
  126. package/dist/node/metadatacache/OnChainMetaData.d.ts +0 -31
  127. package/dist/node/models/Config.d.ts +0 -31
  128. package/dist/node/ocean/Account.d.ts +0 -16
  129. package/dist/node/ocean/Accounts.d.ts +0 -9
  130. package/dist/node/ocean/Assets.d.ts +0 -56
  131. package/dist/node/ocean/AssetsCredential.d.ts +0 -6
  132. package/dist/node/ocean/Compute.d.ts +0 -75
  133. package/dist/node/ocean/DID.d.ts +0 -8
  134. package/dist/node/ocean/EventAccessControl.d.ts +0 -9
  135. package/dist/node/ocean/Ocean.d.ts +0 -34
  136. package/dist/node/ocean/OceanAuth.d.ts +0 -15
  137. package/dist/node/ocean/Versions.d.ts +0 -25
  138. package/dist/node/ocean/utils/SignatureUtils.d.ts +0 -13
  139. package/dist/node/ocean/utils/Utils.d.ts +0 -8
  140. package/dist/node/ocean/utils/WebServiceConnector.d.ts +0 -16
  141. package/dist/node/provider/Provider.d.ts +0 -56
  142. package/dist/node/utils/AssetResolverHelper.d.ts +0 -8
  143. package/dist/node/utils/ConfigHelper.d.ts +0 -17
  144. package/dist/node/utils/ContractUtils.d.ts +0 -5
  145. package/dist/node/utils/ConversionTypeHelpers.d.ts +0 -8
  146. package/dist/node/utils/Datatokens.d.ts +0 -7
  147. package/dist/node/utils/GeneratorHelpers.d.ts +0 -1
  148. package/dist/node/utils/PromiseResolver.d.ts +0 -3
  149. package/dist/node/utils/SubscribableObserver.d.ts +0 -12
  150. package/dist/node/utils/SubscribablePromise.d.ts +0 -14
  151. package/dist/node/utils/Timeout.d.ts +0 -1
  152. package/dist/node/utils/index.d.ts +0 -9
@@ -0,0 +1,146 @@
1
+ import Web3 from 'web3';
2
+ import { AbiItem } from 'web3-utils';
3
+ import { Contract } from 'web3-eth-contract';
4
+ import { TransactionReceipt } from 'web3-eth';
5
+ import { Datatoken } from '../../tokens';
6
+ import { Config } from '../../models/index.js';
7
+ export interface DispenserToken {
8
+ active: boolean;
9
+ owner: string;
10
+ maxTokens: string;
11
+ maxBalance: string;
12
+ balance: string;
13
+ isMinter: boolean;
14
+ allowedSwapper: string;
15
+ }
16
+ export declare class Dispenser {
17
+ GASLIMIT_DEFAULT: number;
18
+ web3: Web3;
19
+ dispenserAddress: string;
20
+ config: Config;
21
+ dispenserAbi: AbiItem | AbiItem[];
22
+ dispenserContract: Contract;
23
+ /**
24
+ * Instantiate Dispenser
25
+ * @param {any} web3
26
+ * @param {String} dispenserAddress
27
+ * @param {any} dispenserABI
28
+ */
29
+ constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
30
+ /**
31
+ * Get information about a datatoken dispenser
32
+ * @param {String} dtAddress
33
+ * @return {Promise<FixedPricedExchange>} Exchange details
34
+ */
35
+ status(dtAdress: string): Promise<DispenserToken>;
36
+ /**
37
+ * Estimate gas cost for create method
38
+ * @param {String} dtAddress Datatoken address
39
+ * @param {String} address Owner address
40
+ * @param {String} maxTokens max tokens to dispense
41
+ * @param {String} maxBalance max balance of requester
42
+ * @param {String} allowedSwapper if !=0, only this address can request DTs
43
+ * @return {Promise<any>}
44
+ */
45
+ estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
46
+ /**
47
+ * Creates a new Dispenser
48
+ * @param {String} dtAddress Datatoken address
49
+ * @param {String} address Owner address
50
+ * @param {String} maxTokens max tokens to dispense
51
+ * @param {String} maxBalance max balance of requester
52
+ * @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
53
+ * @return {Promise<TransactionReceipt>} transactionId
54
+ */
55
+ create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
56
+ /**
57
+ * Estimate gas for activate method
58
+ * @param {String} dtAddress
59
+ * @param {Number} maxTokens max amount of tokens to dispense
60
+ * @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
61
+ * @param {String} address User address (must be owner of the datatoken)
62
+ * @return {Promise<any>}
63
+ */
64
+ estGasActivate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<any>;
65
+ /**
66
+ * Activates a new dispener.
67
+ * @param {String} dtAddress refers to datatoken address.
68
+ * @param {Number} maxTokens max amount of tokens to dispense
69
+ * @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
70
+ * @param {String} address User address (must be owner of the datatoken)
71
+ * @return {Promise<TransactionReceipt>} TransactionReceipt
72
+ */
73
+ activate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<TransactionReceipt>;
74
+ /**
75
+ * Estimate gas for deactivate method
76
+ * @param {String} dtAddress
77
+ * @param {String} address User address (must be owner of the datatoken)
78
+ * @return {Promise<any>}
79
+ */
80
+ estGasDeactivate(dtAddress: string, address: string): Promise<any>;
81
+ /**
82
+ * Deactivate an existing dispenser.
83
+ * @param {String} dtAddress refers to datatoken address.
84
+ * @param {String} address User address (must be owner of the datatoken)
85
+ * @return {Promise<TransactionReceipt>} TransactionReceipt
86
+ */
87
+ deactivate(dtAddress: string, address: string): Promise<TransactionReceipt>;
88
+ /**
89
+ * Estimate gas for setAllowedSwapper method
90
+ * @param {String} dtAddress refers to datatoken address.
91
+ * @param {String} address User address (must be owner of the datatoken)
92
+ * @param {String} newAllowedSwapper refers to the new allowedSwapper
93
+ * @return {Promise<any>}
94
+ */
95
+ estGasSetAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<any>;
96
+ /**
97
+ * Sets a new allowedSwapper.
98
+ * @param {String} dtAddress refers to datatoken address.
99
+ * @param {String} address User address (must be owner of the datatoken)
100
+ * @param {String} newAllowedSwapper refers to the new allowedSwapper
101
+ * @return {Promise<TransactionReceipt>} TransactionReceipt
102
+ */
103
+ setAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
104
+ /**
105
+ * Estimate gas for dispense method
106
+ * @param {String} dtAddress refers to datatoken address.
107
+ * @param {String} address User address (must be owner of the datatoken)
108
+ * @param {String} newAllowedSwapper refers to the new allowedSwapper
109
+ * @return {Promise<any>}
110
+ */
111
+ estGasDispense(dtAddress: string, address: string, amount: string, destination: string): Promise<any>;
112
+ /**
113
+ * Dispense datatokens to caller.
114
+ * The dispenser must be active, hold enough DT (or be able to mint more)
115
+ * and respect maxTokens/maxBalance requirements
116
+ * @param {String} dtAddress refers to datatoken address.
117
+ * @param {String} address User address
118
+ * @param {String} amount amount of datatokens required.
119
+ * @param {String} destination who will receive the tokens
120
+ * @return {Promise<TransactionReceipt>} TransactionReceipt
121
+ */
122
+ dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
123
+ /**
124
+ * Estimate gas for ownerWithdraw method
125
+ * @param {String} dtAddress refers to datatoken address.
126
+ * @param {String} address User address (must be owner of the datatoken)
127
+ * @param {String} newAllowedSwapper refers to the new allowedSwapper
128
+ * @return {Promise<any>}
129
+ */
130
+ estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
131
+ /**
132
+ * Withdraw all tokens from the dispenser
133
+ * @param {String} dtAddress refers to datatoken address.
134
+ * @param {String} address User address (must be owner of the dispenser)
135
+ * @return {Promise<TransactionReceipt>} TransactionReceipt
136
+ */
137
+ ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
138
+ /**
139
+ * Check if tokens can be dispensed
140
+ * @param {String} dtAddress
141
+ * @param {String} address User address that will receive datatokens
142
+ * @param {String} amount amount of datatokens required.
143
+ * @return {Promise<Boolean>}
144
+ */
145
+ isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
146
+ }
@@ -0,0 +1 @@
1
+ export * from './Dispenser';
@@ -0,0 +1,375 @@
1
+ import { TransactionReceipt } from 'web3-core';
2
+ import { Contract } from 'web3-eth-contract';
3
+ import { AbiItem } from 'web3-utils/types';
4
+ import Web3 from 'web3';
5
+ import { Config } from '../../models/index.js';
6
+ export interface FixedPriceExchange {
7
+ active: boolean;
8
+ exchangeOwner: string;
9
+ datatoken: string;
10
+ baseToken: string;
11
+ fixedRate: string;
12
+ dtDecimals: string;
13
+ btDecimals: string;
14
+ dtBalance: string;
15
+ btBalance: string;
16
+ dtSupply: string;
17
+ btSupply: string;
18
+ withMint: boolean;
19
+ allowedSwapper: string;
20
+ exchangeId?: string;
21
+ }
22
+ export interface FeesInfo {
23
+ opcFee: string;
24
+ marketFee: string;
25
+ marketFeeCollector: string;
26
+ marketFeeAvailable: string;
27
+ oceanFeeAvailable: string;
28
+ exchangeId: string;
29
+ }
30
+ export interface FixedPriceSwap {
31
+ exchangeId: string;
32
+ caller: string;
33
+ baseTokenAmount: string;
34
+ datatokenAmount: string;
35
+ }
36
+ export declare enum FixedRateCreateProgressStep {
37
+ CreatingExchange = 0,
38
+ ApprovingDatatoken = 1
39
+ }
40
+ export declare class FixedRateExchange {
41
+ GASLIMIT_DEFAULT: number;
42
+ /** Ocean related functions */
43
+ oceanAddress: string;
44
+ fixedRateAddress: string;
45
+ fixedRateExchangeAbi: AbiItem | AbiItem[];
46
+ fixedRateContract: Contract;
47
+ web3: Web3;
48
+ contract: Contract;
49
+ config: Config;
50
+ ssAbi: AbiItem | AbiItem[];
51
+ /**
52
+ * Instantiate FixedRateExchange
53
+ * @param {any} web3
54
+ * @param {any} fixedRateExchangeAbi
55
+ */
56
+ constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
57
+ amountToUnits(token: string, amount: string): Promise<string>;
58
+ unitsToAmount(token: string, amount: string): Promise<string>;
59
+ /**
60
+ * Creates unique exchange identifier.
61
+ * @param {String} datatoken Datatoken contract address
62
+ * @param {String} owner Owner of the exchange
63
+ * @return {Promise<string>} exchangeId
64
+ */
65
+ generateExchangeId(baseToken: string, datatoken: string, owner: string): Promise<string>;
66
+ /**
67
+ * Estimate gas cost for buyDT
68
+ * @param {String} account
69
+ * @param {String} dtAmount datatoken amount we want to buy
70
+ * @param {String} datatokenAddress datatokenAddress
71
+ * @param {Contract} contractInstance optional contract instance
72
+ * @return {Promise<number>}
73
+ */
74
+ estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, contractInstance?: Contract): Promise<number>;
75
+ /**
76
+ * Atomic swap
77
+ * @param {String} exchangeId ExchangeId
78
+ * @param {String} datatokenAmount Amount of datatokens
79
+ * @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
80
+ * @param {String} address User address
81
+ * @return {Promise<TransactionReceipt>} transaction receipt
82
+ */
83
+ buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string): Promise<TransactionReceipt>;
84
+ /**
85
+ * Estimate gas cost for sellDT
86
+ * @param {String} account
87
+ * @param {String} dtAmount datatoken amount we want to sell
88
+ * @param {String} datatokenAddress datatokenAddress
89
+ * @param {Contract} contractInstance optional contract instance
90
+ * @return {Promise<number>}
91
+ */
92
+ estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, contractInstance?: Contract): Promise<number>;
93
+ /**
94
+ * Atomic swap
95
+ * @param {String} exchangeId ExchangeId
96
+ * @param {String} datatokenAmount Amount of datatokens
97
+ * @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
98
+ * @param {String} address User address
99
+ * @return {Promise<TransactionReceipt>} transaction receipt
100
+ */
101
+ sellDT(address: string, exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string): Promise<TransactionReceipt>;
102
+ /**
103
+ * Gets total number of exchanges
104
+ * @param {String} exchangeId ExchangeId
105
+ * @param {Number} datatokenAmount Amount of datatokens
106
+ * @return {Promise<Number>} no of available exchanges
107
+ */
108
+ getNumberOfExchanges(): Promise<number>;
109
+ /**
110
+ * Estimate gas cost for setRate
111
+ * @param {String} account
112
+ * @param {String} exchangeId ExchangeId
113
+ * @param {Number} newRate New rate
114
+ * @param {Contract} contractInstance optional contract instance
115
+ * @return {Promise<number>}
116
+ */
117
+ estSetRate(account: string, exchangeId: string, newRate: string, contractInstance?: Contract): Promise<number>;
118
+ /**
119
+ * Set new rate
120
+ * @param {String} exchangeId ExchangeId
121
+ * @param {Number} newRate New rate
122
+ * @param {String} address User account
123
+ * @return {Promise<TransactionReceipt>} transaction receipt
124
+ */
125
+ setRate(address: string, exchangeId: string, newRate: string): Promise<TransactionReceipt>;
126
+ /**
127
+ * Estimate gas cost for setRate
128
+ * @param {String} account
129
+ * @param {String} exchangeId ExchangeId
130
+ * @param {String} newAllowedSwapper new allowed swapper address
131
+ * @param {Contract} contractInstance optional contract instance
132
+ * @return {Promise<number>}
133
+ */
134
+ estSetAllowedSwapper(account: string, exchangeId: string, newAllowedSwapper: string, contractInstance?: Contract): Promise<number>;
135
+ /**
136
+ * Set new rate
137
+ * @param {String} exchangeId ExchangeId
138
+ * @param {String} newAllowedSwapper newAllowedSwapper (set address zero if we want to remove allowed swapper)
139
+ * @param {String} address User account
140
+ * @return {Promise<TransactionReceipt>} transaction receipt
141
+ */
142
+ setAllowedSwapper(address: string, exchangeId: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
143
+ /**
144
+ * Estimate gas cost for activate
145
+ * @param {String} account
146
+ * @param {String} exchangeId ExchangeId
147
+ * @param {Contract} contractInstance optional contract instance
148
+ * @return {Promise<number>}
149
+ */
150
+ estActivate(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
151
+ /**
152
+ * Activate an exchange
153
+ * @param {String} exchangeId ExchangeId
154
+ * @param {String} address User address
155
+ * @return {Promise<TransactionReceipt>} transaction receipt
156
+ */
157
+ activate(address: string, exchangeId: string): Promise<TransactionReceipt>;
158
+ /**
159
+ * Estimate gas cost for deactivate
160
+ * @param {String} account
161
+ * @param {String} exchangeId ExchangeId
162
+ * @param {Contract} contractInstance optional contract instance
163
+ * @return {Promise<number>}
164
+ */
165
+ estDeactivate(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
166
+ /**
167
+ * Deactivate an exchange
168
+ * @param {String} exchangeId ExchangeId
169
+ * @param {String} address User address
170
+ * @return {Promise<TransactionReceipt>} transaction receipt
171
+ */
172
+ deactivate(address: string, exchangeId: string): Promise<TransactionReceipt>;
173
+ /**
174
+ * Get Rate
175
+ * @param {String} exchangeId ExchangeId
176
+ * @return {Promise<string>} Rate (converted from wei)
177
+ */
178
+ getRate(exchangeId: string): Promise<string>;
179
+ /**
180
+ * Get Datatoken Supply in the exchange
181
+ * @param {String} exchangeId ExchangeId
182
+ * @return {Promise<string>} dt supply formatted
183
+ */
184
+ getDTSupply(exchangeId: string): Promise<string>;
185
+ /**
186
+ * Get BaseToken Supply in the exchange
187
+ * @param {String} exchangeId ExchangeId
188
+ * @return {Promise<string>} dt supply formatted
189
+ */
190
+ getBTSupply(exchangeId: string): Promise<string>;
191
+ /**
192
+ * Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
193
+ * @param {String} exchangeId ExchangeId
194
+ * @return {Promise<string>} address of allowedSwapper
195
+ */
196
+ getAllowedSwapper(exchangeId: string): Promise<string>;
197
+ /**
198
+ * getBTNeeded - returns amount in baseToken that user will pay for datatokenAmount
199
+ * @param {String} exchangeId ExchangeId
200
+ * @param {Number} datatokenAmount Amount of datatokens user wants to buy
201
+ * @return {Promise<string>} Amount of baseToken needed for buying
202
+ */
203
+ getAmountBTIn(exchangeId: string, datatokenAmount: string): Promise<string>;
204
+ /**
205
+ * getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
206
+ * @param {String} exchangeId ExchangeId
207
+ * @param {Number} datatokenAmount Amount of datatokens
208
+ * @return {Promise<string>} Amount of baseTokens user will receive
209
+ */
210
+ getAmountBTOut(exchangeId: string, datatokenAmount: string): Promise<string>;
211
+ /**
212
+ * Get exchange details
213
+ * @param {String} exchangeId ExchangeId
214
+ * @return {Promise<FixedPricedExchange>} Exchange details
215
+ */
216
+ getExchange(exchangeId: string): Promise<FixedPriceExchange>;
217
+ /**
218
+ * Get fee details for an exchange
219
+ * @param {String} exchangeId ExchangeId
220
+ * @return {Promise<FixedPricedExchange>} Exchange details
221
+ */
222
+ getFeesInfo(exchangeId: string): Promise<FeesInfo>;
223
+ /**
224
+ * Get all exchanges
225
+ * @param {String} exchangeId ExchangeId
226
+ * @return {Promise<String[]>} Exchanges list
227
+ */
228
+ getExchanges(): Promise<string[]>;
229
+ /**
230
+ * Check if an exchange is active
231
+ * @param {String} exchangeId ExchangeId
232
+ * @return {Promise<Boolean>} Result
233
+ */
234
+ isActive(exchangeId: string): Promise<boolean>;
235
+ /**
236
+ * Estimate gas cost for activate
237
+ * @param {String} account
238
+ * @param {String} exchangeId ExchangeId
239
+ * @param {Contract} contractInstance optional contract instance
240
+ * @return {Promise<number>}
241
+ */
242
+ estActivateMint(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
243
+ /**
244
+ * Activate minting option for fixed rate contract
245
+ * @param {String} exchangeId ExchangeId
246
+ * @param {String} address User address
247
+ * @return {Promise<TransactionReceipt>} transaction receipt
248
+ */
249
+ activateMint(address: string, exchangeId: string): Promise<TransactionReceipt>;
250
+ /**
251
+ * Estimate gas cost for deactivate
252
+ * @param {String} account
253
+ * @param {String} exchangeId ExchangeId
254
+ * @param {Contract} contractInstance optional contract instance
255
+ * @return {Promise<number>}
256
+ */
257
+ estDeactivateMint(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
258
+ /**
259
+ * Deactivate minting for fixed rate
260
+ * @param {String} exchangeId ExchangeId
261
+ * @param {String} address User address
262
+ * @return {Promise<TransactionReceipt>} transaction receipt
263
+ */
264
+ deactivateMint(address: string, exchangeId: string): Promise<TransactionReceipt>;
265
+ /**
266
+ * Estimate gas cost for collectBT
267
+ * @param {String} account
268
+ * @param {String} exchangeId ExchangeId
269
+ * @param {Contract} contractInstance optional contract instance
270
+ * @return {Promise<number>}
271
+ */
272
+ estCollectBT(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
273
+ /**
274
+ * Collect BaseTokens in the contract (only exchange owner)
275
+ * @param {String} exchangeId ExchangeId
276
+ * @param {String} address User address
277
+ * @return {Promise<TransactionReceipt>} transaction receipt
278
+ */
279
+ collectBT(address: string, exchangeId: string): Promise<TransactionReceipt>;
280
+ /**
281
+ * Estimate gas cost for collecDT
282
+ * @param {String} account
283
+ * @param {String} exchangeId ExchangeId
284
+ * @param {Contract} contractInstance optional contract instance
285
+ * @return {Promise<number>}
286
+ */
287
+ estCollectDT(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
288
+ /**
289
+ * Collect datatokens in the contract (only exchange owner)
290
+ * @param {String} exchangeId ExchangeId
291
+ * @param {String} address User address
292
+ * @return {Promise<TransactionReceipt>} transaction receipt
293
+ */
294
+ collectDT(address: string, exchangeId: string): Promise<TransactionReceipt>;
295
+ /**
296
+ * Estimate gas cost for collecMarketFee
297
+ * @param {String} account
298
+ * @param {String} exchangeId ExchangeId
299
+ * @param {Contract} contractInstance optional contract instance
300
+ * @return {Promise<number>}
301
+ */
302
+ estCollectMarketFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
303
+ /**
304
+ * Collect market fee and send it to marketFeeCollector (anyone can call it)
305
+ * @param {String} exchangeId ExchangeId
306
+ * @param {String} address User address
307
+ * @return {Promise<TransactionReceipt>} transaction receipt
308
+ */
309
+ collectMarketFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
310
+ /**
311
+ * Estimate gas cost for collectOceanFee
312
+ * @param {String} account
313
+ * @param {String} exchangeId ExchangeId
314
+ * @param {Contract} contractInstance optional contract instance
315
+ * @return {Promise<number>}
316
+ */
317
+ estCollectOceanFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
318
+ /**
319
+ * Collect ocean fee and send it to OPF collector (anyone can call it)
320
+ * @param {String} exchangeId ExchangeId
321
+ * @param {String} address User address
322
+ * @return {Promise<TransactionReceipt>} transaction receipt
323
+ */
324
+ collectOceanFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
325
+ /**
326
+ * Get OPF Collector of fixed rate contract
327
+ * @return {String}
328
+ */
329
+ getOPCCollector(): Promise<string>;
330
+ /**
331
+ * Get Router address set in fixed rate contract
332
+ * @return {String}
333
+ */
334
+ getRouter(): Promise<string>;
335
+ /**
336
+ * Get Exchange Owner given an exchangeId
337
+ * @param {String} exchangeId ExchangeId
338
+ * @return {String} return exchange owner
339
+ */
340
+ getExchangeOwner(exchangeId: string): Promise<string>;
341
+ /**
342
+ * Estimate gas cost for updateMarketFee
343
+ * @param {String} account
344
+ * @param {String} exchangeId ExchangeId
345
+ * @param {String} newMarketFee New market fee
346
+ * @param {Contract} contractInstance optional contract instance
347
+ * @return {Promise<number>}
348
+ */
349
+ estUpdateMarketFee(account: string, exchangeId: string, newMarketFee: string, contractInstance?: Contract): Promise<number>;
350
+ /**
351
+ * Set new market fee, only market fee collector can update it
352
+ * @param {String} address user address
353
+ * @param {String} exchangeId ExchangeId
354
+ * @param {String} newMarketFee New market fee
355
+ * @return {Promise<TransactionReceipt>} transaction receipt
356
+ */
357
+ updateMarketFee(address: string, exchangeId: string, newMarketFee: string): Promise<TransactionReceipt>;
358
+ /**
359
+ * Estimate gas cost for updateMarketFeeCollector
360
+ * @param {String} account
361
+ * @param {String} exchangeId ExchangeId
362
+ * @param {String} newMarketFee New market fee collector
363
+ * @param {Contract} contractInstance optional contract instance
364
+ * @return {Promise<number>}
365
+ */
366
+ estUpdateMarketFeeCollector(account: string, exchangeId: string, newMarketFeeCollector: string, contractInstance?: Contract): Promise<number>;
367
+ /**
368
+ * Set new market fee collector, only market fee collector can update it
369
+ * @param {String} address user address
370
+ * @param {String} exchangeId ExchangeId
371
+ * @param {String} newMarketFeeCollector New market fee collector
372
+ * @return {Promise<TransactionReceipt>} transaction receipt
373
+ */
374
+ updateMarketFeeCollector(address: string, exchangeId: string, newMarketFeeCollector: string): Promise<TransactionReceipt>;
375
+ }
@@ -0,0 +1 @@
1
+ export * from './FixedRateExchange';
@@ -0,0 +1,3 @@
1
+ export * from './balancer';
2
+ export * from './dispenser';
3
+ export * from './fixedRate';
@@ -0,0 +1,132 @@
1
+ import Web3 from 'web3';
2
+ import { AbiItem } from 'web3-utils/types';
3
+ import { TransactionReceipt } from 'web3-core';
4
+ import { Contract } from 'web3-eth-contract';
5
+ import { Config } from '../../models';
6
+ export declare class SideStaking {
7
+ ssAbi: AbiItem | AbiItem[];
8
+ web3: Web3;
9
+ GASLIMIT_DEFAULT: number;
10
+ config: Config;
11
+ constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[], config?: Config);
12
+ amountToUnits(token: string, amount: string): Promise<string>;
13
+ unitsToAmount(token: string, amount: string): Promise<string>;
14
+ /**
15
+ * Get (total vesting amount + token released from the contract when adding liquidity)
16
+ * @param {String} ssAddress side staking contract address
17
+ * @param {String} datatokenAddress datatoken address
18
+ * @return {String}
19
+ */
20
+ getDatatokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
21
+ /**
22
+ * Get actual dts in circulation (vested token withdrawn from the contract +
23
+ token released from the contract when adding liquidity)
24
+ * @param {String} ssAddress side staking contract address
25
+ * @param {String} datatokenAddress datatoken address
26
+ * @return {String}
27
+ */
28
+ getDatatokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
29
+ /**
30
+ * Get Publisher address
31
+ * @param {String} ssAddress side staking contract address
32
+ * @param {String} datatokenAddress datatoken address
33
+ * @return {String}
34
+ */
35
+ getPublisherAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
36
+ /**
37
+ * Get
38
+ * @param {String} ssAddress side staking contract address
39
+ * @param {String} datatokenAddress datatokenAddress
40
+ * @return {String}
41
+ */
42
+ getBaseToken(ssAddress: string, datatokenAddress: string): Promise<string>;
43
+ /**
44
+ * Get Pool Address
45
+ * @param {String} ssAddress side staking contract address
46
+ * @param {String} datatokenAddress datatokenAddress
47
+ * @return {String}
48
+ */
49
+ getPoolAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
50
+ /**
51
+ * Get baseToken balance in the contract
52
+ * @param {String} ssAddress side staking contract address
53
+ * @param {String} datatokenAddress datatokenAddress
54
+ * @return {String}
55
+ */
56
+ getBaseTokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
57
+ /**
58
+ * Get dt balance in the staking contract available for being added as liquidity
59
+ * @param {String} ssAddress side staking contract address
60
+ * @param {String} datatokenAddress datatokenAddress
61
+ * @return {String}
62
+ */
63
+ getDatatokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
64
+ /**
65
+ * Get block when vesting ends
66
+ * @param {String} ssAddress side staking contract address
67
+ * @param {String} datatokenAddress datatokenAddress
68
+ * @return {String} end block for vesting amount
69
+ */
70
+ getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
71
+ /**
72
+ * Get total amount vesting
73
+ * @param {String} ssAddress side staking contract address
74
+ * @param {String} datatokenAddress datatokenAddress
75
+ * @return {String}
76
+ */
77
+ getvestingAmount(ssAddress: string, datatokenAddress: string): Promise<string>;
78
+ /**
79
+ * Get last block publisher got some vested tokens
80
+ * @param {String} ssAddress side staking contract address
81
+ * @param {String} datatokenAddress datatokenAddress
82
+ * @return {String}
83
+ */
84
+ getvestingLastBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
85
+ /**
86
+ * Get how much has been taken from the vesting amount
87
+ * @param {String} ssAddress side staking contract address
88
+ * @param {String} datatokenAddress datatokenAddress
89
+ * @return {String}
90
+ */
91
+ getvestingAmountSoFar(ssAddress: string, datatokenAddress: string): Promise<string>;
92
+ /**
93
+ * Estimate gas cost for getVesting
94
+ * @param {String} account
95
+ * @param {String} ssAddress side staking contract address
96
+ * @param {String} datatokenAddress datatokenAddress
97
+ * @param {Contract} contractInstance optional contract instance
98
+ * @return {Promise<number>}
99
+ */
100
+ estGetVesting(account: string, ssAddress: string, datatokenAddress: string, contractInstance?: Contract): Promise<number>;
101
+ /** Send vested tokens available to the publisher address, can be called by anyone
102
+ *
103
+ * @param {String} account
104
+ * @param {String} ssAddress side staking contract address
105
+ * @param {String} datatokenAddress datatokenAddress
106
+ * @return {TransactionReceipt}
107
+ */
108
+ getVesting(account: string, ssAddress: string, datatokenAddress: string): Promise<TransactionReceipt>;
109
+ /**
110
+ * Estimate gas cost for getVesting
111
+ * @param {String} account
112
+ * @param {String} ssAddress side staking contract address
113
+ * @param {String} datatokenAddress datatokenAddress
114
+ * @param {Contract} contractInstance optional contract instance
115
+ * @return {Promise<number>}
116
+ */
117
+ estSetPoolSwapFee(account: string, ssAddress: string, datatokenAddress: string, poolAddress: string, swapFee: number, contractInstance?: Contract): Promise<number>;
118
+ /** Send vested tokens available to the publisher address, can be called by anyone
119
+ *
120
+ * @param {String} account
121
+ * @param {String} ssAddress side staking contract address
122
+ * @param {String} datatokenAddress datatokenAddress
123
+ * @return {TransactionReceipt}
124
+ */
125
+ setPoolSwapFee(account: string, ssAddress: string, datatokenAddress: string, poolAddress: string, swapFee: number): Promise<TransactionReceipt>;
126
+ /**
127
+ * Get Router address set in side staking contract
128
+ * @param {String} ssAddress side staking contract address
129
+ * @return {String}
130
+ */
131
+ getRouter(ssAddress: string): Promise<string>;
132
+ }
@@ -0,0 +1 @@
1
+ export * from './SideStaking';