@oceanprotocol/lib 1.0.0-next.3 → 1.0.0-next.7
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 +34 -0
- 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/FileMetadata.d.ts +1 -0
- package/dist/src/@types/Provider.d.ts +3 -2
- package/dist/src/aquarius/Aquarius.d.ts +3 -3
- package/dist/src/factories/NFTFactory.d.ts +5 -9
- package/dist/src/interfaces/FixedRateInterface.d.ts +1 -1
- package/dist/src/interfaces/PoolInterface.d.ts +4 -4
- package/dist/src/models/Config.d.ts +4 -0
- package/dist/src/pools/Router.d.ts +3 -2
- package/dist/src/pools/balancer/Pool.d.ts +4 -2
- package/dist/src/pools/dispenser/Dispenser.d.ts +4 -3
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +12 -11
- package/dist/src/pools/ssContracts/SideStaking.d.ts +7 -5
- package/dist/src/provider/Provider.d.ts +10 -10
- package/dist/src/tokens/Datatoken.d.ts +8 -12
- package/dist/src/tokens/NFT.d.ts +3 -1
- package/dist/src/utils/{ContractParams.d.ts → ContractUtils.d.ts} +5 -0
- package/dist/src/utils/index.d.ts +1 -2
- package/docs/beginners_guide.md +4 -4
- package/docs/overview.md +100 -9
- package/docs/quickstart_marketplace.md +34 -33
- package/docs/quickstart_simple.md +18 -16
- package/package.json +3 -1
- package/dist/src/utils/GasUtils.d.ts +0 -2
|
@@ -2,13 +2,14 @@ export interface ProviderFees {
|
|
|
2
2
|
providerFeeAddress: string;
|
|
3
3
|
providerFeeToken: string;
|
|
4
4
|
providerFeeAmount: string;
|
|
5
|
-
providerData: string;
|
|
6
5
|
v: string;
|
|
7
6
|
r: string;
|
|
8
7
|
s: string;
|
|
8
|
+
providerData: string;
|
|
9
|
+
validUntil: string;
|
|
9
10
|
}
|
|
10
11
|
export interface ProviderInitialize {
|
|
11
|
-
|
|
12
|
+
datatoken: string;
|
|
12
13
|
nonce: string;
|
|
13
14
|
computeAddress: string;
|
|
14
15
|
providerFee: ProviderFees;
|
|
@@ -2,9 +2,9 @@ import { Asset, DDO, ValidateMetadata } from '../@types/';
|
|
|
2
2
|
export declare class Aquarius {
|
|
3
3
|
aquariusURL: any;
|
|
4
4
|
constructor(aquariusURL: string);
|
|
5
|
-
resolve(did: string, fetchMethod
|
|
5
|
+
resolve(did: string, fetchMethod?: any): Promise<DDO>;
|
|
6
6
|
sleep(ms: number): Promise<unknown>;
|
|
7
|
-
waitForAqua(
|
|
8
|
-
validate(
|
|
7
|
+
waitForAqua(did: string, txid?: string, fetchMethod?: any): Promise<Asset>;
|
|
8
|
+
validate(ddo: DDO, fetchMethod: any): Promise<ValidateMetadata>;
|
|
9
9
|
}
|
|
10
10
|
export default Aquarius;
|
|
@@ -3,6 +3,8 @@ import Web3 from 'web3';
|
|
|
3
3
|
import { TransactionReceipt } from 'web3-core';
|
|
4
4
|
import { AbiItem } from 'web3-utils';
|
|
5
5
|
import { FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams } from '../interfaces';
|
|
6
|
+
import { Config } from '../models/index.js';
|
|
7
|
+
import { ProviderFees } from '../@types/index.js';
|
|
6
8
|
interface Template {
|
|
7
9
|
templateAddress: string;
|
|
8
10
|
isActive: boolean;
|
|
@@ -11,13 +13,7 @@ export interface TokenOrder {
|
|
|
11
13
|
tokenAddress: string;
|
|
12
14
|
consumer: string;
|
|
13
15
|
serviceIndex: number;
|
|
14
|
-
|
|
15
|
-
providerFeeToken: string;
|
|
16
|
-
providerFeeAmount: string;
|
|
17
|
-
v: string;
|
|
18
|
-
r: string;
|
|
19
|
-
s: string;
|
|
20
|
-
providerData: string;
|
|
16
|
+
_providerFees: ProviderFees;
|
|
21
17
|
}
|
|
22
18
|
export interface NftCreateData {
|
|
23
19
|
name: string;
|
|
@@ -30,9 +26,9 @@ export declare class NftFactory {
|
|
|
30
26
|
factory721Address: string;
|
|
31
27
|
factory721Abi: AbiItem | AbiItem[];
|
|
32
28
|
web3: Web3;
|
|
33
|
-
|
|
29
|
+
config: Config;
|
|
34
30
|
factory721: Contract;
|
|
35
|
-
constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[],
|
|
31
|
+
constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[], config?: Config);
|
|
36
32
|
estGasCreateNFT(address: string, nftData: NftCreateData): Promise<string>;
|
|
37
33
|
createNFT(address: string, nftData: NftCreateData): Promise<string>;
|
|
38
34
|
getCurrentNFTCount(): Promise<number>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export interface PoolCreationParams {
|
|
2
2
|
ssContract: string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
baseTokenAddress: string;
|
|
4
|
+
baseTokenSender: string;
|
|
5
5
|
publisherAddress: string;
|
|
6
6
|
marketFeeCollector: string;
|
|
7
7
|
poolTemplateAddress: string;
|
|
8
8
|
rate: string;
|
|
9
|
-
|
|
9
|
+
baseTokenDecimals: number;
|
|
10
10
|
vestingAmount: string;
|
|
11
11
|
vestedBlocks: number;
|
|
12
|
-
|
|
12
|
+
initialBaseTokenLiquidity: string;
|
|
13
13
|
swapFeeLiquidityProvider: number;
|
|
14
14
|
swapFeeMarketRunner: number;
|
|
15
15
|
}
|
|
@@ -30,5 +30,9 @@ export declare class Config {
|
|
|
30
30
|
subgraphUri: string;
|
|
31
31
|
explorerUri: string;
|
|
32
32
|
oceanTokenSymbol: string;
|
|
33
|
+
transactionBlockTimeout: number;
|
|
34
|
+
transactionConfirmationBlocks: number;
|
|
35
|
+
transactionPollingTimeout: number;
|
|
36
|
+
gasFeeMultiplier: number;
|
|
33
37
|
}
|
|
34
38
|
export default Config;
|
|
@@ -3,14 +3,15 @@ import Web3 from 'web3';
|
|
|
3
3
|
import { TransactionReceipt } from 'web3-core';
|
|
4
4
|
import { AbiItem } from 'web3-utils';
|
|
5
5
|
import { Operation } from '../interfaces/RouterInterface';
|
|
6
|
+
import { Config } from '../models/index.js';
|
|
6
7
|
export declare class Router {
|
|
7
8
|
GASLIMIT_DEFAULT: number;
|
|
8
9
|
routerAddress: string;
|
|
9
10
|
RouterAbi: AbiItem | AbiItem[];
|
|
10
11
|
web3: Web3;
|
|
11
|
-
|
|
12
|
+
config: Config;
|
|
12
13
|
router: Contract;
|
|
13
|
-
constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[],
|
|
14
|
+
constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], config?: Config);
|
|
14
15
|
estGasBuyDTBatch(address: string, operations: Operation[]): Promise<any>;
|
|
15
16
|
buyDTBatch(address: string, operations: Operation[]): Promise<TransactionReceipt>;
|
|
16
17
|
isOceanTokens(address: string): Promise<boolean>;
|
|
@@ -4,12 +4,14 @@ import { TransactionReceipt } from 'web3-core';
|
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
5
|
import { Logger } from '../../utils';
|
|
6
6
|
import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee } from '../../interfaces';
|
|
7
|
+
import { Config } from '../../models';
|
|
7
8
|
export declare class Pool {
|
|
8
9
|
poolAbi: AbiItem | AbiItem[];
|
|
9
10
|
web3: Web3;
|
|
10
11
|
GASLIMIT_DEFAULT: number;
|
|
11
12
|
private logger;
|
|
12
|
-
|
|
13
|
+
private config;
|
|
14
|
+
constructor(web3: Web3, logger: Logger, poolAbi?: AbiItem | AbiItem[], config?: Config);
|
|
13
15
|
estApprove(account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
14
16
|
allowance(tokenAddress: string, owner: string, spender: string): Promise<string>;
|
|
15
17
|
approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
@@ -21,7 +23,7 @@ export declare class Pool {
|
|
|
21
23
|
getCurrentTokens(poolAddress: string): Promise<string[]>;
|
|
22
24
|
getFinalTokens(poolAddress: string): Promise<string[]>;
|
|
23
25
|
getController(poolAddress: string): Promise<string>;
|
|
24
|
-
|
|
26
|
+
getBaseToken(poolAddress: string): Promise<string>;
|
|
25
27
|
getDatatoken(poolAddress: string): Promise<string>;
|
|
26
28
|
getMarketFeeCollector(poolAddress: string): Promise<string>;
|
|
27
29
|
getOPFCollector(poolAddress: string): Promise<string>;
|
|
@@ -3,6 +3,7 @@ import { AbiItem } from 'web3-utils';
|
|
|
3
3
|
import { Contract } from 'web3-eth-contract';
|
|
4
4
|
import { TransactionReceipt } from 'web3-eth';
|
|
5
5
|
import { Datatoken } from '../../tokens';
|
|
6
|
+
import { Config } from '../../models/index.js';
|
|
6
7
|
export interface DispenserToken {
|
|
7
8
|
active: boolean;
|
|
8
9
|
owner: string;
|
|
@@ -16,10 +17,10 @@ export declare class Dispenser {
|
|
|
16
17
|
GASLIMIT_DEFAULT: number;
|
|
17
18
|
web3: Web3;
|
|
18
19
|
dispenserAddress: string;
|
|
19
|
-
|
|
20
|
+
config: Config;
|
|
20
21
|
dispenserAbi: AbiItem | AbiItem[];
|
|
21
22
|
dispenserContract: Contract;
|
|
22
|
-
constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[],
|
|
23
|
+
constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
|
|
23
24
|
status(dtAdress: string): Promise<DispenserToken>;
|
|
24
25
|
estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
|
|
25
26
|
create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
|
|
@@ -33,5 +34,5 @@ export declare class Dispenser {
|
|
|
33
34
|
dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
|
|
34
35
|
estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
|
|
35
36
|
ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
36
|
-
isDispensable(dtAddress: string,
|
|
37
|
+
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
|
|
37
38
|
}
|
|
@@ -2,10 +2,11 @@ import { TransactionReceipt } from 'web3-core';
|
|
|
2
2
|
import { Contract } from 'web3-eth-contract';
|
|
3
3
|
import { AbiItem } from 'web3-utils/types';
|
|
4
4
|
import Web3 from 'web3';
|
|
5
|
+
import { Config } from '../../models/index.js';
|
|
5
6
|
export interface FixedPriceExchange {
|
|
6
7
|
active: boolean;
|
|
7
8
|
exchangeOwner: string;
|
|
8
|
-
|
|
9
|
+
datatoken: string;
|
|
9
10
|
baseToken: string;
|
|
10
11
|
fixedRate: string;
|
|
11
12
|
dtDecimals: string;
|
|
@@ -30,7 +31,7 @@ export interface FixedPriceSwap {
|
|
|
30
31
|
exchangeId: string;
|
|
31
32
|
caller: string;
|
|
32
33
|
baseTokenAmount: string;
|
|
33
|
-
|
|
34
|
+
datatokenAmount: string;
|
|
34
35
|
}
|
|
35
36
|
export declare enum FixedRateCreateProgressStep {
|
|
36
37
|
CreatingExchange = 0,
|
|
@@ -44,16 +45,16 @@ export declare class FixedRateExchange {
|
|
|
44
45
|
fixedRateContract: Contract;
|
|
45
46
|
web3: Web3;
|
|
46
47
|
contract: Contract;
|
|
47
|
-
|
|
48
|
+
config: Config;
|
|
48
49
|
ssAbi: AbiItem | AbiItem[];
|
|
49
|
-
constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string,
|
|
50
|
+
constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
|
|
50
51
|
amountToUnits(token: string, amount: string): Promise<string>;
|
|
51
52
|
unitsToAmount(token: string, amount: string): Promise<string>;
|
|
52
|
-
generateExchangeId(
|
|
53
|
-
estBuyDT(account: string, datatokenAddress: string, dtAmount: string,
|
|
54
|
-
buyDT(address: string, exchangeId: string, datatokenAmount: string,
|
|
55
|
-
estSellDT(account: string, datatokenAddress: string, dtAmount: string,
|
|
56
|
-
sellDT(address: string, exchangeId: string, datatokenAmount: string,
|
|
53
|
+
generateExchangeId(baseToken: string, datatoken: string, owner: string): Promise<string>;
|
|
54
|
+
estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, contractInstance?: Contract): Promise<number>;
|
|
55
|
+
buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string): Promise<TransactionReceipt>;
|
|
56
|
+
estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, contractInstance?: Contract): Promise<number>;
|
|
57
|
+
sellDT(address: string, exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string): Promise<TransactionReceipt>;
|
|
57
58
|
getNumberOfExchanges(): Promise<number>;
|
|
58
59
|
estSetRate(account: string, exchangeId: string, newRate: string, contractInstance?: Contract): Promise<number>;
|
|
59
60
|
setRate(address: string, exchangeId: string, newRate: string): Promise<TransactionReceipt>;
|
|
@@ -67,8 +68,8 @@ export declare class FixedRateExchange {
|
|
|
67
68
|
getDTSupply(exchangeId: string): Promise<string>;
|
|
68
69
|
getBTSupply(exchangeId: string): Promise<string>;
|
|
69
70
|
getAllowedSwapper(exchangeId: string): Promise<string>;
|
|
70
|
-
getAmountBTIn(exchangeId: string,
|
|
71
|
-
getAmountBTOut(exchangeId: string,
|
|
71
|
+
getAmountBTIn(exchangeId: string, datatokenAmount: string): Promise<string>;
|
|
72
|
+
getAmountBTOut(exchangeId: string, datatokenAmount: string): Promise<string>;
|
|
72
73
|
getExchange(exchangeId: string): Promise<FixedPriceExchange>;
|
|
73
74
|
getFeesInfo(exchangeId: string): Promise<FeesInfo>;
|
|
74
75
|
getExchanges(): Promise<string[]>;
|
|
@@ -2,19 +2,21 @@ import Web3 from 'web3';
|
|
|
2
2
|
import { AbiItem } from 'web3-utils/types';
|
|
3
3
|
import { TransactionReceipt } from 'web3-core';
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
|
+
import { Config } from '../../models';
|
|
5
6
|
export declare class SideStaking {
|
|
6
7
|
ssAbi: AbiItem | AbiItem[];
|
|
7
8
|
web3: Web3;
|
|
8
9
|
GASLIMIT_DEFAULT: number;
|
|
9
|
-
|
|
10
|
+
config: Config;
|
|
11
|
+
constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[], config?: Config);
|
|
10
12
|
amountToUnits(token: string, amount: string): Promise<string>;
|
|
11
13
|
unitsToAmount(token: string, amount: string): Promise<string>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
getDatatokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
15
|
+
getDatatokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
14
16
|
getPublisherAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
15
|
-
|
|
17
|
+
getBaseToken(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
16
18
|
getPoolAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
17
|
-
|
|
19
|
+
getBaseTokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
18
20
|
getDatatokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
19
21
|
getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
20
22
|
getvestingAmount(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
@@ -12,20 +12,20 @@ export declare class Provider {
|
|
|
12
12
|
getEndpoints(providerUri: string): Promise<any>;
|
|
13
13
|
getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
|
|
14
14
|
getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
|
|
15
|
-
getNonce(providerUri: string, consumerAddress: string, fetchMethod
|
|
15
|
+
getNonce(providerUri: string, consumerAddress: string, fetchMethod?: any, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
|
|
16
16
|
createSignature(web3: Web3, accountId: string, agreementId: string): Promise<string>;
|
|
17
17
|
createHashSignature(web3: Web3, accountId: string, message: string): Promise<string>;
|
|
18
|
-
encrypt(data: any, providerUri: string, postMethod
|
|
19
|
-
checkDidFiles(did: string, serviceId: number, providerUri: string, fetchMethod
|
|
20
|
-
checkFileUrl(url: string, providerUri: string, fetchMethod
|
|
21
|
-
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string,
|
|
18
|
+
encrypt(data: any, providerUri: string, postMethod?: any): Promise<any>;
|
|
19
|
+
checkDidFiles(did: string, serviceId: number, providerUri: string, fetchMethod?: any): Promise<FileMetadata[]>;
|
|
20
|
+
checkFileUrl(url: string, providerUri: string, fetchMethod?: any): Promise<FileMetadata[]>;
|
|
21
|
+
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, fetchMethod?: any, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
22
22
|
getDownloadUrl(did: string, accountId: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, web3: Web3, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
23
|
-
computeStart(providerUri: string, web3: Web3,
|
|
24
|
-
computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, fetchMethod
|
|
25
|
-
computeStatus(providerUri: string, fetchMethod
|
|
23
|
+
computeStart(providerUri: string, web3: Web3, consumerAddress: string, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, fetchMethod?: any, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
|
|
24
|
+
computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, fetchMethod?: any): Promise<ComputeJob | ComputeJob[]>;
|
|
25
|
+
computeStatus(providerUri: string, fetchMethod?: any, jobId?: string, did?: string, consumerAddress?: string): Promise<ComputeJob | ComputeJob[]>;
|
|
26
26
|
computeResult(jobId: string, index: number, destination: string, accountId: string, providerUri: string, web3: Web3, fetchMethod: any): Promise<any>;
|
|
27
|
-
computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, fetchMethod
|
|
28
|
-
isValidProvider(url: string, fetchMethod
|
|
27
|
+
computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, fetchMethod?: any): Promise<ComputeJob | ComputeJob[]>;
|
|
28
|
+
isValidProvider(url: string, fetchMethod?: any): Promise<boolean>;
|
|
29
29
|
}
|
|
30
30
|
export declare const ProviderInstance: Provider;
|
|
31
31
|
export default ProviderInstance;
|
|
@@ -4,6 +4,8 @@ import { TransactionReceipt } from 'web3-eth';
|
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
5
|
import { FreOrderParams, FreCreationParams } from '../interfaces';
|
|
6
6
|
import { Nft } from './NFT';
|
|
7
|
+
import { Config } from '../models/index.js';
|
|
8
|
+
import { ProviderFees } from '../@types/Provider.js';
|
|
7
9
|
interface Roles {
|
|
8
10
|
minter: boolean;
|
|
9
11
|
paymentManager: boolean;
|
|
@@ -11,13 +13,7 @@ interface Roles {
|
|
|
11
13
|
export interface OrderParams {
|
|
12
14
|
consumer: string;
|
|
13
15
|
serviceIndex: number;
|
|
14
|
-
|
|
15
|
-
providerFeeToken: string;
|
|
16
|
-
providerFeeAmount: string;
|
|
17
|
-
v: string;
|
|
18
|
-
r: string;
|
|
19
|
-
s: string;
|
|
20
|
-
providerData: string;
|
|
16
|
+
_providerFees: ProviderFees;
|
|
21
17
|
}
|
|
22
18
|
export interface DispenserParams {
|
|
23
19
|
maxTokens: string;
|
|
@@ -32,9 +28,9 @@ export declare class Datatoken {
|
|
|
32
28
|
datatokensAbi: AbiItem | AbiItem[];
|
|
33
29
|
datatokensEnterpriseAbi: AbiItem | AbiItem[];
|
|
34
30
|
web3: Web3;
|
|
35
|
-
|
|
31
|
+
config: Config;
|
|
36
32
|
nft: Nft;
|
|
37
|
-
constructor(web3: Web3, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[],
|
|
33
|
+
constructor(web3: Web3, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], config?: Config);
|
|
38
34
|
estGasApprove(dtAddress: string, spender: string, amount: string, address: string, contractInstance?: Contract): Promise<any>;
|
|
39
35
|
approve(dtAddress: string, spender: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
40
36
|
estGasMint(dtAddress: string, address: string, amount: string, toAddress?: string, contractInstance?: Contract): Promise<any>;
|
|
@@ -57,8 +53,8 @@ export declare class Datatoken {
|
|
|
57
53
|
transfer(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
58
54
|
estGasTransfer(dtAddress: string, toAddress: string, amount: string, address: string, contractInstance?: Contract): Promise<any>;
|
|
59
55
|
transferWei(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
60
|
-
estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number,
|
|
61
|
-
startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number,
|
|
56
|
+
estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, contractInstance?: Contract): Promise<any>;
|
|
57
|
+
startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees): Promise<TransactionReceipt>;
|
|
62
58
|
estGasBuyFromFreAndOrder(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams, contractInstance?: Contract): Promise<any>;
|
|
63
59
|
buyFromFreAndOrder(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams): Promise<TransactionReceipt>;
|
|
64
60
|
estGasBuyFromDispenserAndOrder(dtAddress: string, address: string, orderParams: OrderParams, dispenserContract: string, contractInstance?: Contract): Promise<any>;
|
|
@@ -72,6 +68,6 @@ export declare class Datatoken {
|
|
|
72
68
|
getDecimals(dtAddress: string): Promise<string>;
|
|
73
69
|
getNFTAddress(dtAddress: string): Promise<string>;
|
|
74
70
|
isERC20Deployer(dtAddress: string, address: string): Promise<boolean>;
|
|
75
|
-
balance(
|
|
71
|
+
balance(datatokenAddress: string, address: string): Promise<string>;
|
|
76
72
|
}
|
|
77
73
|
export {};
|
package/dist/src/tokens/NFT.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AbiItem } from 'web3-utils';
|
|
|
3
3
|
import { TransactionReceipt } from 'web3-eth';
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
5
|
import { MetadataProof } from '../../src/@types';
|
|
6
|
+
import { Config } from '../models/index.js';
|
|
6
7
|
interface Roles {
|
|
7
8
|
manager: boolean;
|
|
8
9
|
deployERC20: boolean;
|
|
@@ -16,7 +17,8 @@ export declare class Nft {
|
|
|
16
17
|
nftAbi: AbiItem | AbiItem[];
|
|
17
18
|
web3: Web3;
|
|
18
19
|
startBlock: number;
|
|
19
|
-
|
|
20
|
+
config: Config;
|
|
21
|
+
constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], config?: Config);
|
|
20
22
|
estGasCreateErc20(nftAddress: string, address: string, minter: string, feeManager: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, contractInstance?: Contract): Promise<any>;
|
|
21
23
|
createErc20(nftAddress: string, address: string, minter: string, feeManager: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number): Promise<string>;
|
|
22
24
|
estGasAddManager(nftAddress: string, address: string, manager: string, contractInstance?: Contract): Promise<any>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Contract } from 'web3-eth-contract';
|
|
1
3
|
import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../interfaces';
|
|
4
|
+
import { Config } from '../models';
|
|
5
|
+
export declare function setContractDefaults(contract: Contract, config: Config): Contract;
|
|
6
|
+
export declare function getFairGasPrice(web3: Web3, config: Config): Promise<string>;
|
|
2
7
|
export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
|
|
3
8
|
export declare function getFreCreationParams(freParams: FreCreationParams): any;
|
|
4
9
|
export declare function getPoolCreationParams(poolParams: PoolCreationParams): any;
|
package/docs/beginners_guide.md
CHANGED
|
@@ -166,10 +166,10 @@ The process of creating and deploying the ERC20 datatokens has been automated by
|
|
|
166
166
|
|
|
167
167
|
```Javascript
|
|
168
168
|
const Web3 = require("web3");
|
|
169
|
-
const { Ocean,
|
|
169
|
+
const { Ocean, Datatokens } = require("@oceanprotocol/lib");
|
|
170
170
|
|
|
171
|
-
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
|
|
172
|
-
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/
|
|
171
|
+
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/contracts/DTFactory.json");
|
|
172
|
+
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/contracts/DatatokenTemplate.json");
|
|
173
173
|
const { config, contracts, urls } = require("./config");
|
|
174
174
|
|
|
175
175
|
const init = async () => {
|
|
@@ -180,7 +180,7 @@ const init = async () => {
|
|
|
180
180
|
const alice = accounts[0].id;
|
|
181
181
|
console.log('Alice account address:', alice)
|
|
182
182
|
|
|
183
|
-
const datatoken = new
|
|
183
|
+
const datatoken = new Datatokens(
|
|
184
184
|
contracts.DTFactory,
|
|
185
185
|
factoryABI,
|
|
186
186
|
datatokensABI,
|