@oceanprotocol/lib 2.7.0 → 3.0.0-next.0
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.
- package/CHANGELOG.md +10 -0
- package/CodeExamples.md +273 -166
- package/ComputeExamples.md +106 -101
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/src/@types/Contracts.d.ts +26 -0
- package/dist/src/@types/DDO/Metadata.d.ts +2 -2
- package/dist/src/@types/File.d.ts +1 -1
- package/dist/src/@types/ReturnTypes.d.ts +3 -2
- package/dist/src/@types/index.d.ts +1 -0
- package/dist/src/config/Config.d.ts +1 -1
- package/dist/src/config/ConfigHelper.d.ts +6 -0
- package/dist/src/contracts/Datatoken.d.ts +90 -72
- package/dist/src/contracts/Dispenser.d.ts +27 -27
- package/dist/src/contracts/FixedRateExchange.d.ts +57 -60
- package/dist/src/contracts/NFT.d.ts +57 -34
- package/dist/src/contracts/NFTFactory.d.ts +78 -57
- package/dist/src/contracts/Router.d.ts +33 -18
- package/dist/src/contracts/SmartContract.d.ts +35 -12
- package/dist/src/contracts/SmartContractWithAddress.d.ts +7 -8
- package/dist/src/contracts/df/DfRewards.d.ts +6 -7
- package/dist/src/contracts/df/DfStrategyV1.d.ts +3 -5
- package/dist/src/contracts/ve/VeAllocate.d.ts +4 -7
- package/dist/src/contracts/ve/VeFeeDistributor.d.ts +6 -7
- package/dist/src/contracts/ve/VeFeeEstimate.d.ts +2 -2
- package/dist/src/contracts/ve/VeOcean.d.ts +12 -13
- package/dist/src/services/Aquarius.d.ts +3 -4
- package/dist/src/services/Provider.d.ts +124 -76
- package/dist/src/utils/ContractUtils.d.ts +34 -16
- package/dist/src/utils/DatatokenName.d.ts +5 -2
- package/dist/src/utils/DdoHelpers.d.ts +11 -0
- package/dist/src/utils/FetchHelper.d.ts +11 -0
- package/dist/src/utils/General.d.ts +1 -0
- package/dist/src/utils/ProviderErrors.d.ts +1 -0
- package/dist/src/utils/SignatureUtils.d.ts +8 -2
- package/dist/src/utils/TokenUtils.d.ts +43 -43
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/minAbi.d.ts +38 -2
- package/dist/test/config.d.ts +17 -3
- package/dist/test/integration/helpers.d.ts +7 -0
- package/package.json +10 -5
- package/dist/test/TestContractHandler.d.ts +0 -16
- /package/dist/test/integration/{SimplePublishConsumeFlow.test.d.ts → PublishEditConsume.test.d.ts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare type AbiType = 'function' | 'constructor' | 'event' | 'fallback';
|
|
2
|
+
export declare type StateMutabilityType = 'pure' | 'view' | 'nonpayable' | 'payable';
|
|
3
|
+
export interface AbiInput {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
indexed?: boolean;
|
|
7
|
+
components?: AbiInput[];
|
|
8
|
+
internalType?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AbiOutput {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
components?: AbiOutput[];
|
|
14
|
+
internalType?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AbiItem {
|
|
17
|
+
anonymous?: boolean;
|
|
18
|
+
constant?: boolean;
|
|
19
|
+
inputs?: AbiInput[];
|
|
20
|
+
name?: string;
|
|
21
|
+
outputs?: AbiOutput[];
|
|
22
|
+
payable?: boolean;
|
|
23
|
+
stateMutability?: StateMutabilityType;
|
|
24
|
+
type: AbiType;
|
|
25
|
+
gas?: number;
|
|
26
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface MetadataAlgorithm {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Programming language used to implement the software.
|
|
4
4
|
* @type {string}
|
|
5
5
|
*/
|
|
6
6
|
language?: string;
|
|
@@ -106,7 +106,7 @@ export interface Metadata {
|
|
|
106
106
|
*/
|
|
107
107
|
contentLanguage?: string;
|
|
108
108
|
/**
|
|
109
|
-
* Information about asset of
|
|
109
|
+
* Information about asset of type algorithm. Required for algorithm assets.
|
|
110
110
|
* @type {MetadataAlgorithm}
|
|
111
111
|
*/
|
|
112
112
|
algorithm?: MetadataAlgorithm;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type ReceiptOrEstimate<G extends boolean = false> = G extends false ?
|
|
1
|
+
import { BigNumber, providers } from 'ethers';
|
|
2
|
+
export declare type ReceiptOrEstimate<G extends boolean = false> = G extends false ? providers.TransactionResponse : BigNumber;
|
|
3
|
+
export declare type ReceiptOrDecimal<G extends boolean = false> = G extends false ? providers.TransactionResponse : number;
|
|
@@ -2,5 +2,11 @@ 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>;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the config object for a specific network supported by the oceanprotocol stack
|
|
7
|
+
* @param {string | number} network the network's chainId or name
|
|
8
|
+
* @param {string} infuraProjectId optional infura project id that will replace the configs node URI
|
|
9
|
+
* @return {Config} Config obhjedct
|
|
10
|
+
*/
|
|
5
11
|
getConfig(network: string | number, infuraProjectId?: string): Config;
|
|
6
12
|
}
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AbiItem } from '
|
|
3
|
-
import { TransactionReceipt } from 'web3-eth';
|
|
4
|
-
import { ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees, PublishingMarketFee, DispenserParams, OrderParams, DatatokenRoles, ReceiptOrEstimate } from '../@types';
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { AbiItem, ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees, PublishingMarketFee, DispenserParams, OrderParams, DatatokenRoles, ReceiptOrEstimate } from '../@types';
|
|
5
3
|
import { Nft } from './NFT';
|
|
6
4
|
import { Config } from '../config';
|
|
7
5
|
import { SmartContract } from './SmartContract';
|
|
8
6
|
export declare class Datatoken extends SmartContract {
|
|
9
|
-
abiEnterprise: AbiItem
|
|
7
|
+
abiEnterprise: AbiItem[];
|
|
10
8
|
nft: Nft;
|
|
11
|
-
getDefaultAbi(): AbiItem
|
|
9
|
+
getDefaultAbi(): AbiItem[];
|
|
12
10
|
/**
|
|
13
|
-
* Instantiate
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
11
|
+
* Instantiate Datatoken class
|
|
12
|
+
* @param {Signer} signer The signer object.
|
|
13
|
+
* @param {string | number} [network] Network id or name
|
|
14
|
+
* @param {Config} [config] The configuration object.
|
|
15
|
+
* @param {AbiItem[]} [abi] ABI array of the smart contract
|
|
16
|
+
* @param {AbiItem[]} abiEnterprise Enterprise ABI array of the smart contract
|
|
16
17
|
*/
|
|
17
|
-
constructor(
|
|
18
|
+
constructor(signer: Signer, network?: string | number, config?: Config, abi?: AbiItem[], abiEnterprise?: AbiItem[]);
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Approves a spender to spend a certain amount of datatokens.
|
|
20
21
|
* @param {String} dtAddress Datatoken address
|
|
21
22
|
* @param {String} spender Spender address
|
|
22
23
|
* @param {string} amount Number of datatokens, as number. Will be converted to wei
|
|
23
|
-
* @param {
|
|
24
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
24
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
25
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
25
26
|
*/
|
|
26
|
-
approve<G extends boolean = false>(dtAddress: string, spender: string, amount: string,
|
|
27
|
+
approve<G extends boolean = false>(dtAddress: string, spender: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
27
28
|
/**
|
|
28
29
|
* Creates a new FixedRateExchange setup.
|
|
29
30
|
* @param {String} dtAddress Datatoken address
|
|
30
31
|
* @param {String} address Caller address
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
33
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
32
|
+
* @param {FixedRateParams} fixedRateParams The parameters required to create a fixed-rate exchange contract.
|
|
33
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
34
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
34
35
|
*/
|
|
35
36
|
createFixedRate<G extends boolean = false>(dtAddress: string, address: string, fixedRateParams: FreCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
36
37
|
/**
|
|
37
38
|
* Creates a new Dispenser
|
|
38
39
|
* @param {String} dtAddress Datatoken address
|
|
39
40
|
* @param {String} address Caller address
|
|
40
|
-
* @param {String} dispenserAddress
|
|
41
|
-
* @param {
|
|
41
|
+
* @param {String} dispenserAddress Dispenser contract address
|
|
42
|
+
* @param {DispenserParams} dispenserParams The parameters required to create a dispenser contract.
|
|
43
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
42
44
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
43
45
|
*/
|
|
44
46
|
createDispenser<G extends boolean = false>(dtAddress: string, address: string, dispenserAddress: string, dispenserParams: DispenserParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
48
|
+
* Mints datatokens
|
|
47
49
|
* @param {String} dtAddress Datatoken address
|
|
48
50
|
* @param {String} address Minter address
|
|
49
51
|
* @param {String} amount Number of datatokens, as number. Will be converted to wei
|
|
50
52
|
* @param {String} toAddress only if toAddress is different from the minter
|
|
53
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
51
54
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
52
55
|
*/
|
|
53
56
|
mint<G extends boolean = false>(dtAddress: string, address: string, amount: string, toAddress?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -55,8 +58,9 @@ export declare class Datatoken extends SmartContract {
|
|
|
55
58
|
* Add Minter for an ERC20 Datatoken
|
|
56
59
|
* only DatatokenDeployer can succeed
|
|
57
60
|
* @param {String} dtAddress Datatoken address
|
|
58
|
-
* @param {String} address
|
|
59
|
-
* @param {String} minter
|
|
61
|
+
* @param {String} address caller address
|
|
62
|
+
* @param {String} minter address which is going to be a Minter
|
|
63
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
60
64
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
61
65
|
*/
|
|
62
66
|
addMinter<G extends boolean = false>(dtAddress: string, address: string, minter: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -64,18 +68,19 @@ export declare class Datatoken extends SmartContract {
|
|
|
64
68
|
* Revoke Minter permission for an ERC20 Datatoken
|
|
65
69
|
* only DatatokenDeployer can succeed
|
|
66
70
|
* @param {String} dtAddress Datatoken address
|
|
67
|
-
* @param {String} address
|
|
68
|
-
* @param {String} minter
|
|
69
|
-
* @param {
|
|
70
|
-
* @return {Promise<
|
|
71
|
+
* @param {String} address caller address
|
|
72
|
+
* @param {String} minter address which will have removed the Minter permission
|
|
73
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
74
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
71
75
|
*/
|
|
72
76
|
removeMinter<G extends boolean = false>(dtAddress: string, address: string, minter: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
73
77
|
/**
|
|
74
|
-
*
|
|
78
|
+
* Adds a payment manager on a datatoken to a desired address.(can set who's going to collect fee when consuming orders)
|
|
75
79
|
* only DatatokenDeployer can succeed
|
|
76
80
|
* @param {String} dtAddress Datatoken address
|
|
77
|
-
* @param {String} address
|
|
78
|
-
* @param {String} paymentManager
|
|
81
|
+
* @param {String} address Caller address
|
|
82
|
+
* @param {String} paymentManager The address of the payment manager
|
|
83
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
79
84
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
80
85
|
*/
|
|
81
86
|
addPaymentManager<G extends boolean = false>(dtAddress: string, address: string, paymentManager: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -85,6 +90,7 @@ export declare class Datatoken extends SmartContract {
|
|
|
85
90
|
* @param {String} dtAddress Datatoken address
|
|
86
91
|
* @param {String} address User address
|
|
87
92
|
* @param {String} paymentManager User which will be removed from paymentManager permission
|
|
93
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
88
94
|
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
89
95
|
*/
|
|
90
96
|
removePaymentManager<G extends boolean = false>(dtAddress: string, address: string, paymentManager: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -92,120 +98,135 @@ export declare class Datatoken extends SmartContract {
|
|
|
92
98
|
* This function allows to set a new PaymentCollector (receives DT when consuming)
|
|
93
99
|
* If not set the paymentCollector is the NFT Owner
|
|
94
100
|
* only NFT owner can call
|
|
95
|
-
* @param dtAddress
|
|
101
|
+
* @param dtAddress Datatoken address
|
|
96
102
|
* @param address Caller address
|
|
97
103
|
* @param paymentCollector User to be set as new payment collector
|
|
104
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
98
105
|
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
99
106
|
*/
|
|
100
107
|
setPaymentCollector<G extends boolean = false>(dtAddress: string, address: string, paymentCollector: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
101
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* getPaymentCollector - It returns the current paymentCollector
|
|
102
110
|
* @param dtAddress datatoken address
|
|
103
111
|
* @return {Promise<string>}
|
|
104
112
|
*/
|
|
105
113
|
getPaymentCollector(dtAddress: string): Promise<string>;
|
|
106
114
|
/**
|
|
107
|
-
* Transfer as number from address to toAddress
|
|
115
|
+
* Transfer tokens(as number) from address to toAddress
|
|
108
116
|
* @param {String} dtAddress Datatoken address
|
|
109
117
|
* @param {String} toAddress Receiver address
|
|
110
|
-
* @param {String} amount Number of datatokens, as number.
|
|
111
|
-
* @param {
|
|
118
|
+
* @param {String} amount Number of datatokens, as number. Will be converted to wei.
|
|
119
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
112
120
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
113
121
|
*/
|
|
114
|
-
transfer(dtAddress: string, toAddress: string, amount: string,
|
|
122
|
+
transfer<G extends boolean = false>(dtAddress: string, toAddress: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
115
123
|
/**
|
|
116
124
|
* Transfer in wei from address to toAddress
|
|
117
125
|
* @param {String} dtAddress Datatoken address
|
|
118
126
|
* @param {String} toAddress Receiver address
|
|
119
|
-
* @param {String} amount Number of datatokens
|
|
120
|
-
* @param {
|
|
127
|
+
* @param {String} amount Number of datatokens (number) expressed as wei
|
|
128
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
121
129
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
122
130
|
*/
|
|
123
|
-
transferWei<G extends boolean = false>(dtAddress: string, toAddress: string, amount: string,
|
|
124
|
-
/**
|
|
131
|
+
transferWei<G extends boolean = false>(dtAddress: string, toAddress: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
132
|
+
/**
|
|
133
|
+
* Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
|
|
125
134
|
* @param {String} dtAddress Datatoken address
|
|
126
|
-
* @param {String} address User address which calls
|
|
127
135
|
* @param {String} consumer Consumer Address
|
|
128
136
|
* @param {Number} serviceIndex Service index in the metadata
|
|
129
137
|
* @param {providerFees} providerFees provider fees
|
|
130
138
|
* @param {consumeMarketFee} ConsumeMarketFee consume market fees
|
|
139
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
131
140
|
* @return {Promise<ReceiptOrEstimate>} string
|
|
132
141
|
*/
|
|
133
|
-
startOrder<G extends boolean = false>(dtAddress: string,
|
|
134
|
-
/**
|
|
142
|
+
startOrder<G extends boolean = false>(dtAddress: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
143
|
+
/**
|
|
144
|
+
* Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
|
|
135
145
|
* Pays the provider fee again, but it will not require a new datatoken payment
|
|
136
146
|
* Requires previous approval of provider fee.
|
|
137
147
|
* @param {String} dtAddress Datatoken address
|
|
138
|
-
* @param {String} address User address which calls
|
|
139
148
|
* @param {String} orderTxId previous valid order
|
|
140
149
|
* @param {providerFees} providerFees provider fees
|
|
150
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
141
151
|
* @return {Promise<ReceiptOrEstimate>} string
|
|
142
152
|
*/
|
|
143
|
-
reuseOrder<G extends boolean = false>(dtAddress: string,
|
|
144
|
-
/**
|
|
153
|
+
reuseOrder<G extends boolean = false>(dtAddress: string, orderTxId: string, providerFees: ProviderFees, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
154
|
+
/**
|
|
155
|
+
* Buys 1 DT from the FRE and then startsOrder, while burning that DT
|
|
145
156
|
* @param {String} dtAddress Datatoken address
|
|
146
|
-
* @param {
|
|
147
|
-
* @param {
|
|
148
|
-
* @param {
|
|
157
|
+
* @param {OrderParams} orderParams The parameters required to place an order.
|
|
158
|
+
* @param {FreParams} freParams The parameters required to buy from a fixed-rate exchange.
|
|
159
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
149
160
|
* @return {Promise<ReceiptOrEstimate>}
|
|
150
161
|
*/
|
|
151
|
-
buyFromFreAndOrder<G extends boolean = false>(dtAddress: string,
|
|
152
|
-
/**
|
|
162
|
+
buyFromFreAndOrder<G extends boolean = false>(dtAddress: string, orderParams: OrderParams, freParams: FreOrderParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
163
|
+
/**
|
|
164
|
+
* Gets 1 DT from dispenser and then startsOrder, while burning that DT
|
|
153
165
|
* @param {String} dtAddress Datatoken address
|
|
154
|
-
* @param {
|
|
155
|
-
* @param {
|
|
156
|
-
* @param {
|
|
166
|
+
* @param {OrderParams} orderParams - The parameters required to place an order.
|
|
167
|
+
* @param {String} dispenserContract dispenser address
|
|
168
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
157
169
|
* @return {Promise<ReceiptOrEstimate>}
|
|
158
170
|
*/
|
|
159
|
-
buyFromDispenserAndOrder<G extends boolean = false>(dtAddress: string,
|
|
171
|
+
buyFromDispenserAndOrder<G extends boolean = false>(dtAddress: string, orderParams: OrderParams, dispenserContract: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
160
172
|
/** setData
|
|
161
173
|
* This function allows to store data with a preset key (keccak256(dtAddress)) into NFT 725 Store
|
|
162
174
|
* only DatatokenDeployer can succeed
|
|
163
175
|
* @param {String} dtAddress Datatoken address
|
|
164
176
|
* @param {String} address User address
|
|
165
177
|
* @param {String} value Data to be stored into 725Y standard
|
|
178
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
166
179
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
167
180
|
*/
|
|
168
181
|
setData<G extends boolean = false>(dtAddress: string, address: string, value: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
169
182
|
/**
|
|
170
183
|
* Clean Datatoken level Permissions (minters, paymentManager and reset the paymentCollector) for an ERC20 Datatoken
|
|
171
184
|
* 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
|
|
185
|
+
* @param {string} dtAddress Datatoken address where we want to clean permissions
|
|
186
|
+
* @param {string} address User adress
|
|
187
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
174
188
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
175
189
|
*/
|
|
176
190
|
cleanPermissions<G extends boolean = false>(dtAddress: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
177
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Returns ERC20 Datatoken user's permissions for a datatoken
|
|
178
193
|
* @param {String} dtAddress Datatoken adress
|
|
179
194
|
* @param {String} address user adress
|
|
180
195
|
* @return {Promise<DatatokenRoles>}
|
|
181
196
|
*/
|
|
182
197
|
getPermissions(dtAddress: string, address: string): Promise<DatatokenRoles>;
|
|
183
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* Returns the Datatoken cap
|
|
184
200
|
* @param {String} dtAddress Datatoken adress
|
|
185
201
|
* @return {Promise<string>}
|
|
186
202
|
*/
|
|
187
203
|
getCap(dtAddress: string): Promise<string>;
|
|
188
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* It returns the token decimals, how many supported decimal points
|
|
189
206
|
* @param {String} dtAddress Datatoken adress
|
|
190
207
|
* @return {Promise<number>}
|
|
191
208
|
*/
|
|
192
|
-
getDecimals(dtAddress: string): Promise<
|
|
193
|
-
/**
|
|
209
|
+
getDecimals(dtAddress: string): Promise<number>;
|
|
210
|
+
/**
|
|
211
|
+
* It returns the token symbol
|
|
194
212
|
* @param {String} dtAddress Datatoken adress
|
|
195
213
|
* @return {Promise<number>}
|
|
196
214
|
*/
|
|
197
215
|
getSymbol(dtAddress: string): Promise<string>;
|
|
198
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* It returns the name of the token
|
|
199
218
|
* @param {String} dtAddress Datatoken adress
|
|
200
219
|
* @return {Promise<number>}
|
|
201
220
|
*/
|
|
202
221
|
getName(dtAddress: string): Promise<string>;
|
|
203
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* It returns the token decimals, how many supported decimal points
|
|
204
224
|
* @param {String} dtAddress Datatoken adress
|
|
205
225
|
* @return {Promise<number>}
|
|
206
226
|
*/
|
|
207
227
|
getNFTAddress(dtAddress: string): Promise<string>;
|
|
208
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Returns true if address has deployERC20 role
|
|
209
230
|
* @param {String} dtAddress Datatoken adress
|
|
210
231
|
* @param {String} dtAddress Datatoken adress
|
|
211
232
|
* @return {Promise<boolean>}
|
|
@@ -219,24 +240,21 @@ export declare class Datatoken extends SmartContract {
|
|
|
219
240
|
*/
|
|
220
241
|
balance(datatokenAddress: string, address: string): Promise<string>;
|
|
221
242
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* This function allows to set the fee required by the publisherMarket
|
|
243
|
+
* Allows to set the fee required by the publisherMarket
|
|
244
|
+
* only publishMarketFeeAddress can call it
|
|
225
245
|
* @param {string} datatokenAddress Datatoken adress
|
|
226
246
|
* @param {string} publishMarketFeeAddress new publish Market Fee Address
|
|
227
247
|
* @param {string} publishMarketFeeToken new publish Market Fee Token
|
|
228
248
|
* @param {string} publishMarketFeeAmount new fee amount
|
|
229
249
|
* @param {String} address user adress
|
|
250
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
230
251
|
*/
|
|
231
252
|
setPublishingMarketFee<G extends boolean = false>(datatokenAddress: string, publishMarketFeeAddress: string, publishMarketFeeToken: string, publishMarketFeeAmount: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
232
253
|
/**
|
|
233
|
-
*
|
|
234
|
-
* Get publishingMarket Fee
|
|
235
|
-
* This function allows to get the current fee set by the publishing market
|
|
254
|
+
* Returns the current fee set by the publishing market
|
|
236
255
|
* @param {String} datatokenAddress Datatoken adress
|
|
237
|
-
* @param {String} address user adress
|
|
238
256
|
* @return {Promise<PublishingMarketFee>} Current fee set by the publishing market
|
|
239
257
|
*/
|
|
240
|
-
getPublishingMarketFee(datatokenAddress: string
|
|
258
|
+
getPublishingMarketFee(datatokenAddress: string): Promise<PublishingMarketFee>;
|
|
241
259
|
private getFreOrderParams;
|
|
242
260
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { AbiItem } from 'web3-utils';
|
|
2
1
|
import { Datatoken } from './Datatoken';
|
|
3
2
|
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
4
|
-
import { DispenserToken, ReceiptOrEstimate } from '../@types';
|
|
3
|
+
import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types';
|
|
5
4
|
export declare class Dispenser extends SmartContractWithAddress {
|
|
6
|
-
getDefaultAbi(): AbiItem
|
|
5
|
+
getDefaultAbi(): AbiItem[];
|
|
7
6
|
/**
|
|
8
7
|
* Get information about a datatoken dispenser
|
|
9
8
|
* @param {String} dtAddress
|
|
10
|
-
* @return {Promise<
|
|
9
|
+
* @return {Promise<DispenserToken>}
|
|
11
10
|
*/
|
|
12
11
|
status(dtAdress: string): Promise<DispenserToken>;
|
|
13
12
|
/**
|
|
@@ -17,54 +16,55 @@ export declare class Dispenser extends SmartContractWithAddress {
|
|
|
17
16
|
* @param {String} maxTokens max tokens to dispense
|
|
18
17
|
* @param {String} maxBalance max balance of requester
|
|
19
18
|
* @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
|
|
19
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
20
20
|
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
21
21
|
*/
|
|
22
22
|
create<G extends boolean = false>(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
23
|
/**
|
|
24
|
-
* Activates a
|
|
24
|
+
* Activates a dispener.
|
|
25
25
|
* @param {String} dtAddress refers to datatoken address.
|
|
26
26
|
* @param {Number} maxTokens max amount of tokens to dispense
|
|
27
27
|
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
28
|
-
* @param {
|
|
28
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
29
29
|
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
|
30
30
|
*/
|
|
31
|
-
activate<G extends boolean = false>(dtAddress: string, maxTokens: string, maxBalance: string,
|
|
31
|
+
activate<G extends boolean = false>(dtAddress: string, maxTokens: string, maxBalance: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
32
32
|
/**
|
|
33
33
|
* Deactivate an existing dispenser.
|
|
34
34
|
* @param {String} dtAddress refers to datatoken address.
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
36
36
|
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
|
37
37
|
*/
|
|
38
|
-
deactivate<G extends boolean = false>(dtAddress: string,
|
|
38
|
+
deactivate<G extends boolean = false>(dtAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
39
39
|
/**
|
|
40
|
-
* Sets a new
|
|
41
|
-
* @param {String} dtAddress
|
|
42
|
-
* @param {String}
|
|
43
|
-
* @param {
|
|
44
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
40
|
+
* Sets a new allowed swapper.
|
|
41
|
+
* @param {String} dtAddress Datatoken address.
|
|
42
|
+
* @param {String} newAllowedSwapper The address of the new allowed swapper.
|
|
43
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
44
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
45
45
|
*/
|
|
46
|
-
setAllowedSwapper<G extends boolean = false>(dtAddress: string,
|
|
46
|
+
setAllowedSwapper<G extends boolean = false>(dtAddress: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
47
47
|
/**
|
|
48
48
|
* Dispense datatokens to caller.
|
|
49
|
-
* The dispenser must be active, hold enough
|
|
49
|
+
* The dispenser must be active, hold enough datatokens (or be able to mint more)
|
|
50
50
|
* and respect maxTokens/maxBalance requirements
|
|
51
|
-
* @param {String} dtAddress
|
|
52
|
-
* @param {String}
|
|
53
|
-
* @param {String}
|
|
54
|
-
* @param {
|
|
55
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
51
|
+
* @param {String} dtAddress Datatoken address.
|
|
52
|
+
* @param {String} amount Amount of datatokens required.
|
|
53
|
+
* @param {String} destination address of tokens receiver
|
|
54
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
55
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
56
56
|
*/
|
|
57
|
-
dispense<G extends boolean = false>(dtAddress: string,
|
|
57
|
+
dispense<G extends boolean = false>(dtAddress: string, amount: string, destination: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
58
58
|
/**
|
|
59
59
|
* Withdraw all tokens from the dispenser
|
|
60
|
-
* @param {String} dtAddress
|
|
61
|
-
* @param {
|
|
62
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
60
|
+
* @param {String} dtAddress Datatoken address.
|
|
61
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
62
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
63
63
|
*/
|
|
64
|
-
ownerWithdraw<G extends boolean = false>(dtAddress: string,
|
|
64
|
+
ownerWithdraw<G extends boolean = false>(dtAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
65
65
|
/**
|
|
66
66
|
* Check if tokens can be dispensed
|
|
67
|
-
* @param {String} dtAddress
|
|
67
|
+
* @param {String} dtAddress Datatoken address
|
|
68
68
|
* @param {String} address User address that will receive datatokens
|
|
69
69
|
* @param {String} amount amount of datatokens required.
|
|
70
70
|
* @return {Promise<Boolean>}
|