Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michielpost/Dfinity.Blazor
Blazor library to work with Dfinity Internet Computer
https://github.com/michielpost/Dfinity.Blazor
Last synced: 3 months ago
JSON representation
Blazor library to work with Dfinity Internet Computer
- Host: GitHub
- URL: https://github.com/michielpost/Dfinity.Blazor
- Owner: michielpost
- License: mit
- Created: 2021-09-22T09:41:01.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-14T10:28:46.000Z (over 2 years ago)
- Last Synced: 2024-06-29T02:09:01.597Z (4 months ago)
- Language: JavaScript
- Size: 700 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-icp - michielpost/Dfinity.Blazor
README
# Dfinity.Blazor
Blazor library to work with Dfinity Internet Computer. Use this library to easily integrate login with Internet Identity in your Blazor WebAssembly app. This library can also be used to communicate with Internet Computer canisters.Deployed to https://syisf-7qaaa-aaaah-aauda-cai.ic0.app/
Available on NuGet: https://www.nuget.org/packages/Dfinity.Blazor/
## Features
- Login with Internet Identity
- Get Current Internet Identity
- Store and Get key/value pairs
- Store and Get key/value pairs for a logged in user## Demo
- Install the Dfinity SDK from https://smartcontracts.org
- Install the .Net SDK from https://get.dot.net
- Clone this code to your local PC1. Publish the sample app:
```ps
dotnet publish src/Dfinity.Blazor.SampleApp -c Release
```2. Start a local internet computer.
```text
dfx start
```3. Open a new terminal window.
4. Reserve an identifier for your canister.
```text
dfx canister create --all
```5. Install frontend dependencies
```text
npm install
```6. Build the canisters
```text
dfx build
```7. Deploy the canisters
```text
dfx canister install --all
```8. Take note of the URL at which the canister is accessible.
```text
echo "http://localhost:8000/?canisterId=$(dfx canister id www)"
```9. Open the URL in your web browser.
## How to use this in your own app
Example implementation can be found at https://github.com/michielpost/SkyDocs/tree/feature/dfinitySteps:
- Install this library from NuGet [Dfinity.Blazor](https://www.nuget.org/packages/Dfinity.Blazor/)
- Create a folder for your storage canister and add Main.mo
- Add your storage canister to dfx.json```json
"storage": {
"main": "src/storage/main.mo",
"type": "motoko"
},
```- Add index.js and index.html to your www/asset canister
- Add package.json to the root of your project
- Follow the steps to run the demo to build your own project
- Make sure the compiled/minified index.js end up in the `wwwroot` of your Blazor app.
- Include the js file in your html:
```html
```### Inspiration
- https://github.com/krpeacock/auth-client-demo/
- https://github.com/dfinity/examples/tree/master/motoko/phone-book
- https://github.com/dfinity/examples/tree/master/motoko/superheroes