mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Fix compute basetoken issue (#1829)
* fix lint * add dynamic provider fees * fixes * cleanup and more fixes * bump oceanlib to 2.6.0
This commit is contained in:
parent
5ef0594927
commit
cde92c6c46
@ -30,44 +30,47 @@
|
|||||||
{
|
{
|
||||||
"name": "files",
|
"name": "files",
|
||||||
"label": "File",
|
"label": "File",
|
||||||
"prominentHelp": false,
|
"prominentHelp": false,
|
||||||
"type": "tabs",
|
"type": "tabs",
|
||||||
"fields": [{
|
"fields": [
|
||||||
"value": "ipfs",
|
{
|
||||||
"title": "IPFS",
|
"value": "ipfs",
|
||||||
"label": "CID",
|
"title": "IPFS",
|
||||||
"placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq",
|
"label": "CID",
|
||||||
"help": "This CID will be stored encrypted after publishing.",
|
"placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"help": "This CID will be stored encrypted after publishing.",
|
||||||
"prominentHelp": true,
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"type": "files",
|
"prominentHelp": true,
|
||||||
"required": true
|
"type": "files",
|
||||||
},
|
"required": true
|
||||||
{
|
},
|
||||||
"value": "arweave",
|
{
|
||||||
"title": "Arweave",
|
"value": "arweave",
|
||||||
"label": "Transaction ID",
|
"title": "Arweave",
|
||||||
"placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd",
|
"label": "Transaction ID",
|
||||||
"help": "This Transaction ID will be stored encrypted after publishing.",
|
"placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"help": "This Transaction ID will be stored encrypted after publishing.",
|
||||||
"prominentHelp": true,
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"type": "files",
|
"prominentHelp": true,
|
||||||
"required": true
|
"type": "files",
|
||||||
},
|
"required": true
|
||||||
{
|
},
|
||||||
"value": "url",
|
{
|
||||||
"title": "URL",
|
"value": "url",
|
||||||
"label": "File",
|
"title": "URL",
|
||||||
"placeholder": "e.g. https://file.com/file.json",
|
"label": "File",
|
||||||
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
|
"placeholder": "e.g. https://file.com/file.json",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
|
||||||
"prominentHelp": true,
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"type": "files",
|
"prominentHelp": true,
|
||||||
"required": true
|
"type": "files",
|
||||||
}],
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"sortOptions": false,
|
"sortOptions": false,
|
||||||
"required": true
|
"required": true
|
||||||
},{
|
},
|
||||||
|
{
|
||||||
"name": "links",
|
"name": "links",
|
||||||
"label": "Sample file",
|
"label": "Sample file",
|
||||||
"prominentHelp": false,
|
"prominentHelp": false,
|
||||||
@ -83,7 +86,8 @@
|
|||||||
"prominentHelp": true,
|
"prominentHelp": true,
|
||||||
"type": "files",
|
"type": "files",
|
||||||
"required": false
|
"required": false
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -104,60 +104,64 @@
|
|||||||
{
|
{
|
||||||
"name": "files",
|
"name": "files",
|
||||||
"label": "File",
|
"label": "File",
|
||||||
"prominentHelp": false,
|
"prominentHelp": false,
|
||||||
"type": "tabs",
|
"type": "tabs",
|
||||||
"fields": [{
|
"fields": [
|
||||||
"value": "ipfs",
|
{
|
||||||
"title": "IPFS",
|
"value": "ipfs",
|
||||||
"label": "CID",
|
"title": "IPFS",
|
||||||
"placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq",
|
"label": "CID",
|
||||||
"help": "This CID will be stored encrypted after publishing.",
|
"placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"help": "This CID will be stored encrypted after publishing.",
|
||||||
"prominentHelp": true,
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"type": "files",
|
"prominentHelp": true,
|
||||||
"required": true
|
"type": "files",
|
||||||
},
|
"required": true
|
||||||
{
|
},
|
||||||
"value": "arweave",
|
{
|
||||||
"title": "Arweave",
|
"value": "arweave",
|
||||||
"label": "Transaction ID",
|
"title": "Arweave",
|
||||||
"placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd",
|
"label": "Transaction ID",
|
||||||
"help": "This Transaction ID will be stored encrypted after publishing.",
|
"placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"help": "This Transaction ID will be stored encrypted after publishing.",
|
||||||
"prominentHelp": true,
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"type": "files",
|
"prominentHelp": true,
|
||||||
"required": true
|
"type": "files",
|
||||||
},
|
"required": true
|
||||||
{
|
},
|
||||||
"value": "url",
|
{
|
||||||
"title": "URL",
|
"value": "url",
|
||||||
"label": "File",
|
"title": "URL",
|
||||||
"placeholder": "e.g. https://file.com/file.json",
|
"label": "File",
|
||||||
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
|
"placeholder": "e.g. https://file.com/file.json",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
|
||||||
"prominentHelp": true,
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"type": "files",
|
"prominentHelp": true,
|
||||||
"required": true
|
"type": "files",
|
||||||
}],
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"sortOptions": false,
|
"sortOptions": false,
|
||||||
"required": true
|
"required": true
|
||||||
},{
|
},
|
||||||
|
{
|
||||||
"name": "links",
|
"name": "links",
|
||||||
"label": "Sample file",
|
"label": "Sample file",
|
||||||
"prominentHelp": false,
|
"prominentHelp": false,
|
||||||
"type": "tabs",
|
"type": "tabs",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"value": "url",
|
"value": "url",
|
||||||
"title": "URL",
|
"title": "URL",
|
||||||
"label": "File",
|
"label": "File",
|
||||||
"placeholder": "e.g. https://file.com/file.json",
|
"placeholder": "e.g. https://file.com/file.json",
|
||||||
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
|
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
|
||||||
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
|
||||||
"prominentHelp": true,
|
"prominentHelp": true,
|
||||||
"type": "files",
|
"type": "files",
|
||||||
"required": false
|
"required": false
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
32
package-lock.json
generated
32
package-lock.json
generated
@ -13,7 +13,7 @@
|
|||||||
"@coingecko/cryptoformat": "^0.5.4",
|
"@coingecko/cryptoformat": "^0.5.4",
|
||||||
"@loadable/component": "^5.15.2",
|
"@loadable/component": "^5.15.2",
|
||||||
"@oceanprotocol/art": "^3.2.0",
|
"@oceanprotocol/art": "^3.2.0",
|
||||||
"@oceanprotocol/lib": "^2.5.2",
|
"@oceanprotocol/lib": "^2.6.0",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@oceanprotocol/use-dark-mode": "^2.4.3",
|
"@oceanprotocol/use-dark-mode": "^2.4.3",
|
||||||
"@tippyjs/react": "^4.2.6",
|
"@tippyjs/react": "^4.2.6",
|
||||||
@ -4591,18 +4591,18 @@
|
|||||||
"integrity": "sha512-I6xoADZpP/8EyN3VWZ+dLYv24DbJj3xzmSDcYv0FolXeAUF3FluzminL5AgQtAaoyUtlHl1D3ij1B++KupWcQQ=="
|
"integrity": "sha512-I6xoADZpP/8EyN3VWZ+dLYv24DbJj3xzmSDcYv0FolXeAUF3FluzminL5AgQtAaoyUtlHl1D3ij1B++KupWcQQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@oceanprotocol/lib": {
|
"node_modules/@oceanprotocol/lib": {
|
||||||
"version": "2.5.2",
|
"version": "2.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.6.0.tgz",
|
||||||
"integrity": "sha512-hLNTS6go1GhpSJt7un1VPb/6XNNYSwGpYPX/O1E5q2XCRWjaWYodzqwxBcgQKw2ihSQmaH9JsDsFLZiIKqKRLA==",
|
"integrity": "sha512-UMWOdJksJO43wzsmyidOjTyGtARw9OKGde6xbunNuRJDLmeYui4OZ0KTwA5yWBSibsqWk4TVAJgXrxW096NJ5g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/contracts": "^1.1.8",
|
"@oceanprotocol/contracts": "^1.1.8",
|
||||||
"bignumber.js": "^9.1.0",
|
"bignumber.js": "^9.1.0",
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"decimal.js": "^10.4.1",
|
"decimal.js": "^10.4.1",
|
||||||
"web3": "^1.8.0",
|
"web3": "^1.8.1",
|
||||||
"web3-core": "^1.8.0",
|
"web3-core": "^1.8.1",
|
||||||
"web3-eth-contract": "^1.8.0"
|
"web3-eth-contract": "^1.8.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"web3": "^1.8.0"
|
"web3": "^1.8.0"
|
||||||
@ -50186,18 +50186,17 @@
|
|||||||
"integrity": "sha512-I6xoADZpP/8EyN3VWZ+dLYv24DbJj3xzmSDcYv0FolXeAUF3FluzminL5AgQtAaoyUtlHl1D3ij1B++KupWcQQ=="
|
"integrity": "sha512-I6xoADZpP/8EyN3VWZ+dLYv24DbJj3xzmSDcYv0FolXeAUF3FluzminL5AgQtAaoyUtlHl1D3ij1B++KupWcQQ=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/lib": {
|
"@oceanprotocol/lib": {
|
||||||
"version": "2.5.2",
|
"version": "2.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.6.0.tgz",
|
||||||
"integrity": "sha512-hLNTS6go1GhpSJt7un1VPb/6XNNYSwGpYPX/O1E5q2XCRWjaWYodzqwxBcgQKw2ihSQmaH9JsDsFLZiIKqKRLA==",
|
"integrity": "sha512-UMWOdJksJO43wzsmyidOjTyGtARw9OKGde6xbunNuRJDLmeYui4OZ0KTwA5yWBSibsqWk4TVAJgXrxW096NJ5g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@oceanprotocol/contracts": "^1.1.8",
|
"@oceanprotocol/contracts": "^1.1.8",
|
||||||
"bignumber.js": "^9.1.0",
|
"bignumber.js": "^9.1.0",
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"decimal.js": "^10.4.1",
|
"decimal.js": "^10.4.1",
|
||||||
"web3": "^1.8.0",
|
"web3-core": "^1.8.1",
|
||||||
"web3-core": "^1.8.0",
|
"web3-eth-contract": "^1.8.1"
|
||||||
"web3-eth-contract": "^1.8.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@oceanprotocol/typographies": {
|
"@oceanprotocol/typographies": {
|
||||||
@ -50256,7 +50255,6 @@
|
|||||||
"integrity": "sha512-rmVKYEsKzurfRU0xJz+iHelbi1LGlihIWZ7Qvmb/CBz1EkhL7nOkW4SVXmG2dA5Ce0si2gr88i6q4eBOMRNJ1w==",
|
"integrity": "sha512-rmVKYEsKzurfRU0xJz+iHelbi1LGlihIWZ7Qvmb/CBz1EkhL7nOkW4SVXmG2dA5Ce0si2gr88i6q4eBOMRNJ1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@oclif/config": "^1.18.2",
|
|
||||||
"@oclif/errors": "^1.3.5",
|
"@oclif/errors": "^1.3.5",
|
||||||
"@oclif/help": "^1.0.1",
|
"@oclif/help": "^1.0.1",
|
||||||
"@oclif/parser": "^3.8.6",
|
"@oclif/parser": "^3.8.6",
|
||||||
@ -61274,7 +61272,7 @@
|
|||||||
"git-url-parse": "11.6.0",
|
"git-url-parse": "11.6.0",
|
||||||
"glob": "8.0.1",
|
"glob": "8.0.1",
|
||||||
"global-agent": "3.0.0",
|
"global-agent": "3.0.0",
|
||||||
"graphql": "15.8.0",
|
"graphql": "14.0.2 - 14.2.0 || ^14.3.1 || ^15.0.0",
|
||||||
"graphql-tag": "2.12.6",
|
"graphql-tag": "2.12.6",
|
||||||
"listr": "0.14.3",
|
"listr": "0.14.3",
|
||||||
"lodash.identity": "3.0.0",
|
"lodash.identity": "3.0.0",
|
||||||
@ -61515,7 +61513,7 @@
|
|||||||
"cosmiconfig": "^7.0.1",
|
"cosmiconfig": "^7.0.1",
|
||||||
"dotenv": "^16.0.0",
|
"dotenv": "^16.0.0",
|
||||||
"glob": "^8.0.0",
|
"glob": "^8.0.0",
|
||||||
"graphql": "15.8.0",
|
"graphql": "14.0.2 - 14.2.0 || ^14.3.1 || ^15.0.0",
|
||||||
"graphql-tag": "^2.10.1",
|
"graphql-tag": "^2.10.1",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"lodash.merge": "^4.6.1",
|
"lodash.merge": "^4.6.1",
|
||||||
@ -74394,7 +74392,6 @@
|
|||||||
"integrity": "sha512-uJx9y/1NIqoYTp6ZW1osJ7U5ZrXGAJbOQ/Qzl05BdGYvN1S7Qmbzid6xOirgK0EIT0pJKEEh1s8qbassYZe4cw==",
|
"integrity": "sha512-uJx9y/1NIqoYTp6ZW1osJ7U5ZrXGAJbOQ/Qzl05BdGYvN1S7Qmbzid6xOirgK0EIT0pJKEEh1s8qbassYZe4cw==",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/core": "^7.14.0",
|
|
||||||
"@babel/plugin-proposal-async-generator-functions": "^7.0.0",
|
"@babel/plugin-proposal-async-generator-functions": "^7.0.0",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
||||||
"@babel/plugin-proposal-export-default-from": "^7.0.0",
|
"@babel/plugin-proposal-export-default-from": "^7.0.0",
|
||||||
@ -74449,7 +74446,6 @@
|
|||||||
"integrity": "sha512-Ogst/M6ujYrl/+9mpEWqE3zF7l2mTuftDTy3L8wZYwX1pWUQWQpfU1aJBeWiLxt1XlIq+uriRjKzKoRoIK57EA==",
|
"integrity": "sha512-Ogst/M6ujYrl/+9mpEWqE3zF7l2mTuftDTy3L8wZYwX1pWUQWQpfU1aJBeWiLxt1XlIq+uriRjKzKoRoIK57EA==",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/core": "^7.14.0",
|
|
||||||
"babel-preset-fbjs": "^3.4.0",
|
"babel-preset-fbjs": "^3.4.0",
|
||||||
"hermes-parser": "0.8.0",
|
"hermes-parser": "0.8.0",
|
||||||
"metro-babel-transformer": "0.72.3",
|
"metro-babel-transformer": "0.72.3",
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"@coingecko/cryptoformat": "^0.5.4",
|
"@coingecko/cryptoformat": "^0.5.4",
|
||||||
"@loadable/component": "^5.15.2",
|
"@loadable/component": "^5.15.2",
|
||||||
"@oceanprotocol/art": "^3.2.0",
|
"@oceanprotocol/art": "^3.2.0",
|
||||||
"@oceanprotocol/lib": "^2.5.2",
|
"@oceanprotocol/lib": "^2.6.0",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@oceanprotocol/use-dark-mode": "^2.4.3",
|
"@oceanprotocol/use-dark-mode": "^2.4.3",
|
||||||
"@tippyjs/react": "^4.2.6",
|
"@tippyjs/react": "^4.2.6",
|
||||||
|
@ -33,6 +33,7 @@ export default function FormStartCompute({
|
|||||||
hasDatatokenSelectedComputeAsset,
|
hasDatatokenSelectedComputeAsset,
|
||||||
datasetSymbol,
|
datasetSymbol,
|
||||||
algorithmSymbol,
|
algorithmSymbol,
|
||||||
|
providerFeesSymbol,
|
||||||
dtSymbolSelectedComputeAsset,
|
dtSymbolSelectedComputeAsset,
|
||||||
dtBalanceSelectedComputeAsset,
|
dtBalanceSelectedComputeAsset,
|
||||||
selectedComputeAssetType,
|
selectedComputeAssetType,
|
||||||
@ -61,6 +62,7 @@ export default function FormStartCompute({
|
|||||||
hasDatatokenSelectedComputeAsset?: boolean
|
hasDatatokenSelectedComputeAsset?: boolean
|
||||||
datasetSymbol?: string
|
datasetSymbol?: string
|
||||||
algorithmSymbol?: string
|
algorithmSymbol?: string
|
||||||
|
providerFeesSymbol?: string
|
||||||
dtSymbolSelectedComputeAsset?: string
|
dtSymbolSelectedComputeAsset?: string
|
||||||
dtBalanceSelectedComputeAsset?: string
|
dtBalanceSelectedComputeAsset?: string
|
||||||
selectedComputeAssetType?: string
|
selectedComputeAssetType?: string
|
||||||
@ -145,7 +147,7 @@ export default function FormStartCompute({
|
|||||||
? new Decimal(providerFeeAmount).toDecimalPlaces(MAX_DECIMALS)
|
? new Decimal(providerFeeAmount).toDecimalPlaces(MAX_DECIMALS)
|
||||||
: new Decimal(0)
|
: new Decimal(0)
|
||||||
|
|
||||||
if (algorithmSymbol === 'OCEAN') {
|
if (algorithmSymbol === providerFeesSymbol) {
|
||||||
let sum = providerFees.add(priceAlgo)
|
let sum = providerFees.add(priceAlgo)
|
||||||
totalPrices.push({
|
totalPrices.push({
|
||||||
value: sum.toDecimalPlaces(MAX_DECIMALS).toString(),
|
value: sum.toDecimalPlaces(MAX_DECIMALS).toString(),
|
||||||
@ -161,7 +163,7 @@ export default function FormStartCompute({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (datasetSymbol === 'OCEAN') {
|
if (datasetSymbol === providerFeesSymbol) {
|
||||||
const sum = providerFees.add(priceDataset)
|
const sum = providerFees.add(priceDataset)
|
||||||
totalPrices.push({
|
totalPrices.push({
|
||||||
value: sum.toDecimalPlaces(MAX_DECIMALS).toString(),
|
value: sum.toDecimalPlaces(MAX_DECIMALS).toString(),
|
||||||
@ -179,7 +181,7 @@ export default function FormStartCompute({
|
|||||||
})
|
})
|
||||||
totalPrices.push({
|
totalPrices.push({
|
||||||
value: providerFees.toDecimalPlaces(MAX_DECIMALS).toString(),
|
value: providerFees.toDecimalPlaces(MAX_DECIMALS).toString(),
|
||||||
symbol: 'OCEAN'
|
symbol: providerFeesSymbol
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
totalPrices.push({
|
totalPrices.push({
|
||||||
@ -188,7 +190,7 @@ export default function FormStartCompute({
|
|||||||
})
|
})
|
||||||
totalPrices.push({
|
totalPrices.push({
|
||||||
value: providerFees.toDecimalPlaces(MAX_DECIMALS).toString(),
|
value: providerFees.toDecimalPlaces(MAX_DECIMALS).toString(),
|
||||||
symbol: 'OCEAN'
|
symbol: providerFeesSymbol
|
||||||
})
|
})
|
||||||
totalPrices.push({
|
totalPrices.push({
|
||||||
value: priceAlgo.toDecimalPlaces(MAX_DECIMALS).toString(),
|
value: priceAlgo.toDecimalPlaces(MAX_DECIMALS).toString(),
|
||||||
@ -211,7 +213,8 @@ export default function FormStartCompute({
|
|||||||
datasetOrderPrice,
|
datasetOrderPrice,
|
||||||
algoOrderPrice,
|
algoOrderPrice,
|
||||||
algorithmSymbol,
|
algorithmSymbol,
|
||||||
datasetSymbol
|
datasetSymbol,
|
||||||
|
providerFeesSymbol
|
||||||
])
|
])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -263,6 +266,7 @@ export default function FormStartCompute({
|
|||||||
datasetOrderPrice={datasetOrderPrice}
|
datasetOrderPrice={datasetOrderPrice}
|
||||||
algoOrderPrice={algoOrderPrice}
|
algoOrderPrice={algoOrderPrice}
|
||||||
providerFeeAmount={providerFeeAmount}
|
providerFeeAmount={providerFeeAmount}
|
||||||
|
providerFeesSymbol={providerFeesSymbol}
|
||||||
validUntil={validUntil}
|
validUntil={validUntil}
|
||||||
totalPrices={totalPrices}
|
totalPrices={totalPrices}
|
||||||
/>
|
/>
|
||||||
|
@ -20,6 +20,7 @@ interface PriceOutputProps {
|
|||||||
datasetOrderPrice?: string
|
datasetOrderPrice?: string
|
||||||
algoOrderPrice?: string
|
algoOrderPrice?: string
|
||||||
providerFeeAmount?: string
|
providerFeeAmount?: string
|
||||||
|
providerFeesSymbol?: string
|
||||||
validUntil?: string
|
validUntil?: string
|
||||||
totalPrices?: totalPriceMap[]
|
totalPrices?: totalPriceMap[]
|
||||||
}
|
}
|
||||||
@ -84,6 +85,7 @@ export default function PriceOutput({
|
|||||||
datasetOrderPrice,
|
datasetOrderPrice,
|
||||||
algoOrderPrice,
|
algoOrderPrice,
|
||||||
providerFeeAmount,
|
providerFeeAmount,
|
||||||
|
providerFeesSymbol,
|
||||||
validUntil,
|
validUntil,
|
||||||
totalPrices
|
totalPrices
|
||||||
}: PriceOutputProps): ReactElement {
|
}: PriceOutputProps): ReactElement {
|
||||||
@ -134,7 +136,7 @@ export default function PriceOutput({
|
|||||||
<Row
|
<Row
|
||||||
price={providerFeeAmount} // initializeCompute.provider fee amount
|
price={providerFeeAmount} // initializeCompute.provider fee amount
|
||||||
timeout={`${validUntil} seconds`} // valid until value
|
timeout={`${validUntil} seconds`} // valid until value
|
||||||
symbol={'OCEAN'} // we assume that provider fees will always be in OCEAN token
|
symbol={providerFeesSymbol} // we assume that provider fees will always be in OCEAN token
|
||||||
sign="+"
|
sign="+"
|
||||||
type="C2D RESOURCES"
|
type="C2D RESOURCES"
|
||||||
/>
|
/>
|
||||||
|
@ -12,7 +12,8 @@ import {
|
|||||||
ComputeAlgorithm,
|
ComputeAlgorithm,
|
||||||
ComputeOutput,
|
ComputeOutput,
|
||||||
ProviderComputeInitializeResults,
|
ProviderComputeInitializeResults,
|
||||||
unitsToAmount
|
unitsToAmount,
|
||||||
|
minAbi
|
||||||
} from '@oceanprotocol/lib'
|
} from '@oceanprotocol/lib'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import Price from '@shared/Price'
|
import Price from '@shared/Price'
|
||||||
@ -61,7 +62,7 @@ export default function Compute({
|
|||||||
fileIsLoading?: boolean
|
fileIsLoading?: boolean
|
||||||
consumableFeedback?: string
|
consumableFeedback?: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { accountId, web3, isSupportedOceanNetwork } = useWeb3()
|
const { accountId, web3, isSupportedOceanNetwork, networkId } = useWeb3()
|
||||||
const { chainIds } = useUserPreferences()
|
const { chainIds } = useUserPreferences()
|
||||||
const { isAssetNetwork } = useAsset()
|
const { isAssetNetwork } = useAsset()
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ export default function Compute({
|
|||||||
const [initializedProviderResponse, setInitializedProviderResponse] =
|
const [initializedProviderResponse, setInitializedProviderResponse] =
|
||||||
useState<ProviderComputeInitializeResults>()
|
useState<ProviderComputeInitializeResults>()
|
||||||
const [providerFeeAmount, setProviderFeeAmount] = useState<string>('0')
|
const [providerFeeAmount, setProviderFeeAmount] = useState<string>('0')
|
||||||
|
const [providerFeesSymbol, setProviderFeesSymbol] = useState<string>('OCEAN')
|
||||||
const [computeValidUntil, setComputeValidUntil] = useState<string>('0')
|
const [computeValidUntil, setComputeValidUntil] = useState<string>('0')
|
||||||
const [datasetOrderPriceAndFees, setDatasetOrderPriceAndFees] =
|
const [datasetOrderPriceAndFees, setDatasetOrderPriceAndFees] =
|
||||||
useState<OrderPriceAndFees>()
|
useState<OrderPriceAndFees>()
|
||||||
@ -160,6 +162,18 @@ export default function Compute({
|
|||||||
|
|
||||||
setProviderFeeAmount(feeAmount)
|
setProviderFeeAmount(feeAmount)
|
||||||
|
|
||||||
|
const datatoken = new Datatoken(
|
||||||
|
await getDummyWeb3(asset?.chainId),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
minAbi
|
||||||
|
)
|
||||||
|
setProviderFeesSymbol(
|
||||||
|
await datatoken.getSymbol(
|
||||||
|
initializedProvider?.datasets?.[0]?.providerFee?.providerFeeToken
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
const computeDuration = (
|
const computeDuration = (
|
||||||
parseInt(initializedProvider?.datasets?.[0]?.providerFee?.validUntil) -
|
parseInt(initializedProvider?.datasets?.[0]?.providerFee?.validUntil) -
|
||||||
Math.floor(Date.now() / 1000)
|
Math.floor(Date.now() / 1000)
|
||||||
@ -466,11 +480,15 @@ export default function Compute({
|
|||||||
assetTimeout={secondsToString(asset?.services[0].timeout)}
|
assetTimeout={secondsToString(asset?.services[0].timeout)}
|
||||||
hasPreviousOrderSelectedComputeAsset={!!validAlgorithmOrderTx}
|
hasPreviousOrderSelectedComputeAsset={!!validAlgorithmOrderTx}
|
||||||
hasDatatokenSelectedComputeAsset={hasAlgoAssetDatatoken}
|
hasDatatokenSelectedComputeAsset={hasAlgoAssetDatatoken}
|
||||||
datasetSymbol={asset?.accessDetails?.baseToken?.symbol || 'OCEAN'}
|
datasetSymbol={
|
||||||
|
asset?.accessDetails?.baseToken?.symbol ||
|
||||||
|
(asset?.chainId === 137 ? 'mOCEAN' : 'OCEAN')
|
||||||
|
}
|
||||||
algorithmSymbol={
|
algorithmSymbol={
|
||||||
selectedAlgorithmAsset?.accessDetails?.baseToken?.symbol ||
|
selectedAlgorithmAsset?.accessDetails?.baseToken?.symbol ||
|
||||||
'OCEAN'
|
(selectedAlgorithmAsset?.chainId === 137 ? 'mOCEAN' : 'OCEAN')
|
||||||
}
|
}
|
||||||
|
providerFeesSymbol={providerFeesSymbol}
|
||||||
dtSymbolSelectedComputeAsset={
|
dtSymbolSelectedComputeAsset={
|
||||||
selectedAlgorithmAsset?.datatokens[0]?.symbol
|
selectedAlgorithmAsset?.datatokens[0]?.symbol
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user