@oceanprotocol/lib 4.3.3 → 5.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.
@@ -1,3 +1,3 @@
1
- import { BigNumber, providers } from 'ethers';
2
- export type ReceiptOrEstimate<G extends boolean = false> = G extends false ? providers.TransactionResponse : BigNumber;
3
- export type ReceiptOrDecimal<G extends boolean = false> = G extends false ? providers.TransactionResponse : number;
1
+ import { BigNumberish, TransactionResponse } from 'ethers';
2
+ export type ReceiptOrEstimate<G extends boolean = false> = G extends false ? TransactionResponse : BigNumberish;
3
+ export type ReceiptOrDecimal<G extends boolean = false> = G extends false ? TransactionResponse : number;
@@ -1,4 +1,4 @@
1
- import { BigNumber, Signer } from 'ethers';
1
+ import { BigNumberish, Signer } from 'ethers';
2
2
  import { Config } from '../config/index.js';
3
3
  import { AbiItem, ReceiptOrEstimate } from '../@types/index.js';
4
4
  import { SmartContractWithAddress } from './SmartContractWithAddress.js';
@@ -27,7 +27,7 @@ export declare class AccesslistFactory extends SmartContractWithAddress {
27
27
  * @param {Boolean} [estimateGas] if True, return gas estimate
28
28
  * @return {Promise<string|BigNumber>} The transaction hash or the gas estimate.
29
29
  */
30
- deployAccessListContract<G extends boolean = false>(nameAccessList: string, symbolAccessList: string, tokenURI: string[], transferable: boolean, owner: string, user: string[], estimateGas?: G): Promise<G extends false ? string : BigNumber>;
30
+ deployAccessListContract<G extends boolean = false>(nameAccessList: string, symbolAccessList: string, tokenURI: string[], transferable: boolean, owner: string, user: string[], estimateGas?: G): Promise<G extends false ? string : BigNumberish>;
31
31
  /**
32
32
  * Get Factory Owner
33
33
  * @return {Promise<string>} Factory Owner address
@@ -1,11 +1,11 @@
1
1
  import { Datatoken } from './Datatoken.js';
2
- import { Bytes, Signer } from 'ethers';
2
+ import { Signer } from 'ethers';
3
3
  import { AbiItem, ReceiptOrEstimate } from '../@types/index.js';
4
4
  import { AccessListContract } from './AccessList.js';
5
5
  import { Config } from '../config/index.js';
6
6
  export declare class Datatoken4 extends Datatoken {
7
7
  accessList: AccessListContract;
8
- fileObject: Bytes;
8
+ fileObject: Uint8Array;
9
9
  getDefaultAbi(): AbiItem[];
10
10
  /**
11
11
  * Instantiate Datatoken class
@@ -14,8 +14,8 @@ export declare class Datatoken4 extends Datatoken {
14
14
  * @param {Config} [config] The configuration object.
15
15
  * @param {AbiItem[]} [abi] ABI array of the smart contract
16
16
  */
17
- constructor(signer: Signer, fileObject: Bytes, network?: string | number, config?: Config, abi?: AbiItem[]);
18
- setFileObj(fileObj: Bytes): void;
17
+ constructor(signer: Signer, fileObject: Uint8Array, network?: string | number, config?: Config, abi?: AbiItem[]);
18
+ setFileObj(fileObj: Uint8Array): void;
19
19
  /**
20
20
  * getAllowListContract - It returns the current allowList contract address
21
21
  * @param dtAddress datatoken address
@@ -68,5 +68,5 @@ export declare class Datatoken4 extends Datatoken {
68
68
  * @param {String} consumerAddress
69
69
  * @return {Promise<Bytes>} returns file object
70
70
  */
71
- getFileObject(dtAddress: string, serviceIndex: number, providerAddress: string, providerSignature: Bytes, consumerData: Bytes, consumerSignature: Bytes, consumerAddress: string): Promise<Bytes>;
71
+ getFileObject(dtAddress: string, serviceIndex: number, providerAddress: string, providerSignature: Uint8Array, consumerData: Uint8Array, consumerSignature: Uint8Array, consumerAddress: string): Promise<Uint8Array>;
72
72
  }
@@ -25,6 +25,11 @@ export declare class EscrowContract extends SmartContractWithAddress {
25
25
  * @return {Promise<any>} User funds
26
26
  */
27
27
  getUserFunds(payer: string, token: string): Promise<any>;
28
+ /**
29
+ * Get User Tokens
30
+ * @return {Promise<any>} Array of tokens
31
+ */
32
+ getUserTokens(payer: string): Promise<any>;
28
33
  /**
29
34
  * Get Locks
30
35
  * @return {Promise<[]>} Locks
@@ -1,4 +1,3 @@
1
- import { BigNumber } from 'ethers';
2
1
  import { MetadataAndTokenURI, NftRoles, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
3
2
  import { SmartContract } from './SmartContract.js';
4
3
  import { MetadataProof } from '@oceanprotocol/ddo-js';
@@ -20,7 +19,7 @@ export declare class Nft extends SmartContract {
20
19
  * @param {Boolean} estimateGas if True, return gas estimate
21
20
  * @return {Promise<string>} ERC20 Datatoken address
22
21
  */
23
- createDatatoken<G extends boolean = false>(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, filesObject?: string, accessListContract?: string, allowAccessList?: string, denyAccessList?: string, estimateGas?: G): Promise<G extends false ? string : BigNumber>;
22
+ createDatatoken<G extends boolean = false>(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, filesObject?: string, accessListContract?: string, allowAccessList?: string, denyAccessList?: string, estimateGas?: G): Promise<G extends false ? string : BigInt>;
24
23
  /**
25
24
  * Add Manager for NFT Contract (only NFT Owner can succeed)
26
25
  * @param {String} nftAddress NFT contract address
@@ -1,4 +1,3 @@
1
- import { BigNumber } from 'ethers';
2
1
  import { AbiItem, FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types/index.js';
3
2
  import { SmartContractWithAddress } from './SmartContractWithAddress.js';
4
3
  /**
@@ -12,7 +11,7 @@ export declare class NftFactory extends SmartContractWithAddress {
12
11
  * @param {Boolean} [estimateGas] if True, return gas estimate
13
12
  * @return {Promise<string|BigNumber>} The transaction hash or the gas estimate.
14
13
  */
15
- createNFT<G extends boolean = false>(nftData: NftCreateData, estimateGas?: G): Promise<G extends false ? string : BigNumber>;
14
+ createNFT<G extends boolean = false>(nftData: NftCreateData, estimateGas?: G): Promise<G extends false ? string : bigint>;
16
15
  /**
17
16
  * Get Current NFT Count (NFT created)
18
17
  * @return {Promise<number>} Number of NFT created from this factory
@@ -159,7 +159,7 @@ export declare class Provider {
159
159
  * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
160
160
  */
161
161
  computeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, maxJobDuration: number, token: string, resources: ComputeResourceRequest[], chainId: number, // network used by payment (only for payed compute jobs)
162
- metadata?: ComputeJobMetadata, output?: ComputeOutput, policyServer?: any, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
162
+ metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
163
163
  /** Instruct the provider to start a FREE compute job (new C2D V2)
164
164
  * @param {string} providerUri The provider URI.
165
165
  * @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
@@ -173,7 +173,7 @@ export declare class Provider {
173
173
  * @param {AbortSignal} signal abort signal
174
174
  * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
175
175
  */
176
- freeComputeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, output?: ComputeOutput, policyServer?: any, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
176
+ freeComputeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
177
177
  /**
178
178
  *
179
179
  * @param providerUri provider URL
@@ -1,4 +1,4 @@
1
- import { Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers';
1
+ import { Signer, Contract, TransactionResponse, BaseContractMethod, EventLog, TransactionReceipt } from 'ethers';
2
2
  import { Config } from '../config/index.js';
3
3
  export declare function setContractDefaults(contract: Contract, config: Config): Contract;
4
4
  /**
@@ -33,7 +33,7 @@ export declare function unitsToAmount(signer: Signer, token: string, amount: str
33
33
  * @returns {Promise<string>} - The converted amount in units
34
34
  */
35
35
  export declare function amountToUnits(signer: Signer, token: string, amount: string, tokenDecimals?: number): Promise<string>;
36
- export declare function getEventFromTx(txReceipt: any, eventName: any): any;
36
+ export declare function getEventFromTx(txReceipt: TransactionReceipt, eventName: string): EventLog | undefined;
37
37
  /**
38
38
  * Send the transation on chain
39
39
  * @param {BigNumber} estGas estimated gas for the transaction
@@ -43,4 +43,4 @@ export declare function getEventFromTx(txReceipt: any, eventName: any): any;
43
43
  * @param {...any[]} args arguments of the function
44
44
  * @return {Promise<any>} transaction receipt
45
45
  */
46
- export declare function sendTx(estGas: BigNumber, signer: Signer, gasFeeMultiplier: number, functionToSend: ContractFunction, ...args: any[]): Promise<providers.TransactionResponse>;
46
+ export declare function sendTx(estGas: bigint, signer: Signer, gasFeeMultiplier: number, functionToSend: BaseContractMethod, ...args: any[]): Promise<TransactionResponse>;
@@ -21,4 +21,4 @@ import { Asset } from '@oceanprotocol/ddo-js';
21
21
  * @returns {Promise<void>} - A promise that resolves when the asset order process is completed.
22
22
  * @throws {Error} If the pricing schema is not supported or if required indexes are invalid.
23
23
  */
24
- export declare function orderAsset(asset: Asset, consumerAccount: Signer, config: Config, datatoken: Datatoken, providerUrl?: string, consumerAddress?: string, consumeMarketOrderFee?: ConsumeMarketFee, providerFees?: ProviderFees, consumeMarketFixedSwapFee?: string, datatokenIndex?: number, serviceIndex?: number, fixedRateIndex?: number): Promise<import("@ethersproject/abstract-provider").TransactionResponse>;
24
+ export declare function orderAsset(asset: Asset, consumerAccount: Signer, config: Config, datatoken: Datatoken, providerUrl?: string, consumerAddress?: string, consumeMarketOrderFee?: ConsumeMarketFee, providerFees?: ProviderFees, consumeMarketFixedSwapFee?: string, datatokenIndex?: number, serviceIndex?: number, fixedRateIndex?: number): Promise<import("ethers").TransactionResponse>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "4.3.3",
4
+ "version": "5.0.0-next.2",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.cjs",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -57,15 +57,16 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@oasisprotocol/sapphire-paratime": "^1.3.2",
60
- "@oceanprotocol/contracts": "^2.3.0",
60
+ "@oceanprotocol/contracts": "^2.4.0",
61
61
  "@oceanprotocol/ddo-js": "^0.1.2",
62
62
  "@rdfjs/dataset": "^2.0.2",
63
63
  "@rdfjs/formats-common": "^3.1.0",
64
64
  "@zazuko/env-node": "^2.1.4",
65
+ "bignumber.js": "^9.3.1",
65
66
  "cross-fetch": "^4.0.0",
66
67
  "crypto-js": "^4.1.1",
67
68
  "decimal.js": "^10.4.1",
68
- "ethers": "^5.7.2",
69
+ "ethers": "^6.15.0",
69
70
  "form-data": "^2.3.3",
70
71
  "jsonwebtoken": "^9.0.2"
71
72
  },
@@ -77,7 +78,7 @@
77
78
  "@types/crypto-js": "^4.1.1",
78
79
  "@types/jsonwebtoken": "^9.0.10",
79
80
  "@types/mocha": "^10.0.10",
80
- "@types/node": "^18.0.1",
81
+ "@types/node": "^22.15.29",
81
82
  "@types/node-fetch": "^3.0.3",
82
83
  "@typescript-eslint/eslint-plugin": "^6.4.1",
83
84
  "@typescript-eslint/parser": "^6.4.1",
@@ -91,8 +92,8 @@
91
92
  "eslint-config-prettier": "^10.1.5",
92
93
  "eslint-plugin-prettier": "^4.2.1",
93
94
  "fs": "0.0.1-security",
94
- "microbundle": "0.14.2",
95
- "mocha": "^10.0.0",
95
+ "microbundle": "^0.15.1",
96
+ "mocha": "^11.7.1",
96
97
  "mock-local-storage": "^1.1.24",
97
98
  "nyc": "^17.1.0",
98
99
  "ora": "5.4.1",