@oceanprotocol/lib 0.19.3 → 1.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 +81 -0
- package/README.md +1 -1
- package/artifacts/ERC721Factory.sol/ERC721Factory.json +1164 -0
- package/artifacts/addresses/address.json +21 -0
- package/artifacts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json +116 -0
- package/artifacts/pools/FactoryRouter.sol/FactoryRouter.json +1086 -0
- package/artifacts/pools/balancer/BPool.sol/BPool.json +1744 -0
- package/artifacts/pools/dispenser/Dispenser.sol/Dispenser.json +358 -0
- package/artifacts/pools/fixedRate/FixedRateExchange.sol/FixedRateExchange.json +917 -0
- package/artifacts/pools/ssContracts/SideStaking.sol/SideStaking.json +428 -0
- package/artifacts/templates/ERC20Template.sol/ERC20Template.json +1382 -0
- package/artifacts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json +1530 -0
- package/artifacts/templates/ERC721Template.sol/ERC721Template.json +1534 -0
- package/artifacts/utils/mock/MockERC20.sol/MockERC20.json +302 -0
- package/artifacts/utils/mock/MockERC20Decimals.sol/MockERC20Decimals.json +302 -0
- package/dist/node/lib.js +1 -1
- package/dist/node/lib.js.map +1 -1
- package/dist/node/lib.module.js +1 -1
- package/dist/node/lib.module.js.map +1 -1
- package/dist/node/lib.umd.js +1 -1
- package/dist/node/lib.umd.js.map +1 -1
- package/dist/node/src/@types/Asset.d.ts +36 -0
- package/dist/node/{ocean/interfaces → src/@types}/Compute.d.ts +21 -12
- package/dist/node/src/@types/DDO/Credentials.d.ts +8 -0
- package/dist/node/src/@types/DDO/DDO.d.ts +15 -0
- package/dist/node/src/@types/DDO/Event.d.ts +7 -0
- package/dist/node/src/@types/DDO/Metadata.d.ts +38 -0
- package/dist/node/src/@types/DDO/Service.d.ts +28 -0
- package/dist/node/src/@types/FileMetadata.d.ts +8 -0
- package/dist/node/src/@types/Provider.d.ts +15 -0
- package/dist/node/src/@types/index.d.ts +8 -0
- package/dist/node/src/aquarius/Aquarius.d.ts +10 -0
- package/dist/node/src/aquarius/index.d.ts +1 -0
- package/dist/node/src/factories/NFTFactory.d.ts +70 -0
- package/dist/node/src/factories/index.d.ts +1 -0
- package/dist/node/src/index.d.ts +8 -0
- package/dist/node/src/interfaces/DispenserInterface.d.ts +7 -0
- package/dist/node/src/interfaces/Erc20Interface.d.ts +11 -0
- package/dist/node/src/interfaces/FixedRateInterface.d.ts +19 -0
- package/dist/node/src/interfaces/PoolInterface.d.ts +36 -0
- package/dist/node/src/interfaces/RouterInterface.d.ts +12 -0
- package/dist/node/src/interfaces/index.d.ts +5 -0
- package/dist/node/{models → src/models}/Config.d.ts +10 -6
- package/dist/node/src/models/index.d.ts +1 -0
- package/dist/node/src/pools/Router.d.ts +46 -0
- package/dist/node/src/pools/balancer/Pool.d.ts +73 -0
- package/dist/node/src/pools/balancer/index.d.ts +1 -0
- package/dist/node/src/pools/dispenser/Dispenser.d.ts +37 -0
- package/dist/node/src/pools/dispenser/index.d.ts +1 -0
- package/dist/node/src/pools/fixedRate/FixedRateExchange.d.ts +95 -0
- package/dist/node/src/pools/fixedRate/index.d.ts +1 -0
- package/dist/node/src/pools/index.d.ts +3 -0
- package/dist/node/src/pools/ssContracts/SideStaking.d.ts +28 -0
- package/dist/node/src/pools/ssContracts/index.d.ts +1 -0
- package/dist/node/src/provider/Provider.d.ts +31 -0
- package/dist/node/src/provider/index.d.ts +1 -0
- package/dist/node/src/tokens/Datatoken.d.ts +77 -0
- package/dist/node/src/tokens/NFT.d.ts +57 -0
- package/dist/node/src/tokens/index.d.ts +2 -0
- package/dist/node/src/utils/ConfigHelper.d.ts +6 -0
- package/dist/node/src/utils/Constants.d.ts +1 -0
- package/dist/node/src/utils/ContractParams.d.ts +4 -0
- package/dist/node/src/utils/ConversionTypeHelper.d.ts +3 -0
- package/dist/node/{utils/Datatokens.d.ts → src/utils/DatatokenName.d.ts} +1 -1
- package/dist/node/src/utils/DdoHelpers.d.ts +2 -0
- package/dist/node/src/utils/FetchHelper.d.ts +5 -0
- package/dist/node/{utils → src/utils}/GasUtils.d.ts +0 -0
- package/dist/node/{utils → src/utils}/Logger.d.ts +0 -0
- package/dist/node/src/utils/SignatureUtils.d.ts +8 -0
- package/dist/node/src/utils/index.d.ts +9 -0
- package/package.json +23 -19
- package/dist/node/Instantiable.abstract.d.ts +0 -25
- package/dist/node/balancer/OceanPool.d.ts +0 -94
- package/dist/node/balancer/Pool.d.ts +0 -55
- package/dist/node/balancer/PoolFactory.d.ts +0 -13
- package/dist/node/datatokens/ContractEvent.d.ts +0 -19
- package/dist/node/datatokens/ContractHandler.d.ts +0 -12
- package/dist/node/datatokens/Datatokens.d.ts +0 -42
- package/dist/node/datatokens/EventHandler.d.ts +0 -19
- package/dist/node/datatokens/Network.d.ts +0 -5
- package/dist/node/datatokens/Web3Provider.d.ts +0 -5
- package/dist/node/datatokens/contracts/ContractBase.d.ts +0 -27
- package/dist/node/ddo/DDO.d.ts +0 -36
- package/dist/node/ddo/interfaces/AdditionalInformation.d.ts +0 -16
- package/dist/node/ddo/interfaces/Authentication.d.ts +0 -4
- package/dist/node/ddo/interfaces/BestPrice.d.ts +0 -10
- package/dist/node/ddo/interfaces/Consumable.d.ts +0 -5
- package/dist/node/ddo/interfaces/Credentials.d.ts +0 -9
- package/dist/node/ddo/interfaces/Curation.d.ts +0 -6
- package/dist/node/ddo/interfaces/DataTokenInfo.d.ts +0 -10
- package/dist/node/ddo/interfaces/EditableMetadata.d.ts +0 -9
- package/dist/node/ddo/interfaces/EditableMetadataLinks.d.ts +0 -5
- package/dist/node/ddo/interfaces/Event.d.ts +0 -7
- package/dist/node/ddo/interfaces/File.d.ts +0 -13
- package/dist/node/ddo/interfaces/Metadata.d.ts +0 -15
- package/dist/node/ddo/interfaces/MetadataAlgorithm.d.ts +0 -12
- package/dist/node/ddo/interfaces/MetadataMain.d.ts +0 -12
- package/dist/node/ddo/interfaces/Proof.d.ts +0 -6
- package/dist/node/ddo/interfaces/PublicKey.d.ts +0 -8
- package/dist/node/ddo/interfaces/PurgatoryData.d.ts +0 -4
- package/dist/node/ddo/interfaces/Service.d.ts +0 -99
- package/dist/node/ddo/interfaces/ServicePrices.d.ts +0 -4
- package/dist/node/ddo/interfaces/Status.d.ts +0 -5
- package/dist/node/ddo/interfaces/index.d.ts +0 -17
- package/dist/node/dispenser/Dispenser.d.ts +0 -42
- package/dist/node/exchange/FixedRateExchange.d.ts +0 -57
- package/dist/node/index.d.ts +0 -1
- package/dist/node/lib.d.ts +0 -15
- package/dist/node/metadatacache/MetadataCache.d.ts +0 -41
- package/dist/node/metadatacache/OnChainMetaData.d.ts +0 -29
- package/dist/node/ocean/Account.d.ts +0 -16
- package/dist/node/ocean/Accounts.d.ts +0 -9
- package/dist/node/ocean/Assets.d.ts +0 -56
- package/dist/node/ocean/AssetsCredential.d.ts +0 -6
- package/dist/node/ocean/Compute.d.ts +0 -75
- package/dist/node/ocean/DID.d.ts +0 -8
- package/dist/node/ocean/EventAccessControl.d.ts +0 -9
- package/dist/node/ocean/Ocean.d.ts +0 -34
- package/dist/node/ocean/OceanAuth.d.ts +0 -15
- package/dist/node/ocean/Versions.d.ts +0 -25
- package/dist/node/ocean/utils/SignatureUtils.d.ts +0 -13
- package/dist/node/ocean/utils/Utils.d.ts +0 -8
- package/dist/node/ocean/utils/WebServiceConnector.d.ts +0 -15
- package/dist/node/provider/Provider.d.ts +0 -49
- package/dist/node/utils/AssetResolverHelper.d.ts +0 -8
- package/dist/node/utils/ConfigHelper.d.ts +0 -13
- package/dist/node/utils/ConversionTypeHelpers.d.ts +0 -8
- package/dist/node/utils/GeneratorHelpers.d.ts +0 -1
- package/dist/node/utils/PromiseResolver.d.ts +0 -3
- package/dist/node/utils/SubscribableObserver.d.ts +0 -12
- package/dist/node/utils/SubscribablePromise.d.ts +0 -14
- package/dist/node/utils/Timeout.d.ts +0 -1
- package/dist/node/utils/index.d.ts +0 -9
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DDO } from './DDO/DDO';
|
|
2
|
+
export interface AssetNft {
|
|
3
|
+
address: string;
|
|
4
|
+
name: string;
|
|
5
|
+
symbol: string;
|
|
6
|
+
owner: string;
|
|
7
|
+
state: 0 | 1 | 2 | 3 | 4;
|
|
8
|
+
created: string;
|
|
9
|
+
tokenURI: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Purgatory {
|
|
12
|
+
state: boolean;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AssetDatatoken {
|
|
16
|
+
address: string;
|
|
17
|
+
name: string;
|
|
18
|
+
symbol: string;
|
|
19
|
+
serviceId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AssetLastEvent {
|
|
22
|
+
tx: string;
|
|
23
|
+
block: number;
|
|
24
|
+
from: string;
|
|
25
|
+
contract: string;
|
|
26
|
+
datetime: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Asset extends DDO {
|
|
29
|
+
nft: AssetNft;
|
|
30
|
+
datatokens: AssetDatatoken[];
|
|
31
|
+
event: AssetLastEvent;
|
|
32
|
+
stats: {
|
|
33
|
+
consume: number;
|
|
34
|
+
};
|
|
35
|
+
purgatory: Purgatory;
|
|
36
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Metadata, MetadataAlgorithm } from './DDO/Metadata';
|
|
2
|
+
export declare type ComputeResultType = 'algorithmLog' | 'output';
|
|
3
|
+
export interface ComputeResult {
|
|
4
|
+
filename: string;
|
|
5
|
+
filesize: number;
|
|
6
|
+
type: ComputeResultType;
|
|
7
|
+
index?: number;
|
|
8
|
+
}
|
|
4
9
|
export interface ComputeJob {
|
|
5
10
|
owner: string;
|
|
6
11
|
did?: string;
|
|
@@ -9,12 +14,11 @@ export interface ComputeJob {
|
|
|
9
14
|
dateFinished: string;
|
|
10
15
|
status: number;
|
|
11
16
|
statusText: string;
|
|
12
|
-
|
|
13
|
-
resultsUrl: string[];
|
|
14
|
-
resultsDid?: DID;
|
|
17
|
+
results: ComputeResult[];
|
|
15
18
|
inputDID?: string[];
|
|
16
19
|
algoDID?: string;
|
|
17
20
|
agreementId?: string;
|
|
21
|
+
expireTimestamp: number;
|
|
18
22
|
}
|
|
19
23
|
export interface ComputeOutput {
|
|
20
24
|
publishAlgorithmLog?: boolean;
|
|
@@ -28,18 +32,23 @@ export interface ComputeOutput {
|
|
|
28
32
|
secretStoreUri?: string;
|
|
29
33
|
whitelist?: string[];
|
|
30
34
|
}
|
|
31
|
-
export interface
|
|
35
|
+
export interface ComputeAsset {
|
|
32
36
|
documentId: string;
|
|
33
|
-
serviceId:
|
|
37
|
+
serviceId: string;
|
|
34
38
|
transferTxId?: string;
|
|
39
|
+
userdata?: {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
35
42
|
}
|
|
36
43
|
export interface ComputeAlgorithm {
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
documentId?: string;
|
|
45
|
+
serviceId?: string;
|
|
39
46
|
meta?: MetadataAlgorithm;
|
|
40
47
|
transferTxId?: string;
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
algocustomdata?: {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
};
|
|
51
|
+
userdata?: {
|
|
43
52
|
[key: string]: any;
|
|
44
53
|
};
|
|
45
54
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Service } from './Service';
|
|
2
|
+
import { Metadata } from './Metadata';
|
|
3
|
+
import { Credentials } from './Credentials';
|
|
4
|
+
import { Event } from './Event';
|
|
5
|
+
export interface DDO {
|
|
6
|
+
'@context': string[];
|
|
7
|
+
id: string;
|
|
8
|
+
version: string;
|
|
9
|
+
nftAddress: string;
|
|
10
|
+
chainId: number;
|
|
11
|
+
metadata: Metadata;
|
|
12
|
+
services: Service[];
|
|
13
|
+
credentials?: Credentials;
|
|
14
|
+
event?: Event;
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface MetadataAlgorithm {
|
|
2
|
+
language?: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
rawcode?: string;
|
|
5
|
+
container: {
|
|
6
|
+
entrypoint: string;
|
|
7
|
+
image: string;
|
|
8
|
+
tag: string;
|
|
9
|
+
checksum: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface Metadata {
|
|
13
|
+
created: string;
|
|
14
|
+
updated: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
type: 'dataset' | 'algorithm';
|
|
18
|
+
author: string;
|
|
19
|
+
license: string;
|
|
20
|
+
links?: string[];
|
|
21
|
+
tags?: string[];
|
|
22
|
+
copyrightHolder?: string;
|
|
23
|
+
contentLanguage?: string;
|
|
24
|
+
algorithm?: MetadataAlgorithm;
|
|
25
|
+
additionalInformation?: any;
|
|
26
|
+
}
|
|
27
|
+
export interface MetadataProof {
|
|
28
|
+
validatorAddress?: string;
|
|
29
|
+
r?: string;
|
|
30
|
+
s?: string;
|
|
31
|
+
v?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ValidateMetadata {
|
|
34
|
+
valid: Boolean;
|
|
35
|
+
errors?: Object;
|
|
36
|
+
hash?: string;
|
|
37
|
+
proof?: MetadataProof;
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface PublisherTrustedAlgorithm {
|
|
2
|
+
did: string;
|
|
3
|
+
filesChecksum: string;
|
|
4
|
+
containerSectionChecksum: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ServiceComputeOptions {
|
|
7
|
+
namespace: string;
|
|
8
|
+
cpu?: number;
|
|
9
|
+
gpu?: number;
|
|
10
|
+
gpuType?: string;
|
|
11
|
+
memory?: string;
|
|
12
|
+
volumeSize?: string;
|
|
13
|
+
allowRawAlgorithm: boolean;
|
|
14
|
+
allowNetworkAccess: boolean;
|
|
15
|
+
publisherTrustedAlgorithmPublishers: string[];
|
|
16
|
+
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[];
|
|
17
|
+
}
|
|
18
|
+
export interface Service {
|
|
19
|
+
id: string;
|
|
20
|
+
type: 'access' | 'compute' | string;
|
|
21
|
+
files: string;
|
|
22
|
+
datatokenAddress: string;
|
|
23
|
+
serviceEndpoint: string;
|
|
24
|
+
timeout: number;
|
|
25
|
+
name?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
compute?: ServiceComputeOptions;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ProviderFees {
|
|
2
|
+
providerFeeAddress: string;
|
|
3
|
+
providerFeeToken: string;
|
|
4
|
+
providerFeeAmount: string;
|
|
5
|
+
providerData: string;
|
|
6
|
+
v: string;
|
|
7
|
+
r: string;
|
|
8
|
+
s: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProviderInitialize {
|
|
11
|
+
dataToken: string;
|
|
12
|
+
nonce: string;
|
|
13
|
+
computeAddress: string;
|
|
14
|
+
providerFee: ProviderFees;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Asset, DDO, ValidateMetadata } from '../@types/';
|
|
2
|
+
export declare class Aquarius {
|
|
3
|
+
aquariusURL: any;
|
|
4
|
+
constructor(aquariusURL: string);
|
|
5
|
+
resolve(did: string, fetchMethod: any): Promise<DDO>;
|
|
6
|
+
sleep(ms: number): Promise<unknown>;
|
|
7
|
+
waitForAqua(fetchMethod: any, did: string, txid?: string): Promise<Asset>;
|
|
8
|
+
validate(fetchMethod: any, ddo: DDO): Promise<ValidateMetadata>;
|
|
9
|
+
}
|
|
10
|
+
export default Aquarius;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Aquarius';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Contract } from 'web3-eth-contract';
|
|
2
|
+
import Web3 from 'web3';
|
|
3
|
+
import { TransactionReceipt } from 'web3-core';
|
|
4
|
+
import { AbiItem } from 'web3-utils';
|
|
5
|
+
import { FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams } from '../interfaces';
|
|
6
|
+
interface Template {
|
|
7
|
+
templateAddress: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TokenOrder {
|
|
11
|
+
tokenAddress: string;
|
|
12
|
+
consumer: string;
|
|
13
|
+
serviceIndex: number;
|
|
14
|
+
providerFeeAddress: string;
|
|
15
|
+
providerFeeToken: string;
|
|
16
|
+
providerFeeAmount: string;
|
|
17
|
+
v: string;
|
|
18
|
+
r: string;
|
|
19
|
+
s: string;
|
|
20
|
+
providerData: string;
|
|
21
|
+
}
|
|
22
|
+
export interface NftCreateData {
|
|
23
|
+
name: string;
|
|
24
|
+
symbol: string;
|
|
25
|
+
templateIndex: number;
|
|
26
|
+
tokenURI: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class NftFactory {
|
|
29
|
+
GASLIMIT_DEFAULT: number;
|
|
30
|
+
factory721Address: string;
|
|
31
|
+
factory721Abi: AbiItem | AbiItem[];
|
|
32
|
+
web3: Web3;
|
|
33
|
+
startBlock: number;
|
|
34
|
+
factory721: Contract;
|
|
35
|
+
constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[], startBlock?: number);
|
|
36
|
+
estGasCreateNFT(address: string, nftData: NftCreateData): Promise<string>;
|
|
37
|
+
createNFT(address: string, nftData: NftCreateData): Promise<string>;
|
|
38
|
+
getCurrentNFTCount(): Promise<number>;
|
|
39
|
+
getCurrentTokenCount(): Promise<number>;
|
|
40
|
+
getOwner(): Promise<string>;
|
|
41
|
+
getCurrentNFTTemplateCount(): Promise<number>;
|
|
42
|
+
getCurrentTokenTemplateCount(): Promise<number>;
|
|
43
|
+
getNFTTemplate(index: number): Promise<Template>;
|
|
44
|
+
getTokenTemplate(index: number): Promise<Template>;
|
|
45
|
+
checkDatatoken(datatoken: string): Promise<Boolean>;
|
|
46
|
+
checkNFT(nftAddress: string): Promise<String>;
|
|
47
|
+
estGasAddNFTTemplate(address: string, templateAddress: string): Promise<any>;
|
|
48
|
+
addNFTTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
|
|
49
|
+
estGasDisableNFTTemplate(address: string, templateIndex: number): Promise<any>;
|
|
50
|
+
disableNFTTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
|
|
51
|
+
estGasReactivateNFTTemplate(address: string, templateIndex: number): Promise<any>;
|
|
52
|
+
reactivateNFTTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
|
|
53
|
+
estGasAddTokenTemplate(address: string, templateAddress: string): Promise<any>;
|
|
54
|
+
addTokenTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
|
|
55
|
+
estGasDisableTokenTemplate(address: string, templateIndex: number): Promise<any>;
|
|
56
|
+
disableTokenTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
|
|
57
|
+
estGasReactivateTokenTemplate(address: string, templateIndex: number): Promise<any>;
|
|
58
|
+
reactivateTokenTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
|
|
59
|
+
estGasStartMultipleTokenOrder(address: string, orders: TokenOrder[]): Promise<any>;
|
|
60
|
+
startMultipleTokenOrder(address: string, orders: TokenOrder[]): Promise<TransactionReceipt>;
|
|
61
|
+
estGasCreateNftWithErc(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams): Promise<any>;
|
|
62
|
+
createNftWithErc(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams): Promise<TransactionReceipt>;
|
|
63
|
+
estGasCreateNftErcWithPool(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, poolParams: PoolCreationParams): Promise<any>;
|
|
64
|
+
createNftErcWithPool(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, poolParams: PoolCreationParams): Promise<TransactionReceipt>;
|
|
65
|
+
estGasCreateNftErcWithFixedRate(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, freParams: FreCreationParams): Promise<any>;
|
|
66
|
+
createNftErcWithFixedRate(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, freParams: FreCreationParams): Promise<TransactionReceipt>;
|
|
67
|
+
estGasCreateNftErcWithDispenser(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, dispenserParams: DispenserCreationParams): Promise<any>;
|
|
68
|
+
createNftErcWithDispenser(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, dispenserParams: DispenserCreationParams): Promise<TransactionReceipt>;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NFTFactory';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface FreCreationParams {
|
|
2
|
+
fixedRateAddress: string;
|
|
3
|
+
baseTokenAddress: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
marketFeeCollector: string;
|
|
6
|
+
baseTokenDecimals: number;
|
|
7
|
+
dataTokenDecimals: number;
|
|
8
|
+
fixedRate: string;
|
|
9
|
+
marketFee: number;
|
|
10
|
+
withMint?: boolean;
|
|
11
|
+
allowedConsumer?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FreOrderParams {
|
|
14
|
+
exchangeContract: string;
|
|
15
|
+
exchangeId: string;
|
|
16
|
+
maxBaseTokenAmount: string;
|
|
17
|
+
swapMarketFee: string;
|
|
18
|
+
marketFeeAddress: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface PoolCreationParams {
|
|
2
|
+
ssContract: string;
|
|
3
|
+
basetokenAddress: string;
|
|
4
|
+
basetokenSender: string;
|
|
5
|
+
publisherAddress: string;
|
|
6
|
+
marketFeeCollector: string;
|
|
7
|
+
poolTemplateAddress: string;
|
|
8
|
+
rate: string;
|
|
9
|
+
basetokenDecimals: number;
|
|
10
|
+
vestingAmount: string;
|
|
11
|
+
vestedBlocks: number;
|
|
12
|
+
initialBasetokenLiquidity: string;
|
|
13
|
+
swapFeeLiquidityProvider: number;
|
|
14
|
+
swapFeeMarketRunner: number;
|
|
15
|
+
}
|
|
16
|
+
export interface CurrentFees {
|
|
17
|
+
tokens: string[];
|
|
18
|
+
amounts: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface TokenInOutMarket {
|
|
21
|
+
tokenIn: string;
|
|
22
|
+
tokenOut: string;
|
|
23
|
+
marketFeeAddress: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AmountsInMaxFee {
|
|
26
|
+
tokenAmountIn: string;
|
|
27
|
+
minAmountOut: string;
|
|
28
|
+
swapMarketFee: string;
|
|
29
|
+
maxPrice?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AmountsOutMaxFee {
|
|
32
|
+
tokenAmountOut: string;
|
|
33
|
+
maxAmountIn: string;
|
|
34
|
+
swapMarketFee: string;
|
|
35
|
+
maxPrice?: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Operation {
|
|
2
|
+
exchangeIds: string;
|
|
3
|
+
source: string;
|
|
4
|
+
operation: number;
|
|
5
|
+
tokenIn: string;
|
|
6
|
+
amountsIn: string | number;
|
|
7
|
+
tokenOut: string;
|
|
8
|
+
amountsOut: string | number;
|
|
9
|
+
maxPrice: string | number;
|
|
10
|
+
swapMarketFee: string;
|
|
11
|
+
marketFeeAddress: string;
|
|
12
|
+
}
|
|
@@ -5,26 +5,30 @@ export declare class Config {
|
|
|
5
5
|
providerAddress?: string;
|
|
6
6
|
metadataCacheUri?: string;
|
|
7
7
|
providerUri?: string;
|
|
8
|
-
rbacUri?: string;
|
|
9
8
|
web3Provider?: any;
|
|
10
9
|
oceanTokenAddress?: string;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
erc721FactoryAddress?: string;
|
|
11
|
+
erc721FFactoryABI?: AbiItem | AbiItem[];
|
|
13
12
|
datatokensABI?: AbiItem | AbiItem[];
|
|
14
|
-
|
|
13
|
+
poolTemplateAddress?: string;
|
|
15
14
|
poolFactoryABI?: AbiItem | AbiItem[];
|
|
16
15
|
poolABI?: AbiItem | AbiItem[];
|
|
17
16
|
fixedRateExchangeAddress?: string;
|
|
18
17
|
fixedRateExchangeAddressABI?: AbiItem | AbiItem[];
|
|
19
18
|
dispenserAddress?: string;
|
|
20
19
|
dispenserABI?: AbiItem | AbiItem[];
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
opfCommunityFeeCollector?: string;
|
|
21
|
+
sideStakingAddress?: string;
|
|
23
22
|
startBlock?: number;
|
|
24
23
|
verbose?: boolean | LogLevel;
|
|
25
24
|
authMessage?: string;
|
|
26
25
|
authTokenExpiration?: number;
|
|
27
26
|
parityUri?: string;
|
|
28
27
|
threshold?: number;
|
|
28
|
+
chainId: number;
|
|
29
|
+
network: string;
|
|
30
|
+
subgraphUri: string;
|
|
31
|
+
explorerUri: string;
|
|
32
|
+
oceanTokenSymbol: string;
|
|
29
33
|
}
|
|
30
34
|
export default Config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Config';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Contract } from 'web3-eth-contract';
|
|
2
|
+
import Web3 from 'web3';
|
|
3
|
+
import { TransactionReceipt } from 'web3-core';
|
|
4
|
+
import { AbiItem } from 'web3-utils';
|
|
5
|
+
import { Operation } from '../interfaces/RouterInterface';
|
|
6
|
+
export declare class Router {
|
|
7
|
+
GASLIMIT_DEFAULT: number;
|
|
8
|
+
routerAddress: string;
|
|
9
|
+
RouterAbi: AbiItem | AbiItem[];
|
|
10
|
+
web3: Web3;
|
|
11
|
+
startBlock: number;
|
|
12
|
+
router: Contract;
|
|
13
|
+
constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], startBlock?: number);
|
|
14
|
+
estGasBuyDTBatch(address: string, operations: Operation[]): Promise<any>;
|
|
15
|
+
buyDTBatch(address: string, operations: Operation[]): Promise<TransactionReceipt>;
|
|
16
|
+
isOceanTokens(address: string): Promise<boolean>;
|
|
17
|
+
isSideStaking(address: string): Promise<boolean>;
|
|
18
|
+
isFixedPrice(address: string): Promise<boolean>;
|
|
19
|
+
getOwner(): Promise<string>;
|
|
20
|
+
getNFTFactory(): Promise<string>;
|
|
21
|
+
isPoolTemplate(address: string): Promise<boolean>;
|
|
22
|
+
estGasAddOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
|
|
23
|
+
addOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
24
|
+
estGasRemoveOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
|
|
25
|
+
removeOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
26
|
+
estGasAddSSContract(address: string, tokenAddress: string): Promise<any>;
|
|
27
|
+
addSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
28
|
+
estGasRemoveSSContract(address: string, tokenAddress: string): Promise<any>;
|
|
29
|
+
removeSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
30
|
+
estGasAddFixedRateContract(address: string, tokenAddress: string): Promise<any>;
|
|
31
|
+
addFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
32
|
+
estGasRemoveFixedRateContract(address: string, tokenAddress: string): Promise<any>;
|
|
33
|
+
removeFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
34
|
+
estGasAddDispenserContract(address: string, tokenAddress: string): Promise<any>;
|
|
35
|
+
addDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
36
|
+
estGasRemoveDispenserContract(address: string, tokenAddress: string): Promise<any>;
|
|
37
|
+
removeDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
38
|
+
getOPFFee(baseToken: string): Promise<number>;
|
|
39
|
+
getCurrentOPFFee(): Promise<number>;
|
|
40
|
+
estGasUpdateOPFFee(address: string, newFee: number): Promise<any>;
|
|
41
|
+
updateOPFFee(address: string, newFee: number): Promise<TransactionReceipt>;
|
|
42
|
+
estGasAddPoolTemplate(address: string, templateAddress: string): Promise<any>;
|
|
43
|
+
addPoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
|
|
44
|
+
estGasRemovePoolTemplate(address: string, templateAddress: string): Promise<any>;
|
|
45
|
+
removePoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 { Logger } from '../../utils';
|
|
6
|
+
import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee } from '../../interfaces';
|
|
7
|
+
export declare class Pool {
|
|
8
|
+
poolAbi: AbiItem | AbiItem[];
|
|
9
|
+
web3: Web3;
|
|
10
|
+
GASLIMIT_DEFAULT: number;
|
|
11
|
+
private logger;
|
|
12
|
+
constructor(web3: Web3, logger: Logger, poolAbi?: AbiItem | AbiItem[]);
|
|
13
|
+
estApprove(account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
14
|
+
allowance(tokenAddress: string, owner: string, spender: string): Promise<string>;
|
|
15
|
+
approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
16
|
+
sharesBalance(account: string, poolAddress: string): Promise<string>;
|
|
17
|
+
estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
|
|
18
|
+
setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
|
|
19
|
+
getNumTokens(poolAddress: string): Promise<string>;
|
|
20
|
+
getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
|
|
21
|
+
getCurrentTokens(poolAddress: string): Promise<string[]>;
|
|
22
|
+
getFinalTokens(poolAddress: string): Promise<string[]>;
|
|
23
|
+
getController(poolAddress: string): Promise<string>;
|
|
24
|
+
getBasetoken(poolAddress: string): Promise<string>;
|
|
25
|
+
getDatatoken(poolAddress: string): Promise<string>;
|
|
26
|
+
getMarketFeeCollector(poolAddress: string): Promise<string>;
|
|
27
|
+
getOPFCollector(poolAddress: string): Promise<string>;
|
|
28
|
+
isBound(poolAddress: string, token: string): Promise<boolean>;
|
|
29
|
+
getReserve(poolAddress: string, token: string): Promise<string>;
|
|
30
|
+
isFinalized(poolAddress: string): Promise<boolean>;
|
|
31
|
+
getSwapFee(poolAddress: string): Promise<string>;
|
|
32
|
+
getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
33
|
+
getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
34
|
+
getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
|
|
35
|
+
getMarketFees(poolAddress: string, token: string): Promise<string>;
|
|
36
|
+
getCurrentMarketFees(poolAddress: string): Promise<CurrentFees>;
|
|
37
|
+
getCurrentOPFFees(poolAddress: string): Promise<CurrentFees>;
|
|
38
|
+
getCommunityFees(poolAddress: string, token: string): Promise<string>;
|
|
39
|
+
estCollectOPF(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
|
|
40
|
+
collectOPF(address: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
41
|
+
estCollectMarketFee(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
|
|
42
|
+
collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
43
|
+
estUpdateMarketFeeCollector(address: string, poolAddress: string, newCollector: string, contractInstance?: Contract): Promise<number>;
|
|
44
|
+
updateMarketFeeCollector(address: string, poolAddress: string, newCollector: string): Promise<TransactionReceipt>;
|
|
45
|
+
amountToUnits(token: string, amount: string): Promise<string>;
|
|
46
|
+
unitsToAmount(token: string, amount: string): Promise<string>;
|
|
47
|
+
estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
|
|
48
|
+
swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
|
|
49
|
+
estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
|
|
50
|
+
swapExactAmountOut(account: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee): Promise<TransactionReceipt>;
|
|
51
|
+
estJoinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[], contractInstance?: Contract): Promise<number>;
|
|
52
|
+
joinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[]): Promise<TransactionReceipt>;
|
|
53
|
+
estExitPool(address: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[], contractInstance?: Contract): Promise<number>;
|
|
54
|
+
exitPool(account: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[]): Promise<TransactionReceipt>;
|
|
55
|
+
estJoinswapExternAmountIn(address: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string, contractInstance?: Contract): Promise<number>;
|
|
56
|
+
joinswapExternAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
|
|
57
|
+
estJoinswapPoolAmountOut(address: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string, contractInstance?: Contract): Promise<number>;
|
|
58
|
+
joinswapPoolAmountOut(account: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string): Promise<TransactionReceipt>;
|
|
59
|
+
estExitswapPoolAmountIn(address: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string, contractInstance?: Contract): Promise<number>;
|
|
60
|
+
exitswapPoolAmountIn(account: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
|
|
61
|
+
estExitswapExternAmountOut(address: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string, contractInstance?: Contract): Promise<number>;
|
|
62
|
+
exitswapExternAmountOut(account: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string): Promise<TransactionReceipt>;
|
|
63
|
+
getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string, swapMarketFee: string): Promise<string>;
|
|
64
|
+
getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string): Promise<string>;
|
|
65
|
+
getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string): Promise<string>;
|
|
66
|
+
calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string): Promise<string>;
|
|
67
|
+
calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string): Promise<string>;
|
|
68
|
+
calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string): Promise<string>;
|
|
69
|
+
calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string): Promise<string>;
|
|
70
|
+
getSwapEventSignature(): string;
|
|
71
|
+
getJoinEventSignature(): string;
|
|
72
|
+
getExitEventSignature(): string;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Pool';
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
export interface DispenserToken {
|
|
7
|
+
active: boolean;
|
|
8
|
+
owner: string;
|
|
9
|
+
maxTokens: string;
|
|
10
|
+
maxBalance: string;
|
|
11
|
+
balance: string;
|
|
12
|
+
isMinter: boolean;
|
|
13
|
+
allowedSwapper: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class Dispenser {
|
|
16
|
+
GASLIMIT_DEFAULT: number;
|
|
17
|
+
web3: Web3;
|
|
18
|
+
dispenserAddress: string;
|
|
19
|
+
startBlock: number;
|
|
20
|
+
dispenserAbi: AbiItem | AbiItem[];
|
|
21
|
+
dispenserContract: Contract;
|
|
22
|
+
constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], startBlock?: number);
|
|
23
|
+
status(dtAdress: string): Promise<DispenserToken>;
|
|
24
|
+
estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
|
|
25
|
+
create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
|
|
26
|
+
estGasActivate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<any>;
|
|
27
|
+
activate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<TransactionReceipt>;
|
|
28
|
+
estGasDeactivate(dtAddress: string, address: string): Promise<any>;
|
|
29
|
+
deactivate(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
30
|
+
estGasSetAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<any>;
|
|
31
|
+
setAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
|
|
32
|
+
estGasDispense(dtAddress: string, address: string, amount: string, destination: string): Promise<any>;
|
|
33
|
+
dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
|
|
34
|
+
estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
|
|
35
|
+
ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
36
|
+
isDispensable(dtAddress: string, dataToken: Datatoken, address: string, amount?: string): Promise<Boolean>;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Dispenser';
|