@oceanprotocol/lib 5.0.4 → 5.0.5
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 +39 -1
- package/Cheatsheet.md +2 -2
- package/CodeExamples.md +1 -1
- package/ComputeExamples.md +1 -1
- package/README.md +33 -7
- package/dist/lib.cjs +1 -1
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.mjs +1 -1
- package/dist/lib.module.mjs.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/types/config/Config.d.ts +6 -0
- package/dist/types/contracts/EnterpriseFeeCollector.d.ts +33 -0
- package/dist/types/contracts/index.d.ts +1 -0
- package/dist/types/services/Provider.d.ts +4 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/docs/README.md +10 -7
- package/docs/classes/Escrow.md +285 -0
- package/docs/classes/Provider.md +75 -10
- package/docs/interfaces/ComputeEnvironment.md +68 -75
- package/docs/interfaces/ComputeJob.md +34 -1
- package/docs/interfaces/ComputeResourcesRequest.md +6 -2
- package/docs/interfaces/ProviderComputeInitializeResults.md +14 -1
- package/package.json +2 -2
|
@@ -67,6 +67,11 @@ export declare class Config {
|
|
|
67
67
|
* @type {string}
|
|
68
68
|
*/
|
|
69
69
|
opfCommunityFeeCollector?: string;
|
|
70
|
+
/**
|
|
71
|
+
* OPFCommunityFeeCollector
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
EnterpriseFeeCollector?: string;
|
|
70
75
|
/**
|
|
71
76
|
* SideStaking address
|
|
72
77
|
* @type {string}
|
|
@@ -148,5 +153,6 @@ export declare class Config {
|
|
|
148
153
|
veFeeEstimate?: string;
|
|
149
154
|
sdk?: SDK;
|
|
150
155
|
accessListFactory?: string;
|
|
156
|
+
escrow?: string;
|
|
151
157
|
}
|
|
152
158
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { AbiItem } from '../@types';
|
|
3
|
+
import { Config } from '../config';
|
|
4
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
5
|
+
export declare class EnterpriseFeeCollectorContract extends SmartContractWithAddress {
|
|
6
|
+
getDefaultAbi(): AbiItem[];
|
|
7
|
+
/**
|
|
8
|
+
* Instantiate EnterpriseFeeCollectorContract class
|
|
9
|
+
* @param {string} address The contract address.
|
|
10
|
+
* @param {Signer} signer The signer object.
|
|
11
|
+
* @param {string | number} [network] Network id or name
|
|
12
|
+
* @param {Config} [config] The configuration object.
|
|
13
|
+
* @param {AbiItem[]} [abi] ABI array of the smart contract
|
|
14
|
+
*/
|
|
15
|
+
constructor(address: string, signer: Signer, network?: string | number, config?: Config, abi?: AbiItem[]);
|
|
16
|
+
/**
|
|
17
|
+
* Check if token is allowed
|
|
18
|
+
* @return {Promise<any>} Boolean indicating if token is allowed
|
|
19
|
+
*/
|
|
20
|
+
isTokenAllowed(token: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Get Token details
|
|
23
|
+
* @return {Promise<any>} Token details
|
|
24
|
+
*/
|
|
25
|
+
getToken(token: string): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Calculate fee
|
|
28
|
+
* @param {string} token Token address
|
|
29
|
+
* @param {string} amount Amount
|
|
30
|
+
* @return {Promise<string>} Fee amount
|
|
31
|
+
*/
|
|
32
|
+
calculateFee(token: string, amount: number): Promise<any>;
|
|
33
|
+
}
|
|
@@ -156,10 +156,11 @@ export declare class Provider {
|
|
|
156
156
|
* @param {ComputeOutput} output The compute job output settings.
|
|
157
157
|
* @param {any} policyServer Policy server data.
|
|
158
158
|
* @param {AbortSignal} signal abort signal
|
|
159
|
+
* @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
|
|
159
160
|
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
160
161
|
*/
|
|
161
162
|
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, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
163
|
+
metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number): Promise<ComputeJob | ComputeJob[]>;
|
|
163
164
|
/** Instruct the provider to start a FREE compute job (new C2D V2)
|
|
164
165
|
* @param {string} providerUri The provider URI.
|
|
165
166
|
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
@@ -171,9 +172,10 @@ export declare class Provider {
|
|
|
171
172
|
* @param {ComputeOutput} output The compute job output settings.
|
|
172
173
|
* @param {any} policyServer Policy server data.
|
|
173
174
|
* @param {AbortSignal} signal abort signal
|
|
175
|
+
* @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
|
|
174
176
|
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
175
177
|
*/
|
|
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[]>;
|
|
178
|
+
freeComputeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number): Promise<ComputeJob | ComputeJob[]>;
|
|
177
179
|
/**
|
|
178
180
|
*
|
|
179
181
|
* @param providerUri provider URL
|
package/docs/README.md
CHANGED
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
With ocean.js, you can:
|
|
17
17
|
|
|
18
|
-
- **Publish** data services: downloadable files or compute-to-data. Create an ERC721 **data NFT** for each service, and ERC20 **datatoken** for access (1.0 datatokens to access).
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
18
|
+
- **Publish** data services: downloadable files or compute-to-data (C2D). Create an ERC721 **data NFT** for each service, and ERC20 **datatoken** for access (1.0 datatokens to access).
|
|
19
|
+
- **Consume** data: download files or run compute-to-data jobs on datasets while preserving data privacy.
|
|
20
|
+
- **Sell** datatokens via fixed-rate exchanges or dispense them for free.
|
|
21
|
+
- **Manage pricing**: create fixed-rate exchanges, dispensers, or use dynamic pricing mechanisms for your assets.
|
|
22
|
+
- **Compute-to-Data**: run algorithms on the ocean network.
|
|
23
|
+
- **Transfer** data NFTs & datatokens to another owner, and **all other ERC721 & ERC20 actions** using ethers.js.
|
|
21
24
|
|
|
22
25
|
ocean.js is part of the [Ocean Protocol](https://oceanprotocol.com) toolset.
|
|
23
26
|
|
|
@@ -48,7 +51,7 @@ This is in alpha state. If you run into problems, please open up a [new issue](h
|
|
|
48
51
|
npm install @oceanprotocol/lib
|
|
49
52
|
```
|
|
50
53
|
|
|
51
|
-
- Checkout our [code examples](CodeExamples.md)
|
|
54
|
+
- Checkout our [code examples](CodeExamples.md), [compute-to-data examples](ComputeExamples.md), or [quick reference cheatsheet](Cheatsheet.md) to see how you can use ocean.js.
|
|
52
55
|
- Refer to the [Ocean Protocol documentation](https://docs.oceanprotocol.com/) for more guides and tutorials.
|
|
53
56
|
- Visit the [Ocean Protocol website](https://docs.oceanprotocol.com/) for general information about Ocean Protocol.
|
|
54
57
|
- If you have any difficulties or if you have further questions about how to use ocean.js please reach out to us on [Discord](https://discord.gg/TnXjkR5).
|
|
@@ -81,13 +84,13 @@ npm run format
|
|
|
81
84
|
|
|
82
85
|
Test suite for unit & integration tests is setup with [Mocha](https://mochajs.org) as test runner, and [nyc](https://github.com/istanbuljs/nyc) for coverage reporting. A combined coverage report is sent to CodeClimate via the `coverage` GitHub Actions job.
|
|
83
86
|
|
|
84
|
-
Running all tests requires running Ocean Protocol components beforehand with [Barge](https://github.com/oceanprotocol/barge), which also runs a
|
|
87
|
+
Running all tests requires running Ocean Protocol components beforehand with [Barge](https://github.com/oceanprotocol/barge), which also runs a local blockchain instance:
|
|
85
88
|
|
|
86
89
|
```bash
|
|
87
90
|
git clone https://github.com/oceanprotocol/barge
|
|
88
91
|
cd barge
|
|
89
92
|
|
|
90
|
-
./start_ocean.sh
|
|
93
|
+
./start_ocean.sh
|
|
91
94
|
```
|
|
92
95
|
|
|
93
96
|
You can then proceed to run in another terminal.
|
|
@@ -176,7 +179,7 @@ Further releases afterwards can be done with `npm run release` again and selecti
|
|
|
176
179
|
## 🏛 License
|
|
177
180
|
|
|
178
181
|
```
|
|
179
|
-
Copyright ((C))
|
|
182
|
+
Copyright ((C)) 2025 Ocean Protocol Foundation
|
|
180
183
|
|
|
181
184
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
185
|
you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / EscrowContract
|
|
2
|
+
|
|
3
|
+
# Class: EscrowContract
|
|
4
|
+
|
|
5
|
+
Manages escrow payments for C2D jobs - handles deposits, locks, and authorizations.
|
|
6
|
+
|
|
7
|
+
## Hierarchy
|
|
8
|
+
|
|
9
|
+
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
|
10
|
+
|
|
11
|
+
↳ **`EscrowContract`**
|
|
12
|
+
|
|
13
|
+
## Table of contents
|
|
14
|
+
|
|
15
|
+
### Constructors
|
|
16
|
+
|
|
17
|
+
- [constructor](Escrow.md#constructor)
|
|
18
|
+
|
|
19
|
+
### Methods
|
|
20
|
+
|
|
21
|
+
- [getFunds](Escrow.md#getfunds)
|
|
22
|
+
- [getUserFunds](Escrow.md#getuserfunds)
|
|
23
|
+
- [getUserTokens](Escrow.md#getusertokens)
|
|
24
|
+
- [getLocks](Escrow.md#getlocks)
|
|
25
|
+
- [getAuthorizations](Escrow.md#getauthorizations)
|
|
26
|
+
- [verifyFundsForEscrowPayment](Escrow.md#verifyfundsforescrowpayment)
|
|
27
|
+
- [deposit](Escrow.md#deposit)
|
|
28
|
+
- [withdraw](Escrow.md#withdraw)
|
|
29
|
+
- [authorize](Escrow.md#authorize)
|
|
30
|
+
|
|
31
|
+
## Constructors
|
|
32
|
+
|
|
33
|
+
### constructor
|
|
34
|
+
|
|
35
|
+
• **new EscrowContract**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
|
36
|
+
|
|
37
|
+
#### Parameters
|
|
38
|
+
|
|
39
|
+
| Name | Type |
|
|
40
|
+
| :------ | :------ |
|
|
41
|
+
| `address` | `string` |
|
|
42
|
+
| `signer` | `Signer` |
|
|
43
|
+
| `network?` | `string` \| `number` |
|
|
44
|
+
| `config?` | [`Config`](Config.md) |
|
|
45
|
+
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] |
|
|
46
|
+
|
|
47
|
+
#### Inherited from
|
|
48
|
+
|
|
49
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
|
50
|
+
|
|
51
|
+
#### Defined in
|
|
52
|
+
|
|
53
|
+
[contracts/Escrow.ts:26](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L26)
|
|
54
|
+
|
|
55
|
+
## Methods
|
|
56
|
+
|
|
57
|
+
### getFunds
|
|
58
|
+
|
|
59
|
+
▸ **getFunds**(`token`): `Promise`<`{available: bigint, locked: bigint}`\>
|
|
60
|
+
|
|
61
|
+
Get total funds in escrow for a token
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
| Name | Type | Description |
|
|
66
|
+
| :------ | :------ | :------ |
|
|
67
|
+
| `token` | `string` | token address |
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`Promise`<`{available: bigint, locked: bigint}`\>
|
|
72
|
+
|
|
73
|
+
Object with `available` and `locked` amounts
|
|
74
|
+
|
|
75
|
+
#### Defined in
|
|
76
|
+
|
|
77
|
+
[contracts/Escrow.ts:41](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L41)
|
|
78
|
+
|
|
79
|
+
___
|
|
80
|
+
|
|
81
|
+
### getUserFunds
|
|
82
|
+
|
|
83
|
+
▸ **getUserFunds**(`payer`, `token`): `Promise`<`{available: bigint, locked: bigint}`\>
|
|
84
|
+
|
|
85
|
+
Get user's available escrow balance
|
|
86
|
+
|
|
87
|
+
#### Parameters
|
|
88
|
+
|
|
89
|
+
| Name | Type | Description |
|
|
90
|
+
| :------ | :------ | :------ |
|
|
91
|
+
| `payer` | `string` | user address |
|
|
92
|
+
| `token` | `string` | token address |
|
|
93
|
+
|
|
94
|
+
#### Returns
|
|
95
|
+
|
|
96
|
+
`Promise`<`{available: bigint, locked: bigint}`\>
|
|
97
|
+
|
|
98
|
+
Object with `available` and `locked` amounts for this user/token pair
|
|
99
|
+
|
|
100
|
+
#### Defined in
|
|
101
|
+
|
|
102
|
+
[contracts/Escrow.ts:49](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L49)
|
|
103
|
+
|
|
104
|
+
___
|
|
105
|
+
|
|
106
|
+
### getUserTokens
|
|
107
|
+
|
|
108
|
+
▸ **getUserTokens**(`payer`): `Promise`<`string[]`\>
|
|
109
|
+
|
|
110
|
+
Get list of tokens user has deposited
|
|
111
|
+
|
|
112
|
+
#### Parameters
|
|
113
|
+
|
|
114
|
+
| Name | Type | Description |
|
|
115
|
+
| :------ | :------ | :------ |
|
|
116
|
+
| `payer` | `string` | user address |
|
|
117
|
+
|
|
118
|
+
#### Returns
|
|
119
|
+
|
|
120
|
+
`Promise`<`string[]`\>
|
|
121
|
+
|
|
122
|
+
Array of token addresses this user has deposited
|
|
123
|
+
|
|
124
|
+
#### Defined in
|
|
125
|
+
|
|
126
|
+
[contracts/Escrow.ts:57](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L57)
|
|
127
|
+
|
|
128
|
+
___
|
|
129
|
+
|
|
130
|
+
### getLocks
|
|
131
|
+
|
|
132
|
+
▸ **getLocks**(`token`, `payer`, `payee`): `Promise`<`Lock[]`\>
|
|
133
|
+
|
|
134
|
+
Get active payment locks
|
|
135
|
+
|
|
136
|
+
#### Parameters
|
|
137
|
+
|
|
138
|
+
| Name | Type | Description |
|
|
139
|
+
| :------ | :------ | :------ |
|
|
140
|
+
| `token` | `string` | token address |
|
|
141
|
+
| `payer` | `string` | payer address |
|
|
142
|
+
| `payee` | `string` | payee address |
|
|
143
|
+
|
|
144
|
+
#### Returns
|
|
145
|
+
|
|
146
|
+
`Promise`<`Lock[]`\>
|
|
147
|
+
|
|
148
|
+
Array of locks where each lock contains: `{jobId, payer, payee, amount, expiry, token}`
|
|
149
|
+
|
|
150
|
+
#### Defined in
|
|
151
|
+
|
|
152
|
+
[contracts/Escrow.ts:65](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L65)
|
|
153
|
+
|
|
154
|
+
___
|
|
155
|
+
|
|
156
|
+
### getAuthorizations
|
|
157
|
+
|
|
158
|
+
▸ **getAuthorizations**(`token`, `payer`, `payee`): `Promise`<`Authorization[]`\>
|
|
159
|
+
|
|
160
|
+
Get payment authorizations
|
|
161
|
+
|
|
162
|
+
#### Parameters
|
|
163
|
+
|
|
164
|
+
| Name | Type | Description |
|
|
165
|
+
| :------ | :------ | :------ |
|
|
166
|
+
| `token` | `string` | token address |
|
|
167
|
+
| `payer` | `string` | payer address |
|
|
168
|
+
| `payee` | `string` | payee address |
|
|
169
|
+
|
|
170
|
+
#### Returns
|
|
171
|
+
|
|
172
|
+
`Promise`<`Authorization[]`\>
|
|
173
|
+
|
|
174
|
+
Array of authorizations where each contains: `{payee, maxLockedAmount, currentLockedAmount, maxLockSeconds, maxLockCounts, currentLocks}`
|
|
175
|
+
|
|
176
|
+
#### Defined in
|
|
177
|
+
|
|
178
|
+
[contracts/Escrow.ts:73](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L73)
|
|
179
|
+
|
|
180
|
+
___
|
|
181
|
+
|
|
182
|
+
### verifyFundsForEscrowPayment
|
|
183
|
+
|
|
184
|
+
▸ **verifyFundsForEscrowPayment**(`token`, `consumerAddress`, `amountToDeposit?`, `maxLockedAmount?`, `maxLockSeconds?`, `maxLockCounts?`): `Promise`<`ValidationResponse`\>
|
|
185
|
+
|
|
186
|
+
Checks if you have enough funds, authorizes and deposits if needed - all in one call
|
|
187
|
+
|
|
188
|
+
#### Parameters
|
|
189
|
+
|
|
190
|
+
| Name | Type | Description |
|
|
191
|
+
| :------ | :------ | :------ |
|
|
192
|
+
| `token` | `string` | payment token |
|
|
193
|
+
| `consumerAddress` | `string` | compute environment consumer address |
|
|
194
|
+
| `amountToDeposit?` | `string` | how much to deposit (optional) |
|
|
195
|
+
| `maxLockedAmount?` | `string` | max amount for compute job |
|
|
196
|
+
| `maxLockSeconds?` | `string` | max lock duration |
|
|
197
|
+
| `maxLockCounts?` | `string` | max number of locks |
|
|
198
|
+
|
|
199
|
+
#### Returns
|
|
200
|
+
|
|
201
|
+
`Promise`<`ValidationResponse`\>
|
|
202
|
+
|
|
203
|
+
validation status
|
|
204
|
+
|
|
205
|
+
#### Defined in
|
|
206
|
+
|
|
207
|
+
[contracts/Escrow.ts:98](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L98)
|
|
208
|
+
|
|
209
|
+
___
|
|
210
|
+
|
|
211
|
+
### deposit
|
|
212
|
+
|
|
213
|
+
▸ **deposit**<`G`\>(`token`, `amount`, `estimateGas?`): `Promise`<`ReceiptOrEstimate`<`G`\>\>
|
|
214
|
+
|
|
215
|
+
Deposit tokens into escrow
|
|
216
|
+
|
|
217
|
+
#### Parameters
|
|
218
|
+
|
|
219
|
+
| Name | Type |
|
|
220
|
+
| :------ | :------ |
|
|
221
|
+
| `token` | `string` |
|
|
222
|
+
| `amount` | `string` |
|
|
223
|
+
| `estimateGas?` | `G` |
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
|
|
227
|
+
`Promise`<`ReceiptOrEstimate`<`G`\>\>
|
|
228
|
+
|
|
229
|
+
#### Defined in
|
|
230
|
+
|
|
231
|
+
[contracts/Escrow.ts:191](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L191)
|
|
232
|
+
|
|
233
|
+
___
|
|
234
|
+
|
|
235
|
+
### withdraw
|
|
236
|
+
|
|
237
|
+
▸ **withdraw**<`G`\>(`tokens`, `amounts`, `estimateGas?`): `Promise`<`ReceiptOrEstimate`<`G`\>\>
|
|
238
|
+
|
|
239
|
+
Withdraw tokens from escrow
|
|
240
|
+
|
|
241
|
+
#### Parameters
|
|
242
|
+
|
|
243
|
+
| Name | Type | Description |
|
|
244
|
+
| :------ | :------ | :------ |
|
|
245
|
+
| `tokens` | `string[]` | array of token addresses |
|
|
246
|
+
| `amounts` | `string[]` | array of amounts to withdraw |
|
|
247
|
+
| `estimateGas?` | `G` | - |
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
`Promise`<`ReceiptOrEstimate`<`G`\>\>
|
|
252
|
+
|
|
253
|
+
#### Defined in
|
|
254
|
+
|
|
255
|
+
[contracts/Escrow.ts:217](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L217)
|
|
256
|
+
|
|
257
|
+
___
|
|
258
|
+
|
|
259
|
+
### authorize
|
|
260
|
+
|
|
261
|
+
▸ **authorize**<`G`\>(`token`, `payee`, `maxLockedAmount`, `maxLockSeconds`, `maxLockCounts`, `estimateGas?`): `Promise`<`ReceiptOrEstimate`<`G`\>\>
|
|
262
|
+
|
|
263
|
+
Authorize someone to lock your funds
|
|
264
|
+
|
|
265
|
+
#### Parameters
|
|
266
|
+
|
|
267
|
+
| Name | Type |
|
|
268
|
+
| :------ | :------ |
|
|
269
|
+
| `token` | `string` |
|
|
270
|
+
| `payee` | `string` |
|
|
271
|
+
| `maxLockedAmount` | `string` |
|
|
272
|
+
| `maxLockSeconds` | `string` |
|
|
273
|
+
| `maxLockCounts` | `string` |
|
|
274
|
+
| `estimateGas?` | `G` |
|
|
275
|
+
|
|
276
|
+
#### Returns
|
|
277
|
+
|
|
278
|
+
`Promise`<`ReceiptOrEstimate`<`G`\>\>
|
|
279
|
+
|
|
280
|
+
#### Defined in
|
|
281
|
+
|
|
282
|
+
[contracts/Escrow.ts:274](https://github.com/oceanprotocol/ocean.js/blob/main/src/contracts/Escrow.ts#L274)
|
|
283
|
+
|
|
284
|
+
___
|
|
285
|
+
|
package/docs/classes/Provider.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
- [computeStart](Provider.md#computestart)
|
|
16
16
|
- [computeStatus](Provider.md#computestatus)
|
|
17
17
|
- [computeStop](Provider.md#computestop)
|
|
18
|
+
- [freeComputeStart](Provider.md#freecomputestart)
|
|
19
|
+
- [getComputeStartRoutes](Provider.md#getcomputestartroutes)
|
|
18
20
|
- [encrypt](Provider.md#encrypt)
|
|
19
21
|
- [getComputeEnvironments](Provider.md#getcomputeenvironments)
|
|
20
22
|
- [getComputeResultUrl](Provider.md#getcomputeresulturl)
|
|
@@ -97,24 +99,28 @@ ___
|
|
|
97
99
|
|
|
98
100
|
### computeStart
|
|
99
101
|
|
|
100
|
-
▸ **computeStart**(`providerUri`, `
|
|
102
|
+
▸ **computeStart**(`providerUri`, `signerOrAuthToken`, `computeEnv`, `datasets`, `algorithm`, `maxJobDuration`, `token`, `resources`, `chainId`, `metadata?`, `additionalViewers?`, `output?`, `policyServer?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
|
101
103
|
|
|
102
|
-
Instruct the provider to start a compute job
|
|
104
|
+
Instruct the provider to start a PAID compute job (C2D V2)
|
|
103
105
|
|
|
104
106
|
#### Parameters
|
|
105
107
|
|
|
106
108
|
| Name | Type | Description |
|
|
107
109
|
| :------ | :------ | :------ |
|
|
108
110
|
| `providerUri` | `string` | The provider URI. |
|
|
109
|
-
| `
|
|
110
|
-
| `computeEnv` | `string` | The compute environment. |
|
|
111
|
-
| `datasets` | [`ComputeAsset`](../interfaces/ComputeAsset.md) | The
|
|
111
|
+
| `signerOrAuthToken` | `Signer` \| `string` | The consumer signer object or auth token |
|
|
112
|
+
| `computeEnv` | `string` | The compute environment ID. |
|
|
113
|
+
| `datasets` | [`ComputeAsset`](../interfaces/ComputeAsset.md)[] | The datasets to start compute on (including additional datasets) |
|
|
112
114
|
| `algorithm` | [`ComputeAlgorithm`](../interfaces/ComputeAlgorithm.md) | The algorithm to start compute with. |
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
+
| `maxJobDuration` | `number` | The compute job max execution time. |
|
|
116
|
+
| `token` | `string` | The token address for compute payment. |
|
|
117
|
+
| `resources` | [`ComputeResourceRequest`](../interfaces/ComputeResourcesRequest.md)[] | The resources to start compute job with. |
|
|
118
|
+
| `chainId` | `number` | The chain ID used for payments |
|
|
119
|
+
| `metadata?` | `ComputeJobMetadata` | Additional metadata to be stored in the database. |
|
|
120
|
+
| `additionalViewers?` | `string[]` | Additional addresses that can view the compute job results. |
|
|
115
121
|
| `output?` | [`ComputeOutput`](../interfaces/ComputeOutput.md) | The compute job output settings. |
|
|
116
|
-
| `
|
|
117
|
-
|
|
122
|
+
| `policyServer?` | `any` | Policy server data. |
|
|
123
|
+
| `signal?` | `AbortSignal` | Abort signal |
|
|
118
124
|
|
|
119
125
|
#### Returns
|
|
120
126
|
|
|
@@ -124,7 +130,7 @@ The compute job or jobs.
|
|
|
124
130
|
|
|
125
131
|
#### Defined in
|
|
126
132
|
|
|
127
|
-
[services/Provider.ts:
|
|
133
|
+
[services/Provider.ts:772](https://github.com/oceanprotocol/ocean.js/blob/main/src/services/Provider.ts#L772)
|
|
128
134
|
|
|
129
135
|
___
|
|
130
136
|
|
|
@@ -182,6 +188,65 @@ Instruct the provider to Stop the execution of a to stop a compute job.
|
|
|
182
188
|
|
|
183
189
|
___
|
|
184
190
|
|
|
191
|
+
### freeComputeStart
|
|
192
|
+
|
|
193
|
+
▸ **freeComputeStart**(`providerUri`, `signerOrAuthToken`, `computeEnv`, `datasets`, `algorithm`, `resources?`, `metadata?`, `additionalViewers?`, `output?`, `policyServer?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
|
194
|
+
|
|
195
|
+
Instruct the provider to start a FREE compute job (C2D V2)
|
|
196
|
+
|
|
197
|
+
#### Parameters
|
|
198
|
+
|
|
199
|
+
| Name | Type | Description |
|
|
200
|
+
| :------ | :------ | :------ |
|
|
201
|
+
| `providerUri` | `string` | The provider URI. |
|
|
202
|
+
| `signerOrAuthToken` | `Signer` \| `string` | The consumer signer object or auth token |
|
|
203
|
+
| `computeEnv` | `string` | The compute environment ID. |
|
|
204
|
+
| `datasets` | [`ComputeAsset`](../interfaces/ComputeAsset.md)[] | The datasets to start compute on (including additional datasets) |
|
|
205
|
+
| `algorithm` | [`ComputeAlgorithm`](../interfaces/ComputeAlgorithm.md) | The algorithm to start compute with. |
|
|
206
|
+
| `resources?` | [`ComputeResourceRequest`](../interfaces/ComputeResourcesRequest.md)[] | The resources to start compute job with. |
|
|
207
|
+
| `metadata?` | `ComputeJobMetadata` | Additional metadata to be stored in the database. |
|
|
208
|
+
| `additionalViewers?` | `string[]` | Additional addresses that can view the compute job results. |
|
|
209
|
+
| `output?` | [`ComputeOutput`](../interfaces/ComputeOutput.md) | The compute job output settings. |
|
|
210
|
+
| `policyServer?` | `any` | Policy server data. |
|
|
211
|
+
| `signal?` | `AbortSignal` | Abort signal |
|
|
212
|
+
|
|
213
|
+
#### Returns
|
|
214
|
+
|
|
215
|
+
`Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
|
216
|
+
|
|
217
|
+
The compute job or jobs.
|
|
218
|
+
|
|
219
|
+
#### Defined in
|
|
220
|
+
|
|
221
|
+
[services/Provider.ts:892](https://github.com/oceanprotocol/ocean.js/blob/main/src/services/Provider.ts#L892)
|
|
222
|
+
|
|
223
|
+
___
|
|
224
|
+
|
|
225
|
+
### getComputeStartRoutes
|
|
226
|
+
|
|
227
|
+
▸ **getComputeStartRoutes**(`providerUri`, `isFreeCompute?`): `Promise`<`string` \| `null`\>
|
|
228
|
+
|
|
229
|
+
Get the compute start route path for either free or paid compute
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
| Name | Type | Default value | Description |
|
|
234
|
+
| :------ | :------ | :------ | :------ |
|
|
235
|
+
| `providerUri` | `string` | `undefined` | The provider URI. |
|
|
236
|
+
| `isFreeCompute` | `boolean` | `false` | Whether to get the free compute route (true) or paid compute route (false). |
|
|
237
|
+
|
|
238
|
+
#### Returns
|
|
239
|
+
|
|
240
|
+
`Promise`<`string` \| `null`\>
|
|
241
|
+
|
|
242
|
+
The compute start route path or null if not available.
|
|
243
|
+
|
|
244
|
+
#### Defined in
|
|
245
|
+
|
|
246
|
+
[services/Provider.ts:1071](https://github.com/oceanprotocol/ocean.js/blob/main/src/services/Provider.ts#L1071)
|
|
247
|
+
|
|
248
|
+
___
|
|
249
|
+
|
|
185
250
|
### encrypt
|
|
186
251
|
|
|
187
252
|
▸ **encrypt**(`data`, `chainId`, `providerUri`, `signal?`): `Promise`<`string`\>
|