@oceanprotocol/lib 8.1.0 → 8.3.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/dist/lib.cjs +4 -4
- package/dist/lib.module.mjs +4 -4
- package/dist/lib.umd.js +4 -4
- package/dist/types/@types/Assets.d.ts +1 -0
- package/dist/types/@types/NFT.d.ts +1 -1
- package/dist/types/@types/index.d.ts +1 -0
- package/dist/types/contracts/AccessList.d.ts +6 -1
- package/dist/types/contracts/AccessListFactory.d.ts +4 -1
- package/dist/types/contracts/Datatoken.d.ts +18 -1
- package/dist/types/contracts/Datatoken4.d.ts +4 -1
- package/dist/types/contracts/Dispenser.d.ts +7 -0
- package/dist/types/contracts/Escrow.d.ts +7 -1
- package/dist/types/contracts/FixedRateExchange.d.ts +15 -0
- package/dist/types/contracts/NFT.d.ts +21 -2
- package/dist/types/contracts/NFTFactory.d.ts +12 -0
- package/dist/types/contracts/Router.d.ts +9 -0
- package/dist/types/services/Aquarius.d.ts +1 -1
- package/dist/types/services/providers/BaseProvider.d.ts +1 -1
- package/dist/types/services/providers/P2pProvider.d.ts +1 -1
- package/dist/types/utils/Assets.d.ts +1 -1
- package/dist/types/utils/ContractUtils.d.ts +7 -3
- package/dist/types/utils/OrderUtils.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
|
1
2
|
import { AbiItem, FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types/index.js';
|
|
2
3
|
import { SmartContractWithAddress } from './SmartContractWithAddress.js';
|
|
3
4
|
/**
|
|
@@ -12,6 +13,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
12
13
|
* @return {Promise<string|BigNumber>} The transaction hash or the gas estimate.
|
|
13
14
|
*/
|
|
14
15
|
createNFT<G extends boolean = false>(nftData: NftCreateData, estimateGas?: G): Promise<G extends false ? string : bigint>;
|
|
16
|
+
createNFTTx(nftData: NftCreateData): Promise<TransactionRequest>;
|
|
15
17
|
/**
|
|
16
18
|
* Get Current NFT Count (NFT created)
|
|
17
19
|
* @return {Promise<number>} Number of NFT created from this factory
|
|
@@ -69,6 +71,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
69
71
|
* @return {Promise<ReceiptOrEstimate>}
|
|
70
72
|
*/
|
|
71
73
|
addNFTTemplate<G extends boolean = false>(address: string, templateAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
74
|
+
addNFTTemplateTx(address: string, templateAddress: string): Promise<TransactionRequest>;
|
|
72
75
|
/**
|
|
73
76
|
* Disable token template - only factory Owner
|
|
74
77
|
* @param {String} address
|
|
@@ -77,6 +80,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
77
80
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
78
81
|
*/
|
|
79
82
|
disableNFTTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
83
|
+
disableNFTTemplateTx(address: string, templateIndex: number): Promise<TransactionRequest>;
|
|
80
84
|
/**
|
|
81
85
|
* Reactivate a previously disabled token template - only factory Owner
|
|
82
86
|
* @param {String} address
|
|
@@ -85,6 +89,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
85
89
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
86
90
|
*/
|
|
87
91
|
reactivateNFTTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
92
|
+
reactivateNFTTemplateTx(address: string, templateIndex: number): Promise<TransactionRequest>;
|
|
88
93
|
/**
|
|
89
94
|
* Add a new NFT token template - only factory Owner
|
|
90
95
|
* @param {String} address caller address
|
|
@@ -93,6 +98,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
93
98
|
* @return {Promise<ReceiptOrEstimate>}
|
|
94
99
|
*/
|
|
95
100
|
addTokenTemplate<G extends boolean = false>(address: string, templateAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
101
|
+
addTokenTemplateTx(address: string, templateAddress: string): Promise<TransactionRequest>;
|
|
96
102
|
/**
|
|
97
103
|
* Disable token template - only factory Owner
|
|
98
104
|
* @param {String} address caller address
|
|
@@ -101,6 +107,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
101
107
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
102
108
|
*/
|
|
103
109
|
disableTokenTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
110
|
+
disableTokenTemplateTx(address: string, templateIndex: number): Promise<TransactionRequest>;
|
|
104
111
|
/**
|
|
105
112
|
* Reactivate a previously disabled token template - only factory Owner
|
|
106
113
|
* @param {String} address caller address
|
|
@@ -109,6 +116,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
109
116
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
110
117
|
*/
|
|
111
118
|
reactivateTokenTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
119
|
+
reactivateTokenTemplateTx(address: string, templateIndex: number): Promise<TransactionRequest>;
|
|
112
120
|
/**
|
|
113
121
|
* Used as a proxy to order multiple services
|
|
114
122
|
* Users can have inifinite approvals for fees for factory instead of having one approval/ Datatoken contract
|
|
@@ -121,6 +129,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
121
129
|
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
122
130
|
*/
|
|
123
131
|
startMultipleTokenOrder<G extends boolean = false>(orders: TokenOrder[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
132
|
+
startMultipleTokenOrderTx(orders: TokenOrder[]): Promise<TransactionRequest>;
|
|
124
133
|
/**
|
|
125
134
|
* Creates a new NFT, then a datatoken,all in one call
|
|
126
135
|
* @param {NftCreateData} nftCreateData - The data required to create an NFT.
|
|
@@ -129,6 +138,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
129
138
|
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
130
139
|
*/
|
|
131
140
|
createNftWithDatatoken<G extends boolean = false>(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
141
|
+
createNftWithDatatokenTx(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams): Promise<TransactionRequest>;
|
|
132
142
|
/**
|
|
133
143
|
* Creates an NFT with a datatoken with a fixed rate all in one call.
|
|
134
144
|
* be aware if Fixed Rate creation fails, you are still going to pay a lot of gas
|
|
@@ -139,6 +149,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
139
149
|
* @returns {Promis<ReceiptOrEstimate<G>>}
|
|
140
150
|
*/
|
|
141
151
|
createNftWithDatatokenWithFixedRate<G extends boolean = false>(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, freParams: FreCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
152
|
+
createNftWithDatatokenWithFixedRateTx(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, freParams: FreCreationParams): Promise<TransactionRequest>;
|
|
142
153
|
/**
|
|
143
154
|
* Creates an NFT with a datatoken with a dispenser in one call.
|
|
144
155
|
* Be aware if Fixed Rate creation fails, you are still going to pay a lot of gas
|
|
@@ -149,6 +160,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
149
160
|
* @returns {Promis<ReceiptOrEstimate<G>>}
|
|
150
161
|
*/
|
|
151
162
|
createNftWithDatatokenWithDispenser<G extends boolean = false>(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, dispenserParams: DispenserCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
163
|
+
createNftWithDatatokenWithDispenserTx(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, dispenserParams: DispenserCreationParams): Promise<TransactionRequest>;
|
|
152
164
|
/**
|
|
153
165
|
* Gets the parameters required to create an ERC20 token.
|
|
154
166
|
* @param {DatatokenCreateParams} dtParams - The parameters required to create a datatoken.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
|
1
2
|
import { Operation, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
|
|
2
3
|
import { SmartContractWithAddress } from './SmartContractWithAddress.js';
|
|
3
4
|
/**
|
|
@@ -14,6 +15,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
14
15
|
* @return {Promise<ReceiptOrEstimate>} Transaction receipt
|
|
15
16
|
*/
|
|
16
17
|
buyDatatokenBatch<G extends boolean = false>(operations: Operation[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
18
|
+
buyDatatokenBatchTx(operations: Operation[]): Promise<TransactionRequest>;
|
|
17
19
|
/**
|
|
18
20
|
* Checks if a token is on approved tokens list,
|
|
19
21
|
* if true opfFee is lower in pools with that token/DT
|
|
@@ -45,6 +47,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
45
47
|
* @return {Promise<ReceiptOrEstimate>}
|
|
46
48
|
*/
|
|
47
49
|
addApprovedToken<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
50
|
+
addApprovedTokenTx(address: string, tokenAddress: string): Promise<TransactionRequest>;
|
|
48
51
|
/**
|
|
49
52
|
* Removes a token if exists from the list of tokens with reduced fees
|
|
50
53
|
* @param {String} address caller address
|
|
@@ -53,6 +56,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
53
56
|
* @return {Promise<ReceiptOrEstimate>}
|
|
54
57
|
*/
|
|
55
58
|
removeApprovedToken<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
59
|
+
removeApprovedTokenTx(address: string, tokenAddress: string): Promise<TransactionRequest>;
|
|
56
60
|
/**
|
|
57
61
|
* Adds an address to the list of fixed rate contracts
|
|
58
62
|
* @param {String} address caller address
|
|
@@ -61,6 +65,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
61
65
|
* @return {Promise<ReceiptOrEstimate>}
|
|
62
66
|
*/
|
|
63
67
|
addFixedRateContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
68
|
+
addFixedRateContractTx(address: string, tokenAddress: string): Promise<TransactionRequest>;
|
|
64
69
|
/**
|
|
65
70
|
* Removes an address from the list of fixed rate contracts
|
|
66
71
|
* @param {String} address caller address
|
|
@@ -69,6 +74,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
69
74
|
* @return {Promise<ReceiptOrEstimate>}
|
|
70
75
|
*/
|
|
71
76
|
removeFixedRateContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
77
|
+
removeFixedRateContractTx(address: string, tokenAddress: string): Promise<TransactionRequest>;
|
|
72
78
|
/**
|
|
73
79
|
* Adds an address to the list of dispensers
|
|
74
80
|
* @param {String} address caller address
|
|
@@ -77,6 +83,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
77
83
|
* @return {Promise<ReceiptOrEstimate>}
|
|
78
84
|
*/
|
|
79
85
|
addDispenserContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
86
|
+
addDispenserContractTx(address: string, tokenAddress: string): Promise<TransactionRequest>;
|
|
80
87
|
/**
|
|
81
88
|
* Removes an address from the list of dispensers
|
|
82
89
|
* @param {String} address caller address
|
|
@@ -85,6 +92,7 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
85
92
|
* @return {Promise<ReceiptOrEstimate>}
|
|
86
93
|
*/
|
|
87
94
|
removeDispenserContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
95
|
+
removeDispenserContractTx(address: string, tokenAddress: string): Promise<TransactionRequest>;
|
|
88
96
|
/** Get OPF Fee per token
|
|
89
97
|
* @return {Promise<number>} OPC fee for a specific baseToken
|
|
90
98
|
*/
|
|
@@ -104,4 +112,5 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
104
112
|
* @return {Promise<ReceiptOrEstimate>}
|
|
105
113
|
*/
|
|
106
114
|
updateOPCFee<G extends boolean = false>(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
115
|
+
updateOPCFeeTx(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<TransactionRequest>;
|
|
107
116
|
}
|
|
@@ -29,7 +29,7 @@ export declare class BaseProvider {
|
|
|
29
29
|
getComputeResultUrl(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number): Promise<string>;
|
|
30
30
|
getComputeResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number, offset?: number): Promise<ComputeResultStream>;
|
|
31
31
|
generateAuthToken(consumer: Signer, nodeUri: OceanNode, signal?: AbortSignal): Promise<string>;
|
|
32
|
-
generateSignedAuthToken(address: string, signature: string, nonce: string, nodeUri: OceanNode, signal?: AbortSignal): Promise<string>;
|
|
32
|
+
generateSignedAuthToken(address: string, signature: string, nonce: string, nodeUri: OceanNode, validUntil?: number, signal?: AbortSignal): Promise<string>;
|
|
33
33
|
invalidateAuthToken(consumer: Signer, token: string, nodeUri: OceanNode, signal?: AbortSignal): Promise<{
|
|
34
34
|
success: boolean;
|
|
35
35
|
}>;
|
|
@@ -161,7 +161,7 @@ export declare class P2pProvider {
|
|
|
161
161
|
/**
|
|
162
162
|
* Generate an auth token from a pre-signed request (no Signer needed).
|
|
163
163
|
*/
|
|
164
|
-
generateSignedAuthToken(address: string, signature: string, nonce: string, nodeUri: OceanNode, signal?: AbortSignal): Promise<string>;
|
|
164
|
+
generateSignedAuthToken(address: string, signature: string, nonce: string, nodeUri: OceanNode, validUntil?: number, signal?: AbortSignal): Promise<string>;
|
|
165
165
|
/**
|
|
166
166
|
* Resolve a DDO by DID via P2P GET_DDO command.
|
|
167
167
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
2
|
import { Aquarius } from '../services/Aquarius.js';
|
|
3
|
-
import { DDO } from '@oceanprotocol/ddo-js';
|
|
3
|
+
import { type DDO } from '@oceanprotocol/ddo-js';
|
|
4
4
|
import { StorageObject } from '../@types/File.js';
|
|
5
5
|
export declare const DEVELOPMENT_CHAIN_ID = 8996;
|
|
6
6
|
export declare function useOasisSDK(network: string | number): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer, Contract, TransactionResponse,
|
|
1
|
+
import { Signer, Contract, TransactionResponse, TransactionRequest, BaseContractMethod, 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: TransactionReceipt, eventName: string):
|
|
36
|
+
export declare function getEventFromTx(txReceipt: TransactionReceipt, eventName: string): any;
|
|
37
37
|
/**
|
|
38
38
|
* Send the transation on chain
|
|
39
39
|
* @param {BigNumber} estGas estimated gas for the transaction
|
|
@@ -41,6 +41,10 @@ export declare function getEventFromTx(txReceipt: TransactionReceipt, eventName:
|
|
|
41
41
|
* @param {number} gasFeeMultiplier number represinting the multiplier we apply to gas fees
|
|
42
42
|
* @param {Function} functionToSend function that we need to send
|
|
43
43
|
* @param {...any[]} args arguments of the function
|
|
44
|
-
* @return {Promise<any>}
|
|
44
|
+
* @return {Promise<any>} transaction receipt
|
|
45
45
|
*/
|
|
46
46
|
export declare function sendTx(estGas: bigint, signer: Signer, gasFeeMultiplier: number, functionToSend: BaseContractMethod, ...args: any[]): Promise<TransactionResponse>;
|
|
47
|
+
export declare function buildTxOverrides(estGas: bigint, signer: Signer, gasFeeMultiplier: number): Promise<Record<string, any>>;
|
|
48
|
+
export declare function buildUnsignedTx(functionToSend: BaseContractMethod, args: any[], overrides: Record<string, any>): Promise<TransactionRequest>;
|
|
49
|
+
export declare function sendPreparedTx(functionToSend: BaseContractMethod, args: any[], overrides: Record<string, any>): Promise<TransactionResponse>;
|
|
50
|
+
export declare function sendPreparedTransaction(signer: Signer, tx: TransactionRequest): Promise<TransactionResponse>;
|
|
@@ -3,7 +3,7 @@ import { Config } from '../config/Config.js';
|
|
|
3
3
|
import { Datatoken } from '../contracts/Datatoken.js';
|
|
4
4
|
import { ConsumeMarketFee } from '../@types/Datatoken.js';
|
|
5
5
|
import { ProviderFees } from '../@types/Provider.js';
|
|
6
|
-
import { Asset } from '@oceanprotocol/ddo-js';
|
|
6
|
+
import { type Asset } from '@oceanprotocol/ddo-js';
|
|
7
7
|
/**
|
|
8
8
|
* Orders an asset based on the specified pricing schema and configuration.
|
|
9
9
|
* @param {Asset} asset - The asset to be ordered.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.3.0",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.cjs",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"web3": "^1.8.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@oceanprotocol/ddo-js": "^0.3.0",
|
|
72
71
|
"@oasisprotocol/sapphire-paratime": "^1.3.2",
|
|
72
|
+
"@oceanprotocol/ddo-js": "^0.3.0",
|
|
73
73
|
"bignumber.js": "^9.3.1",
|
|
74
74
|
"cross-fetch": "^4.0.0",
|
|
75
75
|
"crypto-js": "^4.1.1",
|
|
@@ -90,8 +90,7 @@
|
|
|
90
90
|
"@libp2p/tcp": "^11.0.13",
|
|
91
91
|
"@libp2p/websockets": "^10.1.6",
|
|
92
92
|
"@multiformats/multiaddr": "^13.0.1",
|
|
93
|
-
"@oceanprotocol/contracts": "^2.
|
|
94
|
-
"libp2p": "^3.1.6",
|
|
93
|
+
"@oceanprotocol/contracts": "^2.7.0",
|
|
95
94
|
"@truffle/hdwallet-provider": "^2.0.14",
|
|
96
95
|
"@types/chai": "^5.2.2",
|
|
97
96
|
"@types/chai-spies": "^1.0.3",
|
|
@@ -112,11 +111,12 @@
|
|
|
112
111
|
"eslint-config-prettier": "^10.1.5",
|
|
113
112
|
"eslint-plugin-prettier": "^4.2.1",
|
|
114
113
|
"fs": "0.0.1-security",
|
|
114
|
+
"libp2p": "^3.1.6",
|
|
115
115
|
"microbundle": "^0.15.1",
|
|
116
116
|
"mocha": "^11.7.1",
|
|
117
117
|
"mock-local-storage": "^1.1.24",
|
|
118
|
-
"nyc": "^
|
|
119
|
-
"ora": "
|
|
118
|
+
"nyc": "^18.0.0",
|
|
119
|
+
"ora": "9.4.0",
|
|
120
120
|
"prettier": "^2.7.1",
|
|
121
121
|
"release-it": "^19.2.4",
|
|
122
122
|
"source-map-support": "^0.5.21",
|