@oceanprotocol/lib 0.20.1 → 1.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/CHANGELOG.md +75 -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 +36 -0
  12. package/dist/{node/ocean/interfaces → src/@types}/Compute.d.ts +13 -9
  13. package/dist/src/@types/DDO/Credentials.d.ts +8 -0
  14. package/dist/src/@types/DDO/DDO.d.ts +15 -0
  15. package/dist/src/@types/DDO/Event.d.ts +7 -0
  16. package/dist/src/@types/DDO/Metadata.d.ts +38 -0
  17. package/dist/src/@types/DDO/Service.d.ts +28 -0
  18. package/dist/src/@types/FileMetadata.d.ts +8 -0
  19. package/dist/src/@types/Provider.d.ts +15 -0
  20. package/dist/src/@types/index.d.ts +8 -0
  21. package/dist/src/aquarius/Aquarius.d.ts +10 -0
  22. package/dist/src/aquarius/index.d.ts +1 -0
  23. package/dist/src/factories/NFTFactory.d.ts +70 -0
  24. package/dist/src/factories/index.d.ts +1 -0
  25. package/dist/src/index.d.ts +8 -0
  26. package/dist/src/interfaces/DispenserInterface.d.ts +7 -0
  27. package/dist/src/interfaces/Erc20Interface.d.ts +11 -0
  28. package/dist/src/interfaces/FixedRateInterface.d.ts +19 -0
  29. package/dist/src/interfaces/PoolInterface.d.ts +36 -0
  30. package/dist/src/interfaces/RouterInterface.d.ts +12 -0
  31. package/dist/src/interfaces/index.d.ts +5 -0
  32. package/dist/{node → src}/models/Config.d.ts +10 -7
  33. package/dist/src/models/index.d.ts +1 -0
  34. package/dist/src/pools/Router.d.ts +46 -0
  35. package/dist/src/pools/balancer/Pool.d.ts +73 -0
  36. package/dist/src/pools/balancer/index.d.ts +1 -0
  37. package/dist/src/pools/dispenser/Dispenser.d.ts +37 -0
  38. package/dist/src/pools/dispenser/index.d.ts +1 -0
  39. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +95 -0
  40. package/dist/src/pools/fixedRate/index.d.ts +1 -0
  41. package/dist/src/pools/index.d.ts +3 -0
  42. package/dist/src/pools/ssContracts/SideStaking.d.ts +28 -0
  43. package/dist/src/pools/ssContracts/index.d.ts +1 -0
  44. package/dist/src/provider/Provider.d.ts +31 -0
  45. package/dist/src/provider/index.d.ts +1 -0
  46. package/dist/src/tokens/Datatoken.d.ts +77 -0
  47. package/dist/src/tokens/NFT.d.ts +57 -0
  48. package/dist/src/tokens/index.d.ts +2 -0
  49. package/dist/src/utils/ConfigHelper.d.ts +6 -0
  50. package/dist/src/utils/Constants.d.ts +1 -0
  51. package/dist/src/utils/ContractParams.d.ts +4 -0
  52. package/dist/src/utils/ConversionTypeHelper.d.ts +3 -0
  53. package/dist/{node/utils/Datatokens.d.ts → src/utils/DatatokenName.d.ts} +1 -1
  54. package/dist/src/utils/DdoHelpers.d.ts +2 -0
  55. package/dist/src/utils/FetchHelper.d.ts +5 -0
  56. package/dist/src/utils/GasUtils.d.ts +2 -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/index.d.ts +9 -0
  60. package/dist/test/TestContractHandler.d.ts +44 -0
  61. package/dist/test/integration/ComputeFlow.test.d.ts +1 -0
  62. package/dist/test/integration/Provider.test.d.ts +1 -0
  63. package/dist/test/integration/PublishFlows.test.d.ts +1 -0
  64. package/dist/test/integration/SimplePublishConsumeFlow.test.d.ts +1 -0
  65. package/dist/test/integration/config.d.ts +3 -0
  66. package/dist/test/unit/NftFactory.test.d.ts +1 -0
  67. package/dist/test/unit/config.d.ts +3 -0
  68. package/dist/test/unit/pools/Router.test.d.ts +1 -0
  69. package/dist/test/unit/pools/balancer/Pool.test.d.ts +1 -0
  70. package/dist/test/unit/pools/dispenser/Dispenser.test.d.ts +1 -0
  71. package/dist/test/unit/pools/fixedRate/FixedRateExchange.test.d.ts +1 -0
  72. package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +1 -0
  73. package/dist/test/unit/tokens/Datatoken.test.d.ts +1 -0
  74. package/dist/test/unit/tokens/Nft.test.d.ts +1 -0
  75. package/package.json +34 -27
  76. package/dist/node/Instantiable.abstract.d.ts +0 -25
  77. package/dist/node/balancer/OceanPool.d.ts +0 -95
  78. package/dist/node/balancer/Pool.d.ts +0 -56
  79. package/dist/node/balancer/PoolFactory.d.ts +0 -15
  80. package/dist/node/datatokens/ContractEvent.d.ts +0 -19
  81. package/dist/node/datatokens/ContractHandler.d.ts +0 -12
  82. package/dist/node/datatokens/Datatokens.d.ts +0 -44
  83. package/dist/node/datatokens/EventHandler.d.ts +0 -19
  84. package/dist/node/datatokens/Network.d.ts +0 -5
  85. package/dist/node/datatokens/Web3Provider.d.ts +0 -5
  86. package/dist/node/datatokens/contracts/ContractBase.d.ts +0 -27
  87. package/dist/node/ddo/DDO.d.ts +0 -36
  88. package/dist/node/ddo/interfaces/AdditionalInformation.d.ts +0 -16
  89. package/dist/node/ddo/interfaces/Authentication.d.ts +0 -4
  90. package/dist/node/ddo/interfaces/BestPrice.d.ts +0 -10
  91. package/dist/node/ddo/interfaces/Consumable.d.ts +0 -5
  92. package/dist/node/ddo/interfaces/Credentials.d.ts +0 -9
  93. package/dist/node/ddo/interfaces/Curation.d.ts +0 -6
  94. package/dist/node/ddo/interfaces/DataTokenInfo.d.ts +0 -10
  95. package/dist/node/ddo/interfaces/EditableMetadata.d.ts +0 -9
  96. package/dist/node/ddo/interfaces/EditableMetadataLinks.d.ts +0 -5
  97. package/dist/node/ddo/interfaces/Event.d.ts +0 -7
  98. package/dist/node/ddo/interfaces/File.d.ts +0 -13
  99. package/dist/node/ddo/interfaces/Metadata.d.ts +0 -15
  100. package/dist/node/ddo/interfaces/MetadataAlgorithm.d.ts +0 -12
  101. package/dist/node/ddo/interfaces/MetadataMain.d.ts +0 -12
  102. package/dist/node/ddo/interfaces/Proof.d.ts +0 -6
  103. package/dist/node/ddo/interfaces/PublicKey.d.ts +0 -8
  104. package/dist/node/ddo/interfaces/PurgatoryData.d.ts +0 -4
  105. package/dist/node/ddo/interfaces/Service.d.ts +0 -99
  106. package/dist/node/ddo/interfaces/ServicePrices.d.ts +0 -4
  107. package/dist/node/ddo/interfaces/Status.d.ts +0 -5
  108. package/dist/node/ddo/interfaces/index.d.ts +0 -17
  109. package/dist/node/dispenser/Dispenser.d.ts +0 -44
  110. package/dist/node/exchange/FixedRateExchange.d.ts +0 -59
  111. package/dist/node/index.d.ts +0 -1
  112. package/dist/node/lib.d.ts +0 -15
  113. package/dist/node/lib.js +0 -2
  114. package/dist/node/lib.js.map +0 -1
  115. package/dist/node/lib.module.js +0 -2
  116. package/dist/node/lib.module.js.map +0 -1
  117. package/dist/node/lib.umd.js +0 -2
  118. package/dist/node/lib.umd.js.map +0 -1
  119. package/dist/node/metadatacache/MetadataCache.d.ts +0 -41
  120. package/dist/node/metadatacache/OnChainMetaData.d.ts +0 -31
  121. package/dist/node/ocean/Account.d.ts +0 -16
  122. package/dist/node/ocean/Accounts.d.ts +0 -9
  123. package/dist/node/ocean/Assets.d.ts +0 -56
  124. package/dist/node/ocean/AssetsCredential.d.ts +0 -6
  125. package/dist/node/ocean/Compute.d.ts +0 -75
  126. package/dist/node/ocean/DID.d.ts +0 -8
  127. package/dist/node/ocean/EventAccessControl.d.ts +0 -9
  128. package/dist/node/ocean/Ocean.d.ts +0 -34
  129. package/dist/node/ocean/OceanAuth.d.ts +0 -15
  130. package/dist/node/ocean/Versions.d.ts +0 -25
  131. package/dist/node/ocean/utils/SignatureUtils.d.ts +0 -13
  132. package/dist/node/ocean/utils/Utils.d.ts +0 -8
  133. package/dist/node/ocean/utils/WebServiceConnector.d.ts +0 -16
  134. package/dist/node/provider/Provider.d.ts +0 -56
  135. package/dist/node/utils/AssetResolverHelper.d.ts +0 -8
  136. package/dist/node/utils/ConfigHelper.d.ts +0 -17
  137. package/dist/node/utils/ContractUtils.d.ts +0 -5
  138. package/dist/node/utils/ConversionTypeHelpers.d.ts +0 -8
  139. package/dist/node/utils/GeneratorHelpers.d.ts +0 -1
  140. package/dist/node/utils/PromiseResolver.d.ts +0 -3
  141. package/dist/node/utils/SubscribableObserver.d.ts +0 -12
  142. package/dist/node/utils/SubscribablePromise.d.ts +0 -14
  143. package/dist/node/utils/Timeout.d.ts +0 -1
  144. package/dist/node/utils/index.d.ts +0 -9
@@ -1,95 +0,0 @@
1
- import Web3 from 'web3';
2
- import { AbiItem } from 'web3-utils/types';
3
- import { TransactionReceipt } from 'web3-core';
4
- import { Pool } from './Pool';
5
- import { SubscribablePromise, Logger } from '../utils';
6
- import { ConfigHelperConfig } from '../utils/ConfigHelper';
7
- declare type PoolTransactionType = 'swap' | 'join' | 'exit';
8
- export interface PoolDetails {
9
- poolAddress: string;
10
- tokens: string[];
11
- }
12
- export interface PoolShare {
13
- poolAddress: string;
14
- shares: string;
15
- did: string;
16
- }
17
- export interface TokensReceived {
18
- dtAmount: string;
19
- oceanAmount: string;
20
- }
21
- export interface PoolTransaction {
22
- poolAddress: string;
23
- dtAddress: string;
24
- caller: string;
25
- transactionHash: string;
26
- blockNumber: number;
27
- timestamp: number;
28
- tokenIn?: string;
29
- tokenOut?: string;
30
- tokenAmountIn?: string;
31
- tokenAmountOut?: string;
32
- type: PoolTransactionType;
33
- }
34
- export declare enum PoolCreateProgressStep {
35
- CreatingPool = 0,
36
- ApprovingDatatoken = 1,
37
- ApprovingOcean = 2,
38
- SetupPool = 3
39
- }
40
- export declare class OceanPool extends Pool {
41
- oceanAddress: string;
42
- dtAddress: string;
43
- startBlock: number;
44
- constructor(web3: Web3, logger: Logger, factoryABI?: AbiItem | AbiItem[], poolABI?: AbiItem | AbiItem[], factoryAddress?: string, oceanAddress?: string, config?: ConfigHelperConfig);
45
- create(account: string, dtAddress: string, dtAmount: string, dtWeight: string, oceanAmount: string, fee: string): SubscribablePromise<PoolCreateProgressStep, TransactionReceipt>;
46
- getDTAddress(poolAddress: string): Promise<string>;
47
- getOceanReserve(poolAddress: string): Promise<string>;
48
- getDTReserve(poolAddress: string): Promise<string>;
49
- getMaxBuyQuantity(poolAddress: string, tokenAddress: string): Promise<string>;
50
- getOceanMaxBuyQuantity(poolAddress: string): Promise<string>;
51
- getDTMaxBuyQuantity(poolAddress: string): Promise<string>;
52
- calcInGivenOut(poolAddress: string, tokenInAddress: string, tokenOutAddress: string, tokenOutAmount: string): Promise<string>;
53
- calcOutGivenIn(poolAddress: string, tokenInAddress: string, tokenOutAddress: string, tokenInAmount: string): Promise<string>;
54
- calcPoolOutGivenSingleIn(poolAddress: string, tokenInAddress: string, tokenInAmount: string): Promise<string>;
55
- calcSingleInGivenPoolOut(poolAddress: string, tokenInAddress: string, poolShares: string): Promise<string>;
56
- calcSingleOutGivenPoolIn(poolAddress: string, tokenOutAddress: string, poolShares: string): Promise<string>;
57
- calcPoolInGivenSingleOut(poolAddress: string, tokenOutAddress: string, tokenOutAmount: string): Promise<string>;
58
- getPoolSharesRequiredToRemoveDT(poolAddress: string, dtAmount: string): Promise<string>;
59
- getDTRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<string>;
60
- getPoolSharesRequiredToRemoveOcean(poolAddress: string, oceanAmount: string): Promise<string>;
61
- getOceanRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<string>;
62
- getTokensRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<TokensReceived>;
63
- getDTMaxAddLiquidity(poolAddress: string): Promise<string>;
64
- getOceanMaxAddLiquidity(poolAddress: string): Promise<string>;
65
- getMaxAddLiquidity(poolAddress: string, tokenAddress: string): Promise<string>;
66
- getMaxRemoveLiquidity(poolAddress: string, tokenAddress: string): Promise<string>;
67
- getDTMaxRemoveLiquidity(poolAddress: string): Promise<string>;
68
- getOceanMaxRemoveLiquidity(poolAddress: string): Promise<string>;
69
- buyDT(account: string, poolAddress: string, dtAmountWanted: string, maxOceanAmount: string, maxPrice?: string): Promise<TransactionReceipt>;
70
- buyDTWithExactOcean(account: string, poolAddress: string, minimumdtAmountWanted: string, oceanAmount: string, maxPrice?: string): Promise<TransactionReceipt>;
71
- sellDT(account: string, poolAddress: string, dtAmount: string, oceanAmountWanted: string, maxPrice?: string): Promise<TransactionReceipt>;
72
- addDTLiquidity(account: string, poolAddress: string, amount: string): Promise<TransactionReceipt>;
73
- removeDTLiquidity(account: string, poolAddress: string, amount: string, maximumPoolShares: string): Promise<TransactionReceipt>;
74
- addOceanLiquidity(account: string, poolAddress: string, amount: string): Promise<TransactionReceipt>;
75
- removeOceanLiquidityWithMinimum(account: string, poolAddress: string, poolShares: string, minOcean: string): Promise<TransactionReceipt>;
76
- removeOceanLiquidity(account: string, poolAddress: string, amount: string, maximumPoolShares: string): Promise<TransactionReceipt>;
77
- removePoolLiquidity(account: string, poolAddress: string, poolShares: string, minDT?: string, minOcean?: string): Promise<TransactionReceipt>;
78
- getDTPrice(poolAddress: string): Promise<string>;
79
- searchPoolforDT(dtAddress: string): Promise<string[]>;
80
- getOceanNeeded(poolAddress: string, dtRequired: string): Promise<string>;
81
- getOceanReceived(poolAddress: string, dtAmount: string): Promise<string>;
82
- getDTReceived(poolAddress: string, oceanAmount: string): Promise<string>;
83
- getDTNeeded(poolAddress: string, OceanRequired: string): Promise<string>;
84
- getPoolsbyCreator(account?: string): Promise<PoolDetails[]>;
85
- private getResult;
86
- getPoolSharesByAddress(account: string): Promise<PoolShare[]>;
87
- getPoolDetails(poolAddress: string): Promise<PoolDetails>;
88
- getPoolLogs(poolAddress: string, startBlock?: number, account?: string): Promise<PoolTransaction[]>;
89
- getAllPoolLogs(account: string): Promise<PoolTransaction[]>;
90
- private getEventData;
91
- private computeSlippage;
92
- computeBuySlippage(poolAddress: string, oceanAmount: string): Promise<string>;
93
- computeSellSlippage(poolAddress: string, dtAmount: string): Promise<string>;
94
- }
95
- export {};
@@ -1,56 +0,0 @@
1
- import Web3 from 'web3';
2
- import { AbiItem } from 'web3-utils/types';
3
- import { TransactionReceipt } from 'web3-core';
4
- import { Logger } from '../utils';
5
- import { PoolFactory } from './PoolFactory';
6
- import { ConfigHelperConfig } from '../utils/ConfigHelper';
7
- export interface TokensToAdd {
8
- address: string;
9
- amount: string;
10
- weight: string;
11
- }
12
- export declare class Pool extends PoolFactory {
13
- poolABI: AbiItem | AbiItem[];
14
- constructor(web3: Web3, logger: Logger, factoryABI?: AbiItem | AbiItem[], poolABI?: AbiItem | AbiItem[], factoryAddress?: string, config?: ConfigHelperConfig);
15
- createPool(account: string): Promise<TransactionReceipt>;
16
- setup(account: string, poolAddress: string, dataToken: string, dataTokenAmount: string, dataTokenWeight: string, baseToken: string, baseTokenAmount: string, baseTokenWeight: string, swapFee: string): Promise<string>;
17
- allowance(tokenAdress: string, owner: string, spender: string): Promise<string>;
18
- approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
19
- sharesBalance(account: string, poolAddress: string): Promise<string>;
20
- addToPool(account: string, poolAddress: string, tokens: TokensToAdd[]): Promise<void>;
21
- setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
22
- finalize(account: string, poolAddress: string): Promise<TransactionReceipt>;
23
- getNumTokens(poolAddress: string): Promise<string>;
24
- getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
25
- getCurrentTokens(poolAddress: string): Promise<string[]>;
26
- getFinalTokens(poolAddress: string): Promise<string[]>;
27
- getController(poolAddress: string): Promise<string>;
28
- setController(account: string, poolAddress: string, controllerAddress: string): Promise<string>;
29
- isBound(poolAddress: string, token: string): Promise<boolean>;
30
- getReserve(poolAddress: string, token: string): Promise<string>;
31
- isFinalized(poolAddress: string): Promise<boolean>;
32
- getSwapFee(poolAddress: string): Promise<string>;
33
- getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
34
- getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
35
- getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
36
- swapExactAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, tokenOut: string, minAmountOut: string, maxPrice?: string): Promise<TransactionReceipt>;
37
- swapExactAmountOut(account: string, poolAddress: string, tokenIn: string, maxAmountIn: string, tokenOut: string, minAmountOut: string, maxPrice?: string): Promise<TransactionReceipt>;
38
- joinPool(account: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[]): Promise<TransactionReceipt>;
39
- exitPool(account: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[]): Promise<TransactionReceipt>;
40
- joinswapExternAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
41
- joinswapPoolAmountOut(account: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string): Promise<TransactionReceipt>;
42
- exitswapPoolAmountIn(account: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
43
- exitswapExternAmountOut(account: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string): Promise<TransactionReceipt>;
44
- getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string): Promise<string>;
45
- getSpotPriceSansFee(poolAddress: string, tokenIn: string, tokenOut: string): Promise<string>;
46
- calcSpotPrice(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, tokenBalanceOut: string, tokenWeightOut: string, swapFee: string): Promise<string>;
47
- calcInGivenOut(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, tokenBalanceOut: string, tokenWeightOut: string, tokenAmountOut: string, swapFee: string): Promise<string>;
48
- calcOutGivenIn(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, tokenBalanceOut: string, tokenWeightOut: string, tokenAmountIn: string, swapFee: string): Promise<string>;
49
- calcPoolOutGivenSingleIn(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, poolSupply: string, totalWeight: string, tokenAmountIn: string, swapFee: string): Promise<string>;
50
- calcSingleInGivenPoolOut(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, poolSupply: string, totalWeight: string, poolAmountOut: string, swapFee: string): Promise<string>;
51
- calcSingleOutGivenPoolIn(poolAddress: string, tokenBalanceOut: string, tokenWeightOut: string, poolSupply: string, totalWeight: string, poolAmountIn: string, swapFee: string): Promise<string>;
52
- calcPoolInGivenSingleOut(poolAddress: string, tokenBalanceOut: string, tokenWeightOut: string, poolSupply: string, totalWeight: string, tokenAmountOut: string, swapFee: string): Promise<string>;
53
- getSwapEventSignature(): string;
54
- getJoinEventSignature(): string;
55
- getExitEventSignature(): string;
56
- }
@@ -1,15 +0,0 @@
1
- import Web3 from 'web3';
2
- import { AbiItem } from 'web3-utils/types';
3
- import { Logger } from '../utils';
4
- import { TransactionReceipt } from 'web3-core';
5
- import { ConfigHelperConfig } from '../utils/ConfigHelper';
6
- export declare class PoolFactory {
7
- GASLIMIT_DEFAULT: number;
8
- web3: Web3;
9
- factoryABI: AbiItem | AbiItem[];
10
- factoryAddress: string;
11
- logger: Logger;
12
- config: ConfigHelperConfig;
13
- constructor(web3: Web3, logger: Logger, factoryABI?: AbiItem | AbiItem[], factoryAddress?: string, config?: ConfigHelperConfig);
14
- createPool(account: string): Promise<TransactionReceipt>;
15
- }
@@ -1,19 +0,0 @@
1
- import { EventData, Filter } from 'web3-eth-contract';
2
- import ContractBase from './contracts/ContractBase';
3
- interface EventEmitter {
4
- subscribe: (onEvent: (blockNumber: number) => void) => void;
5
- unsubscribe: (onEvent: (blockNumber: number) => void) => void;
6
- }
7
- export interface ContractEventSubscription {
8
- unsubscribe: () => void;
9
- }
10
- export declare class ContractEvent {
11
- private eventEmitter;
12
- private contract;
13
- private eventName;
14
- private filter;
15
- constructor(eventEmitter: EventEmitter, contract: ContractBase, eventName: string, filter: Filter);
16
- subscribe(callback: (events: EventData[]) => void): ContractEventSubscription;
17
- once(callback?: (events: EventData[]) => void): Promise<any[]>;
18
- }
19
- export {};
@@ -1,12 +0,0 @@
1
- import { Contract } from 'web3-eth-contract';
2
- import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
3
- export default class ContractHandler extends Instantiable {
4
- protected static getContract(what: string, networkId: number): Contract;
5
- protected static setContract(what: string, networkId: number, contractInstance: Contract): void;
6
- protected static hasContract(what: string, networkId: number): boolean;
7
- private static contracts;
8
- private static getHash;
9
- constructor(config: InstantiableConfig);
10
- get(what: string, optional?: boolean): Promise<Contract>;
11
- private load;
12
- }
@@ -1,44 +0,0 @@
1
- import Web3 from 'web3';
2
- import { AbiItem } from 'web3-utils/types';
3
- import { ConfigHelperConfig } from '../utils/ConfigHelper';
4
- import { Logger } from '../utils';
5
- import { TransactionReceipt } from 'web3-core';
6
- export declare class DataTokens {
7
- GASLIMIT_DEFAULT: number;
8
- factoryAddress: string;
9
- factoryABI: AbiItem | AbiItem[];
10
- datatokensABI: AbiItem | AbiItem[];
11
- web3: Web3;
12
- private logger;
13
- startBlock: number;
14
- private config;
15
- constructor(factoryAddress: string, factoryABI: AbiItem | AbiItem[], datatokensABI: AbiItem | AbiItem[], web3: Web3, logger: Logger, config?: ConfigHelperConfig);
16
- generateDtName(wordList?: {
17
- nouns: string[];
18
- adjectives: string[];
19
- }): {
20
- name: string;
21
- symbol: string;
22
- };
23
- create(metadataCacheUri: string, address: string, cap?: string, name?: string, symbol?: string): Promise<string>;
24
- approve(dataTokenAddress: string, spender: string, amount: string, address: string): Promise<TransactionReceipt>;
25
- mint(dataTokenAddress: string, address: string, amount: string, toAddress?: string): Promise<TransactionReceipt>;
26
- transfer(dataTokenAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
27
- transferToken(dataTokenAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
28
- transferWei(dataTokenAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
29
- transferFrom(dataTokenAddress: string, fromAddress: string, amount: string, address: string): Promise<string>;
30
- balance(dataTokenAddress: string, address: string): Promise<string>;
31
- allowance(dataTokenAddress: string, owner: string, spender: string): Promise<string>;
32
- getBlob(dataTokenAddress: string): Promise<string>;
33
- getName(dataTokenAddress: string): Promise<string>;
34
- getSymbol(dataTokenAddress: string): Promise<string>;
35
- getCap(dataTokenAddress: string): Promise<string>;
36
- toWei(amount: string): string;
37
- fromWei(amount: string): string;
38
- startOrder(dataTokenAddress: string, consumer: string, amount: string, serviceId: number, mpFeeAddress: string, address: string): Promise<TransactionReceipt>;
39
- getPreviousValidOrders(dataTokenAddress: string, amount: string, serviceId: number, timeout: number, address: string): Promise<string>;
40
- getStartOrderEventSignature(): string;
41
- proposeMinter(dataTokenAddress: string, newMinterAddress: string, address: string): Promise<TransactionReceipt>;
42
- approveMinter(dataTokenAddress: string, address: string): Promise<TransactionReceipt>;
43
- isMinter(dataTokenAddress: string, address: string): Promise<boolean>;
44
- }
@@ -1,19 +0,0 @@
1
- import { ContractEvent } from './ContractEvent';
2
- import ContractBase from './contracts/ContractBase';
3
- import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
4
- import { Filter } from 'web3-eth-contract';
5
- export declare class EventHandler extends Instantiable {
6
- get count(): number;
7
- private events;
8
- private lastBlock;
9
- private interval;
10
- private polling;
11
- private lastTimeout;
12
- constructor(config: InstantiableConfig);
13
- subscribe(callback: (blockNumber: number) => void): {
14
- unsubscribe: () => void;
15
- };
16
- unsubscribe(callback: (blockNumber: number) => void): void;
17
- getEvent(contract: ContractBase, eventName: string, filter: Filter): ContractEvent;
18
- private checkBlock;
19
- }
@@ -1,5 +0,0 @@
1
- import { Instantiable } from '../Instantiable.abstract';
2
- export declare class Network extends Instantiable {
3
- getNetworkId(): Promise<number>;
4
- getNetworkName(): Promise<string>;
5
- }
@@ -1,5 +0,0 @@
1
- import Web3 from 'web3';
2
- import Config from '../models/Config';
3
- export default class Web3Provider {
4
- static getWeb3(config?: Partial<Config>): Web3;
5
- }
@@ -1,27 +0,0 @@
1
- import { EventData, EventOptions, Filter } from 'web3-eth-contract';
2
- import { TransactionReceipt } from 'web3-core';
3
- import { Instantiable, InstantiableConfig } from '../../Instantiable.abstract';
4
- export interface EventDataOptions extends EventOptions {
5
- fromBlock: string | number;
6
- toBlock: string | number;
7
- }
8
- export declare abstract class ContractBase extends Instantiable {
9
- private optional;
10
- protected static instance: any;
11
- contractName: string;
12
- private contract;
13
- get address(): string;
14
- constructor(contractName: string, optional?: boolean);
15
- getEventData(eventName: string, options: EventDataOptions): Promise<EventData[]>;
16
- getPastEvents(eventName: string, filter: Filter): Promise<EventData[]>;
17
- getAddress(): string;
18
- getSignatureOfMethod(methodName: string): string;
19
- getInputsOfMethod(methodName: string): any[];
20
- protected init(config: InstantiableConfig): Promise<void>;
21
- protected getFromAddress(from?: string): Promise<string>;
22
- protected sendFrom(name: string, args: any[], from?: string): Promise<TransactionReceipt>;
23
- protected send(name: string, from: string, args: any[]): Promise<TransactionReceipt>;
24
- protected call<T extends any>(name: string, args: any[], from?: string): Promise<T>;
25
- private searchMethod;
26
- }
27
- export default ContractBase;
@@ -1,36 +0,0 @@
1
- import { Ocean } from '../ocean/Ocean';
2
- import { Authentication } from './interfaces/Authentication';
3
- import { Proof } from './interfaces/Proof';
4
- import { PublicKey } from './interfaces/PublicKey';
5
- import { Service, ServiceType } from './interfaces/Service';
6
- import { BestPrice } from './interfaces/BestPrice';
7
- import { DataTokenInfo } from './interfaces/DataTokenInfo';
8
- import { PurgatoryData } from './interfaces/PurgatoryData';
9
- import { Credentials } from './interfaces/Credentials';
10
- import { Event } from './interfaces/Event';
11
- export declare class DDO {
12
- static serialize(ddo: DDO): string;
13
- static deserialize(ddoString: string): DDO;
14
- '@context': string;
15
- id: string;
16
- created: string;
17
- updated: string;
18
- dataToken: string;
19
- publicKey: PublicKey[];
20
- authentication: Authentication[];
21
- service: Service[];
22
- proof: Proof;
23
- price: BestPrice;
24
- isInPurgatory: 'false' | 'true';
25
- purgatoryData?: PurgatoryData;
26
- dataTokenInfo?: DataTokenInfo;
27
- credentials?: Credentials;
28
- chainId?: number;
29
- event?: Event;
30
- constructor(ddo?: Partial<DDO>);
31
- shortId(): string;
32
- findServiceById<T extends ServiceType>(index: number): Service<T>;
33
- findServiceByType<T extends ServiceType>(serviceType: T): Service<T>;
34
- getChecksum(): string;
35
- addProof(ocean: Ocean, publicKey: string, password?: string): Promise<void>;
36
- }
@@ -1,16 +0,0 @@
1
- export interface AdditionalInformation {
2
- description?: string;
3
- copyrightHolder?: string;
4
- workExample?: string;
5
- links?: {
6
- [name: string]: string;
7
- }[];
8
- inLanguage?: string;
9
- categories?: string[];
10
- tags?: string[];
11
- updateFrequency?: string;
12
- structuredMarkup?: {
13
- uri: string;
14
- mediaType: string;
15
- }[];
16
- }
@@ -1,4 +0,0 @@
1
- export interface Authentication {
2
- type: string;
3
- publicKey: string;
4
- }
@@ -1,10 +0,0 @@
1
- export interface BestPrice {
2
- type: 'pool' | 'exchange' | 'free' | '';
3
- address: string;
4
- value: number;
5
- isConsumable?: 'true' | 'false' | '';
6
- ocean?: number;
7
- datatoken?: number;
8
- exchange_id?: string;
9
- pools: string[];
10
- }
@@ -1,5 +0,0 @@
1
- export interface Consumable {
2
- status: number;
3
- message: string;
4
- result: boolean;
5
- }
@@ -1,9 +0,0 @@
1
- export declare type CredentialAction = 'allow' | 'deny';
2
- export interface Credential {
3
- type: string;
4
- values: string[];
5
- }
6
- export interface Credentials {
7
- allow?: Credential[];
8
- deny?: Credential[];
9
- }
@@ -1,6 +0,0 @@
1
- export interface Curation {
2
- rating: number;
3
- numVotes: number;
4
- schema?: string;
5
- isListed?: boolean;
6
- }
@@ -1,10 +0,0 @@
1
- export interface DataTokenInfo {
2
- address: string;
3
- name: string;
4
- symbol: string;
5
- decimals?: number;
6
- totalSupply?: number;
7
- cap?: number;
8
- minter?: string;
9
- minterBalance?: number;
10
- }
@@ -1,9 +0,0 @@
1
- import { EditableMetadataLinks } from './EditableMetadataLinks';
2
- import { Status } from './Status';
3
- export interface EditableMetadata {
4
- description?: string;
5
- author?: string;
6
- title?: string;
7
- links?: EditableMetadataLinks[];
8
- status?: Status;
9
- }
@@ -1,5 +0,0 @@
1
- export interface EditableMetadataLinks {
2
- name: string;
3
- url: string;
4
- type: string;
5
- }
@@ -1,7 +0,0 @@
1
- export interface Event {
2
- blockNo: number;
3
- contract: string;
4
- from: string;
5
- txid: string;
6
- update: boolean;
7
- }
@@ -1,13 +0,0 @@
1
- export interface File {
2
- name?: string;
3
- url?: string;
4
- index?: number;
5
- contentType: string;
6
- checksum?: string;
7
- checksumType?: string;
8
- contentLength?: string;
9
- resourceId?: string;
10
- encoding?: string;
11
- compression?: string;
12
- valid?: boolean;
13
- }
@@ -1,15 +0,0 @@
1
- import { MetadataMain } from './MetadataMain';
2
- import { AdditionalInformation } from './AdditionalInformation';
3
- import { Curation } from './Curation';
4
- import { Status } from './Status';
5
- export interface Metadata {
6
- main: MetadataMain;
7
- encryptedFiles?: string;
8
- additionalInformation?: AdditionalInformation;
9
- curation?: Curation;
10
- status?: Status;
11
- }
12
- export interface ValidateMetadata {
13
- valid: Boolean;
14
- errors?: Object;
15
- }
@@ -1,12 +0,0 @@
1
- export interface MetadataAlgorithm {
2
- url?: string;
3
- rawcode?: string;
4
- language?: string;
5
- format?: string;
6
- version?: string;
7
- container: {
8
- entrypoint: string;
9
- image: string;
10
- tag: string;
11
- };
12
- }
@@ -1,12 +0,0 @@
1
- import { MetadataAlgorithm } from './MetadataAlgorithm';
2
- import { File } from './File';
3
- export interface MetadataMain {
4
- name: string;
5
- type: 'dataset' | 'algorithm';
6
- dateCreated: string;
7
- datePublished?: string;
8
- author: string;
9
- license: string;
10
- files: File[];
11
- algorithm?: MetadataAlgorithm;
12
- }
@@ -1,6 +0,0 @@
1
- export interface Proof {
2
- type: string;
3
- created: string;
4
- creator: string;
5
- signatureValue: string;
6
- }
@@ -1,8 +0,0 @@
1
- export interface PublicKey {
2
- id: string;
3
- type: 'Ed25519VerificationKey2018' | 'RsaVerificationKey2018' | 'EdDsaSAPublicKeySecp256k1' | 'EthereumECDSAKey';
4
- owner: string;
5
- publicKeyPem?: string;
6
- publicKeyBase58?: string;
7
- publicKeyHex?: string;
8
- }
@@ -1,4 +0,0 @@
1
- export interface PurgatoryData {
2
- did: string;
3
- reason: string;
4
- }
@@ -1,99 +0,0 @@
1
- import { Metadata } from './Metadata';
2
- import { Status } from './Status';
3
- export interface ServiceCustomParameter {
4
- name: string;
5
- type: string;
6
- label: string;
7
- required: boolean;
8
- options?: any;
9
- description: string;
10
- }
11
- export interface ServiceCustomParametersRequired {
12
- userCustomParameters?: ServiceCustomParameter[];
13
- algoCustomParameters?: ServiceCustomParameter[];
14
- }
15
- export declare type ServiceType = 'authorization' | 'metadata' | 'access' | 'compute';
16
- export interface ServiceCommonAttributes extends ServiceCustomParametersRequired {
17
- main: {
18
- [key: string]: any;
19
- };
20
- additionalInformation?: {
21
- [key: string]: any;
22
- };
23
- status?: Status;
24
- }
25
- export interface ServiceCommon {
26
- type: ServiceType;
27
- index: number;
28
- serviceEndpoint?: string;
29
- attributes: ServiceCommonAttributes;
30
- }
31
- export interface ServiceAccessAttributes extends ServiceCommonAttributes {
32
- main: {
33
- creator: string;
34
- name: string;
35
- datePublished: string;
36
- cost: string;
37
- timeout: number;
38
- };
39
- }
40
- export interface publisherTrustedAlgorithm {
41
- did: string;
42
- filesChecksum: string;
43
- containerSectionChecksum: string;
44
- }
45
- export interface ServiceComputePrivacy {
46
- allowRawAlgorithm?: boolean;
47
- allowNetworkAccess?: boolean;
48
- allowAllPublishedAlgorithms?: boolean;
49
- publisherTrustedAlgorithms?: publisherTrustedAlgorithm[];
50
- }
51
- export interface ServiceComputeProvider {
52
- type: string;
53
- description: string;
54
- environment: {
55
- cluster: {
56
- type: string;
57
- url: string;
58
- };
59
- supportedContainers: {
60
- image: string;
61
- tag: string;
62
- checksum: string;
63
- }[];
64
- supportedServers: {
65
- serverId: string;
66
- serverType: string;
67
- cost: string;
68
- cpu: string;
69
- gpu: string;
70
- memory: string;
71
- disk: string;
72
- maxExecutionTime: number;
73
- }[];
74
- };
75
- }
76
- export interface ServiceComputeAttributes extends ServiceCommonAttributes {
77
- main: {
78
- creator: string;
79
- datePublished: string;
80
- cost: string;
81
- timeout: number;
82
- provider?: ServiceComputeProvider;
83
- name: string;
84
- privacy?: ServiceComputePrivacy;
85
- };
86
- }
87
- export interface ServiceMetadata extends ServiceCommon {
88
- type: 'metadata';
89
- attributes: Metadata;
90
- }
91
- export interface ServiceAccess extends ServiceCommon {
92
- type: 'access';
93
- attributes: ServiceAccessAttributes;
94
- }
95
- export interface ServiceCompute extends ServiceCommon {
96
- type: 'compute';
97
- attributes: ServiceComputeAttributes;
98
- }
99
- export declare type Service<T extends ServiceType | 'default' = 'default'> = T extends 'metadata' ? ServiceMetadata : T extends 'access' ? ServiceAccess : T extends 'compute' ? ServiceCompute : T extends 'default' ? ServiceCommon : ServiceCommon;
@@ -1,4 +0,0 @@
1
- export interface ServicePrices {
2
- serviceIndex: number;
3
- cost: string;
4
- }
@@ -1,5 +0,0 @@
1
- export interface Status {
2
- isListed?: boolean;
3
- isRetired?: boolean;
4
- isOrderDisabled?: boolean;
5
- }