├── .gitignore
├── README.md
├── assets
└── examples
│ ├── vcs-1427-1.json
│ ├── vcs-1427-2.json
│ ├── vcs-1427-3.json
│ └── vcs-1427-4.js
├── backend
├── head-sync
│ ├── configs
│ │ └── configs
│ ├── go.mod
│ ├── go.sum
│ ├── helpers
│ │ ├── configs.go
│ │ ├── logs.go
│ │ └── postgresql.go
│ └── main.go
├── indexer
│ ├── configs
│ │ └── configs
│ ├── go.mod
│ ├── go.sum
│ ├── helpers
│ │ ├── configs.go
│ │ ├── logs.go
│ │ └── postgresql.go
│ └── main.go
├── pinning
│ ├── configs
│ │ └── configs
│ ├── go.mod
│ ├── go.sum
│ ├── helpers
│ │ ├── configs.go
│ │ ├── helpers.go
│ │ ├── http_client.go
│ │ ├── logs.go
│ │ └── postgresql.go
│ └── main.go
├── postgres
│ ├── 01.install.sql
│ ├── 02.helpers.sql
│ ├── 03.01.auth-alteration-1.sql
│ ├── 03.auth.sql
│ ├── 04.01.head-alteration-1.sql
│ ├── 04.head.sql
│ ├── 05.01.scraper-alteration-1.sql
│ ├── 05.02.scraper-alteration-1.sql
│ ├── 05.03.scraper-alteration-1.sql
│ ├── 05.scraper.sql
│ ├── 06.estuary.sql
│ ├── 07.pinning.sql
│ ├── 08.bacalhau.sql
│ ├── 09.functions.sql
│ └── 10.pipelines.sql
└── rest-api
│ ├── api
│ └── api.go
│ ├── configs
│ └── configs
│ ├── go.mod
│ ├── go.sum
│ ├── internal
│ ├── configs.go
│ ├── helpers.go
│ ├── logs.go
│ └── postgresql.go
│ └── main.go
├── cli
├── .env.example
├── README.md
├── assets
│ ├── Virtuzone___UAE_Corporate_Tax_Guide_2023.pdf
│ ├── test document.pdf
│ ├── test image.jpg
│ └── test.zip
├── package.json
└── src
│ └── examples
│ ├── add_asset.js
│ ├── add_asset_with_nested_assets.js
│ ├── add_asset_with_nested_template.js
│ ├── add_big_asset.js
│ ├── add_template.js
│ ├── authenticate.js
│ ├── create_invalid_dag-pb.js
│ ├── get_account.js
│ ├── get_accounts.js
│ ├── get_asset.js
│ ├── get_raw_data.js
│ ├── get_template.js
│ ├── search.js
│ ├── search_assets.js
│ ├── search_templates.js
│ ├── serialize_dag_cbor.js
│ └── sign_cid.js
├── client
├── decarbonize.travel
│ ├── .babelrc
│ ├── .env.example
│ ├── LICENSE
│ ├── README.md
│ ├── assets
│ │ ├── Brave-logo-color-RGB.svg
│ │ ├── metamask-fox.svg
│ │ ├── unverified.png
│ │ └── verified.png
│ ├── package.json
│ ├── public
│ │ └── index.html
│ ├── src
│ │ ├── components
│ │ │ ├── asset
│ │ │ │ └── Asset.vue
│ │ │ ├── helpers
│ │ │ │ ├── FormElements.vue
│ │ │ │ ├── Header.vue
│ │ │ │ ├── JsonEditor.vue
│ │ │ │ └── LoadingBlocker.vue
│ │ │ └── template
│ │ │ │ └── Template.vue
│ │ ├── fonts
│ │ │ └── OpenSans
│ │ │ │ ├── OpenSans-Bold.ttf
│ │ │ │ ├── OpenSans-BoldItalic.ttf
│ │ │ │ ├── OpenSans-ExtraBold.ttf
│ │ │ │ ├── OpenSans-ExtraBoldItalic.ttf
│ │ │ │ ├── OpenSans-Italic.ttf
│ │ │ │ ├── OpenSans-Light.ttf
│ │ │ │ ├── OpenSans-LightItalic.ttf
│ │ │ │ ├── OpenSans-Medium.ttf
│ │ │ │ ├── OpenSans-MediumItalic.ttf
│ │ │ │ ├── OpenSans-Regular.ttf
│ │ │ │ ├── OpenSans-SemiBold.ttf
│ │ │ │ ├── OpenSans-SemiBoldItalic.ttf
│ │ │ │ └── font.scss
│ │ ├── js
│ │ │ ├── asset
│ │ │ │ └── asset.js
│ │ │ ├── helpers
│ │ │ │ ├── form-elements.js
│ │ │ │ ├── header.js
│ │ │ │ ├── json-editor.js
│ │ │ │ └── loading-blocker.js
│ │ │ ├── router.js
│ │ │ └── template
│ │ │ │ └── template.js
│ │ ├── locales
│ │ │ └── en_GB.js
│ │ ├── mixins
│ │ │ ├── authentication
│ │ │ │ └── authentication.js
│ │ │ ├── clipboard
│ │ │ │ └── copy-to-clipboard.js
│ │ │ ├── cookie
│ │ │ │ └── cookie.js
│ │ │ ├── delay
│ │ │ │ └── delay.js
│ │ │ ├── error
│ │ │ │ └── print.js
│ │ │ ├── file
│ │ │ │ └── human-readable-file-size.js
│ │ │ ├── form-elements
│ │ │ │ ├── sync-form-files.js
│ │ │ │ └── update-form.js
│ │ │ ├── i18n
│ │ │ │ └── language.js
│ │ │ ├── ipfs
│ │ │ │ ├── cid-obj-to-str.js
│ │ │ │ ├── determine-template-type-and-keys.js
│ │ │ │ ├── ensure-ipfs-is-running.js
│ │ │ │ ├── fg-storage.js
│ │ │ │ └── normalize-schema-fields.js
│ │ │ └── router
│ │ │ │ └── navigate.js
│ │ ├── scss
│ │ │ ├── asset
│ │ │ │ └── asset.scss
│ │ │ ├── components
│ │ │ │ └── vue-json-pretty
│ │ │ │ │ └── styles.css
│ │ │ ├── helpers
│ │ │ │ ├── form-elements.scss
│ │ │ │ ├── header.scss
│ │ │ │ ├── json-editor.scss
│ │ │ │ └── loading-blocker.scss
│ │ │ ├── router.scss
│ │ │ └── template
│ │ │ │ └── template.scss
│ │ └── stores
│ │ │ └── main.js
│ └── webpack.config.js
├── form
│ ├── .babelrc
│ ├── .env.example
│ ├── LICENSE
│ ├── README.md
│ ├── assets
│ │ ├── Brave-logo-color-RGB.svg
│ │ ├── metamask-fox.svg
│ │ ├── unverified.png
│ │ └── verified.png
│ ├── package.json
│ ├── public
│ │ └── index.html
│ ├── src
│ │ ├── components
│ │ │ ├── asset
│ │ │ │ └── Asset.vue
│ │ │ ├── helpers
│ │ │ │ ├── FormElements.vue
│ │ │ │ ├── Header.vue
│ │ │ │ ├── JsonEditor.vue
│ │ │ │ └── LoadingBlocker.vue
│ │ │ └── template
│ │ │ │ └── Template.vue
│ │ ├── fonts
│ │ │ └── OpenSans
│ │ │ │ ├── OpenSans-Bold.ttf
│ │ │ │ ├── OpenSans-BoldItalic.ttf
│ │ │ │ ├── OpenSans-ExtraBold.ttf
│ │ │ │ ├── OpenSans-ExtraBoldItalic.ttf
│ │ │ │ ├── OpenSans-Italic.ttf
│ │ │ │ ├── OpenSans-Light.ttf
│ │ │ │ ├── OpenSans-LightItalic.ttf
│ │ │ │ ├── OpenSans-Medium.ttf
│ │ │ │ ├── OpenSans-MediumItalic.ttf
│ │ │ │ ├── OpenSans-Regular.ttf
│ │ │ │ ├── OpenSans-SemiBold.ttf
│ │ │ │ ├── OpenSans-SemiBoldItalic.ttf
│ │ │ │ └── font.scss
│ │ ├── js
│ │ │ ├── asset
│ │ │ │ └── asset.js
│ │ │ ├── helpers
│ │ │ │ ├── form-elements.js
│ │ │ │ ├── header.js
│ │ │ │ ├── json-editor.js
│ │ │ │ └── loading-blocker.js
│ │ │ ├── router.js
│ │ │ └── template
│ │ │ │ └── template.js
│ │ ├── locales
│ │ │ └── en_GB.js
│ │ ├── mixins
│ │ │ ├── authentication
│ │ │ │ └── authentication.js
│ │ │ ├── clipboard
│ │ │ │ └── copy-to-clipboard.js
│ │ │ ├── cookie
│ │ │ │ └── cookie.js
│ │ │ ├── delay
│ │ │ │ └── delay.js
│ │ │ ├── error
│ │ │ │ └── print.js
│ │ │ ├── file
│ │ │ │ └── human-readable-file-size.js
│ │ │ ├── form-elements
│ │ │ │ ├── sync-form-files.js
│ │ │ │ └── update-form.js
│ │ │ ├── i18n
│ │ │ │ └── language.js
│ │ │ ├── ipfs
│ │ │ │ ├── cid-obj-to-str.js
│ │ │ │ ├── determine-template-type-and-keys.js
│ │ │ │ ├── ensure-ipfs-is-running.js
│ │ │ │ ├── fg-storage.js
│ │ │ │ └── normalize-schema-fields.js
│ │ │ └── router
│ │ │ │ └── navigate.js
│ │ ├── scss
│ │ │ ├── asset
│ │ │ │ └── asset.scss
│ │ │ ├── components
│ │ │ │ └── vue-json-pretty
│ │ │ │ │ └── styles.css
│ │ │ ├── helpers
│ │ │ │ ├── form-elements.scss
│ │ │ │ ├── header.scss
│ │ │ │ ├── json-editor.scss
│ │ │ │ └── loading-blocker.scss
│ │ │ ├── router.scss
│ │ │ └── template
│ │ │ │ └── template.scss
│ │ └── stores
│ │ │ └── main.js
│ └── webpack.config.js
├── landing-page
│ ├── .babelrc
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ └── index.html
│ ├── src
│ │ ├── components
│ │ │ ├── helpers
│ │ │ │ └── Header.vue
│ │ │ └── main
│ │ │ │ └── Main.vue
│ │ ├── fonts
│ │ │ └── OpenSans
│ │ │ │ ├── OpenSans-Bold 2.ttf
│ │ │ │ ├── OpenSans-Bold.ttf
│ │ │ │ ├── OpenSans-BoldItalic 2.ttf
│ │ │ │ ├── OpenSans-BoldItalic.ttf
│ │ │ │ ├── OpenSans-ExtraBold 2.ttf
│ │ │ │ ├── OpenSans-ExtraBold.ttf
│ │ │ │ ├── OpenSans-ExtraBoldItalic 2.ttf
│ │ │ │ ├── OpenSans-ExtraBoldItalic.ttf
│ │ │ │ ├── OpenSans-Italic 2.ttf
│ │ │ │ ├── OpenSans-Italic.ttf
│ │ │ │ ├── OpenSans-Light 2.ttf
│ │ │ │ ├── OpenSans-Light.ttf
│ │ │ │ ├── OpenSans-LightItalic 2.ttf
│ │ │ │ ├── OpenSans-LightItalic.ttf
│ │ │ │ ├── OpenSans-Medium.ttf
│ │ │ │ ├── OpenSans-MediumItalic.ttf
│ │ │ │ ├── OpenSans-Regular.ttf
│ │ │ │ ├── OpenSans-SemiBold 2.ttf
│ │ │ │ ├── OpenSans-SemiBold.ttf
│ │ │ │ ├── OpenSans-SemiBoldItalic.ttf
│ │ │ │ └── font.scss
│ │ ├── js
│ │ │ ├── helpers
│ │ │ │ ├── header 2.js
│ │ │ │ └── header.js
│ │ │ ├── main
│ │ │ │ ├── main 2.js
│ │ │ │ └── main.js
│ │ │ └── router.js
│ │ ├── locales
│ │ │ └── en_GB.js
│ │ ├── mixins
│ │ │ └── i18n
│ │ │ │ └── language.js
│ │ ├── scss
│ │ │ ├── helpers
│ │ │ │ ├── header 2.scss
│ │ │ │ └── header.scss
│ │ │ ├── main
│ │ │ │ └── main.scss
│ │ │ └── router.scss
│ │ └── stores
│ │ │ └── main.js
│ └── webpack.config.js
├── pipeline-inspector
│ ├── .babelrc
│ ├── .env.example
│ ├── LICENSE
│ ├── README.md
│ ├── assets
│ │ ├── Brave-logo-color-RGB.svg
│ │ └── metamask-fox.svg
│ ├── package.json
│ ├── public
│ │ └── index.html
│ ├── src
│ │ ├── components
│ │ │ ├── helpers
│ │ │ │ ├── Header.vue
│ │ │ │ └── LoadingBlocker.vue
│ │ │ └── pipelines
│ │ │ │ └── Pipelines.vue
│ │ ├── fonts
│ │ │ └── OpenSans
│ │ │ │ ├── OpenSans-Bold.ttf
│ │ │ │ ├── OpenSans-BoldItalic.ttf
│ │ │ │ ├── OpenSans-ExtraBold.ttf
│ │ │ │ ├── OpenSans-ExtraBoldItalic.ttf
│ │ │ │ ├── OpenSans-Italic.ttf
│ │ │ │ ├── OpenSans-Light.ttf
│ │ │ │ ├── OpenSans-LightItalic.ttf
│ │ │ │ ├── OpenSans-Medium.ttf
│ │ │ │ ├── OpenSans-MediumItalic.ttf
│ │ │ │ ├── OpenSans-Regular.ttf
│ │ │ │ ├── OpenSans-SemiBold.ttf
│ │ │ │ ├── OpenSans-SemiBoldItalic.ttf
│ │ │ │ └── font.scss
│ │ ├── js
│ │ │ ├── helpers
│ │ │ │ ├── header.js
│ │ │ │ └── loading-blocker.js
│ │ │ ├── pipelines
│ │ │ │ └── pipelines.js
│ │ │ └── router.js
│ │ ├── locales
│ │ │ └── en_GB.js
│ │ ├── mixins
│ │ │ ├── api
│ │ │ │ ├── api-profile.js
│ │ │ │ └── get-token.js
│ │ │ ├── authentication
│ │ │ │ └── authentication.js
│ │ │ ├── clipboard
│ │ │ │ └── copy-to-clipboard.js
│ │ │ ├── cookie
│ │ │ │ └── cookie.js
│ │ │ ├── delay
│ │ │ │ └── delay.js
│ │ │ ├── error
│ │ │ │ └── print.js
│ │ │ ├── file
│ │ │ │ └── human-readable-file-size.js
│ │ │ ├── form-elements
│ │ │ │ ├── list-elements-group-by.js
│ │ │ │ ├── sync-form-files.js
│ │ │ │ └── update-form.js
│ │ │ ├── i18n
│ │ │ │ └── language.js
│ │ │ ├── ipfs
│ │ │ │ ├── cid-obj-to-str.js
│ │ │ │ ├── determine-template-type-and-keys.js
│ │ │ │ ├── ensure-ipfs-is-running.js
│ │ │ │ ├── fg-storage.js
│ │ │ │ └── normalize-schema-fields.js
│ │ │ ├── provenance
│ │ │ │ └── provenance.js
│ │ │ └── router
│ │ │ │ └── navigate.js
│ │ ├── scss
│ │ │ ├── components
│ │ │ │ └── vue-json-pretty
│ │ │ │ │ └── styles.css
│ │ │ ├── helpers
│ │ │ │ ├── header.scss
│ │ │ │ └── loading-blocker.scss
│ │ │ ├── pipelines
│ │ │ │ └── pipelines.scss
│ │ │ └── router.scss
│ │ └── stores
│ │ │ └── main.js
│ └── webpack.config.js
└── web
│ ├── .babelrc
│ ├── .env.example
│ ├── LICENSE
│ ├── README.md
│ ├── assets
│ ├── Bacalhau-WA.png
│ ├── Bacalhau-WA.xcf
│ ├── Toucan.json
│ ├── account.png
│ ├── acr.json
│ ├── attribution-account.txt
│ ├── attribution-bulb.txt
│ ├── attribution-ecology.txt
│ ├── attribution-environment.txt
│ ├── attribution-planet-earth.txt
│ ├── attribution-private-key.txt
│ ├── attribution-theme.txt
│ ├── bulb.png
│ ├── contract.png
│ ├── ecology.png
│ ├── environment.png
│ ├── gold-standard.json
│ ├── planet-earth.png
│ ├── private-key.png
│ ├── programmer.png
│ ├── theme.png
│ └── verra.json
│ ├── package.json
│ ├── public
│ └── index.html
│ ├── src
│ ├── components
│ │ ├── about
│ │ │ └── About.vue
│ │ ├── assets
│ │ │ └── Assets.vue
│ │ ├── dashboard
│ │ │ └── Dashboard.vue
│ │ ├── functions
│ │ │ └── Functions.vue
│ │ ├── helpers
│ │ │ ├── Contributor.vue
│ │ │ ├── FormElements.vue
│ │ │ ├── Header.vue
│ │ │ ├── JsonEditor.vue
│ │ │ └── LoadingBlocker.vue
│ │ ├── main
│ │ │ └── Main.vue
│ │ ├── pipelines
│ │ │ ├── CreatePipeline.vue
│ │ │ └── Pipelines.vue
│ │ ├── profile
│ │ │ └── Profile.vue
│ │ └── templates
│ │ │ └── Templates.vue
│ ├── fonts
│ │ └── OpenSans
│ │ │ ├── OpenSans-Bold.ttf
│ │ │ ├── OpenSans-BoldItalic.ttf
│ │ │ ├── OpenSans-ExtraBold.ttf
│ │ │ ├── OpenSans-ExtraBoldItalic.ttf
│ │ │ ├── OpenSans-Italic.ttf
│ │ │ ├── OpenSans-Light.ttf
│ │ │ ├── OpenSans-LightItalic.ttf
│ │ │ ├── OpenSans-Medium.ttf
│ │ │ ├── OpenSans-MediumItalic.ttf
│ │ │ ├── OpenSans-Regular.ttf
│ │ │ ├── OpenSans-SemiBold.ttf
│ │ │ ├── OpenSans-SemiBoldItalic.ttf
│ │ │ └── font.scss
│ ├── index.js
│ ├── js
│ │ ├── about
│ │ │ └── about.js
│ │ ├── assets
│ │ │ └── assets.js
│ │ ├── dashboard
│ │ │ └── dashboard.js
│ │ ├── functions
│ │ │ └── functions.js
│ │ ├── helpers
│ │ │ ├── contributor.js
│ │ │ ├── form-elements.js
│ │ │ ├── header.js
│ │ │ ├── json-editor.js
│ │ │ └── loading-blocker.js
│ │ ├── main
│ │ │ └── main.js
│ │ ├── pipelines
│ │ │ ├── create-pipeline.js
│ │ │ └── pipelines.js
│ │ ├── profile
│ │ │ └── profile.js
│ │ ├── router.js
│ │ └── templates
│ │ │ └── templates.js
│ ├── locales
│ │ └── en_GB.js
│ ├── mixins
│ │ ├── api
│ │ │ ├── api-profile.js
│ │ │ └── get-token.js
│ │ ├── authentication
│ │ │ └── authentication.js
│ │ ├── clipboard
│ │ │ └── copy-to-clipboard.js
│ │ ├── cookie
│ │ │ └── cookie.js
│ │ ├── delay
│ │ │ └── delay.js
│ │ ├── error
│ │ │ └── print.js
│ │ ├── file
│ │ │ └── human-readable-file-size.js
│ │ ├── form-elements
│ │ │ ├── list-elements-group-by.js
│ │ │ ├── sync-form-files.js
│ │ │ └── update-form.js
│ │ ├── i18n
│ │ │ └── language.js
│ │ ├── ipfs
│ │ │ ├── cid-obj-to-str.js
│ │ │ ├── determine-template-type-and-keys.js
│ │ │ ├── ensure-ipfs-is-running.js
│ │ │ ├── fg-storage.js
│ │ │ └── normalize-schema-fields.js
│ │ ├── provenance
│ │ │ └── provenance.js
│ │ └── router
│ │ │ └── navigate.js
│ ├── scss
│ │ ├── about
│ │ │ └── about.scss
│ │ ├── assets
│ │ │ └── assets.scss
│ │ ├── components
│ │ │ └── vue-json-pretty
│ │ │ │ └── styles.css
│ │ ├── dashboard
│ │ │ └── dashboard.scss
│ │ ├── functions
│ │ │ └── functions.scss
│ │ ├── helpers
│ │ │ ├── contributor.scss
│ │ │ ├── form-elements.scss
│ │ │ ├── header.scss
│ │ │ ├── json-editor.scss
│ │ │ └── loading-blocker.scss
│ │ ├── main
│ │ │ └── main.scss
│ │ ├── pipelines
│ │ │ ├── create-pipeline.scss
│ │ │ └── pipelines.scss
│ │ ├── profile
│ │ │ └── profile.scss
│ │ ├── router.scss
│ │ └── templates
│ │ │ └── templates.scss
│ └── stores
│ │ └── main.js
│ └── webpack.config.js
├── co2-storage.png
├── functions
├── bacalhau
│ └── travel-decarbonization
│ │ └── v0
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── inputs
│ │ └── asset
│ │ ├── main.go
│ │ ├── outputs
│ │ ├── Driving Emissions (kg CO2)
│ │ ├── Emissions Description
│ │ ├── Flying Emissions (kg CO2)
│ │ ├── Net Zero
│ │ ├── Offset Amount (kg CO2e)
│ │ ├── Offset Chain
│ │ ├── Offset Transaction Hash
│ │ ├── Total Emissions (kg CO2)
│ │ └── travel-emissions.json
│ │ └── wasm
│ │ └── main.wasm
└── docker
│ ├── inputs
│ ├── 1.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── 5.jpg
│ ├── 6.jpg
│ ├── 7.jpg
│ ├── 8.jpg
│ ├── 9.jpg
│ └── Sunda-pangolin.jpg
│ └── outputs
│ ├── preds1.json
│ ├── preds2.json
│ └── preds3.json
├── js-api
├── README.md
├── package.json
└── src
│ └── js
│ ├── auth
│ └── Auth.js
│ ├── helpers
│ ├── Common.js
│ ├── Estuary.js
│ └── FG.js
│ ├── index.js
│ └── storage
│ └── FGStorage.js
├── node
├── install.sh
└── install.sh.original
└── signing-records
└── contracts
├── CO2storageCidSignatureVerifier.sol
├── CO2storageMessageSignatureVerifier.sol
└── CO2storageProvenanceMessageSignatureVerifier.sol
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.DS_Store
2 | **/libs/
3 | **/logs/
4 | **/.settings
5 | **/.htaccess
6 | **/.project
7 | **/favicon.ico
8 | **/humans.txt
9 | **/robots.txt
10 | **/.buildpath
11 | **/node_modules/
12 | **/dist/
13 | **/npm-debug.log*
14 | **/yarn-debug.log*
15 | **/yarn-error.log*
16 | **/test/unit/coverage/
17 | **/test/e2e/reports/
18 | **/selenium-debug.log
19 | **/.sass-cache
20 | **/target
21 | **/package-lock.json
22 | **/*.code-workspace
23 | **/.env
24 | **/.env.local
25 | **/.env.dev
26 | **/.env.prod
27 | **/.env.development
28 | **/.env.production
29 | **/*.key
30 | **/*.ext
31 | **/*.csr
32 | **/*.crt
33 | **/*.srl
34 | **/*.pem
35 |
36 | # Editor directories and files
37 | **/.idea
38 | **/.vscode
39 | **/*.suo
40 | **/*.ntvs*
41 | **/*.njsproj
42 | **/*.sln
43 |
--------------------------------------------------------------------------------
/assets/examples/vcs-1427-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "code": "VCS",
3 | "statistics": [
4 | {
5 | "code": "issued",
6 | "value": "961909151"
7 | },
8 | {
9 | "code": "retired",
10 | "value": "500893492"
11 | },
12 | {
13 | "code": "resourcesRegistered",
14 | "value": "1807"
15 | },
16 | {
17 | "code": "resourcesRegisteredWithCertificatesIssued",
18 | "value": "1482"
19 | },
20 | {
21 | "code": "resourcesRegisteredWithoutCertificatesIssued",
22 | "value": "325"
23 | },
24 | {
25 | "code": "resourcesBufferCreditsDeposited",
26 | "value": "63284391"
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/backend/head-sync/configs/configs:
--------------------------------------------------------------------------------
1 | [postgresql]
2 | postgresql_host = localhost
3 | postgresql_port = 5432
4 | postgresql_database = co2_storage
5 | postgresql_user = co2_storage
6 | postgresql_password = DATABASE_PASSWORD
7 |
8 | [log]
9 | logfile = logs/log
10 |
--------------------------------------------------------------------------------
/backend/head-sync/helpers/configs.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "bufio"
5 | "io"
6 | "os"
7 | "strings"
8 | )
9 |
10 | type Config map[string]string
11 |
12 | func ReadConfigs(path string) (Config, error) {
13 | // init config
14 | config := Config{
15 | "file": path,
16 | }
17 |
18 | // return error if config filepath is not provided
19 | if len(path) == 0 {
20 | return config, nil
21 | }
22 |
23 | // open configs file
24 | file, err := os.Open(path)
25 | if err != nil {
26 | return nil, err
27 | }
28 | defer file.Close()
29 |
30 | // instatiate new reader
31 | reader := bufio.NewReader(file)
32 |
33 | // parse through config file
34 | for {
35 | line, err := reader.ReadString('\n')
36 |
37 | // check line for '=' delimiter
38 | if equal := strings.Index(line, "="); equal >= 0 {
39 | // extract key
40 | if key := strings.TrimSpace(line[:equal]); len(key) > 0 {
41 | // init value
42 | value := ""
43 | if len(line) > equal {
44 | // assign value if not empty
45 | value = strings.TrimSpace(line[equal+1:])
46 | }
47 |
48 | // assign the config map
49 | config[key] = value
50 | }
51 | }
52 |
53 | // process errors
54 | if err == io.EOF {
55 | break
56 | }
57 | if err != nil {
58 | return nil, err
59 | }
60 | }
61 |
62 | return config, nil
63 | }
64 |
--------------------------------------------------------------------------------
/backend/head-sync/helpers/logs.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "os"
5 |
6 | log "github.com/sirupsen/logrus"
7 | )
8 |
9 | func WriteLog(level string, message string, category string) {
10 | // provide configs file path
11 | confsPath := "configs/configs"
12 |
13 | // init config
14 | config := Config{
15 | "file": confsPath,
16 | }
17 |
18 | // read configs
19 | config, rcerr := ReadConfigs(confsPath)
20 |
21 | if rcerr != nil {
22 | panic(rcerr)
23 | }
24 |
25 | // open log file
26 | file, logerr := os.OpenFile(config["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
27 | if logerr != nil {
28 | panic(logerr)
29 | }
30 | defer file.Close()
31 |
32 | // set log output to log file
33 | log.SetOutput(file)
34 |
35 | // set formatter
36 | log.SetFormatter(&log.JSONFormatter{})
37 |
38 | // log message into a log file
39 | switch level {
40 | case "trace":
41 | log.WithFields(log.Fields{
42 | "category": category,
43 | }).Trace(message)
44 | case "debug":
45 | log.WithFields(log.Fields{
46 | "category": category,
47 | }).Debug(message)
48 | case "info":
49 | log.WithFields(log.Fields{
50 | "category": category,
51 | }).Info(message)
52 | case "warn":
53 | log.WithFields(log.Fields{
54 | "category": category,
55 | }).Warn(message)
56 | case "error":
57 | log.WithFields(log.Fields{
58 | "category": category,
59 | }).Error(message)
60 | case "fatal":
61 | log.WithFields(log.Fields{
62 | "category": category,
63 | }).Fatal(message)
64 | case "panic":
65 | log.WithFields(log.Fields{
66 | "category": category,
67 | }).Panic(message)
68 | default:
69 | log.WithFields(log.Fields{
70 | "category": category,
71 | }).Info(message)
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/backend/head-sync/helpers/postgresql.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "os"
7 |
8 | "github.com/jackc/pgx/v4/log/logrusadapter"
9 | "github.com/jackc/pgx/v4/pgxpool"
10 | log "github.com/sirupsen/logrus"
11 | )
12 |
13 | func DbInit(host string, port int, user string,
14 | password string, dbname string) (*pgxpool.Pool, error) {
15 | psqlconn := fmt.Sprintf("postgres://%s:%s@%s:%d/%s", user, password, host, port, dbname)
16 |
17 | // provide configs file path
18 | confsPath := "configs/configs"
19 |
20 | // init config
21 | confs := Config{
22 | "file": confsPath,
23 | }
24 |
25 | // read configs
26 | confs, rcerr := ReadConfigs(confsPath)
27 |
28 | if rcerr != nil {
29 | panic(rcerr)
30 | }
31 |
32 | // open log file
33 | logFile, logErr := os.OpenFile(confs["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
34 | if logErr != nil {
35 | fmt.Fprintf(os.Stderr, "Unable to opent log file: %v\n", logErr)
36 | os.Exit(1)
37 | }
38 |
39 | pgxPoolConfig, pgxPoolConfigErr := pgxpool.ParseConfig(psqlconn)
40 | if pgxPoolConfigErr != nil {
41 | fmt.Fprintf(os.Stderr, "Unable to parse pgxPoolConfig: %v\n", pgxPoolConfigErr)
42 | os.Exit(1)
43 | }
44 |
45 | logger := &log.Logger{
46 | Out: logFile,
47 | Formatter: new(log.JSONFormatter),
48 | Hooks: make(log.LevelHooks),
49 | Level: log.InfoLevel,
50 | ExitFunc: os.Exit,
51 | ReportCaller: false,
52 | }
53 |
54 | pgxPoolConfig.ConnConfig.Logger = logrusadapter.NewLogger(logger)
55 |
56 | db, err := pgxpool.ConnectConfig(context.Background(), pgxPoolConfig)
57 |
58 | if err != nil {
59 | fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
60 | os.Exit(1)
61 | }
62 |
63 | return db, nil
64 | }
65 |
--------------------------------------------------------------------------------
/backend/indexer/configs/configs:
--------------------------------------------------------------------------------
1 | [postgresql]
2 | postgresql_host = localhost
3 | postgresql_port = 5432
4 | postgresql_database = co2_storage
5 | postgresql_user = co2_storage
6 | postgresql_password = DATABASE_PASSWORD
7 |
8 | [log]
9 | logfile = logs/log
10 |
11 | [scheduler]
12 | scrape_ipfs_every = @every 5s
13 |
14 | [ipfs]
15 | ipfs_node = /ip4/127.0.0.1/tcp/5001
16 |
--------------------------------------------------------------------------------
/backend/indexer/helpers/configs.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "bufio"
5 | "io"
6 | "os"
7 | "strings"
8 | )
9 |
10 | type Config map[string]string
11 |
12 | func ReadConfigs(path string) (Config, error) {
13 | // init config
14 | config := Config{
15 | "file": path,
16 | }
17 |
18 | // return error if config filepath is not provided
19 | if len(path) == 0 {
20 | return config, nil
21 | }
22 |
23 | // open configs file
24 | file, err := os.Open(path)
25 | if err != nil {
26 | return nil, err
27 | }
28 | defer file.Close()
29 |
30 | // instatiate new reader
31 | reader := bufio.NewReader(file)
32 |
33 | // parse through config file
34 | for {
35 | line, err := reader.ReadString('\n')
36 |
37 | // check line for '=' delimiter
38 | if equal := strings.Index(line, "="); equal >= 0 {
39 | // extract key
40 | if key := strings.TrimSpace(line[:equal]); len(key) > 0 {
41 | // init value
42 | value := ""
43 | if len(line) > equal {
44 | // assign value if not empty
45 | value = strings.TrimSpace(line[equal+1:])
46 | }
47 |
48 | // assign the config map
49 | config[key] = value
50 | }
51 | }
52 |
53 | // process errors
54 | if err == io.EOF {
55 | break
56 | }
57 | if err != nil {
58 | return nil, err
59 | }
60 | }
61 |
62 | return config, nil
63 | }
64 |
--------------------------------------------------------------------------------
/backend/indexer/helpers/logs.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "os"
5 |
6 | log "github.com/sirupsen/logrus"
7 | )
8 |
9 | func WriteLog(level string, message string, category string) {
10 | // provide configs file path
11 | confsPath := "configs/configs"
12 |
13 | // init config
14 | config := Config{
15 | "file": confsPath,
16 | }
17 |
18 | // read configs
19 | config, rcerr := ReadConfigs(confsPath)
20 |
21 | if rcerr != nil {
22 | panic(rcerr)
23 | }
24 |
25 | // open log file
26 | file, logerr := os.OpenFile(config["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
27 | if logerr != nil {
28 | panic(logerr)
29 | }
30 | defer file.Close()
31 |
32 | // set log output to log file
33 | log.SetOutput(file)
34 |
35 | // set formatter
36 | log.SetFormatter(&log.JSONFormatter{})
37 |
38 | // log message into a log file
39 | switch level {
40 | case "trace":
41 | log.WithFields(log.Fields{
42 | "category": category,
43 | }).Trace(message)
44 | case "debug":
45 | log.WithFields(log.Fields{
46 | "category": category,
47 | }).Debug(message)
48 | case "info":
49 | log.WithFields(log.Fields{
50 | "category": category,
51 | }).Info(message)
52 | case "warn":
53 | log.WithFields(log.Fields{
54 | "category": category,
55 | }).Warn(message)
56 | case "error":
57 | log.WithFields(log.Fields{
58 | "category": category,
59 | }).Error(message)
60 | case "fatal":
61 | log.WithFields(log.Fields{
62 | "category": category,
63 | }).Fatal(message)
64 | case "panic":
65 | log.WithFields(log.Fields{
66 | "category": category,
67 | }).Panic(message)
68 | default:
69 | log.WithFields(log.Fields{
70 | "category": category,
71 | }).Info(message)
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/backend/indexer/helpers/postgresql.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "os"
7 |
8 | "github.com/jackc/pgx/v4/log/logrusadapter"
9 | "github.com/jackc/pgx/v4/pgxpool"
10 | log "github.com/sirupsen/logrus"
11 | )
12 |
13 | func DbInit(host string, port int, user string,
14 | password string, dbname string) (*pgxpool.Pool, error) {
15 | psqlconn := fmt.Sprintf("postgres://%s:%s@%s:%d/%s", user, password, host, port, dbname)
16 |
17 | // provide configs file path
18 | confsPath := "configs/configs"
19 |
20 | // init config
21 | confs := Config{
22 | "file": confsPath,
23 | }
24 |
25 | // read configs
26 | confs, rcerr := ReadConfigs(confsPath)
27 |
28 | if rcerr != nil {
29 | panic(rcerr)
30 | }
31 |
32 | // open log file
33 | logFile, logErr := os.OpenFile(confs["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
34 | if logErr != nil {
35 | fmt.Fprintf(os.Stderr, "Unable to opent log file: %v\n", logErr)
36 | os.Exit(1)
37 | }
38 |
39 | pgxPoolConfig, pgxPoolConfigErr := pgxpool.ParseConfig(psqlconn)
40 | if pgxPoolConfigErr != nil {
41 | fmt.Fprintf(os.Stderr, "Unable to parse pgxPoolConfig: %v\n", pgxPoolConfigErr)
42 | os.Exit(1)
43 | }
44 |
45 | logger := &log.Logger{
46 | Out: logFile,
47 | Formatter: new(log.JSONFormatter),
48 | Hooks: make(log.LevelHooks),
49 | Level: log.InfoLevel,
50 | ExitFunc: os.Exit,
51 | ReportCaller: false,
52 | }
53 |
54 | pgxPoolConfig.ConnConfig.Logger = logrusadapter.NewLogger(logger)
55 |
56 | db, err := pgxpool.ConnectConfig(context.Background(), pgxPoolConfig)
57 |
58 | if err != nil {
59 | fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
60 | os.Exit(1)
61 | }
62 |
63 | return db, nil
64 | }
65 |
--------------------------------------------------------------------------------
/backend/pinning/configs/configs:
--------------------------------------------------------------------------------
1 | [postgresql]
2 | postgresql_host = localhost
3 | postgresql_port = 5432
4 | postgresql_database = co2_storage
5 | postgresql_user = co2_storage
6 | postgresql_password = DATABASE_PASSWORD
7 |
8 | [log]
9 | logfile = logs/log
10 |
11 | [scheduler]
12 | try_pinning_every = @every 5s
13 | check_pinning_nodes = @every 1m
14 | calculate_pin_size = @every 1m
15 |
16 | [ipfs]
17 | ipfs_node_addr = /ip4/127.0.0.1/tcp/5001
18 | ipfs_node_id = 12D3KooWQk7d16YumM6Pn1BJ7FiKjDdnJnFTLu56CTR7YJAs2fej
19 | bootstrap_peers = /ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWQk7d16YumM6Pn1BJ7FiKjDdnJnFTLu56CTR7YJAs2fej,/dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic,/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6,/dns4/node2.preload.ipfs.io/tcp/443/wss/p2p/QmV7gnbW5VTcJ3oyM2Xk1rdFBJ3kTkvxc87UFGsun29STS,/dns4/node3.preload.ipfs.io/tcp/443/wss/p2p/QmY7JB6MQXhxHvq7dBDh4HpbH29v4yE9JRadAVpndvzySN,/dns4/proxy.co2.storage/udp/4001/quic/p2p/12D3KooWGWHSrAxr6sznTpdcGuqz6zfQ2Y43PZQzhg22uJmGP9n1,/dns4/web2.co2.storage/udp/4001/quic/p2p/12D3KooWFBCcWEDW9GYr9Aw8D2QL7hZakPAw1DGfeZCwfsrjd43b,/dns4/web1.co2.storage/udp/4001/quic/p2p/12D3KooWCPzmui9TSQQG8HTNcZeFiHz6AGS19aaCwxJdjykVqq7f,/dns4/green.filecoin.space/udp/4001/quic/p2p/12D3KooWJmYbQp2sgKX22vZgSRVURkpMQ5YCSc8vf3toHesJc5Y9
--------------------------------------------------------------------------------
/backend/pinning/helpers/configs.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "bufio"
5 | "io"
6 | "os"
7 | "strings"
8 | )
9 |
10 | type Config map[string]string
11 |
12 | func ReadConfigs(path string) (Config, error) {
13 | // init config
14 | config := Config{
15 | "file": path,
16 | }
17 |
18 | // return error if config filepath is not provided
19 | if len(path) == 0 {
20 | return config, nil
21 | }
22 |
23 | // open configs file
24 | file, err := os.Open(path)
25 | if err != nil {
26 | return nil, err
27 | }
28 | defer file.Close()
29 |
30 | // instatiate new reader
31 | reader := bufio.NewReader(file)
32 |
33 | // parse through config file
34 | for {
35 | line, err := reader.ReadString('\n')
36 |
37 | // check line for '=' delimiter
38 | if equal := strings.Index(line, "="); equal >= 0 {
39 | // extract key
40 | if key := strings.TrimSpace(line[:equal]); len(key) > 0 {
41 | // init value
42 | value := ""
43 | if len(line) > equal {
44 | // assign value if not empty
45 | value = strings.TrimSpace(line[equal+1:])
46 | }
47 |
48 | // assign the config map
49 | config[key] = value
50 | }
51 | }
52 |
53 | // process errors
54 | if err == io.EOF {
55 | break
56 | }
57 | if err != nil {
58 | return nil, err
59 | }
60 | }
61 |
62 | return config, nil
63 | }
64 |
--------------------------------------------------------------------------------
/backend/pinning/helpers/http_client.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "crypto/tls"
5 | "net/http"
6 | "net/url"
7 | "strconv"
8 | )
9 |
10 | func HttpProxyClient(proxyProtocol string, proxyHost string,
11 | proxyPort int) (*http.Client, error) {
12 | proxyUrl, _ := url.Parse(proxyProtocol +
13 | "://" + proxyHost + ":" + strconv.Itoa(proxyPort))
14 | tr := &http.Transport{
15 | Proxy: http.ProxyURL(proxyUrl),
16 | TLSClientConfig: &tls.Config{
17 | InsecureSkipVerify: true,
18 | },
19 | }
20 | client := &http.Client{Transport: tr}
21 |
22 | return client, nil
23 | }
24 |
25 | func HttpClient() (*http.Client, error) {
26 | tr := &http.Transport{
27 | TLSClientConfig: &tls.Config{
28 | InsecureSkipVerify: true,
29 | },
30 | }
31 | client := &http.Client{Transport: tr}
32 |
33 | return client, nil
34 | }
35 |
--------------------------------------------------------------------------------
/backend/pinning/helpers/logs.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "os"
5 |
6 | log "github.com/sirupsen/logrus"
7 | )
8 |
9 | func WriteLog(level string, message string, category string) {
10 | // provide configs file path
11 | confsPath := "configs/configs"
12 |
13 | // init config
14 | config := Config{
15 | "file": confsPath,
16 | }
17 |
18 | // read configs
19 | config, rcerr := ReadConfigs(confsPath)
20 |
21 | if rcerr != nil {
22 | panic(rcerr)
23 | }
24 |
25 | // open log file
26 | file, logerr := os.OpenFile(config["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
27 | if logerr != nil {
28 | panic(logerr)
29 | }
30 | defer file.Close()
31 |
32 | // set log output to log file
33 | log.SetOutput(file)
34 |
35 | // set formatter
36 | log.SetFormatter(&log.JSONFormatter{})
37 |
38 | // log message into a log file
39 | switch level {
40 | case "trace":
41 | log.WithFields(log.Fields{
42 | "category": category,
43 | }).Trace(message)
44 | case "debug":
45 | log.WithFields(log.Fields{
46 | "category": category,
47 | }).Debug(message)
48 | case "info":
49 | log.WithFields(log.Fields{
50 | "category": category,
51 | }).Info(message)
52 | case "warn":
53 | log.WithFields(log.Fields{
54 | "category": category,
55 | }).Warn(message)
56 | case "error":
57 | log.WithFields(log.Fields{
58 | "category": category,
59 | }).Error(message)
60 | case "fatal":
61 | log.WithFields(log.Fields{
62 | "category": category,
63 | }).Fatal(message)
64 | case "panic":
65 | log.WithFields(log.Fields{
66 | "category": category,
67 | }).Panic(message)
68 | default:
69 | log.WithFields(log.Fields{
70 | "category": category,
71 | }).Info(message)
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/backend/pinning/helpers/postgresql.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "os"
7 |
8 | "github.com/jackc/pgx/v4/log/logrusadapter"
9 | "github.com/jackc/pgx/v4/pgxpool"
10 | log "github.com/sirupsen/logrus"
11 | )
12 |
13 | func DbInit(host string, port int, user string,
14 | password string, dbname string) (*pgxpool.Pool, error) {
15 | psqlconn := fmt.Sprintf("postgres://%s:%s@%s:%d/%s", user, password, host, port, dbname)
16 |
17 | // provide configs file path
18 | confsPath := "configs/configs"
19 |
20 | // init config
21 | confs := Config{
22 | "file": confsPath,
23 | }
24 |
25 | // read configs
26 | confs, rcerr := ReadConfigs(confsPath)
27 |
28 | if rcerr != nil {
29 | panic(rcerr)
30 | }
31 |
32 | // open log file
33 | logFile, logErr := os.OpenFile(confs["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
34 | if logErr != nil {
35 | fmt.Fprintf(os.Stderr, "Unable to opent log file: %v\n", logErr)
36 | os.Exit(1)
37 | }
38 |
39 | pgxPoolConfig, pgxPoolConfigErr := pgxpool.ParseConfig(psqlconn)
40 | if pgxPoolConfigErr != nil {
41 | fmt.Fprintf(os.Stderr, "Unable to parse pgxPoolConfig: %v\n", pgxPoolConfigErr)
42 | os.Exit(1)
43 | }
44 |
45 | logger := &log.Logger{
46 | Out: logFile,
47 | Formatter: new(log.JSONFormatter),
48 | Hooks: make(log.LevelHooks),
49 | Level: log.InfoLevel,
50 | ExitFunc: os.Exit,
51 | ReportCaller: false,
52 | }
53 |
54 | pgxPoolConfig.ConnConfig.Logger = logrusadapter.NewLogger(logger)
55 |
56 | db, err := pgxpool.ConnectConfig(context.Background(), pgxPoolConfig)
57 |
58 | if err != nil {
59 | fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
60 | os.Exit(1)
61 | }
62 |
63 | return db, nil
64 | }
65 |
--------------------------------------------------------------------------------
/backend/postgres/01.install.sql:
--------------------------------------------------------------------------------
1 | -- login as postgres
2 | CREATE ROLE co2_storage WITH LOGIN PASSWORD 'secret';
3 | CREATE DATABASE co2_storage;
4 | \c co2_storage
5 | CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
6 | CREATE EXTENSION IF NOT EXISTS pgcrypto;
7 | CREATE SCHEMA IF NOT EXISTS co2_storage_api AUTHORIZATION co2_storage;
8 | CREATE SCHEMA IF NOT EXISTS co2_storage_scraper AUTHORIZATION co2_storage;
9 | CREATE SCHEMA IF NOT EXISTS co2_storage_helpers AUTHORIZATION co2_storage;
10 |
--------------------------------------------------------------------------------
/backend/postgres/02.helpers.sql:
--------------------------------------------------------------------------------
1 | -- Full text search update / trigger function
2 | --
3 | --DROP FUNCTION IF EXISTS co2_storage_helpers.update_full_text_search();
4 | CREATE OR REPLACE FUNCTION co2_storage_helpers.update_full_text_search() RETURNS TRIGGER AS $update_full_text_search$
5 | DECLARE
6 | considered_columns VARCHAR[] = regexp_split_to_array(TG_ARGV[4], '\|\|\|');
7 | counter SMALLINT = 1;
8 | no_of_columns SMALLINT = array_length(considered_columns , 1);
9 | fts VARCHAR = '';
10 | BEGIN
11 | WHILE counter <= no_of_columns LOOP
12 | fts = concat(fts, format(' COALESCE(translate(NULLIF(cast("%s" AS TEXT),''''),''/.-*'','' ''),'''') ', considered_columns[counter]));
13 | IF (counter < no_of_columns) THEN
14 | fts = concat(fts, ' || '' '' || ');
15 | END IF;
16 | counter = counter + 1;
17 | END LOOP;
18 | EXECUTE format('UPDATE %s SET %s = to_tsvector(''%s'', %s) WHERE "id" = ''%s'';', concat('"', TG_ARGV[0], '"."', TG_ARGV[1], '"'), concat('"', TG_ARGV[3], '"'), TG_ARGV[2], fts, NEW.id);
19 | RETURN NULL; -- result will be ignored since this is AFTER trigger function
20 | END;
21 | $update_full_text_search$ LANGUAGE plpgsql;
22 |
--------------------------------------------------------------------------------
/backend/postgres/04.01.head-alteration-1.sql:
--------------------------------------------------------------------------------
1 | -- Head
2 | --
3 | -- Added archived to co2_storage_api.chain
4 | ALTER TABLE co2_storage_api.chain
5 | ADD COLUMN "archived" BOOLEAN DEFAULT FALSE;
--------------------------------------------------------------------------------
/backend/postgres/05.01.scraper-alteration-1.sql:
--------------------------------------------------------------------------------
1 | -- Contents
2 | --
3 | -- Adding pinning_node, replication_nodes, archive, archive_deals
4 | -- archived, restored and size to co2_storage_scraper.contents
5 | --
6 | -- Adding contents_pinning_node_idx to indexes
7 | ALTER TABLE co2_storage_scraper.contents
8 | ADD COLUMN "ipfs_nodes" VARCHAR(1024)[] DEFAULT '{}',
9 | ADD COLUMN "archive" BOOLEAN DEFAULT FALSE,
10 | ADD COLUMN "archive_deals" VARCHAR(1024)[] DEFAULT '{}',
11 | ADD COLUMN "archived" TIMESTAMPTZ[] DEFAULT '{}',
12 | ADD COLUMN "restored" TIMESTAMPTZ[] DEFAULT '{}',
13 | ADD COLUMN "size" BIGINT DEFAULT NULL;
14 |
--------------------------------------------------------------------------------
/backend/postgres/05.02.scraper-alteration-1.sql:
--------------------------------------------------------------------------------
1 | -- Contents
2 | --
3 | -- Adding protocol and license to co2_storage_scraper.contents
4 | ALTER TABLE co2_storage_scraper.contents
5 | ADD COLUMN "protocol" VARCHAR(255) DEFAULT NULL,
6 | ADD COLUMN "license" VARCHAR(255) DEFAULT NULL;
7 |
8 | -- Create indexes
9 | CREATE INDEX IF NOT EXISTS contents_protocol_idx ON co2_storage_scraper.contents ("protocol");
10 | CREATE INDEX IF NOT EXISTS contents_license_idx ON co2_storage_scraper.contents ("license");
11 |
--------------------------------------------------------------------------------
/backend/rest-api/internal/configs.go:
--------------------------------------------------------------------------------
1 | package internal
2 |
3 | import (
4 | "bufio"
5 | "io"
6 | "os"
7 | "strings"
8 | )
9 |
10 | type Config map[string]string
11 |
12 | func ReadConfigs(path string) (Config, error) {
13 | // init config
14 | config := Config{
15 | "file": path,
16 | }
17 |
18 | // return error if config filepath is not provided
19 | if len(path) == 0 {
20 | return config, nil
21 | }
22 |
23 | // open configs file
24 | file, err := os.Open(path)
25 | if err != nil {
26 | return nil, err
27 | }
28 | defer file.Close()
29 |
30 | // instatiate new reader
31 | reader := bufio.NewReader(file)
32 |
33 | // parse through config file
34 | for {
35 | line, err := reader.ReadString('\n')
36 |
37 | // check line for '=' delimiter
38 | if equal := strings.Index(line, "="); equal >= 0 {
39 | // extract key
40 | if key := strings.TrimSpace(line[:equal]); len(key) > 0 {
41 | // init value
42 | value := ""
43 | if len(line) > equal {
44 | // assign value if not empty
45 | value = strings.TrimSpace(line[equal+1:])
46 | }
47 |
48 | // assign the config map
49 | config[key] = value
50 | }
51 | }
52 |
53 | // process errors
54 | if err == io.EOF {
55 | break
56 | }
57 | if err != nil {
58 | return nil, err
59 | }
60 | }
61 |
62 | return config, nil
63 | }
64 |
--------------------------------------------------------------------------------
/backend/rest-api/internal/logs.go:
--------------------------------------------------------------------------------
1 | package internal
2 |
3 | import (
4 | "os"
5 |
6 | log "github.com/sirupsen/logrus"
7 | )
8 |
9 | func WriteLog(level string, message string, category string) {
10 | // provide configs file path
11 | confsPath := "configs/configs"
12 |
13 | // init config
14 | config := Config{
15 | "file": confsPath,
16 | }
17 |
18 | // read configs
19 | config, rcerr := ReadConfigs(confsPath)
20 |
21 | if rcerr != nil {
22 | panic(rcerr)
23 | }
24 |
25 | // open log file
26 | file, logerr := os.OpenFile(config["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
27 | if logerr != nil {
28 | panic(logerr)
29 | }
30 | defer file.Close()
31 |
32 | // set log output to log file
33 | log.SetOutput(file)
34 |
35 | // set formatter
36 | log.SetFormatter(&log.JSONFormatter{})
37 |
38 | // log message into a log file
39 | switch level {
40 | case "trace":
41 | log.WithFields(log.Fields{
42 | "category": category,
43 | }).Trace(message)
44 | case "debug":
45 | log.WithFields(log.Fields{
46 | "category": category,
47 | }).Debug(message)
48 | case "info":
49 | log.WithFields(log.Fields{
50 | "category": category,
51 | }).Info(message)
52 | case "warn":
53 | log.WithFields(log.Fields{
54 | "category": category,
55 | }).Warn(message)
56 | case "error":
57 | log.WithFields(log.Fields{
58 | "category": category,
59 | }).Error(message)
60 | case "fatal":
61 | log.WithFields(log.Fields{
62 | "category": category,
63 | }).Fatal(message)
64 | case "panic":
65 | log.WithFields(log.Fields{
66 | "category": category,
67 | }).Panic(message)
68 | default:
69 | log.WithFields(log.Fields{
70 | "category": category,
71 | }).Info(message)
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/backend/rest-api/internal/postgresql.go:
--------------------------------------------------------------------------------
1 | package internal
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "os"
7 |
8 | "github.com/jackc/pgx/v4/log/logrusadapter"
9 | "github.com/jackc/pgx/v4/pgxpool"
10 | log "github.com/sirupsen/logrus"
11 | )
12 |
13 | func DbInit(host string, port int, user string,
14 | password string, dbname string) (*pgxpool.Pool, error) {
15 | psqlconn := fmt.Sprintf("postgres://%s:%s@%s:%d/%s", user, password, host, port, dbname)
16 |
17 | // provide configs file path
18 | confsPath := "configs/configs"
19 |
20 | // init config
21 | confs := Config{
22 | "file": confsPath,
23 | }
24 |
25 | // read configs
26 | confs, rcerr := ReadConfigs(confsPath)
27 |
28 | if rcerr != nil {
29 | panic(rcerr)
30 | }
31 |
32 | // open log file
33 | logFile, logErr := os.OpenFile(confs["logfile"], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
34 | if logErr != nil {
35 | fmt.Fprintf(os.Stderr, "Unable to opent log file: %v\n", logErr)
36 | os.Exit(1)
37 | }
38 |
39 | pgxPoolConfig, pgxPoolConfigErr := pgxpool.ParseConfig(psqlconn)
40 | if pgxPoolConfigErr != nil {
41 | fmt.Fprintf(os.Stderr, "Unable to parse pgxPoolConfig: %v\n", pgxPoolConfigErr)
42 | os.Exit(1)
43 | }
44 |
45 | logger := &log.Logger{
46 | Out: logFile,
47 | Formatter: new(log.JSONFormatter),
48 | Hooks: make(log.LevelHooks),
49 | Level: log.InfoLevel,
50 | ExitFunc: os.Exit,
51 | ReportCaller: false,
52 | }
53 |
54 | pgxPoolConfig.ConnConfig.Logger = logrusadapter.NewLogger(logger)
55 |
56 | db, err := pgxpool.ConnectConfig(context.Background(), pgxPoolConfig)
57 |
58 | if err != nil {
59 | fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
60 | os.Exit(1)
61 | }
62 |
63 | return db, nil
64 | }
65 |
--------------------------------------------------------------------------------
/backend/rest-api/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "log"
5 | "net/http"
6 | "os"
7 | "strconv"
8 |
9 | "github.com/adgsm/co2-storage-rest-api/api"
10 | "github.com/adgsm/co2-storage-rest-api/internal"
11 | "github.com/joho/godotenv"
12 | )
13 |
14 | func main() {
15 | // provide configs file path
16 | confsPath := "configs/configs"
17 |
18 | // read configs
19 | config, rcerr := internal.ReadConfigs(confsPath)
20 |
21 | if rcerr != nil {
22 | panic(rcerr)
23 | }
24 |
25 | // cast port to int
26 | port, atoierr := strconv.Atoi(config["postgresql_port"])
27 |
28 | if atoierr != nil {
29 | panic(atoierr)
30 | }
31 |
32 | // init db connection
33 | db, dberr := internal.DbInit(config["postgresql_host"], port,
34 | config["postgresql_user"], goDotEnvVariable(config["postgresql_password"]), config["postgresql_database"])
35 |
36 | if dberr != nil {
37 | panic(dberr)
38 | }
39 |
40 | // close db connections
41 | // when func closes
42 | defer db.Close()
43 |
44 | // start API
45 | a := api.New(db, goDotEnvVariable(config["rpc_provider"]))
46 | // log.Fatal(http.ListenAndServeTLS(":"+config["api_port"], config["tsl_cert"], config["tsl_key"], a))
47 | log.Fatal(http.ListenAndServe(":"+config["api_port"], a))
48 | }
49 |
50 | // Load/read the .env file and
51 | // return the value of the key
52 | func goDotEnvVariable(key string) string {
53 | // load .env file
54 | err := godotenv.Load(".env")
55 |
56 | if err != nil {
57 | panic(err)
58 | }
59 |
60 | return os.Getenv(key)
61 | }
62 |
--------------------------------------------------------------------------------
/cli/.env.example:
--------------------------------------------------------------------------------
1 | ESTUARY_API_KEY=ESTxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxARY
2 | INFURA_API_KEY=...
3 | PK=0x...
4 | FG_TOKEN=...
--------------------------------------------------------------------------------
/cli/README.md:
--------------------------------------------------------------------------------
1 | # CLI | Example
2 | by [Momcilo Dzunic aka smartbee.eth](https://twitter.com/mdzunic)
3 |
4 | ### License
5 | Licensed under the MIT license.
6 | http://www.opensource.org/licenses/mit-license.php
7 |
--------------------------------------------------------------------------------
/cli/assets/Virtuzone___UAE_Corporate_Tax_Guide_2023.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/cli/assets/Virtuzone___UAE_Corporate_Tax_Guide_2023.pdf
--------------------------------------------------------------------------------
/cli/assets/test document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/cli/assets/test document.pdf
--------------------------------------------------------------------------------
/cli/assets/test image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/cli/assets/test image.jpg
--------------------------------------------------------------------------------
/cli/assets/test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/cli/assets/test.zip
--------------------------------------------------------------------------------
/cli/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "CLI-example",
3 | "version": "0.0.1",
4 | "description": "CLI example",
5 | "type": "module",
6 | "author": {
7 | "name": "Momcilo Dzunic",
8 | "email": "momcilo.dzunic@protocol.ai"
9 | },
10 | "devDependencies": {
11 | "env-cmd": "^10.1.0"
12 | },
13 | "scripts": {
14 | "authenticate": "env-cmd node src/examples/authenticate.js",
15 | "search_templates": "env-cmd node src/examples/search_templates.js",
16 | "get_template": "env-cmd node src/examples/get_template.js",
17 | "add_template": "env-cmd node src/examples/add_template.js",
18 | "search_assets": "env-cmd node src/examples/search_assets.js",
19 | "search": "env-cmd node src/examples/search.js",
20 | "get_asset": "env-cmd node src/examples/get_asset.js",
21 | "add_asset": "env-cmd node src/examples/add_asset.js",
22 | "add_big_asset": "env-cmd node src/examples/add_big_asset.js",
23 | "add_asset_with_nested_template": "env-cmd node src/examples/add_asset_with_nested_template.js",
24 | "add_asset_with_nested_assets": "env-cmd node src/examples/add_asset_with_nested_assets.js",
25 | "sign_cid": "env-cmd node src/examples/sign_cid.js",
26 | "get_accounts": "env-cmd node src/examples/get_accounts.js",
27 | "get_account": "env-cmd node src/examples/get_account.js",
28 | "get_raw_data": "env-cmd node src/examples/get_raw_data.js",
29 | "serialize-dag-cbor": "env-cmd node src/examples/serialize_dag_cbor.js",
30 | "test": "env-cmd node src/examples/create_invalid_dag-pb.js"
31 | },
32 | "dependencies": {
33 | "@co2-storage/js-api": "^1.4.4",
34 | "@ipld/dag-pb": "^4.0.4",
35 | "fs": "^0.0.1-security",
36 | "ipfs-unixfs": "^11.0.1",
37 | "multiformats": "^12.0.1",
38 | "path": "^0.12.7",
39 | "web3": "^4.0.1"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/cli/src/examples/add_template.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web1.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web1.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Add a template
14 | * parameters: (template:json, template name:string, template base:string, template description:string, template parent:string(CID), chain_name: string)
15 | */
16 |
17 | const template = {
18 | Country: { type: 'string', mandatory: true },
19 | Retired: { type: 'boolean' },
20 | Vintage: { type: 'date', mandatory: true }
21 | }
22 | const templateName = 'CLI example test template (1.0.3-v1)'
23 | const templateBase = {title: 'VCS', reference: 'bafyreigenzubua7r7rlxomgpyy2o4q46u6anvw3qvbxmlxhifkbrdbhcwm'}
24 | const templateDescription = 'Test template (1.0.3-v1)'
25 | const templateParent = 'bafyreigijwcxu4nda2nol5x3cepjhel6mlvgyiizvivki3dpg3ttegdl2y'
26 | const chainName = 'sandbox'
27 | let addTemplateResponse = await fgStorage.addTemplate(template, templateName, templateBase, templateDescription, templateParent, chainName)
28 | if(addTemplateResponse.error != null) {
29 | console.error(addTemplateResponse.error)
30 | await new Promise(reject => setTimeout(reject, 300));
31 | process.exit()
32 | }
33 |
34 | console.dir(addTemplateResponse.result, {depth: null})
35 |
36 | await new Promise(resolve => setTimeout(resolve, 1000));
37 |
38 | // Exit program
39 | process.exit()
40 |
--------------------------------------------------------------------------------
/cli/src/examples/authenticate.js:
--------------------------------------------------------------------------------
1 | import { Auth } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const auth = new Auth(authType)
5 |
6 | /**
7 | * Authenticate with a private key
8 | */
9 |
10 | let authResponse = await auth.authenticate()
11 |
12 | if(authResponse.error != null) {
13 | console.error(authResponse.error)
14 | await new Promise(reject => setTimeout(reject, 300));
15 | process.exit()
16 | }
17 |
18 | console.dir(authResponse.result, {depth: null})
19 |
20 | await new Promise(resolve => setTimeout(resolve, 1000));
21 |
22 | // Exit program
23 | process.exit()
--------------------------------------------------------------------------------
/cli/src/examples/get_account.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web2.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web2.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Get account
14 | */
15 |
16 | let accountResponse = await fgStorage.getAccount('sandbox')
17 | if(accountResponse.error != null) {
18 | console.error(accountResponse.error)
19 | await new Promise(reject => setTimeout(reject, 300));
20 | process.exit()
21 | }
22 |
23 | console.dir(accountResponse.result, {depth: null})
24 |
25 | await new Promise(resolve => setTimeout(resolve, 1000));
26 |
27 | // Exit program
28 | process.exit()
29 |
--------------------------------------------------------------------------------
/cli/src/examples/get_accounts.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web2.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web2.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Get accounts
14 | */
15 |
16 | let accountsResponse = await fgStorage.getAccounts('sandbox')
17 | if(accountsResponse.error != null) {
18 | console.error(accountsResponse.error)
19 | await new Promise(reject => setTimeout(reject, 300));
20 | process.exit()
21 | }
22 |
23 | console.dir(accountsResponse.result, {depth: null})
24 |
25 | await new Promise(resolve => setTimeout(resolve, 1000));
26 |
27 | // Exit program
28 | process.exit()
29 |
--------------------------------------------------------------------------------
/cli/src/examples/get_asset.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web2.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web2.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Search assets
14 | * parameters: (chainName, phrases, cid, name, base, account, offset, limit, sortBy, sortDir)
15 | * // default data_chain: 'sandbox', phrases: null, cid: null, name: null, base: null, account: null, offset: 0, limit: 10
16 | */
17 |
18 | let searchAssetsResponse = await fgStorage.searchAssets('sandbox') // ('SP Audits', 'Water')
19 | if(searchAssetsResponse.error != null) {
20 | console.error(searchAssetsResponse.error)
21 | await new Promise(reject => setTimeout(reject, 300));
22 | process.exit()
23 | }
24 |
25 | /**
26 | * Get asset
27 | * parameters: asset block CID
28 | */
29 |
30 | const lastListedAsset = searchAssetsResponse.result.assets[searchAssetsResponse.result.assets.length-1]
31 | if(lastListedAsset) {
32 | let getAssetResponse = await fgStorage.getAsset(lastListedAsset.block)
33 | if(getAssetResponse.error != null) {
34 | console.error(getAssetResponse.error)
35 | await new Promise(reject => setTimeout(reject, 300));
36 | process.exit()
37 | }
38 |
39 | console.dir(getAssetResponse.result, {depth: null})
40 | }
41 |
42 | await new Promise(resolve => setTimeout(resolve, 1000));
43 |
44 | // Exit program
45 | process.exit()
46 |
--------------------------------------------------------------------------------
/cli/src/examples/get_raw_data.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | import { CID } from 'multiformats/cid'
4 |
5 |
6 | const authType = "pk" // or "metamask"
7 | const ipfsNodeType = "client"
8 | const ipfsNodeAddr = "/dns4/web2.co2.storage/tcp/5002/https"
9 | const fgApiUrl = "https://web2.co2.storage"
10 |
11 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
12 |
13 | const ipfs = await fgStorage.ensureIpfsIsRunning()
14 |
15 | const cid = 'bafybeibks5ute3txdug5cy3dyyggogbp7cmav57rylgwllnl6lghsjyml4'
16 | // Get all at once
17 | //const buffer = await fgStorage.getRawData(cid)
18 | // Get first 100000 bytes
19 | const buffer = await fgStorage.getRawData(cid, {offset: 0, length: 100000}, (bytes) => {
20 | console.log(`${bytes} bytes received`)
21 | })
22 |
23 | //console.log(buffer)
24 | process.exit()
25 |
--------------------------------------------------------------------------------
/cli/src/examples/get_template.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web1.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web1.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Search templates
14 | * parameters: (chainName, phrases, cid, name, base, account, offset, limit, sortBy, sortDir)
15 | * // default data_chain: 'sandbox', phrases: null, cid: null, name: null, base: null, account: null, offset: 0, limit: 10
16 | */
17 |
18 | let searchTemplatesResponse = await fgStorage.searchTemplates('sandbox') // ('SP Audits', 'Water')
19 | if(searchTemplatesResponse.error != null) {
20 | console.error(searchTemplatesResponse.error)
21 | await new Promise(reject => setTimeout(reject, 300));
22 | process.exit()
23 | }
24 |
25 | /**
26 | * Get template
27 | * parameters: template block CID
28 | */
29 |
30 | const lastListedTemplate = searchTemplatesResponse.result.templates[searchTemplatesResponse.result.templates.length-1]
31 | if(lastListedTemplate) {
32 | let getTemplateResponse = await fgStorage.getTemplate(lastListedTemplate.block)
33 | if(getTemplateResponse.error != null) {
34 | console.error(getTemplateResponse.error)
35 | await new Promise(reject => setTimeout(reject, 300));
36 | process.exit()
37 | }
38 |
39 | console.dir(getTemplateResponse.result, {depth: null})
40 | }
41 |
42 | await new Promise(resolve => setTimeout(resolve, 1000));
43 |
44 | // Exit program
45 | process.exit()
46 |
--------------------------------------------------------------------------------
/cli/src/examples/search.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web1.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web1.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Search
14 | * parameters: (chainName, phrases, dataStructure, cid, parent, name, description, base,
15 | reference, contentCid, creator, createdFrom, createdTo, version, offset, limit, sortBy, sortDir)
16 | */
17 |
18 | let searchResponse = await fgStorage.search(null, null, 'asset', null, null, null, null, null,
19 | 'bafyreigcprw3dp3mrsv2xgysomratgv3oz4cpl3rsiij2hzucckyxfbpd4')
20 | if(searchResponse.error != null) {
21 | console.error(searchResponse.error)
22 | await new Promise(reject => setTimeout(reject, 300));
23 | process.exit()
24 | }
25 |
26 | console.dir(searchResponse.result, {depth: null})
27 |
28 | await new Promise(resolve => setTimeout(resolve, 1000));
29 |
30 | // Exit program
31 | process.exit()
32 |
--------------------------------------------------------------------------------
/cli/src/examples/search_assets.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web2.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web2.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Search assets
14 | * parameters: (chainName, phrases, cid, name, base, account, offset, limit, sortBy, sortDir)
15 | * // default data_chain: 'sandbox', phrases: null, cid: null, name: null, base: null, account: null, offset: 0, limit: 10
16 | */
17 |
18 | let searchAssetsResponse = await fgStorage.searchAssets('sandbox') // ('SP Audits', 'Water')
19 | if(searchAssetsResponse.error != null) {
20 | console.error(searchAssetsResponse.error)
21 | await new Promise(reject => setTimeout(reject, 300));
22 | process.exit()
23 | }
24 |
25 | console.dir(searchAssetsResponse.result, {depth: null})
26 |
27 | await new Promise(resolve => setTimeout(resolve, 1000));
28 |
29 | // Exit program
30 | process.exit()
31 |
--------------------------------------------------------------------------------
/cli/src/examples/search_templates.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web1.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web1.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Search templates
14 | * parameters: (chainName, phrases, cid, name, base, account, offset, limit, sortBy, sortDir)
15 | * // default data_chain: 'sandbox', phrases: null, cid: null, name: null, base: null, account: null, offset: 0, limit: 10
16 | */
17 |
18 | let searchTemplatesResponse = await fgStorage.searchTemplates('sandbox') // ('SP Audits', 'Water')
19 | if(searchTemplatesResponse.error != null) {
20 | console.error(searchTemplatesResponse.error)
21 | await new Promise(reject => setTimeout(reject, 300));
22 | process.exit()
23 | }
24 |
25 | console.dir(searchTemplatesResponse.result, {depth: null})
26 |
27 | await new Promise(resolve => setTimeout(resolve, 1000));
28 |
29 | // Exit program
30 | process.exit()
31 |
--------------------------------------------------------------------------------
/cli/src/examples/serialize_dag_cbor.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web1.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web1.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | //const dagCbors = ["bafyreih4pji37htdhepzltpq6fifgdkwgb2l7yflm4if3pbwqwz6vi6k3q"]
13 | //const dagCbors = ["bafyreibxm2zsr66qotjh2vraapnukyrd4n6qvbwfxllwqpi7ssfzchgomu"]
14 | const dagCbors = ["bafyreibdvfxofhmoclyan6dvqzvuuzz57ezfuspcd3q3dm5w6xd2vwsysm"]
15 |
16 | try {
17 | const serialized = await fgStorage.serializeBacalhauJobInputs(dagCbors)
18 | console.log(serialized.result.toString())
19 | // console.dir(serialized, {depth: null})
20 | } catch (error) {
21 | console.log(error)
22 | }
23 |
24 | process.exit()
--------------------------------------------------------------------------------
/cli/src/examples/sign_cid.js:
--------------------------------------------------------------------------------
1 | import { FGStorage } from '@co2-storage/js-api'
2 |
3 | const authType = "pk"
4 | const ipfsNodeType = "client"
5 | //const ipfsNodeAddr = "/ip4/127.0.0.1/tcp/5001"
6 | //const fgApiUrl = "http://localhost:3020"
7 | const ipfsNodeAddr = "/dns4/web1.co2.storage/tcp/5002/https"
8 | const fgApiUrl = "https://web1.co2.storage"
9 |
10 | const fgStorage = new FGStorage({authType: authType, ipfsNodeType: ipfsNodeType, ipfsNodeAddr: ipfsNodeAddr, fgApiHost: fgApiUrl})
11 |
12 | /**
13 | * Sign CID
14 | * parameters: blockCid: string, callback: function(response)
15 | */
16 |
17 | const cid = 'bafyreicakk2qxdwlx52l547jj3goez5horyslk6jprofr3k3dgwvnurwzm'
18 | const contributorName = 'Moca'
19 | const contributionLicense = 'CC0 (No Rights Reserved, Public Domain)'
20 | const contributionNote = 'Test note'
21 | const indexingDataChain = 'test'
22 |
23 | const response = await fgStorage.addProvenanceMessage(cid, contributorName, contributionLicense, contributionNote, indexingDataChain)
24 |
25 | console.dir(response, { depth: null })
26 |
27 | await new Promise(resolve => setTimeout(resolve, 1000))
28 |
29 | // Exit program
30 | process.exit()
31 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "sourceType": "unambiguous",
3 | "presets": ["@babel/preset-env"],
4 | "plugins": [
5 | [
6 | "@babel/plugin-transform-runtime", {}
7 | ]
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/.env.example:
--------------------------------------------------------------------------------
1 | ESTUARY_API_KEY=...
2 | INFURA_API_KEY=...
3 | PK=0x...
4 | SYSTEM_PK=0x...
5 | COSMOS_PK=...
--------------------------------------------------------------------------------
/client/decarbonize.travel/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Momcilo Dzunic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/README.md:
--------------------------------------------------------------------------------
1 | # form.co2.storage
2 | by [Momcilo Dzunic aka smartbee.eth](https://twitter.com/mdzunic)
3 |
4 | Simple co2.storage type/template previewer for easy asset creation.
5 |
6 | ### Demo
7 |
8 | [https://form.co2.storage/](https://form.co2.storage/)
9 |
10 | ### Use
11 | // clean dist
12 | npm run clean
13 |
14 | // build for production
15 | npm run build
16 |
17 | // run dev server with hot reload
18 | npm run start
19 |
20 | ### License
21 | Licensed under the MIT license.
22 | http://www.opensource.org/licenses/mit-license.php
23 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/assets/unverified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/assets/unverified.png
--------------------------------------------------------------------------------
/client/decarbonize.travel/assets/verified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/assets/verified.png
--------------------------------------------------------------------------------
/client/decarbonize.travel/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Decarbonize your travel
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/components/helpers/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/components/helpers/JsonEditor.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/components/helpers/LoadingBlocker.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | {{ message }}
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Bold.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-ExtraBold.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Italic.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Light.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-LightItalic.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Medium.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-MediumItalic.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-SemiBold.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/fonts/OpenSans/font.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: 300;
4 | font-style: normal;
5 | src: url('~@/src/fonts/OpenSans/OpenSans-Light.ttf') format('truetype');
6 | }
7 |
8 | @font-face {
9 | font-family: 'Open Sans';
10 | font-weight: 400;
11 | font-style: normal;
12 | src: url('~@/src/fonts/OpenSans/OpenSans-Regular.ttf') format('truetype');
13 | }
14 |
15 | @font-face {
16 | font-family: 'Open Sans';
17 | font-weight: 700;
18 | font-style: normal;
19 | src: url('~@/src/fonts/OpenSans/OpenSans-Bold.ttf') format('truetype');
20 | }
21 |
22 | @font-face {
23 | font-family: 'Open Sans';
24 | font-weight: 300;
25 | font-style: italic;
26 | src: url('~@/src/fonts/OpenSans/OpenSans-LightItalic.ttf') format('truetype');
27 | }
28 |
29 | @font-face {
30 | font-family: 'Open Sans';
31 | font-weight: 400;
32 | font-style: italic;
33 | src: url('~@/src/fonts/OpenSans/OpenSans-Italic.ttf') format('truetype');
34 | }
35 |
36 | @font-face {
37 | font-family: 'Open Sans';
38 | font-weight: 700;
39 | font-style: italic;
40 | src: url('~@/src/fonts/OpenSans/OpenSans-BoldItalic.ttf') format('truetype');
41 | }
42 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/js/helpers/header.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | const created = async function() {
4 | const that = this
5 |
6 | // set language
7 | this.setLanguage(this.$route)
8 | }
9 |
10 | const computed = {
11 | headerClass() {
12 | return this.theme + '-header-' + this.themeVariety
13 | },
14 | locale() {
15 | return this.$store.getters['main/getLocale']
16 | },
17 | theme() {
18 | return this.$store.getters['main/getTheme']
19 | },
20 | themeVariety() {
21 | return this.$store.getters['main/getThemeVariety']
22 | },
23 | selectedAddress() {
24 | return this.$store.getters['main/getSelectedAddress']
25 | }
26 | }
27 |
28 | const watch = {
29 | }
30 |
31 | const mounted = async function() {
32 | }
33 |
34 | const methods = {
35 | async account() {
36 | if(this.selectedAddress == undefined)
37 | this.$emit('authenticate')
38 | }
39 | }
40 |
41 | const destroyed = function() {
42 | }
43 |
44 | export default {
45 | props: [],
46 | mixins: [
47 | language
48 | ],
49 | components: {
50 | },
51 | directives: {
52 | },
53 | name: 'Header',
54 | data () {
55 | return {
56 | }
57 | },
58 | created: created,
59 | computed: computed,
60 | watch: watch,
61 | mounted: mounted,
62 | methods: methods,
63 | destroyed: destroyed
64 | }
65 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/js/helpers/json-editor.js:
--------------------------------------------------------------------------------
1 | import { JSONEditor } from 'vanilla-jsoneditor'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | }
8 |
9 | const watch = {
10 | }
11 |
12 | const mounted = function() {
13 | this.editor = new JSONEditor({
14 | target: document.getElementById(this.container),
15 | props: {
16 | content: this.content,
17 | mode: this.mode,
18 | onChange: (updatedContent, previousContent, patchResult) => {
19 | // emit content changed event to parent
20 | this.$emit('content', {updatedContent, previousContent, patchResult})
21 | },
22 | onChangeMode: (mode) => {
23 | // emit mode changed event to parent
24 | this.$emit('mode', mode)
25 | }
26 | }
27 | })
28 | }
29 |
30 | const methods = {
31 | setContent(updatedContent) {
32 | if(this.mode == 'code')
33 | updatedContent.text = JSON.stringify(JSON.parse(updatedContent.text), null, this.indentation)
34 | this.editor.set(updatedContent)
35 | this.$emit('content', {updatedContent})
36 | }
37 | }
38 |
39 | const destroyed = function() {
40 | }
41 |
42 | export default {
43 | props: [
44 | 'content',
45 | 'mode'
46 | ],
47 | mixins: [
48 | ],
49 | components: {
50 | JSONEditor
51 | },
52 | directives: {
53 | },
54 | name: 'JsonEditor',
55 | data () {
56 | return {
57 | container: 'jsonEditorContainer',
58 | editor: null,
59 | indentation: 2
60 | }
61 | },
62 | created: created,
63 | computed: computed,
64 | watch: watch,
65 | mounted: mounted,
66 | methods: methods,
67 | destroyed: destroyed
68 | }
69 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/js/helpers/loading-blocker.js:
--------------------------------------------------------------------------------
1 | import ProgressSpinner from 'primevue/progressspinner'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | loadingBlockerClass() {
8 | return this.theme + '-loading-blocker-' + this.themeVariety
9 | },
10 | locale() {
11 | return this.$store.getters['main/getLocale']
12 | },
13 | theme() {
14 | return this.$store.getters['main/getTheme']
15 | },
16 | themeVariety() {
17 | return this.$store.getters['main/getThemeVariety']
18 | }
19 | }
20 |
21 | const watch = {
22 | }
23 |
24 | const mounted = function() {
25 | }
26 |
27 | const methods = {
28 | }
29 |
30 | const destroyed = function() {
31 | }
32 |
33 | export default {
34 | props: ['loading', 'message'],
35 | mixins: [
36 | ],
37 | components: {
38 | ProgressSpinner
39 | },
40 | directives: {
41 | },
42 | name: 'LoadingBlocker',
43 | data () {
44 | return {
45 | }
46 | },
47 | created: created,
48 | computed: computed,
49 | watch: watch,
50 | mounted: mounted,
51 | methods: methods,
52 | destroyed: destroyed
53 | }
54 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/js/router.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue/dist/vue.esm-bundler'
2 | import { createWebHistory, createRouter } from 'vue-router'
3 | import { createI18n } from 'vue-i18n/dist/vue-i18n.cjs'
4 | import { createStore } from 'vuex'
5 |
6 | import Locale_en_GB from '@/src/locales/en_GB.js'
7 | import MainStore from '@/src/stores/main.js'
8 |
9 | import PrimeVue from 'primevue/config'
10 | import ConfirmationService from 'primevue/confirmationservice'
11 | import ToastService from 'primevue/toastservice'
12 |
13 | const store = createStore({
14 | modules: {
15 | main: MainStore
16 | }
17 | });
18 |
19 | const messages = {
20 | 'en_GB': Locale_en_GB
21 | }
22 |
23 | const i18n = createI18n({
24 | locale: 'en_GB',
25 | fallbackLocale: 'en_GB',
26 | messages
27 | })
28 |
29 | const Template = () => import('@/src/components/template/Template.vue')
30 | const Asset = () => import('@/src/components/asset/Asset.vue')
31 |
32 | const routes = [
33 | {
34 | path: '/',
35 | name: 'template',
36 | title: 'Template',
37 | component: Template,
38 | children: [
39 | {
40 | path: ':cid',
41 | component: Template
42 | }
43 | ]
44 | },
45 | {
46 | path: '/asset',
47 | name: 'asset',
48 | title: 'Asset',
49 | component: Asset,
50 | children: [
51 | {
52 | path: ':cid',
53 | component: Asset
54 | }
55 | ]
56 | }];
57 |
58 | const router = createRouter({
59 | history: createWebHistory(),
60 | routes
61 | })
62 |
63 | const routerApp = createApp(router)
64 | routerApp.use(router)
65 | routerApp.use(i18n)
66 | routerApp.use(store)
67 | routerApp.use(PrimeVue, {ripple: true})
68 | routerApp.use(ConfirmationService)
69 | routerApp.use(ToastService)
70 | routerApp.mount('#router_app')
71 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/clipboard/copy-to-clipboard.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | copyToClipboard(event){
3 | const that = this
4 | const content = event.target.getAttribute('data-ref')
5 | if (!navigator.clipboard){
6 | this.$refs[content].focus()
7 | this.$refs[content].select()
8 | document.execCommand('copy')
9 | this.$toast.add({
10 | severity: 'success',
11 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
12 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
13 | life: 3000
14 | })
15 | }
16 | else {
17 | navigator.clipboard.writeText(content).then(
18 | () => {
19 | that.$toast.add({
20 | severity: 'success',
21 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
22 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
23 | life: 3000
24 | })
25 | })
26 | .catch(
27 | () => {
28 | that.$toast.add({
29 | severity: 'error',
30 | summary: 'Error!',
31 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.not-copied"),
32 | life: 3000
33 | })
34 | })
35 | }
36 | }
37 | }
38 |
39 | export default {
40 | data () {
41 | return {
42 | }
43 | },
44 | methods: methods
45 | }
46 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/cookie/cookie.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setCookie(name, value, days) {
3 | let expires = ""
4 | if (days) {
5 | let date = new Date()
6 | date.setTime(date.getTime() + (days*24*60*60*1000))
7 | expires = "; expires=" + date.toUTCString()
8 | }
9 | document.cookie = name + "=" + (value || "") + expires + "; path=/"
10 | },
11 | getCookie(name) {
12 | let nameEQ = name + "="
13 | let ca = document.cookie.split(';')
14 | for(let i=0;i < ca.length;i++) {
15 | let c = ca[i]
16 | while (c.charAt(0)==' ') c = c.substring(1,c.length)
17 | if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
18 | }
19 | return null
20 | },
21 | eraseCookie(name) {
22 | document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
23 | }
24 | }
25 |
26 | export default {
27 | data () {
28 | return {
29 | }
30 | },
31 | methods: methods
32 | }
33 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/delay/delay.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | delay(ms) {
3 | return new Promise(resolve => setTimeout(resolve, ms));
4 | }
5 | }
6 |
7 | export default {
8 | data () {
9 | return {
10 | }
11 | },
12 | methods: methods
13 | }
14 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/error/print.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | printError(error, duration) {
3 | if(error != null) {
4 | if(!duration)
5 | duration = 3000
6 | try {
7 | while(typeof error != 'string') {
8 | error = error.message || error.error
9 | }
10 | } catch (err) {
11 | this.printError(err)
12 | }
13 | this.$toast.add({severity: 'error', summary: this.$t('message.shared.error'), detail: error, life: duration})
14 | }
15 | }
16 | }
17 |
18 | export default {
19 | data () {
20 | return {
21 | }
22 | },
23 | methods: methods
24 | }
25 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/file/human-readable-file-size.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | humanReadableFileSize(bytes){
3 | if(bytes < 1024) {
4 | return `${bytes} bytes`
5 | }
6 | else if(bytes < 1024*1024) {
7 | return `${Math.round(bytes/1024)} kB`
8 | }
9 | else if(bytes < 1024*1024*1024) {
10 | return `${Math.round(bytes/(1024*1024))} MB`
11 | }
12 | else if(bytes < 1024*1024*1024*1024) {
13 | return `${Math.round(bytes/(1024*1024*1024))} GB`
14 | }
15 | else if(bytes < 1024*1024*1024*1024*1024) {
16 | return `${Math.round(bytes/(1024*1024*1024*1024))} TB`
17 | }
18 | else if(bytes < 1024*1024*1024*1024*1024*1024) {
19 | return `${Math.round(bytes/(1024*1024*1024*1024*1024))} PB`
20 | }
21 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024) {
22 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024))} EB`
23 | }
24 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024*1024) {
25 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024))} ZB`
26 | }
27 | else {
28 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024*1024))} YB`
29 | }
30 | }
31 | }
32 |
33 | export default {
34 | data () {
35 | return {
36 | }
37 | },
38 | methods: methods
39 | }
40 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/form-elements/sync-form-files.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | syncFormFiles(sync) {
3 | const event = sync.event
4 | let element = sync.element
5 | if(!element.value)
6 | element.value = []
7 | else
8 | element.value = element.value.filter((v) => {return v.existing})
9 |
10 | if(event != undefined && event.files != undefined)
11 | for (const file of event.files) {
12 | const existingFilenames = element.value.map((v) => {return v.path})
13 | if(!element.value.existing && existingFilenames.indexOf(`/${file.name}`) == -1 && existingFilenames.indexOf(file.name) == -1)
14 | element.value.push({
15 | path: `/${file.name}`,
16 | content: file
17 | })
18 | }
19 | }
20 | }
21 |
22 | export default {
23 | data () {
24 | return {
25 | }
26 | },
27 | methods: methods
28 | }
29 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/i18n/language.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setLanguage(route){
3 | try{
4 | if(route.params['lang'])
5 | this.$i18n.locale = route.params['lang'];
6 | }
7 | catch(e){
8 | console.log(e);
9 | }
10 | }
11 | }
12 |
13 | export default {
14 | data () {
15 | return {
16 | }
17 | },
18 | methods: methods
19 | }
20 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/ipfs/cid-obj-to-str.js:
--------------------------------------------------------------------------------
1 | import { CID } from 'multiformats/cid'
2 | import { base32 } from 'multiformats/bases/base32'
3 | import multihash from 'multihashes'
4 |
5 | const methods = {
6 | cidObjToStr(cidObj){
7 | const bytes = Uint8Array.from(Object.values(cidObj.hash))
8 | const encoded = multihash.encode(bytes, 'sha2-256')
9 | encoded.bytes = bytes
10 | const cid = CID.createV1(cidObj.code, encoded)
11 | return cid.toString(base32)
12 | }
13 | }
14 |
15 | export default {
16 | data () {
17 | return {
18 | }
19 | },
20 | methods: methods
21 | }
22 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/ipfs/determine-template-type-and-keys.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | determineTemplateTypeAndKeys(template){
3 | let templateKeys = []
4 | let templateType = 'object'
5 | if(Array.isArray(template)) {
6 | // Template is a list
7 | if(Array.isArray(template[0])) {
8 | // Template is a list of lists
9 | templateKeys = template.map((el)=>{return el[0]})
10 | templateType = 'list_of_lists'
11 | }
12 | else {
13 | // Template is a list of objects
14 | templateKeys = template.map((el)=>{return Object.keys(el)[0]})
15 | templateType = 'list_of_objects'
16 | }
17 | }
18 | else {
19 | // Template is an object
20 | templateKeys = Object.keys(template)
21 | }
22 | return {
23 | templateType: templateType,
24 | templateKeys: templateKeys
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/ipfs/ensure-ipfs-is-running.js:
--------------------------------------------------------------------------------
1 | import LoadingBlocker from '@/src/components/helpers/LoadingBlocker.vue'
2 |
3 | const methods = {
4 | async ensureIpfsIsRunning(fgStorage){
5 | this.loadingMessage = this.$t('message.shared.initializing-ipfs-node')
6 | this.loading = true
7 | const ipfs = await fgStorage.ensureIpfsIsRunning()
8 | this.$store.dispatch('main/setIpfs', ipfs)
9 | this.loading = false
10 | return ipfs
11 | }
12 | }
13 |
14 | export default {
15 | componentc: {
16 | LoadingBlocker
17 | },
18 | data () {
19 | return {
20 | loading: false,
21 | loadingMessage: ''
22 | }
23 | },
24 | methods: methods
25 | }
26 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/ipfs/normalize-schema-fields.js:
--------------------------------------------------------------------------------
1 | import cidObjToStr from '@/src/mixins/ipfs/cid-obj-to-str.js'
2 |
3 | const methods = {
4 | normalizeSchemaFields(template){
5 | if(Array.isArray(template)) {
6 | for (const el of template) {
7 | if(Array.isArray(el)) {
8 | const val = el[1]
9 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
10 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
11 | && typeof val.value == 'object')
12 | val.value = this.cidObjToStr(val.value)
13 | }
14 | else {
15 | const key = Object.keys(el)[0]
16 | const val = el[key]
17 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
18 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
19 | && typeof val.value == 'object')
20 | val.value = this.cidObjToStr(val.value)
21 | }
22 | }
23 | }
24 | else {
25 | const keys = Object.keys(template)
26 | for (const key of keys) {
27 | const val = template[key]
28 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
29 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
30 | && typeof val.value == 'object')
31 | val.value = this.cidObjToStr(val.value)
32 | }
33 | }
34 | return template
35 | }
36 | }
37 |
38 | export default {
39 | data () {
40 | return {
41 | }
42 | },
43 | mixins: [
44 | cidObjToStr
45 | ],
46 | methods: methods
47 | }
48 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/mixins/router/navigate.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | navigate(path) {
3 | this.$router.push({ path: path })
4 | },
5 | externalUrl(url, target) {
6 | window.open(url, (target) ? target : "_blank")
7 | }
8 | }
9 |
10 | export default {
11 | data () {
12 | return {
13 | }
14 | },
15 | methods: methods
16 | }
17 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/scss/helpers/json-editor.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/decarbonize.travel/src/scss/helpers/json-editor.scss
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/scss/helpers/loading-blocker.scss:
--------------------------------------------------------------------------------
1 | .common-loading-blocker {
2 | position: fixed;
3 | top: 0;
4 | left: 0;
5 | bottom: 0;
6 | right: 0;
7 | width: 100vw;
8 | height: 100vh;
9 | background-color: rgba(255, 255, 255, .75);
10 |
11 | z-index: 10;
12 |
13 | @keyframes p-progress-spinner-color {
14 | 100%,
15 | 0% {
16 | stroke: #d62d20;
17 | }
18 | 40% {
19 | stroke: #0057e7;
20 | }
21 | 66% {
22 | stroke: #008744;
23 | }
24 | 80%,
25 | 90% {
26 | stroke: #ffa700;
27 | }
28 | }
29 |
30 | text-align: center;
31 | padding: 0 3rem;
32 |
33 | display: flex;
34 | flex-direction: column;
35 | flex-wrap: nowrap;
36 | justify-content: center;
37 |
38 | @media (max-width: 1024px) {
39 | }
40 |
41 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 800px) {
42 | }
43 | }
44 |
45 | .common-loading-blocker-light {
46 | @extend .common-loading-blocker !optional;
47 | }
48 |
--------------------------------------------------------------------------------
/client/decarbonize.travel/src/scss/router.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * import font
3 | */
4 | @import '~@/src/fonts/OpenSans/font.scss';
5 |
6 | body {
7 | font-family: 'Open Sans', sans-serif;
8 | margin: 0;
9 | padding: 0;
10 |
11 | background-color: #fff;
12 | }
13 |
14 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 1024px) {
15 | body {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/client/form/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "sourceType": "unambiguous",
3 | "presets": ["@babel/preset-env"],
4 | "plugins": [
5 | [
6 | "@babel/plugin-transform-runtime", {}
7 | ]
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/client/form/.env.example:
--------------------------------------------------------------------------------
1 | ESTUARY_API_KEY=ESTxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxARY
2 | INFURA_API_KEY=...
3 | PK=...
--------------------------------------------------------------------------------
/client/form/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Momcilo Dzunic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/form/README.md:
--------------------------------------------------------------------------------
1 | # form.co2.storage
2 | by [Momcilo Dzunic aka smartbee.eth](https://twitter.com/mdzunic)
3 |
4 | Simple co2.storage type/template previewer for easy asset creation.
5 |
6 | ### Demo
7 |
8 | [https://form.co2.storage/](https://form.co2.storage/)
9 |
10 | ### Use
11 | // clean dist
12 | npm run clean
13 |
14 | // build for production
15 | npm run build
16 |
17 | // run dev server with hot reload
18 | npm run start
19 |
20 | ### License
21 | Licensed under the MIT license.
22 | http://www.opensource.org/licenses/mit-license.php
23 |
--------------------------------------------------------------------------------
/client/form/assets/unverified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/assets/unverified.png
--------------------------------------------------------------------------------
/client/form/assets/verified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/assets/verified.png
--------------------------------------------------------------------------------
/client/form/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | form.co2.storage
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/client/form/src/components/helpers/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/client/form/src/components/helpers/JsonEditor.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/client/form/src/components/helpers/LoadingBlocker.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | {{ message }}
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-Bold.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-ExtraBold.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-Italic.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-Light.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-LightItalic.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-Medium.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-MediumItalic.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-SemiBold.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/client/form/src/fonts/OpenSans/font.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: 300;
4 | font-style: normal;
5 | src: url('~@/src/fonts/OpenSans/OpenSans-Light.ttf') format('truetype');
6 | }
7 |
8 | @font-face {
9 | font-family: 'Open Sans';
10 | font-weight: 400;
11 | font-style: normal;
12 | src: url('~@/src/fonts/OpenSans/OpenSans-Regular.ttf') format('truetype');
13 | }
14 |
15 | @font-face {
16 | font-family: 'Open Sans';
17 | font-weight: 700;
18 | font-style: normal;
19 | src: url('~@/src/fonts/OpenSans/OpenSans-Bold.ttf') format('truetype');
20 | }
21 |
22 | @font-face {
23 | font-family: 'Open Sans';
24 | font-weight: 300;
25 | font-style: italic;
26 | src: url('~@/src/fonts/OpenSans/OpenSans-LightItalic.ttf') format('truetype');
27 | }
28 |
29 | @font-face {
30 | font-family: 'Open Sans';
31 | font-weight: 400;
32 | font-style: italic;
33 | src: url('~@/src/fonts/OpenSans/OpenSans-Italic.ttf') format('truetype');
34 | }
35 |
36 | @font-face {
37 | font-family: 'Open Sans';
38 | font-weight: 700;
39 | font-style: italic;
40 | src: url('~@/src/fonts/OpenSans/OpenSans-BoldItalic.ttf') format('truetype');
41 | }
42 |
--------------------------------------------------------------------------------
/client/form/src/js/helpers/header.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | const created = async function() {
4 | const that = this
5 |
6 | // set language
7 | this.setLanguage(this.$route)
8 | }
9 |
10 | const computed = {
11 | headerClass() {
12 | return this.theme + '-header-' + this.themeVariety
13 | },
14 | locale() {
15 | return this.$store.getters['main/getLocale']
16 | },
17 | theme() {
18 | return this.$store.getters['main/getTheme']
19 | },
20 | themeVariety() {
21 | return this.$store.getters['main/getThemeVariety']
22 | },
23 | selectedAddress() {
24 | return this.$store.getters['main/getSelectedAddress']
25 | }
26 | }
27 |
28 | const watch = {
29 | }
30 |
31 | const mounted = async function() {
32 | }
33 |
34 | const methods = {
35 | async account() {
36 | if(this.selectedAddress == undefined)
37 | this.$emit('authenticate')
38 | }
39 | }
40 |
41 | const destroyed = function() {
42 | }
43 |
44 | export default {
45 | props: [],
46 | mixins: [
47 | language
48 | ],
49 | components: {
50 | },
51 | directives: {
52 | },
53 | name: 'Header',
54 | data () {
55 | return {
56 | }
57 | },
58 | created: created,
59 | computed: computed,
60 | watch: watch,
61 | mounted: mounted,
62 | methods: methods,
63 | destroyed: destroyed
64 | }
65 |
--------------------------------------------------------------------------------
/client/form/src/js/helpers/json-editor.js:
--------------------------------------------------------------------------------
1 | import { JSONEditor } from 'svelte-jsoneditor/dist/jsoneditor.js'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | }
8 |
9 | const watch = {
10 | }
11 |
12 | const mounted = function() {
13 | this.editor = new JSONEditor({
14 | target: document.getElementById(this.container),
15 | props: {
16 | content: this.content,
17 | mode: this.mode,
18 | onChange: (updatedContent, previousContent, patchResult) => {
19 | // emit content changed event to parent
20 | this.$emit('content', {updatedContent, previousContent, patchResult})
21 | },
22 | onChangeMode: (mode) => {
23 | // emit mode changed event to parent
24 | this.$emit('mode', mode)
25 | }
26 | }
27 | })
28 | }
29 |
30 | const methods = {
31 | setContent(updatedContent) {
32 | if(this.mode == 'text')
33 | updatedContent.text = JSON.stringify(JSON.parse(updatedContent.text), null, this.indentation)
34 | this.editor.set(updatedContent)
35 | this.$emit('content', {updatedContent})
36 | }
37 | }
38 |
39 | const destroyed = function() {
40 | }
41 |
42 | export default {
43 | props: [
44 | 'content',
45 | 'mode'
46 | ],
47 | mixins: [
48 | ],
49 | components: {
50 | JSONEditor
51 | },
52 | directives: {
53 | },
54 | name: 'JsonEditor',
55 | data () {
56 | return {
57 | container: 'jsonEditorContainer',
58 | editor: null,
59 | indentation: 2
60 | }
61 | },
62 | created: created,
63 | computed: computed,
64 | watch: watch,
65 | mounted: mounted,
66 | methods: methods,
67 | destroyed: destroyed
68 | }
69 |
--------------------------------------------------------------------------------
/client/form/src/js/helpers/loading-blocker.js:
--------------------------------------------------------------------------------
1 | import ProgressSpinner from 'primevue/progressspinner'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | loadingBlockerClass() {
8 | return this.theme + '-loading-blocker-' + this.themeVariety
9 | },
10 | locale() {
11 | return this.$store.getters['main/getLocale']
12 | },
13 | theme() {
14 | return this.$store.getters['main/getTheme']
15 | },
16 | themeVariety() {
17 | return this.$store.getters['main/getThemeVariety']
18 | }
19 | }
20 |
21 | const watch = {
22 | }
23 |
24 | const mounted = function() {
25 | }
26 |
27 | const methods = {
28 | }
29 |
30 | const destroyed = function() {
31 | }
32 |
33 | export default {
34 | props: ['loading', 'message'],
35 | mixins: [
36 | ],
37 | components: {
38 | ProgressSpinner
39 | },
40 | directives: {
41 | },
42 | name: 'LoadingBlocker',
43 | data () {
44 | return {
45 | }
46 | },
47 | created: created,
48 | computed: computed,
49 | watch: watch,
50 | mounted: mounted,
51 | methods: methods,
52 | destroyed: destroyed
53 | }
54 |
--------------------------------------------------------------------------------
/client/form/src/js/router.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue/dist/vue.esm-bundler'
2 | import { createWebHistory, createRouter } from 'vue-router'
3 | import { createI18n } from 'vue-i18n/dist/vue-i18n.cjs'
4 | import { createStore } from 'vuex'
5 |
6 | import Locale_en_GB from '@/src/locales/en_GB.js'
7 | import MainStore from '@/src/stores/main.js'
8 |
9 | import PrimeVue from 'primevue/config'
10 | import ConfirmationService from 'primevue/confirmationservice'
11 | import ToastService from 'primevue/toastservice'
12 |
13 | const store = createStore({
14 | modules: {
15 | main: MainStore
16 | }
17 | });
18 |
19 | const messages = {
20 | 'en_GB': Locale_en_GB
21 | }
22 |
23 | const i18n = createI18n({
24 | locale: 'en_GB',
25 | fallbackLocale: 'en_GB',
26 | messages
27 | })
28 |
29 | const Template = () => import('@/src/components/template/Template.vue')
30 | const Asset = () => import('@/src/components/asset/Asset.vue')
31 |
32 | const routes = [
33 | {
34 | path: '/',
35 | name: 'template',
36 | title: 'Template',
37 | component: Template,
38 | children: [
39 | {
40 | path: ':cid',
41 | component: Template
42 | }
43 | ]
44 | },
45 | {
46 | path: '/asset',
47 | name: 'asset',
48 | title: 'Asset',
49 | component: Asset,
50 | children: [
51 | {
52 | path: ':cid',
53 | component: Asset
54 | }
55 | ]
56 | }];
57 |
58 | const router = createRouter({
59 | history: createWebHistory(),
60 | routes
61 | })
62 |
63 | const routerApp = createApp(router)
64 | routerApp.use(router)
65 | routerApp.use(i18n)
66 | routerApp.use(store)
67 | routerApp.use(PrimeVue, {ripple: true})
68 | routerApp.use(ConfirmationService)
69 | routerApp.use(ToastService)
70 | routerApp.mount('#router_app')
71 |
--------------------------------------------------------------------------------
/client/form/src/mixins/clipboard/copy-to-clipboard.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | copyToClipboard(event){
3 | const that = this
4 | const content = event.target.getAttribute('data-ref')
5 | if (!navigator.clipboard){
6 | this.$refs[content].focus()
7 | this.$refs[content].select()
8 | document.execCommand('copy')
9 | this.$toast.add({
10 | severity: 'success',
11 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
12 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
13 | life: 3000
14 | })
15 | }
16 | else {
17 | navigator.clipboard.writeText(content).then(
18 | () => {
19 | that.$toast.add({
20 | severity: 'success',
21 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
22 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
23 | life: 3000
24 | })
25 | })
26 | .catch(
27 | () => {
28 | that.$toast.add({
29 | severity: 'error',
30 | summary: 'Error!',
31 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.not-copied"),
32 | life: 3000
33 | })
34 | })
35 | }
36 | }
37 | }
38 |
39 | export default {
40 | data () {
41 | return {
42 | }
43 | },
44 | methods: methods
45 | }
46 |
--------------------------------------------------------------------------------
/client/form/src/mixins/cookie/cookie.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setCookie(name, value, days) {
3 | let expires = ""
4 | if (days) {
5 | let date = new Date()
6 | date.setTime(date.getTime() + (days*24*60*60*1000))
7 | expires = "; expires=" + date.toUTCString()
8 | }
9 | document.cookie = name + "=" + (value || "") + expires + "; path=/"
10 | },
11 | getCookie(name) {
12 | let nameEQ = name + "="
13 | let ca = document.cookie.split(';')
14 | for(let i=0;i < ca.length;i++) {
15 | let c = ca[i]
16 | while (c.charAt(0)==' ') c = c.substring(1,c.length)
17 | if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
18 | }
19 | return null
20 | },
21 | eraseCookie(name) {
22 | document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
23 | }
24 | }
25 |
26 | export default {
27 | data () {
28 | return {
29 | }
30 | },
31 | methods: methods
32 | }
33 |
--------------------------------------------------------------------------------
/client/form/src/mixins/delay/delay.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | delay(ms) {
3 | return new Promise(resolve => setTimeout(resolve, ms));
4 | }
5 | }
6 |
7 | export default {
8 | data () {
9 | return {
10 | }
11 | },
12 | methods: methods
13 | }
14 |
--------------------------------------------------------------------------------
/client/form/src/mixins/error/print.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | printError(error, duration) {
3 | if(error != null) {
4 | if(!duration)
5 | duration = 3000
6 | try {
7 | while(typeof error != 'string') {
8 | error = error.message || error.error
9 | }
10 | } catch (err) {
11 | this.printError(err)
12 | }
13 | this.$toast.add({severity: 'error', summary: this.$t('message.shared.error'), detail: error, life: duration})
14 | }
15 | }
16 | }
17 |
18 | export default {
19 | data () {
20 | return {
21 | }
22 | },
23 | methods: methods
24 | }
25 |
--------------------------------------------------------------------------------
/client/form/src/mixins/file/human-readable-file-size.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | humanReadableFileSize(bytes){
3 | if(bytes < 1024) {
4 | return `${bytes} bytes`
5 | }
6 | else if(bytes < 1024*1024) {
7 | return `${Math.round(bytes/1024)} kB`
8 | }
9 | else if(bytes < 1024*1024*1024) {
10 | return `${Math.round(bytes/(1024*1024))} MB`
11 | }
12 | else if(bytes < 1024*1024*1024*1024) {
13 | return `${Math.round(bytes/(1024*1024*1024))} GB`
14 | }
15 | else if(bytes < 1024*1024*1024*1024*1024) {
16 | return `${Math.round(bytes/(1024*1024*1024*1024))} TB`
17 | }
18 | else if(bytes < 1024*1024*1024*1024*1024*1024) {
19 | return `${Math.round(bytes/(1024*1024*1024*1024*1024))} PB`
20 | }
21 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024) {
22 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024))} EB`
23 | }
24 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024*1024) {
25 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024))} ZB`
26 | }
27 | else {
28 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024*1024))} YB`
29 | }
30 | }
31 | }
32 |
33 | export default {
34 | data () {
35 | return {
36 | }
37 | },
38 | methods: methods
39 | }
40 |
--------------------------------------------------------------------------------
/client/form/src/mixins/form-elements/sync-form-files.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | syncFormFiles(sync) {
3 | const event = sync.event
4 | let element = sync.element
5 | if(!element.value)
6 | element.value = []
7 | else
8 | element.value = element.value.filter((v) => {return v.existing})
9 |
10 | if(event != undefined && event.files != undefined)
11 | for (const file of event.files) {
12 | const existingFilenames = element.value.map((v) => {return v.path})
13 | if(!element.value.existing && existingFilenames.indexOf(`/${file.name}`) == -1 && existingFilenames.indexOf(file.name) == -1)
14 | element.value.push({
15 | path: `/${file.name}`,
16 | content: file
17 | })
18 | }
19 | }
20 | }
21 |
22 | export default {
23 | data () {
24 | return {
25 | }
26 | },
27 | methods: methods
28 | }
29 |
--------------------------------------------------------------------------------
/client/form/src/mixins/i18n/language.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setLanguage(route){
3 | try{
4 | if(route.params['lang'])
5 | this.$i18n.locale = route.params['lang'];
6 | }
7 | catch(e){
8 | console.log(e);
9 | }
10 | }
11 | }
12 |
13 | export default {
14 | data () {
15 | return {
16 | }
17 | },
18 | methods: methods
19 | }
20 |
--------------------------------------------------------------------------------
/client/form/src/mixins/ipfs/cid-obj-to-str.js:
--------------------------------------------------------------------------------
1 | import { CID } from 'multiformats/cid'
2 | import { base32 } from 'multiformats/bases/base32'
3 | import multihash from 'multihashes'
4 |
5 | const methods = {
6 | cidObjToStr(cidObj){
7 | if(typeof cidObj == 'object' && !Array.isArray(cidObj) && Object.keys(cidObj).indexOf("/") > -1) {
8 | const val = cidObj["/"]
9 | if(typeof val == 'string') {
10 | return val
11 | }
12 | else {
13 | return cidObj.toString(base32)
14 | }
15 | }
16 | else if(typeof cidObj == 'object' && !Array.isArray(cidObj) && Object.keys(cidObj)["code"] > -1 && Object.keys(cidObj)["hash"] > -1) {
17 | const bytes = Uint8Array.from(Object.values(cidObj.hash))
18 | const encoded = multihash.encode(bytes, 'sha2-256')
19 | encoded.bytes = bytes
20 |
21 | return (CID.createV1(cidObj.code, encoded)).toString(base32)
22 | }
23 | else if(typeof cidObj == 'string') {
24 | return cidObj
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/form/src/mixins/ipfs/determine-template-type-and-keys.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | determineTemplateTypeAndKeys(template){
3 | let templateKeys = []
4 | let templateType = 'object'
5 | if(Array.isArray(template)) {
6 | // Template is a list
7 | if(Array.isArray(template[0])) {
8 | // Template is a list of lists
9 | templateKeys = template.map((el)=>{return el[0]})
10 | templateType = 'list_of_lists'
11 | }
12 | else {
13 | // Template is a list of objects
14 | templateKeys = template.map((el)=>{return Object.keys(el)[0]})
15 | templateType = 'list_of_objects'
16 | }
17 | }
18 | else {
19 | // Template is an object
20 | templateKeys = Object.keys(template)
21 | }
22 | return {
23 | templateType: templateType,
24 | templateKeys: templateKeys
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/form/src/mixins/ipfs/ensure-ipfs-is-running.js:
--------------------------------------------------------------------------------
1 | import LoadingBlocker from '@/src/components/helpers/LoadingBlocker.vue'
2 |
3 | const methods = {
4 | async ensureIpfsIsRunning(fgStorage){
5 | this.loadingMessage = this.$t('message.shared.initializing-ipfs-node')
6 | this.loading = true
7 | const ipfs = await fgStorage.ensureIpfsIsRunning()
8 | this.$store.dispatch('main/setIpfs', ipfs)
9 | this.loading = false
10 | return ipfs
11 | }
12 | }
13 |
14 | export default {
15 | componentc: {
16 | LoadingBlocker
17 | },
18 | data () {
19 | return {
20 | loading: false,
21 | loadingMessage: ''
22 | }
23 | },
24 | methods: methods
25 | }
26 |
--------------------------------------------------------------------------------
/client/form/src/mixins/ipfs/normalize-schema-fields.js:
--------------------------------------------------------------------------------
1 | import cidObjToStr from '@/src/mixins/ipfs/cid-obj-to-str.js'
2 |
3 | const methods = {
4 | normalizeSchemaFields(template){
5 | if(Array.isArray(template)) {
6 | for (const el of template) {
7 | if(Array.isArray(el)) {
8 | const val = el[1]
9 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
10 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
11 | && typeof val.value == 'object')
12 | val.value = this.cidObjToStr(val.value)
13 | }
14 | else {
15 | const key = Object.keys(el)[0]
16 | const val = el[key]
17 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
18 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
19 | && typeof val.value == 'object')
20 | val.value = this.cidObjToStr(val.value)
21 | }
22 | }
23 | }
24 | else {
25 | const keys = Object.keys(template)
26 | for (const key of keys) {
27 | const val = template[key]
28 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
29 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
30 | && typeof val.value == 'object')
31 | val.value = this.cidObjToStr(val.value)
32 | }
33 | }
34 | return template
35 | }
36 | }
37 |
38 | export default {
39 | data () {
40 | return {
41 | }
42 | },
43 | mixins: [
44 | cidObjToStr
45 | ],
46 | methods: methods
47 | }
48 |
--------------------------------------------------------------------------------
/client/form/src/mixins/router/navigate.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | navigate(path) {
3 | this.$router.push({ path: path })
4 | },
5 | externalUrl(url, target) {
6 | window.open(url, (target) ? target : "_blank")
7 | }
8 | }
9 |
10 | export default {
11 | data () {
12 | return {
13 | }
14 | },
15 | methods: methods
16 | }
17 |
--------------------------------------------------------------------------------
/client/form/src/scss/helpers/json-editor.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/form/src/scss/helpers/json-editor.scss
--------------------------------------------------------------------------------
/client/form/src/scss/helpers/loading-blocker.scss:
--------------------------------------------------------------------------------
1 | .common-loading-blocker {
2 | position: fixed;
3 | top: 0;
4 | left: 0;
5 | bottom: 0;
6 | right: 0;
7 | width: 100vw;
8 | height: 100vh;
9 | background-color: rgba(255, 255, 255, .75);
10 |
11 | z-index: 10;
12 |
13 | @keyframes p-progress-spinner-color {
14 | 100%,
15 | 0% {
16 | stroke: #d62d20;
17 | }
18 | 40% {
19 | stroke: #0057e7;
20 | }
21 | 66% {
22 | stroke: #008744;
23 | }
24 | 80%,
25 | 90% {
26 | stroke: #ffa700;
27 | }
28 | }
29 |
30 | text-align: center;
31 | padding: 0 3rem;
32 |
33 | display: flex;
34 | flex-direction: column;
35 | flex-wrap: nowrap;
36 | justify-content: center;
37 |
38 | @media (max-width: 1024px) {
39 | }
40 |
41 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 800px) {
42 | }
43 | }
44 |
45 | .common-loading-blocker-light {
46 | @extend .common-loading-blocker !optional;
47 | }
48 |
--------------------------------------------------------------------------------
/client/form/src/scss/router.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * import font
3 | */
4 | @import '~@/src/fonts/OpenSans/font.scss';
5 |
6 | body {
7 | font-family: 'Open Sans', sans-serif;
8 | margin: 0;
9 | padding: 0;
10 |
11 | background-color: #fff;
12 | }
13 |
14 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 1024px) {
15 | body {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/client/landing-page/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "sourceType": "unambiguous",
3 | "presets": ["@babel/preset-env"],
4 | "plugins": [
5 | [
6 | "@babel/plugin-transform-runtime", {}
7 | ]
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/client/landing-page/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Momcilo Dzunic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/landing-page/README.md:
--------------------------------------------------------------------------------
1 | # co2.storage landing page
2 |
3 | ### Use
4 |
5 | ### ToDo
6 |
7 | ### License
8 | Licensed under the MIT license.
9 | http://www.opensource.org/licenses/mit-license.php
10 |
--------------------------------------------------------------------------------
/client/landing-page/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | CO2.Storage
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/client/landing-page/src/components/helpers/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Bold 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Bold 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Bold.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-BoldItalic 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-BoldItalic 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBold 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBold 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBold.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBoldItalic 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBoldItalic 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Italic 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Italic 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Italic.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Light 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Light 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Light.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-LightItalic 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-LightItalic 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-LightItalic.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Medium.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-MediumItalic.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-SemiBold 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-SemiBold 2.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-SemiBold.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/landing-page/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/client/landing-page/src/fonts/OpenSans/font.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: 300;
4 | font-style: normal;
5 | src: url('~@/src/fonts/OpenSans/OpenSans-Light.ttf') format('truetype');
6 | }
7 |
8 | @font-face {
9 | font-family: 'Open Sans';
10 | font-weight: 400;
11 | font-style: normal;
12 | src: url('~@/src/fonts/OpenSans/OpenSans-Regular.ttf') format('truetype');
13 | }
14 |
15 | @font-face {
16 | font-family: 'Open Sans';
17 | font-weight: 700;
18 | font-style: normal;
19 | src: url('~@/src/fonts/OpenSans/OpenSans-Bold.ttf') format('truetype');
20 | }
21 |
22 | @font-face {
23 | font-family: 'Open Sans';
24 | font-weight: 300;
25 | font-style: italic;
26 | src: url('~@/src/fonts/OpenSans/OpenSans-LightItalic.ttf') format('truetype');
27 | }
28 |
29 | @font-face {
30 | font-family: 'Open Sans';
31 | font-weight: 400;
32 | font-style: italic;
33 | src: url('~@/src/fonts/OpenSans/OpenSans-Italic.ttf') format('truetype');
34 | }
35 |
36 | @font-face {
37 | font-family: 'Open Sans';
38 | font-weight: 700;
39 | font-style: italic;
40 | src: url('~@/src/fonts/OpenSans/OpenSans-BoldItalic.ttf') format('truetype');
41 | }
42 |
--------------------------------------------------------------------------------
/client/landing-page/src/js/helpers/header 2.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | const created = function() {
4 | const that = this
5 |
6 | // set language
7 | this.setLanguage(this.$route)
8 | }
9 |
10 | const computed = {
11 | headerClass() {
12 | return this.theme + '-header-' + this.themeVariety
13 | },
14 | locale() {
15 | return this.$store.getters['main/getLocale']
16 | },
17 | theme() {
18 | return this.$store.getters['main/getTheme']
19 | },
20 | themeVariety() {
21 | return this.$store.getters['main/getThemeVariety']
22 | }
23 | }
24 |
25 | const watch = {
26 | }
27 |
28 | const mounted = async function() {
29 | }
30 |
31 | const methods = {
32 | }
33 |
34 | const destroyed = function() {
35 | }
36 |
37 | export default {
38 | props: [],
39 | mixins: [
40 | language
41 | ],
42 | components: {
43 | },
44 | directives: {
45 | },
46 | name: 'Header',
47 | data () {
48 | return {
49 | }
50 | },
51 | created: created,
52 | computed: computed,
53 | watch: watch,
54 | mounted: mounted,
55 | methods: methods,
56 | destroyed: destroyed
57 | }
58 |
--------------------------------------------------------------------------------
/client/landing-page/src/js/helpers/header.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | const created = function() {
4 | const that = this
5 |
6 | // set language
7 | this.setLanguage(this.$route)
8 | }
9 |
10 | const computed = {
11 | headerClass() {
12 | return this.theme + '-header-' + this.themeVariety
13 | },
14 | locale() {
15 | return this.$store.getters['main/getLocale']
16 | },
17 | theme() {
18 | return this.$store.getters['main/getTheme']
19 | },
20 | themeVariety() {
21 | return this.$store.getters['main/getThemeVariety']
22 | }
23 | }
24 |
25 | const watch = {
26 | }
27 |
28 | const mounted = async function() {
29 | }
30 |
31 | const methods = {
32 | }
33 |
34 | const destroyed = function() {
35 | }
36 |
37 | export default {
38 | props: [],
39 | mixins: [
40 | language
41 | ],
42 | components: {
43 | },
44 | directives: {
45 | },
46 | name: 'Header',
47 | data () {
48 | return {
49 | }
50 | },
51 | created: created,
52 | computed: computed,
53 | watch: watch,
54 | mounted: mounted,
55 | methods: methods,
56 | destroyed: destroyed
57 | }
58 |
--------------------------------------------------------------------------------
/client/landing-page/src/js/main/main 2.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | import Header from '@/src/components/helpers/Header.vue'
4 |
5 | const created = function() {
6 | const that = this
7 |
8 | // set language
9 | this.setLanguage(this.$route)
10 | }
11 |
12 | const computed = {
13 | mainClass() {
14 | return this.theme + '-main-' + this.themeVariety
15 | },
16 | locale() {
17 | return this.$store.getters['main/getLocale']
18 | },
19 | theme() {
20 | return this.$store.getters['main/getTheme']
21 | },
22 | themeVariety() {
23 | return this.$store.getters['main/getThemeVariety']
24 | }
25 | }
26 |
27 | const watch = {
28 | }
29 |
30 | const mounted = async function() {
31 | }
32 |
33 | const methods = {
34 | }
35 |
36 | const destroyed = function() {
37 | }
38 |
39 | export default {
40 | mixins: [
41 | language
42 | ],
43 | components: {
44 | Header
45 | },
46 | directives: {
47 | },
48 | name: 'Main',
49 | data () {
50 | return {
51 | }
52 | },
53 | created: created,
54 | computed: computed,
55 | watch: watch,
56 | mounted: mounted,
57 | methods: methods,
58 | destroyed: destroyed
59 | }
60 |
--------------------------------------------------------------------------------
/client/landing-page/src/js/main/main.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | import Header from '@/src/components/helpers/Header.vue'
4 |
5 | const created = function() {
6 | const that = this
7 |
8 | // set language
9 | this.setLanguage(this.$route)
10 | }
11 |
12 | const computed = {
13 | mainClass() {
14 | return this.theme + '-main-' + this.themeVariety
15 | },
16 | locale() {
17 | return this.$store.getters['main/getLocale']
18 | },
19 | theme() {
20 | return this.$store.getters['main/getTheme']
21 | },
22 | themeVariety() {
23 | return this.$store.getters['main/getThemeVariety']
24 | }
25 | }
26 |
27 | const watch = {
28 | }
29 |
30 | const mounted = async function() {
31 | }
32 |
33 | const methods = {
34 | }
35 |
36 | const destroyed = function() {
37 | }
38 |
39 | export default {
40 | mixins: [
41 | language
42 | ],
43 | components: {
44 | Header
45 | },
46 | directives: {
47 | },
48 | name: 'Main',
49 | data () {
50 | return {
51 | }
52 | },
53 | created: created,
54 | computed: computed,
55 | watch: watch,
56 | mounted: mounted,
57 | methods: methods,
58 | destroyed: destroyed
59 | }
60 |
--------------------------------------------------------------------------------
/client/landing-page/src/js/router.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue/dist/vue.esm-bundler'
2 | import { createWebHistory, createRouter } from 'vue-router'
3 | import { createI18n } from 'vue-i18n'
4 | import { createStore } from 'vuex'
5 |
6 | import Locale_en_GB from '@/src/locales/en_GB.js'
7 | import MainStore from '@/src/stores/main.js'
8 |
9 | import PrimeVue from 'primevue/config'
10 |
11 | const store = createStore({
12 | modules: {
13 | main: MainStore
14 | }
15 | });
16 |
17 | const messages = {
18 | 'en_GB': Locale_en_GB
19 | }
20 |
21 | const i18n = createI18n({
22 | locale: 'en_GB',
23 | fallbackLocale: 'en_GB',
24 | messages
25 | })
26 |
27 | const Main = () => import('@/src/components/main/Main.vue')
28 |
29 | const routes = [
30 | {
31 | path: '/',
32 | name: 'main',
33 | title: 'Main',
34 | component: Main
35 | }
36 | ]
37 |
38 | const router = createRouter({
39 | history: createWebHistory(),
40 | routes
41 | })
42 |
43 | const routerApp = createApp(router)
44 | routerApp.use(router)
45 | routerApp.use(i18n)
46 | routerApp.use(store)
47 | routerApp.use(PrimeVue, {ripple: true})
48 | routerApp.mount('#router_app')
49 |
--------------------------------------------------------------------------------
/client/landing-page/src/mixins/i18n/language.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setLanguage(route){
3 | try{
4 | if(route.params['lang'])
5 | this.$i18n.locale = route.params['lang'];
6 | }
7 | catch(e){
8 | console.log(e);
9 | }
10 | }
11 | }
12 |
13 | export default {
14 | data () {
15 | return {
16 | }
17 | },
18 | methods: methods
19 | }
20 |
--------------------------------------------------------------------------------
/client/landing-page/src/scss/router.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * import font
3 | */
4 | @import '~@/src/fonts/OpenSans/font.scss';
5 |
6 | body {
7 | font-family: 'Open Sans', sans-serif;
8 | margin: 0;
9 | padding: 0;
10 |
11 | background-color: #000;
12 | }
13 |
14 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 1024px) {
15 | body {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/client/landing-page/src/stores/main.js:
--------------------------------------------------------------------------------
1 | export default {
2 | namespaced: true,
3 | state: {
4 | theme: 'common',
5 | themeVariety: 'dark',
6 | locale: 'en_GB'
7 | },
8 | mutations: {
9 | SET_THEME(state, theme) {
10 | state.theme = theme;
11 | },
12 | SET_THEME_VARIETY(state, themeVariety) {
13 | state.themeVariety = themeVariety;
14 | },
15 | SET_LOCALE(state, locale) {
16 | state.locale = locale;
17 | }
18 | },
19 | actions: {
20 | setTheme(context, theme) {
21 | context.commit('SET_THEME', theme);
22 | },
23 | setThemeVariety(context, themeVariety) {
24 | context.commit('SET_THEME_VARIETY', themeVariety);
25 | },
26 | setLocale(context, locale) {
27 | context.commit('SET_LOCALE', locale);
28 | }
29 | },
30 | getters: {
31 | getTheme(state) {
32 | return state.theme;
33 | },
34 | getThemeVariety(state) {
35 | return state.themeVariety;
36 | },
37 | getLocale(state) {
38 | return state.locale;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["@babel/syntax-dynamic-import"],
3 | "presets": [
4 | [
5 | "@babel/preset-env",
6 | {
7 | "modules": false
8 | }
9 | ]
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/.env.example:
--------------------------------------------------------------------------------
1 | ESTUARY_API_KEY=ESTxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxARY
2 | INFURA_API_KEY=...
3 | PK=0x...
--------------------------------------------------------------------------------
/client/pipeline-inspector/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Momcilo Dzunic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/README.md:
--------------------------------------------------------------------------------
1 | # co2.storage
2 | by [Momcilo Dzunic aka smartbee.eth](https://twitter.com/mdzunic)
3 |
4 | Simple previewer for attestation documents and base data schema (DAG) objects related to Renewable Energy Certificates (RECs) -> [0004-FGTP-Content-Address-EACs](https://github.com/protocol/FilecoinGreen-tools/blob/main/0004-FGTP-Content-Address-EACs.md)
5 |
6 | ### Demo
7 |
8 | [https://filecoin-green-eac-browser.dzunic.net/](https://filecoin-green-eac-browser.dzunic.net/)
9 |
10 | ### Use
11 |
12 | Open-source [PDF.js](https://mozilla.github.io/pdf.js/) library is integrated into our project to render a PDF inside our app. After downloading the [latest stable release](https://mozilla.github.io/pdf.js/getting_started/#download) and then extracting the contents,
13 | make sure `libs` folder is available in root directory of your project. Also, make sure your hosting address is added to `HOSTED_VIEWER_ORIGINS` in `viewer.js` file.
14 |
15 | const HOSTED_VIEWER_ORIGINS = ["null", "http://mozilla.github.io", "https://mozilla.github.io", "https://localhost:3000", "http://localhost:3000"];
16 |
17 | You would also need an running IPFS node to attach to since this app is using `ipfs-http-client` lib.
18 |
19 | Thereafter run any of scripts defined in `package.json`
20 |
21 | // clean dist
22 | npm run clean
23 |
24 | // build for production
25 | npm run build
26 |
27 | // run dev server with hot reload
28 | npm run start
29 |
30 | ### ToDo
31 |
32 | 1. Attestation documents filtering
33 | 2. Direct link to specific Attestation document
34 |
35 | ### License
36 | Licensed under the MIT license.
37 | http://www.opensource.org/licenses/mit-license.php
38 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | CO2.Storage | Pipelines inspector
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/components/helpers/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/components/helpers/LoadingBlocker.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | {{ message }}
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Bold.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-ExtraBold.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Italic.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Light.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-LightItalic.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Medium.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-MediumItalic.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-SemiBold.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/pipeline-inspector/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/fonts/OpenSans/font.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: 300;
4 | font-style: normal;
5 | src: url('~@/src/fonts/OpenSans/OpenSans-Light.ttf') format('truetype');
6 | }
7 |
8 | @font-face {
9 | font-family: 'Open Sans';
10 | font-weight: 400;
11 | font-style: normal;
12 | src: url('~@/src/fonts/OpenSans/OpenSans-Regular.ttf') format('truetype');
13 | }
14 |
15 | @font-face {
16 | font-family: 'Open Sans';
17 | font-weight: 700;
18 | font-style: normal;
19 | src: url('~@/src/fonts/OpenSans/OpenSans-Bold.ttf') format('truetype');
20 | }
21 |
22 | @font-face {
23 | font-family: 'Open Sans';
24 | font-weight: 300;
25 | font-style: italic;
26 | src: url('~@/src/fonts/OpenSans/OpenSans-LightItalic.ttf') format('truetype');
27 | }
28 |
29 | @font-face {
30 | font-family: 'Open Sans';
31 | font-weight: 400;
32 | font-style: italic;
33 | src: url('~@/src/fonts/OpenSans/OpenSans-Italic.ttf') format('truetype');
34 | }
35 |
36 | @font-face {
37 | font-family: 'Open Sans';
38 | font-weight: 700;
39 | font-style: italic;
40 | src: url('~@/src/fonts/OpenSans/OpenSans-BoldItalic.ttf') format('truetype');
41 | }
42 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/js/helpers/header.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | const created = async function() {
4 | const that = this
5 |
6 | // set language
7 | this.setLanguage(this.$route)
8 | }
9 |
10 | const computed = {
11 | headerClass() {
12 | return this.theme + '-header-' + this.themeVariety
13 | },
14 | locale() {
15 | return this.$store.getters['main/getLocale']
16 | },
17 | theme() {
18 | return this.$store.getters['main/getTheme']
19 | },
20 | themeVariety() {
21 | return this.$store.getters['main/getThemeVariety']
22 | },
23 | selectedAddress() {
24 | return this.$store.getters['main/getSelectedAddress']
25 | }
26 | }
27 |
28 | const watch = {
29 | }
30 |
31 | const mounted = async function() {
32 | }
33 |
34 | const methods = {
35 | async account() {
36 | if(this.selectedAddress == undefined)
37 | this.$emit('authenticate')
38 | },
39 | switchThemeVariety() {
40 | if(this.themeVariety == 'dark') {
41 | this.$store.dispatch('main/setThemeVariety', 'light')
42 | }
43 | else {
44 | this.$store.dispatch('main/setThemeVariety', 'dark')
45 | }
46 | }
47 | }
48 |
49 | const destroyed = function() {
50 | }
51 |
52 | export default {
53 | props: [],
54 | mixins: [
55 | language
56 | ],
57 | components: {
58 | },
59 | directives: {
60 | },
61 | name: 'Header',
62 | data () {
63 | return {
64 | }
65 | },
66 | created: created,
67 | computed: computed,
68 | watch: watch,
69 | mounted: mounted,
70 | methods: methods,
71 | destroyed: destroyed
72 | }
73 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/js/helpers/loading-blocker.js:
--------------------------------------------------------------------------------
1 | import ProgressSpinner from 'primevue/progressspinner'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | loadingBlockerClass() {
8 | return this.theme + '-loading-blocker-' + this.themeVariety
9 | },
10 | locale() {
11 | return this.$store.getters['main/getLocale']
12 | },
13 | theme() {
14 | return this.$store.getters['main/getTheme']
15 | },
16 | themeVariety() {
17 | return this.$store.getters['main/getThemeVariety']
18 | }
19 | }
20 |
21 | const watch = {
22 | }
23 |
24 | const mounted = function() {
25 | }
26 |
27 | const methods = {
28 | }
29 |
30 | const destroyed = function() {
31 | }
32 |
33 | export default {
34 | props: ['loading', 'message'],
35 | mixins: [
36 | ],
37 | components: {
38 | ProgressSpinner
39 | },
40 | directives: {
41 | },
42 | name: 'LoadingBlocker',
43 | data () {
44 | return {
45 | }
46 | },
47 | created: created,
48 | computed: computed,
49 | watch: watch,
50 | mounted: mounted,
51 | methods: methods,
52 | destroyed: destroyed
53 | }
54 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/js/router.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue/dist/vue.esm-bundler'
2 | import { createWebHistory, createRouter } from 'vue-router'
3 | import { createI18n } from 'vue-i18n/dist/vue-i18n.cjs'
4 | import { createStore } from 'vuex'
5 |
6 | import Locale_en_GB from '@/src/locales/en_GB.js'
7 | import MainStore from '@/src/stores/main.js'
8 |
9 | import PrimeVue from 'primevue/config'
10 | import ConfirmationService from 'primevue/confirmationservice'
11 | import ToastService from 'primevue/toastservice'
12 |
13 | const store = createStore({
14 | modules: {
15 | main: MainStore
16 | }
17 | });
18 |
19 | const messages = {
20 | 'en_GB': Locale_en_GB
21 | }
22 |
23 | const i18n = createI18n({
24 | locale: 'en_GB',
25 | fallbackLocale: 'en_GB',
26 | messages
27 | })
28 |
29 | const Pipelines = () => import('@/src/components/pipelines/Pipelines.vue')
30 |
31 | const routes = [
32 | {
33 | path: '/',
34 | name: 'pipelines',
35 | title: 'Pipelines',
36 | component: Pipelines,
37 | children: [
38 | {
39 | path: ':cid',
40 | component: Pipelines
41 | }
42 | ]
43 | }
44 | ]
45 |
46 | const router = createRouter({
47 | history: createWebHistory(),
48 | routes
49 | })
50 |
51 | const routerApp = createApp(router)
52 | routerApp.use(router)
53 | routerApp.use(i18n)
54 | routerApp.use(store)
55 | routerApp.use(PrimeVue, {ripple: true})
56 | routerApp.use(ConfirmationService)
57 | routerApp.use(ToastService)
58 | routerApp.mount('#router_app')
59 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/api/api-profile.js:
--------------------------------------------------------------------------------
1 | import cookie from '@/src/mixins/cookie/cookie.js'
2 |
3 | const computed = {
4 | fgStorage() {
5 | return this.$store.getters['main/getFGStorage']
6 | },
7 | fgApiToken() {
8 | return this.$store.getters['main/getFgApiToken']
9 | },
10 | fgApiProfileDefaultDataLicense() {
11 | return this.$store.getters['main/getFgApiProfileDefaultDataLicense']
12 | },
13 | fgApiProfileName() {
14 | return this.$store.getters['main/getFgApiProfileName']
15 | }
16 | }
17 |
18 | const methods = {
19 | async loadApiProfile() {
20 | if(this.fgApiProfileName == null && this.fgApiProfileDefaultDataLicense == null)
21 | try {
22 | await this.getApiProfile()
23 | } catch (error) {
24 | let tkn = (await this.fgStorage.getApiToken(true)).result.data.token
25 | this.fgStorage.fgApiToken = tkn
26 | this.$store.dispatch('main/setFgApiToken', tkn)
27 | this.setCookie('storage.co2.token', tkn, 365)
28 | await this.getApiProfile()
29 | }
30 | },
31 | async getApiProfile() {
32 | const getApiProfileResponse = await this.fgStorage.getApiProfile()
33 | if(!getApiProfileResponse || getApiProfileResponse.error)
34 | return
35 | this.$store.dispatch('main/setFgApiProfileDefaultDataLicense', getApiProfileResponse.result.data.default_data_license)
36 | this.$store.dispatch('main/setFgApiProfileName', getApiProfileResponse.result.data.name)
37 | }
38 | }
39 |
40 | export const apiProfile = {
41 | computed: computed,
42 | mixins: [
43 | cookie
44 | ],
45 | data () {
46 | return {
47 | }
48 | },
49 | methods: methods
50 | }
51 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/api/get-token.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | async getToken() {
3 | let token = this.fgApiToken || this.getCookie('storage.co2.token')
4 | if(token == null || token.length == 0) {
5 | try {
6 | token = (await this.fgStorage.getApiToken(false)).result.data.token
7 | this.setCookie('storage.co2.token', token, 365)
8 | } catch (error) {
9 | return {
10 | result: null,
11 | error: error
12 | }
13 | }
14 | }
15 | else {
16 | try {
17 | const checkTokenValidity = await this.fgStorage.checkApiTokenValidity(token)
18 | if(checkTokenValidity.error) {
19 | return {
20 | result: null,
21 | error: checkTokenValidity.error
22 | }
23 | }
24 | if(checkTokenValidity.result == false) {
25 | this.$store.dispatch('main/setFgApiToken', null)
26 | this.eraseCookie('storage.co2.token')
27 | return await this.getToken()
28 | }
29 | } catch (error) {
30 | this.$store.dispatch('main/setFgApiToken', null)
31 | this.eraseCookie('storage.co2.token')
32 | return await this.getToken()
33 | }
34 | }
35 | this.fgStorage.setApiToken(token)
36 | this.$store.dispatch('main/setFgApiToken', token)
37 |
38 | return {
39 | result: token,
40 | error: null
41 | }
42 | }
43 | }
44 |
45 | export default {
46 | data () {
47 | return {
48 | }
49 | },
50 | methods: methods
51 | }
52 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/clipboard/copy-to-clipboard.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | copyToClipboard(event){
3 | const that = this
4 | const content = event.target.getAttribute('data-ref')
5 | if (!navigator.clipboard){
6 | this.$refs[content].focus()
7 | this.$refs[content].select()
8 | document.execCommand('copy')
9 | this.$toast.add({
10 | severity: 'success',
11 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
12 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
13 | life: 3000
14 | })
15 | }
16 | else {
17 | navigator.clipboard.writeText(content).then(
18 | () => {
19 | that.$toast.add({
20 | severity: 'success',
21 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
22 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
23 | life: 3000
24 | })
25 | })
26 | .catch(
27 | () => {
28 | that.$toast.add({
29 | severity: 'error',
30 | summary: 'Error!',
31 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.not-copied"),
32 | life: 3000
33 | })
34 | })
35 | }
36 | }
37 | }
38 |
39 | export default {
40 | data () {
41 | return {
42 | }
43 | },
44 | methods: methods
45 | }
46 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/cookie/cookie.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setCookie(name, value, days) {
3 | let expires = ""
4 | if (days) {
5 | let date = new Date()
6 | date.setTime(date.getTime() + (days*24*60*60*1000))
7 | expires = "; expires=" + date.toUTCString()
8 | }
9 | document.cookie = name + "=" + (value || "") + expires + "; path=/"
10 | },
11 | getCookie(name) {
12 | let nameEQ = name + "="
13 | let ca = document.cookie.split(';')
14 | for(let i=0;i < ca.length;i++) {
15 | let c = ca[i]
16 | while (c.charAt(0)==' ') c = c.substring(1,c.length)
17 | if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
18 | }
19 | return null
20 | },
21 | eraseCookie(name) {
22 | document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
23 | }
24 | }
25 |
26 | export default {
27 | data () {
28 | return {
29 | }
30 | },
31 | methods: methods
32 | }
33 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/delay/delay.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | delay(ms) {
3 | return new Promise(resolve => setTimeout(resolve, ms));
4 | }
5 | }
6 |
7 | export default {
8 | data () {
9 | return {
10 | }
11 | },
12 | methods: methods
13 | }
14 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/error/print.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | printError(error, duration) {
3 | if(error != null) {
4 | if(!duration)
5 | duration = 3000
6 | try {
7 | while(typeof error != 'string') {
8 | error = error.message || error.error
9 | }
10 | } catch (err) {
11 | this.printError(err)
12 | }
13 | this.$toast.add({severity: 'error', summary: this.$t('message.shared.error'), detail: error, life: duration})
14 | }
15 | }
16 | }
17 |
18 | export default {
19 | data () {
20 | return {
21 | }
22 | },
23 | methods: methods
24 | }
25 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/file/human-readable-file-size.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | humanReadableFileSize(bytes){
3 | bytes = Number(bytes)
4 | if(bytes < 1024) {
5 | return `${bytes} bytes`
6 | }
7 | else if(bytes < 1024*1024) {
8 | return `${Math.round(bytes/1024)} kB`
9 | }
10 | else if(bytes < 1024*1024*1024) {
11 | return `${Math.round(bytes/(1024*1024))} MB`
12 | }
13 | else if(bytes < 1024*1024*1024*1024) {
14 | return `${Math.round(bytes/(1024*1024*1024))} GB`
15 | }
16 | else if(bytes < 1024*1024*1024*1024*1024) {
17 | return `${Math.round(bytes/(1024*1024*1024*1024))} TB`
18 | }
19 | else if(bytes < 1024*1024*1024*1024*1024*1024) {
20 | return `${Math.round(bytes/(1024*1024*1024*1024*1024))} PB`
21 | }
22 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024) {
23 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024))} EB`
24 | }
25 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024*1024) {
26 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024))} ZB`
27 | }
28 | else {
29 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024*1024))} YB`
30 | }
31 | }
32 | }
33 |
34 | export default {
35 | data () {
36 | return {
37 | }
38 | },
39 | methods: methods
40 | }
41 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/form-elements/list-elements-group-by.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | listElementsGroupByAsObject(xs, key) {
3 | return xs.reduce((rv, x) => {
4 | (rv[x[key]] = rv[x[key]] || []).push(x)
5 | return rv
6 | }, {})
7 | },
8 | listElementsGroupByAsList(xs, key) {
9 | let list = []
10 | const obj = this.listElementsGroupByAsObject(xs, key)
11 | for (const key in obj) {
12 | if (Object.hasOwnProperty.call(obj, key)) {
13 | const element = obj[key];
14 | list.push(element)
15 | }
16 | }
17 | return list
18 | }
19 | }
20 |
21 | export const listElementsGroupBy = {
22 | data () {
23 | return {
24 | }
25 | },
26 | methods: methods
27 | }
28 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/form-elements/sync-form-files.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | syncFormFiles(sync) {
3 | const event = sync.event
4 | let element = sync.element
5 | if(!element.value)
6 | element.value = []
7 | else
8 | element.value = element.value.filter((v) => {return v.existing})
9 |
10 | if(event != undefined && event.files != undefined)
11 | for (const file of event.files) {
12 | const existingFilenames = element.value.map((v) => {return v.path})
13 | if(!element.value.existing && existingFilenames.indexOf(`/${file.name}`) == -1 && existingFilenames.indexOf(file.name) == -1)
14 | element.value.push({
15 | path: `/${file.name}`,
16 | content: file
17 | })
18 | }
19 | }
20 | }
21 |
22 | export default {
23 | data () {
24 | return {
25 | }
26 | },
27 | methods: methods
28 | }
29 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/i18n/language.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setLanguage(route){
3 | try{
4 | if(route.params['lang'])
5 | this.$i18n.locale = route.params['lang'];
6 | }
7 | catch(e){
8 | console.log(e);
9 | }
10 | }
11 | }
12 |
13 | export default {
14 | data () {
15 | return {
16 | }
17 | },
18 | methods: methods
19 | }
20 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/ipfs/cid-obj-to-str.js:
--------------------------------------------------------------------------------
1 | import { CID } from 'multiformats/cid'
2 | import { base32 } from 'multiformats/bases/base32'
3 | import multihash from 'multihashes'
4 |
5 | const methods = {
6 | cidObjToStr(cidObj){
7 | if(typeof cidObj == 'object' && !Array.isArray(cidObj) && Object.keys(cidObj).indexOf("/") > -1) {
8 | const val = cidObj["/"]
9 | if(typeof val == 'string') {
10 | return val
11 | }
12 | else {
13 | return cidObj.toString(base32)
14 | }
15 | }
16 | else if(typeof cidObj == 'object' && !Array.isArray(cidObj) && Object.keys(cidObj)["code"] > -1 && Object.keys(cidObj)["hash"] > -1) {
17 | const bytes = Uint8Array.from(Object.values(cidObj.hash))
18 | const encoded = multihash.encode(bytes, 'sha2-256')
19 | encoded.bytes = bytes
20 |
21 | return (CID.createV1(cidObj.code, encoded)).toString(base32)
22 | }
23 | else if(typeof cidObj == 'string') {
24 | return cidObj
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/ipfs/determine-template-type-and-keys.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | determineTemplateTypeAndKeys(template){
3 | let templateKeys = []
4 | let templateType = 'object'
5 | if(Array.isArray(template)) {
6 | // Template is a list
7 | if(Array.isArray(template[0])) {
8 | // Template is a list of lists
9 | templateKeys = template.map((el)=>{return el[0]})
10 | templateType = 'list_of_lists'
11 | }
12 | else {
13 | // Template is a list of objects
14 | templateKeys = template.map((el)=>{return Object.keys(el)[0]})
15 | templateType = 'list_of_objects'
16 | }
17 | }
18 | else {
19 | // Template is an object
20 | templateKeys = Object.keys(template)
21 | }
22 | return {
23 | templateType: templateType,
24 | templateKeys: templateKeys
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/ipfs/ensure-ipfs-is-running.js:
--------------------------------------------------------------------------------
1 | import LoadingBlocker from '@/src/components/helpers/LoadingBlocker.vue'
2 |
3 | const methods = {
4 | async ensureIpfsIsRunning(fgStorage){
5 | this.loadingMessage = this.$t('message.shared.initializing-ipfs-node')
6 | this.loading = true
7 | const ipfs = await fgStorage.ensureIpfsIsRunning()
8 | this.$store.dispatch('main/setIpfs', ipfs)
9 | this.loading = false
10 | return ipfs
11 | }
12 | }
13 |
14 | export default {
15 | componentc: {
16 | LoadingBlocker
17 | },
18 | data () {
19 | return {
20 | loading: false,
21 | loadingMessage: ''
22 | }
23 | },
24 | methods: methods
25 | }
26 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/ipfs/normalize-schema-fields.js:
--------------------------------------------------------------------------------
1 | import cidObjToStr from '@/src/mixins/ipfs/cid-obj-to-str.js'
2 |
3 | const methods = {
4 | normalizeSchemaFields(template){
5 | if(Array.isArray(template)) {
6 | for (const el of template) {
7 | if(Array.isArray(el)) {
8 | const val = el[1]
9 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
10 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
11 | && typeof val.value == 'object')
12 | val.value = this.cidObjToStr(val.value)
13 | }
14 | else {
15 | const key = Object.keys(el)[0]
16 | const val = el[key]
17 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
18 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
19 | && typeof val.value == 'object')
20 | val.value = this.cidObjToStr(val.value)
21 | }
22 | }
23 | }
24 | else {
25 | const keys = Object.keys(template)
26 | for (const key of keys) {
27 | const val = template[key]
28 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
29 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
30 | && typeof val.value == 'object')
31 | val.value = this.cidObjToStr(val.value)
32 | }
33 | }
34 | return template
35 | }
36 | }
37 |
38 | export default {
39 | data () {
40 | return {
41 | }
42 | },
43 | mixins: [
44 | cidObjToStr
45 | ],
46 | methods: methods
47 | }
48 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/mixins/router/navigate.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | navigate(path) {
3 | this.$router.push({ path: path })
4 | },
5 | externalUrl(url, target) {
6 | window.open(url, (target) ? target : "_blank")
7 | }
8 | }
9 |
10 | export default {
11 | data () {
12 | return {
13 | }
14 | },
15 | methods: methods
16 | }
17 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/scss/helpers/loading-blocker.scss:
--------------------------------------------------------------------------------
1 | @import "~@/node_modules/primeicons/primeicons.css";
2 | @import "~@/node_modules/primevue/resources/themes/arya-green/theme.css";
3 | @import "~@/node_modules/primevue/resources/primevue.min.css";
4 |
5 | @import "~@/node_modules/vanilla-jsoneditor/themes/jse-theme-dark.css";
6 |
7 | .common-loading-blocker {
8 | position: fixed;
9 | top: 0;
10 | left: 0;
11 | bottom: 0;
12 | right: 0;
13 | width: 100vw;
14 | height: 100vh;
15 | background-color: rgba(0, 0, 0, .75);
16 |
17 | z-index: 10;
18 |
19 | @keyframes p-progress-spinner-color {
20 | 100%,
21 | 0% {
22 | stroke: #d62d20;
23 | }
24 | 40% {
25 | stroke: #0057e7;
26 | }
27 | 66% {
28 | stroke: #008744;
29 | }
30 | 80%,
31 | 90% {
32 | stroke: #ffa700;
33 | }
34 | }
35 |
36 | text-align: center;
37 | padding: 0 3rem;
38 |
39 | display: flex;
40 | flex-direction: column;
41 | flex-wrap: nowrap;
42 | justify-content: center;
43 |
44 | @media (max-width: 1024px) {
45 | }
46 |
47 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 800px) {
48 | }
49 | }
50 |
51 | .common-loading-blocker-dark {
52 | @extend .common-loading-blocker !optional;
53 | }
54 |
55 | .common-loading-blocker-light {
56 | @extend .common-loading-blocker !optional;
57 | }
58 |
--------------------------------------------------------------------------------
/client/pipeline-inspector/src/scss/router.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * import font
3 | */
4 | @import '~@/src/fonts/OpenSans/font.scss';
5 |
6 | body {
7 | font-family: 'Open Sans', sans-serif;
8 | margin: 0;
9 | padding: 0;
10 |
11 | background-color: #000;
12 | }
13 |
14 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 1024px) {
15 | }
16 |
--------------------------------------------------------------------------------
/client/web/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["@babel/syntax-dynamic-import"],
3 | "presets": [
4 | [
5 | "@babel/preset-env",
6 | {
7 | "modules": false
8 | }
9 | ]
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/client/web/.env.example:
--------------------------------------------------------------------------------
1 | ESTUARY_API_KEY=ESTxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxARY
2 | INFURA_API_KEY=...
3 | PK=0x...
--------------------------------------------------------------------------------
/client/web/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Momcilo Dzunic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/web/README.md:
--------------------------------------------------------------------------------
1 | # co2.storage
2 | by [Momcilo Dzunic aka smartbee.eth](https://twitter.com/mdzunic)
3 |
4 | Simple previewer for attestation documents and base data schema (DAG) objects related to Renewable Energy Certificates (RECs) -> [0004-FGTP-Content-Address-EACs](https://github.com/protocol/FilecoinGreen-tools/blob/main/0004-FGTP-Content-Address-EACs.md)
5 |
6 | ### Demo
7 |
8 | [https://filecoin-green-eac-browser.dzunic.net/](https://filecoin-green-eac-browser.dzunic.net/)
9 |
10 | ### Use
11 |
12 | Open-source [PDF.js](https://mozilla.github.io/pdf.js/) library is integrated into our project to render a PDF inside our app. After downloading the [latest stable release](https://mozilla.github.io/pdf.js/getting_started/#download) and then extracting the contents,
13 | make sure `libs` folder is available in root directory of your project. Also, make sure your hosting address is added to `HOSTED_VIEWER_ORIGINS` in `viewer.js` file.
14 |
15 | const HOSTED_VIEWER_ORIGINS = ["null", "http://mozilla.github.io", "https://mozilla.github.io", "https://localhost:3000", "http://localhost:3000"];
16 |
17 | You would also need an running IPFS node to attach to since this app is using `ipfs-http-client` lib.
18 |
19 | Thereafter run any of scripts defined in `package.json`
20 |
21 | // clean dist
22 | npm run clean
23 |
24 | // build for production
25 | npm run build
26 |
27 | // run dev server with hot reload
28 | npm run start
29 |
30 | ### ToDo
31 |
32 | 1. Attestation documents filtering
33 | 2. Direct link to specific Attestation document
34 |
35 | ### License
36 | Licensed under the MIT license.
37 | http://www.opensource.org/licenses/mit-license.php
38 |
--------------------------------------------------------------------------------
/client/web/assets/Bacalhau-WA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/Bacalhau-WA.png
--------------------------------------------------------------------------------
/client/web/assets/Bacalhau-WA.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/Bacalhau-WA.xcf
--------------------------------------------------------------------------------
/client/web/assets/account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/account.png
--------------------------------------------------------------------------------
/client/web/assets/acr.json:
--------------------------------------------------------------------------------
1 | {
2 | "SDGs": {
3 | "type": "array",
4 | "options": [
5 | "Option 1",
6 | "Option 2",
7 | "Option 3"
8 | ],
9 | "mandatory": true
10 | },
11 | "Vintage": {
12 | "type": "date",
13 | "mandatory": true
14 | },
15 | "Documents": {
16 | "type": "string"
17 | },
18 | "ProjectID": {
19 | "min": 0,
20 | "type": "integer",
21 | "value": 0,
22 | "mandatory": true
23 | },
24 | "DateIssued": {
25 | "type": "date",
26 | "mandatory": true
27 | },
28 | "ProjectVVB": {
29 | "type": "string"
30 | },
31 | "ProjectName": {
32 | "type": "string",
33 | "mandatory": true
34 | },
35 | "ProjectType": {
36 | "type": "string",
37 | "mandatory": true
38 | },
39 | "ARB_Elligible": "boolean",
40 | "ProjectWebsite": {
41 | "type": "string"
42 | },
43 | "VerifiedRemoval": {
44 | "type": "string"
45 | },
46 | "CORSIA_Qualified": "boolean",
47 | "ProjectDeveloper": {
48 | "type": "string",
49 | "mandatory": true
50 | },
51 | "ProjectSiteState": {
52 | "type": "string",
53 | "mandatory": true
54 | },
55 | "ProjectSiteCountry": {
56 | "type": "string",
57 | "mandatory": true
58 | },
59 | "TotalCreditsIssued": {
60 | "min": 0,
61 | "type": "integer",
62 | "value": 0,
63 | "mandatory": true
64 | },
65 | "ProjectSiteLocation": {
66 | "type": "string",
67 | "mandatory": true
68 | },
69 | "CreditsIssuedtoProject": {
70 | "min": 0,
71 | "type": "integer",
72 | "value": 0,
73 | "mandatory": true
74 | },
75 | "CreditsIssuedtoBufferPool": {
76 | "type": "string"
77 | },
78 | "Methodology/ProtocolVersion": "int",
79 | "ProjectMethodology/Protocol": {
80 | "type": "string",
81 | "mandatory": true
82 | }
83 | }
--------------------------------------------------------------------------------
/client/web/assets/attribution-account.txt:
--------------------------------------------------------------------------------
1 | Login icons created by monkik - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/attribution-bulb.txt:
--------------------------------------------------------------------------------
1 | Project icons created by DinosoftLabs - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/attribution-ecology.txt:
--------------------------------------------------------------------------------
1 | Project icons created by Freepik - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/attribution-environment.txt:
--------------------------------------------------------------------------------
1 | Environment icons created by iconixar - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/attribution-planet-earth.txt:
--------------------------------------------------------------------------------
1 | Environment icons created by Freepik - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/attribution-private-key.txt:
--------------------------------------------------------------------------------
1 | Private icons created by Flat Icons - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/attribution-theme.txt:
--------------------------------------------------------------------------------
1 | Theme icons created by Flat Icons - Flaticon
--------------------------------------------------------------------------------
/client/web/assets/bulb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/bulb.png
--------------------------------------------------------------------------------
/client/web/assets/contract.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/contract.png
--------------------------------------------------------------------------------
/client/web/assets/ecology.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/ecology.png
--------------------------------------------------------------------------------
/client/web/assets/environment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/environment.png
--------------------------------------------------------------------------------
/client/web/assets/gold-standard.json:
--------------------------------------------------------------------------------
1 | {
2 | "GSID": {
3 | "type": "integer",
4 | "min": 0,
5 | "value": 0,
6 | "mandatory": true
7 | },
8 | "Vintage": {
9 | "type": "date",
10 | "mandatory": true
11 | },
12 | "Status": {
13 | "type": "array",
14 | "options": ["Active", "Retired", "Canceled"],
15 | "mandatory": true
16 | },
17 | "QuantityIssued": {
18 | "type": "integer",
19 | "min": 0,
20 | "value": 0,
21 | "mandatory": true
22 | },
23 | "ProjectName": {
24 | "type": "string",
25 | "mandatory": true
26 | },
27 | "Country/Region": {
28 | "type": "string",
29 | "mandatory": true
30 | },
31 | "ProjectType": {
32 | "type": "array",
33 | "options": ["CER", "VER", "PER"],
34 | "mandatory": true
35 | },
36 | "IssuanceDate": {
37 | "type": "date",
38 | "mandatory": true
39 | },
40 | "RetirementDate": {
41 | "type": "string"
42 | },
43 | "CORSIA": {
44 | "type": "boolean"
45 | },
46 | "ProjectDescription": {
47 | "type": "string"
48 | },
49 | "CertifiedSDGs": {
50 | "type": "string"
51 | },
52 | "QuantityRetired": {
53 | "type": "integer",
54 | "min": 0,
55 | "value": 0
56 | },
57 | "ProjectDeveloper": {
58 | "type": "string",
59 | "mandatory": true
60 | },
61 | "Methodology": {
62 | "type": "string"
63 | },
64 | "CreditingPeriod": {
65 | "type": "string"
66 | },
67 | "ProjectScale": {
68 | "type": "integer",
69 | "min": 0,
70 | "value": 0
71 | }
72 | }
--------------------------------------------------------------------------------
/client/web/assets/planet-earth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/planet-earth.png
--------------------------------------------------------------------------------
/client/web/assets/private-key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/private-key.png
--------------------------------------------------------------------------------
/client/web/assets/programmer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/programmer.png
--------------------------------------------------------------------------------
/client/web/assets/theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/assets/theme.png
--------------------------------------------------------------------------------
/client/web/assets/verra.json:
--------------------------------------------------------------------------------
1 | {
2 | "ProjectID": {
3 | "type": "integer",
4 | "min": 0,
5 | "value": 0,
6 | "mandatory": true
7 | },
8 | "ProjectName": {
9 | "type": "string",
10 | "mandatory": true
11 | },
12 | "ProjectType": {
13 | "type": "string",
14 | "mandatory": true
15 | },
16 | "Country": {
17 | "type": "string",
18 | "mandatory": true
19 | },
20 | "CertificationBody": {
21 | "type": "string"
22 | },
23 | "IssuanceStatus": {
24 | "type": "array",
25 | "options": ["Active", "Retired", "Canceled"],
26 | "mandatory": true
27 | },
28 | "SerialNumberBlockStart": {
29 | "type": "string"
30 | },
31 | "SerialNumberBlockEnd": {
32 | "type": "string"
33 | },
34 | "IssuanceDate": {
35 | "type": "date",
36 | "mandatory": true
37 | },
38 | "TotalVintageQuantity": {
39 | "type": "integer",
40 | "min": 0,
41 | "value": 0,
42 | "mandatory": true
43 | },
44 | "Vintage": {
45 | "type": "date",
46 | "mandatory": true
47 | },
48 | "CorrespondingAdjustment": {
49 | "type": "string"
50 | },
51 | "QuantityIssued": {
52 | "type": "integer",
53 | "min": 0,
54 | "value": 0,
55 | "mandatory": true
56 | },
57 | "SerialNumber": {
58 | "type": "integer",
59 | "min": 0,
60 | "value": 0,
61 | "mandatory": true
62 | },
63 | "Retirement/CancellationDate": {
64 | "type": "date"
65 | },
66 | "RetirmentReason": {
67 | "type": "string"
68 | },
69 | "RetirementDetail": {
70 | "type": "integer",
71 | "min": 0,
72 | "value": 0
73 | },
74 | "Retired": {
75 | "type": "boolean"
76 | }
77 | }
--------------------------------------------------------------------------------
/client/web/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | CO2.Storage
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/client/web/src/components/helpers/Contributor.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/client/web/src/components/helpers/JsonEditor.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/client/web/src/components/helpers/LoadingBlocker.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | {{ message }}
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/client/web/src/components/pipelines/CreatePipeline.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | { await doAuth() }" />
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-Bold.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-ExtraBold.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-Italic.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-Light.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-LightItalic.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-Medium.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-MediumItalic.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-SemiBold.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/fonts/OpenSans/OpenSans-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/client/web/src/fonts/OpenSans/font.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: 300;
4 | font-style: normal;
5 | src: url('~@/src/fonts/OpenSans/OpenSans-Light.ttf') format('truetype');
6 | }
7 |
8 | @font-face {
9 | font-family: 'Open Sans';
10 | font-weight: 400;
11 | font-style: normal;
12 | src: url('~@/src/fonts/OpenSans/OpenSans-Regular.ttf') format('truetype');
13 | }
14 |
15 | @font-face {
16 | font-family: 'Open Sans';
17 | font-weight: 700;
18 | font-style: normal;
19 | src: url('~@/src/fonts/OpenSans/OpenSans-Bold.ttf') format('truetype');
20 | }
21 |
22 | @font-face {
23 | font-family: 'Open Sans';
24 | font-weight: 300;
25 | font-style: italic;
26 | src: url('~@/src/fonts/OpenSans/OpenSans-LightItalic.ttf') format('truetype');
27 | }
28 |
29 | @font-face {
30 | font-family: 'Open Sans';
31 | font-weight: 400;
32 | font-style: italic;
33 | src: url('~@/src/fonts/OpenSans/OpenSans-Italic.ttf') format('truetype');
34 | }
35 |
36 | @font-face {
37 | font-family: 'Open Sans';
38 | font-weight: 700;
39 | font-style: italic;
40 | src: url('~@/src/fonts/OpenSans/OpenSans-BoldItalic.ttf') format('truetype');
41 | }
42 |
--------------------------------------------------------------------------------
/client/web/src/index.js:
--------------------------------------------------------------------------------
1 | console.log("Hello World!");
2 |
--------------------------------------------------------------------------------
/client/web/src/js/about/about.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 | import Header from '@/src/components/helpers/Header.vue'
3 |
4 | const created = function() {
5 | const that = this
6 |
7 | // set language
8 | this.setLanguage(this.$route)
9 | }
10 |
11 | const computed = {
12 | aboutClass() {
13 | return this.theme + '-about-' + this.themeVariety
14 | },
15 | locale() {
16 | return this.$store.getters['main/getLocale']
17 | },
18 | theme() {
19 | return this.$store.getters['main/getTheme']
20 | },
21 | themeVariety() {
22 | return this.$store.getters['main/getThemeVariety']
23 | }
24 | }
25 |
26 | const mounted = async function() {
27 | }
28 |
29 | const watch = {
30 | }
31 |
32 | const methods = {
33 | }
34 |
35 | const destroyed = function() {
36 | }
37 |
38 | export default {
39 | mixins: [
40 | language
41 | ],
42 | components: {
43 | Header
44 | },
45 | directives: {
46 | },
47 | name: 'About',
48 | data () {
49 | return {
50 | currentProvider: null,
51 | selectedAddress: null,
52 | walletError: null
53 | }
54 | },
55 | created: created,
56 | computed: computed,
57 | mounted: mounted,
58 | methods: methods,
59 | destroyed: destroyed
60 | }
61 |
--------------------------------------------------------------------------------
/client/web/src/js/helpers/json-editor.js:
--------------------------------------------------------------------------------
1 | import { JSONEditor } from 'vanilla-jsoneditor'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | }
8 |
9 | const watch = {
10 | }
11 |
12 | const mounted = function() {
13 | this.editor = new JSONEditor({
14 | target: document.getElementById(this.container),
15 | props: {
16 | content: this.content,
17 | mode: this.mode,
18 | onChange: (updatedContent, previousContent, patchResult) => {
19 | // emit content changed event to parent
20 | this.$emit('content', {updatedContent, previousContent, patchResult})
21 | },
22 | onChangeMode: (mode) => {
23 | // emit mode changed event to parent
24 | this.$emit('mode', mode)
25 | }
26 | }
27 | })
28 | }
29 |
30 | const methods = {
31 | setContent(updatedContent) {
32 | if(this.mode == 'text')
33 | updatedContent.text = JSON.stringify(JSON.parse(updatedContent.text), null, this.indentation)
34 | this.editor.set(updatedContent)
35 | this.$emit('content', {updatedContent})
36 | }
37 | }
38 |
39 | const destroyed = function() {
40 | }
41 |
42 | export default {
43 | props: [
44 | 'content',
45 | 'mode'
46 | ],
47 | mixins: [
48 | ],
49 | components: {
50 | JSONEditor
51 | },
52 | directives: {
53 | },
54 | name: 'JsonEditor',
55 | data () {
56 | return {
57 | container: 'jsonEditorContainer',
58 | editor: null,
59 | indentation: 2
60 | }
61 | },
62 | created: created,
63 | computed: computed,
64 | watch: watch,
65 | mounted: mounted,
66 | methods: methods,
67 | destroyed: destroyed
68 | }
69 |
--------------------------------------------------------------------------------
/client/web/src/js/helpers/loading-blocker.js:
--------------------------------------------------------------------------------
1 | import ProgressSpinner from 'primevue/progressspinner'
2 |
3 | const created = function() {
4 | }
5 |
6 | const computed = {
7 | loadingBlockerClass() {
8 | return this.theme + '-loading-blocker-' + this.themeVariety
9 | },
10 | locale() {
11 | return this.$store.getters['main/getLocale']
12 | },
13 | theme() {
14 | return this.$store.getters['main/getTheme']
15 | },
16 | themeVariety() {
17 | return this.$store.getters['main/getThemeVariety']
18 | }
19 | }
20 |
21 | const watch = {
22 | }
23 |
24 | const mounted = function() {
25 | }
26 |
27 | const methods = {
28 | }
29 |
30 | const destroyed = function() {
31 | }
32 |
33 | export default {
34 | props: ['loading', 'message'],
35 | mixins: [
36 | ],
37 | components: {
38 | ProgressSpinner
39 | },
40 | directives: {
41 | },
42 | name: 'LoadingBlocker',
43 | data () {
44 | return {
45 | }
46 | },
47 | created: created,
48 | computed: computed,
49 | watch: watch,
50 | mounted: mounted,
51 | methods: methods,
52 | destroyed: destroyed
53 | }
54 |
--------------------------------------------------------------------------------
/client/web/src/js/main/main.js:
--------------------------------------------------------------------------------
1 | import language from '@/src/mixins/i18n/language.js'
2 |
3 | import Header from '@/src/components/helpers/Header.vue'
4 |
5 | const created = function() {
6 | const that = this
7 |
8 | // set language
9 | this.setLanguage(this.$route)
10 | }
11 |
12 | const computed = {
13 | mainClass() {
14 | return this.theme + '-main-' + this.themeVariety
15 | },
16 | locale() {
17 | return this.$store.getters['main/getLocale']
18 | },
19 | theme() {
20 | return this.$store.getters['main/getTheme']
21 | },
22 | themeVariety() {
23 | return this.$store.getters['main/getThemeVariety']
24 | }
25 | }
26 |
27 | const watch = {
28 | }
29 |
30 | const mounted = async function() {
31 | }
32 |
33 | const methods = {
34 | }
35 |
36 | const destroyed = function() {
37 | }
38 |
39 | export default {
40 | mixins: [
41 | language
42 | ],
43 | components: {
44 | Header
45 | },
46 | directives: {
47 | },
48 | name: 'Main',
49 | data () {
50 | return {
51 | }
52 | },
53 | created: created,
54 | computed: computed,
55 | watch: watch,
56 | mounted: mounted,
57 | methods: methods,
58 | destroyed: destroyed
59 | }
60 |
--------------------------------------------------------------------------------
/client/web/src/mixins/api/api-profile.js:
--------------------------------------------------------------------------------
1 | import cookie from '@/src/mixins/cookie/cookie.js'
2 |
3 | const computed = {
4 | fgStorage() {
5 | return this.$store.getters['main/getFGStorage']
6 | },
7 | fgApiToken() {
8 | return this.$store.getters['main/getFgApiToken']
9 | },
10 | fgApiProfileDefaultDataLicense() {
11 | return this.$store.getters['main/getFgApiProfileDefaultDataLicense']
12 | },
13 | fgApiProfileName() {
14 | return this.$store.getters['main/getFgApiProfileName']
15 | }
16 | }
17 |
18 | const methods = {
19 | async loadApiProfile() {
20 | if(this.fgApiProfileName == null && this.fgApiProfileDefaultDataLicense == null)
21 | try {
22 | await this.getApiProfile()
23 | } catch (error) {
24 | let tkn = (await this.fgStorage.getApiToken(true)).result.data.token
25 | this.fgStorage.fgApiToken = tkn
26 | this.$store.dispatch('main/setFgApiToken', tkn)
27 | this.setCookie('storage.co2.token', tkn, 365)
28 | await this.getApiProfile()
29 | }
30 | },
31 | async getApiProfile() {
32 | const getApiProfileResponse = await this.fgStorage.getApiProfile()
33 | if(!getApiProfileResponse || getApiProfileResponse.error)
34 | return
35 | this.$store.dispatch('main/setFgApiProfileDefaultDataLicense', getApiProfileResponse.result.data.default_data_license)
36 | this.$store.dispatch('main/setFgApiProfileName', getApiProfileResponse.result.data.name)
37 | }
38 | }
39 |
40 | export const apiProfile = {
41 | computed: computed,
42 | mixins: [
43 | cookie
44 | ],
45 | data () {
46 | return {
47 | }
48 | },
49 | methods: methods
50 | }
51 |
--------------------------------------------------------------------------------
/client/web/src/mixins/api/get-token.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | async getToken() {
3 | let token = this.fgApiToken || this.getCookie('storage.co2.token')
4 | if(token == null || token.length == 0) {
5 | try {
6 | token = (await this.fgStorage.getApiToken(false)).result.data.token
7 | this.setCookie('storage.co2.token', token, 365)
8 | } catch (error) {
9 | return {
10 | result: null,
11 | error: error
12 | }
13 | }
14 | }
15 | else {
16 | try {
17 | const checkTokenValidity = await this.fgStorage.checkApiTokenValidity(token)
18 | if(checkTokenValidity.error) {
19 | return {
20 | result: null,
21 | error: checkTokenValidity.error
22 | }
23 | }
24 | if(checkTokenValidity.result == false) {
25 | this.$store.dispatch('main/setFgApiToken', null)
26 | this.eraseCookie('storage.co2.token')
27 | return await this.getToken()
28 | }
29 | } catch (error) {
30 | this.$store.dispatch('main/setFgApiToken', null)
31 | this.eraseCookie('storage.co2.token')
32 | return await this.getToken()
33 | }
34 | }
35 | this.fgStorage.setApiToken(token)
36 | this.$store.dispatch('main/setFgApiToken', token)
37 |
38 | return {
39 | result: token,
40 | error: null
41 | }
42 | }
43 | }
44 |
45 | export default {
46 | data () {
47 | return {
48 | }
49 | },
50 | methods: methods
51 | }
52 |
--------------------------------------------------------------------------------
/client/web/src/mixins/clipboard/copy-to-clipboard.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | copyToClipboard(event){
3 | const that = this
4 | const content = event.target.getAttribute('data-ref')
5 | if (!navigator.clipboard){
6 | this.$refs[content].focus()
7 | this.$refs[content].select()
8 | document.execCommand('copy')
9 | this.$toast.add({
10 | severity: 'success',
11 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
12 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
13 | life: 3000
14 | })
15 | }
16 | else {
17 | navigator.clipboard.writeText(content).then(
18 | () => {
19 | that.$toast.add({
20 | severity: 'success',
21 | summary: this.$t("message.mixins.clipboard.copy-to-clipboard.success"),
22 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.copied"),
23 | life: 3000
24 | })
25 | })
26 | .catch(
27 | () => {
28 | that.$toast.add({
29 | severity: 'error',
30 | summary: 'Error!',
31 | detail: this.$t("message.mixins.clipboard.copy-to-clipboard.not-copied"),
32 | life: 3000
33 | })
34 | })
35 | }
36 | }
37 | }
38 |
39 | export default {
40 | data () {
41 | return {
42 | }
43 | },
44 | methods: methods
45 | }
46 |
--------------------------------------------------------------------------------
/client/web/src/mixins/cookie/cookie.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setCookie(name, value, days) {
3 | let expires = ""
4 | if (days) {
5 | let date = new Date()
6 | date.setTime(date.getTime() + (days*24*60*60*1000))
7 | expires = "; expires=" + date.toUTCString()
8 | }
9 | document.cookie = name + "=" + (value || "") + expires + "; path=/"
10 | },
11 | getCookie(name) {
12 | let nameEQ = name + "="
13 | let ca = document.cookie.split(';')
14 | for(let i=0;i < ca.length;i++) {
15 | let c = ca[i]
16 | while (c.charAt(0)==' ') c = c.substring(1,c.length)
17 | if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
18 | }
19 | return null
20 | },
21 | eraseCookie(name) {
22 | document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
23 | }
24 | }
25 |
26 | export default {
27 | data () {
28 | return {
29 | }
30 | },
31 | methods: methods
32 | }
33 |
--------------------------------------------------------------------------------
/client/web/src/mixins/delay/delay.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | delay(ms) {
3 | return new Promise(resolve => setTimeout(resolve, ms));
4 | }
5 | }
6 |
7 | export default {
8 | data () {
9 | return {
10 | }
11 | },
12 | methods: methods
13 | }
14 |
--------------------------------------------------------------------------------
/client/web/src/mixins/error/print.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | printError(error, duration) {
3 | if(error != null) {
4 | if(!duration)
5 | duration = 3000
6 | try {
7 | while(typeof error != 'string') {
8 | error = error.message || error.error
9 | }
10 | } catch (err) {
11 | this.printError(err)
12 | }
13 | this.$toast.add({severity: 'error', summary: this.$t('message.shared.error'), detail: error, life: duration})
14 | }
15 | }
16 | }
17 |
18 | export default {
19 | data () {
20 | return {
21 | }
22 | },
23 | methods: methods
24 | }
25 |
--------------------------------------------------------------------------------
/client/web/src/mixins/file/human-readable-file-size.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | humanReadableFileSize(bytes){
3 | bytes = Number(bytes)
4 | if(bytes < 1024) {
5 | return `${bytes} bytes`
6 | }
7 | else if(bytes < 1024*1024) {
8 | return `${Math.round(bytes/1024)} kB`
9 | }
10 | else if(bytes < 1024*1024*1024) {
11 | return `${Math.round(bytes/(1024*1024))} MB`
12 | }
13 | else if(bytes < 1024*1024*1024*1024) {
14 | return `${Math.round(bytes/(1024*1024*1024))} GB`
15 | }
16 | else if(bytes < 1024*1024*1024*1024*1024) {
17 | return `${Math.round(bytes/(1024*1024*1024*1024))} TB`
18 | }
19 | else if(bytes < 1024*1024*1024*1024*1024*1024) {
20 | return `${Math.round(bytes/(1024*1024*1024*1024*1024))} PB`
21 | }
22 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024) {
23 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024))} EB`
24 | }
25 | else if(bytes < 1024*1024*1024*1024*1024*1024*1024*1024) {
26 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024))} ZB`
27 | }
28 | else {
29 | return `${Math.round(bytes/(1024*1024*1024*1024*1024*1024*1024*1024))} YB`
30 | }
31 | }
32 | }
33 |
34 | export default {
35 | data () {
36 | return {
37 | }
38 | },
39 | methods: methods
40 | }
41 |
--------------------------------------------------------------------------------
/client/web/src/mixins/form-elements/list-elements-group-by.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | listElementsGroupByAsObject(xs, key) {
3 | return xs.reduce((rv, x) => {
4 | (rv[x[key]] = rv[x[key]] || []).push(x)
5 | return rv
6 | }, {})
7 | },
8 | listElementsGroupByAsList(xs, key) {
9 | let list = []
10 | const obj = this.listElementsGroupByAsObject(xs, key)
11 | for (const key in obj) {
12 | if (Object.hasOwnProperty.call(obj, key)) {
13 | const element = obj[key];
14 | list.push(element)
15 | }
16 | }
17 | return list
18 | }
19 | }
20 |
21 | export const listElementsGroupBy = {
22 | data () {
23 | return {
24 | }
25 | },
26 | methods: methods
27 | }
28 |
--------------------------------------------------------------------------------
/client/web/src/mixins/form-elements/sync-form-files.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | syncFormFiles(sync) {
3 | const event = sync.event
4 | let element = sync.element
5 | if(!element.value)
6 | element.value = []
7 | else
8 | element.value = element.value.filter((v) => {return v.existing})
9 |
10 | if(event != undefined && event.files != undefined)
11 | for (const file of event.files) {
12 | const existingFilenames = element.value.map((v) => {return v.path})
13 | if(!element.value.existing && existingFilenames.indexOf(`/${file.name}`) == -1 && existingFilenames.indexOf(file.name) == -1)
14 | element.value.push({
15 | path: `/${file.name}`,
16 | content: file
17 | })
18 | }
19 | }
20 | }
21 |
22 | export default {
23 | data () {
24 | return {
25 | }
26 | },
27 | methods: methods
28 | }
29 |
--------------------------------------------------------------------------------
/client/web/src/mixins/i18n/language.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | setLanguage(route){
3 | try{
4 | if(route.params['lang'])
5 | this.$i18n.locale = route.params['lang'];
6 | }
7 | catch(e){
8 | console.log(e);
9 | }
10 | }
11 | }
12 |
13 | export default {
14 | data () {
15 | return {
16 | }
17 | },
18 | methods: methods
19 | }
20 |
--------------------------------------------------------------------------------
/client/web/src/mixins/ipfs/cid-obj-to-str.js:
--------------------------------------------------------------------------------
1 | import { CID } from 'multiformats/cid'
2 | import { base32 } from 'multiformats/bases/base32'
3 | import multihash from 'multihashes'
4 |
5 | const methods = {
6 | cidObjToStr(cidObj){
7 | if(typeof cidObj == 'object' && !Array.isArray(cidObj) && Object.keys(cidObj).indexOf("/") > -1) {
8 | const val = cidObj["/"]
9 | if(typeof val == 'string') {
10 | return val
11 | }
12 | else {
13 | return cidObj.toString(base32)
14 | }
15 | }
16 | else if(typeof cidObj == 'object' && !Array.isArray(cidObj) && Object.keys(cidObj)["code"] > -1 && Object.keys(cidObj)["hash"] > -1) {
17 | const bytes = Uint8Array.from(Object.values(cidObj.hash))
18 | const encoded = multihash.encode(bytes, 'sha2-256')
19 | encoded.bytes = bytes
20 |
21 | return (CID.createV1(cidObj.code, encoded)).toString(base32)
22 | }
23 | else if(typeof cidObj == 'string') {
24 | return cidObj
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/web/src/mixins/ipfs/determine-template-type-and-keys.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | determineTemplateTypeAndKeys(template){
3 | let templateKeys = []
4 | let templateType = 'object'
5 | if(Array.isArray(template)) {
6 | // Template is a list
7 | if(Array.isArray(template[0])) {
8 | // Template is a list of lists
9 | templateKeys = template.map((el)=>{return el[0]})
10 | templateType = 'list_of_lists'
11 | }
12 | else {
13 | // Template is a list of objects
14 | templateKeys = template.map((el)=>{return Object.keys(el)[0]})
15 | templateType = 'list_of_objects'
16 | }
17 | }
18 | else {
19 | // Template is an object
20 | templateKeys = Object.keys(template)
21 | }
22 | return {
23 | templateType: templateType,
24 | templateKeys: templateKeys
25 | }
26 | }
27 | }
28 |
29 | export default {
30 | data () {
31 | return {
32 | }
33 | },
34 | methods: methods
35 | }
36 |
--------------------------------------------------------------------------------
/client/web/src/mixins/ipfs/ensure-ipfs-is-running.js:
--------------------------------------------------------------------------------
1 | import LoadingBlocker from '@/src/components/helpers/LoadingBlocker.vue'
2 |
3 | const methods = {
4 | async ensureIpfsIsRunning(fgStorage){
5 | this.loadingMessage = this.$t('message.shared.initializing-ipfs-node')
6 | this.loading = true
7 | const ipfs = await fgStorage.ensureIpfsIsRunning()
8 | this.$store.dispatch('main/setIpfs', ipfs)
9 | this.loading = false
10 | return ipfs
11 | }
12 | }
13 |
14 | export default {
15 | componentc: {
16 | LoadingBlocker
17 | },
18 | data () {
19 | return {
20 | loading: false,
21 | loadingMessage: ''
22 | }
23 | },
24 | methods: methods
25 | }
26 |
--------------------------------------------------------------------------------
/client/web/src/mixins/ipfs/normalize-schema-fields.js:
--------------------------------------------------------------------------------
1 | import cidObjToStr from '@/src/mixins/ipfs/cid-obj-to-str.js'
2 |
3 | const methods = {
4 | normalizeSchemaFields(template){
5 | if(Array.isArray(template)) {
6 | for (const el of template) {
7 | if(Array.isArray(el)) {
8 | const val = el[1]
9 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
10 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
11 | && typeof val.value == 'object')
12 | val.value = this.cidObjToStr(val.value)
13 | }
14 | else {
15 | const key = Object.keys(el)[0]
16 | const val = el[key]
17 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
18 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
19 | && typeof val.value == 'object')
20 | val.value = this.cidObjToStr(val.value)
21 | }
22 | }
23 | }
24 | else {
25 | const keys = Object.keys(template)
26 | for (const key of keys) {
27 | const val = template[key]
28 | if((val.type.toLowerCase() == 'schema' || val.type.toLowerCase() == 'template'
29 | || val.type.toLowerCase() == 'schema-list' || val.type.toLowerCase() == 'template-list') && val.value
30 | && typeof val.value == 'object')
31 | val.value = this.cidObjToStr(val.value)
32 | }
33 | }
34 | return template
35 | }
36 | }
37 |
38 | export default {
39 | data () {
40 | return {
41 | }
42 | },
43 | mixins: [
44 | cidObjToStr
45 | ],
46 | methods: methods
47 | }
48 |
--------------------------------------------------------------------------------
/client/web/src/mixins/router/navigate.js:
--------------------------------------------------------------------------------
1 | const methods = {
2 | navigate(path) {
3 | this.$router.push({ path: path })
4 | },
5 | externalUrl(url, target) {
6 | window.open(url, (target) ? target : "_blank")
7 | }
8 | }
9 |
10 | export default {
11 | data () {
12 | return {
13 | }
14 | },
15 | methods: methods
16 | }
17 |
--------------------------------------------------------------------------------
/client/web/src/scss/helpers/contributor.scss:
--------------------------------------------------------------------------------
1 | .p-dialog .contributor-field-element {
2 | margin: .5em 0;
3 |
4 | input,
5 | .p-dropdown,
6 | .p-inputtextarea {
7 | width: 100%;
8 | }
9 | }
10 |
11 | .common-contributor {
12 | @media (max-width: 1024px) {
13 | }
14 |
15 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 800px) {
16 | }
17 | }
18 |
19 | .common-contributor-dark {
20 | @extend .common-contributor !optional;
21 | }
22 |
--------------------------------------------------------------------------------
/client/web/src/scss/helpers/json-editor.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/client/web/src/scss/helpers/json-editor.scss
--------------------------------------------------------------------------------
/client/web/src/scss/helpers/loading-blocker.scss:
--------------------------------------------------------------------------------
1 | @import "~@/node_modules/primeicons/primeicons.css";
2 | @import "~@/node_modules/primevue/resources/themes/arya-green/theme.css";
3 | @import "~@/node_modules/primevue/resources/primevue.min.css";
4 |
5 | @import "~@/node_modules/vanilla-jsoneditor/themes/jse-theme-dark.css";
6 |
7 | .common-loading-blocker {
8 | position: fixed;
9 | top: 0;
10 | left: 0;
11 | bottom: 0;
12 | right: 0;
13 | width: 100vw;
14 | height: 100vh;
15 | background-color: rgba(0, 0, 0, .75);
16 |
17 | z-index: 10;
18 |
19 | @keyframes p-progress-spinner-color {
20 | 100%,
21 | 0% {
22 | stroke: #d62d20;
23 | }
24 | 40% {
25 | stroke: #0057e7;
26 | }
27 | 66% {
28 | stroke: #008744;
29 | }
30 | 80%,
31 | 90% {
32 | stroke: #ffa700;
33 | }
34 | }
35 |
36 | text-align: center;
37 | padding: 0 3rem;
38 |
39 | display: flex;
40 | flex-direction: column;
41 | flex-wrap: nowrap;
42 | justify-content: center;
43 |
44 | @media (max-width: 1024px) {
45 | }
46 |
47 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 800px) {
48 | }
49 | }
50 |
51 | .common-loading-blocker-dark {
52 | @extend .common-loading-blocker !optional;
53 | }
54 |
--------------------------------------------------------------------------------
/client/web/src/scss/router.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * import font
3 | */
4 | @import '~@/src/fonts/OpenSans/font.scss';
5 |
6 | body {
7 | font-family: 'Open Sans', sans-serif;
8 | margin: 0;
9 | padding: 0;
10 |
11 | background-color: #000;
12 | }
13 |
14 | @media (max-aspect-ratio: 13/9) and (orientation: portrait), (max-width: 1024px) {
15 | }
16 |
--------------------------------------------------------------------------------
/co2-storage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/co2-storage.png
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/inputs/asset:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Attendee Name": "Attendee"
4 | },
5 | {
6 | "Event": "Event"
7 | },
8 | {
9 | "Start Date": "2023-06-18T13:50:00.000Z"
10 | },
11 | {
12 | "End Date": "2023-06-18T13:50:00.000Z"
13 | },
14 | {
15 | "Travel Description": "Travel to a nice event"
16 | },
17 | {
18 | "One-way Driving Distance (miles)": 150.00
19 | },
20 | {
21 | "One-way Flying Distance (miles)": 850.00
22 | },
23 | {
24 | "Offset Chain": "regen-1"
25 | },
26 | {
27 | "Offset Amount (kg CO2e)": 1000
28 | },
29 | {
30 | "Emissions Description": "https://www.epa.gov/system/files/documents/2023-05/420f23014.pdf, https://theicct.org/wp-content/uploads/2021/06/ICCT_CO2-commercl-aviation-2018_20190918.pdf"
31 | },
32 | {
33 | "Offset Transaction Hash": "sdfdss79sdf7fsd7fs9d7sdfs9d"
34 | }
35 | ]
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Driving Emissions (kg CO2):
--------------------------------------------------------------------------------
1 | 120
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Emissions Description:
--------------------------------------------------------------------------------
1 | https://www.epa.gov/system/files/documents/2023-05/420f23014.pdf, https://theicct.org/wp-content/uploads/2021/06/ICCT_CO2-commercl-aviation-2018_20190918.pdf
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Flying Emissions (kg CO2):
--------------------------------------------------------------------------------
1 | 232.5502
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Net Zero:
--------------------------------------------------------------------------------
1 | true
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Offset Amount (kg CO2e):
--------------------------------------------------------------------------------
1 | 1000
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Offset Chain:
--------------------------------------------------------------------------------
1 | regen-1
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Offset Transaction Hash:
--------------------------------------------------------------------------------
1 | sdfdss79sdf7fsd7fs9d7sdfs9d
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/Total Emissions (kg CO2):
--------------------------------------------------------------------------------
1 | 352.5502
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/outputs/travel-emissions.json:
--------------------------------------------------------------------------------
1 | {"Offset Chain":"regen-1","Emissions Description":"https://www.epa.gov/system/files/documents/2023-05/420f23014.pdf, https://theicct.org/wp-content/uploads/2021/06/ICCT_CO2-commercl-aviation-2018_20190918.pdf","Offset Transaction Hash":"sdfdss79sdf7fsd7fs9d7sdfs9d","Offset Amount (kg CO2e)":1000,"Driving Emissions (kg CO2)":120,"Flying Emissions (kg CO2)":232.5502,"Total Emissions (kg CO2)":352.5502,"Net Zero":true}
--------------------------------------------------------------------------------
/functions/bacalhau/travel-decarbonization/v0/wasm/main.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/bacalhau/travel-decarbonization/v0/wasm/main.wasm
--------------------------------------------------------------------------------
/functions/docker/inputs/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/1.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/2.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/3.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/4.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/5.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/6.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/7.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/8.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/9.jpg
--------------------------------------------------------------------------------
/functions/docker/inputs/Sunda-pangolin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/protocol/co2-storage/6e3794920177ee6ce926f2d2c095861a037d089d/functions/docker/inputs/Sunda-pangolin.jpg
--------------------------------------------------------------------------------
/js-api/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@co2-storage/js-api",
3 | "version": "1.4.4",
4 | "description": "JS API for co2.storage",
5 | "main": "src/js/index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "type": "module",
10 | "repository": {
11 | "type": "git",
12 | "url": "https://github.com/protocol/co2-storage/tree/main/js-api"
13 | },
14 | "keywords": [
15 | "co2",
16 | "storage",
17 | "refi",
18 | "js",
19 | "api"
20 | ],
21 | "author": "Momcilo Dzunic",
22 | "license": "MIT",
23 | "dependencies": {
24 | "@ipld/dag-pb": "^4.0.4",
25 | "@libp2p/websockets": "^6.0.3",
26 | "@metamask/eth-sig-util": "^5.1.0",
27 | "@multiformats/multiaddr": "^12.1.3",
28 | "axios": "^1.4.0",
29 | "browser-or-node": "^2.1.1",
30 | "filereader": "^0.10.3",
31 | "ipfs-http-client": "^60.0.0",
32 | "ipfs-unixfs": "^11.0.1",
33 | "multiformats": "^12.0.1",
34 | "multihashes": "^4.0.3",
35 | "web3": "^4.0.1",
36 | "ws": "^8.13.0"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/js-api/src/js/index.js:
--------------------------------------------------------------------------------
1 | import { Auth } from './auth/Auth.js'
2 | import { FGStorage } from './storage/FGStorage.js'
3 |
4 | export {
5 | Auth,
6 | FGStorage
7 | }
--------------------------------------------------------------------------------
/signing-records/contracts/CO2storageCidSignatureVerifier.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity ^0.8.13;
3 |
4 | contract CO2storageSignatureVerifier {
5 | constructor() {}
6 |
7 | function getContractAddress() public view returns (address) {
8 | return address(this);
9 | }
10 |
11 | function getChainId() public view returns (uint256) {
12 | return block.chainid;
13 | }
14 |
15 | function geteip712DomainHash () public view returns (bytes32) {
16 | return
17 | keccak256(
18 | abi.encode(
19 | keccak256(
20 | "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
21 | ),
22 | keccak256(bytes("CO2.storage Record")),
23 | keccak256(bytes("1")),
24 | block.chainid,
25 | address(this)
26 | )
27 | );
28 | }
29 |
30 | function gethashStruct(address signer, string memory cid) public pure returns (bytes32) {
31 | return keccak256(
32 | abi.encode(
33 | keccak256("Record(address signer,string cid)"),
34 | signer,
35 | keccak256(abi.encodePacked(cid))
36 | )
37 | );
38 | }
39 |
40 | function verifySignature (address signer, string memory cid, uint8 v, bytes32 r, bytes32 s)
41 | public
42 | view returns (bool) {
43 | bytes32 eip712DomainHash = geteip712DomainHash();
44 | bytes32 hashStruct = gethashStruct(signer, cid);
45 | bytes32 hash = keccak256(abi.encodePacked("\x19\x01", eip712DomainHash, hashStruct));
46 | address recoveredSigner = ecrecover(hash, v, r, s);
47 | return recoveredSigner == signer;
48 | }
49 | }
--------------------------------------------------------------------------------
/signing-records/contracts/CO2storageMessageSignatureVerifier.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity ^0.8.18;
3 |
4 | contract CO2storageSignatureVerifier {
5 | constructor() {}
6 |
7 | function getContractAddress() public view returns (address) {
8 | return address(this);
9 | }
10 |
11 | function getChainId() public view returns (uint256) {
12 | return block.chainid;
13 | }
14 |
15 | function geteip712DomainHash () public view returns (bytes32) {
16 | return
17 | keccak256(
18 | abi.encode(
19 | keccak256(
20 | "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
21 | ),
22 | keccak256(bytes("CO2.storage Message")),
23 | keccak256(bytes("1")),
24 | block.chainid,
25 | address(this)
26 | )
27 | );
28 | }
29 |
30 | function gethashStruct(address signer, string memory message) public pure returns (bytes32) {
31 | return keccak256(
32 | abi.encode(
33 | keccak256("Record(address signer,string message)"),
34 | signer,
35 | keccak256(abi.encodePacked(message))
36 | )
37 | );
38 | }
39 |
40 | function verifySignature (address signer, string memory message, uint8 v, bytes32 r, bytes32 s)
41 | public
42 | view returns (bool) {
43 | bytes32 eip712DomainHash = geteip712DomainHash();
44 | bytes32 hashStruct = gethashStruct(signer, message);
45 | bytes32 hash = keccak256(abi.encodePacked("\x19\x01", eip712DomainHash, hashStruct));
46 | address recoveredSigner = ecrecover(hash, v, r, s);
47 | return recoveredSigner == signer;
48 | }
49 | }
--------------------------------------------------------------------------------