-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
vite.svg,1713755213475,59ec4b6085a0cb1bf712a5e48dd5f35b08e34830d49c2026c18241be04e05d5a | ||
leetmigo waifu 1.png,1719180166792,e196e9e48be328b15c212d370e23a5ea33186361619ee1dfe7a6b05136ff4f5a | ||
gendonotevil1.png,1716715413819,87612e12215c5df3dd01be8177bbdd74734b0f76f7eb0c5ef72dcfa81a7766d9 | ||
index.html,1724499268298,3d4408a748e8b1f5d10c674a827c0721f042d253f015547be3c50dec75770577 | ||
assets/LeetMigo_banner_main_01-B7g23Qd-.png,1724499268298,4ada8c13ac119d2ab923d7e00d6def14e3326c0b0938c8a79afa7176075f773a | ||
assets/index-DI5JVsUB.js,1724499268297,7bf01dc8bb3627a0ef32bb72ee1758ca8205b82b040b0d82e634e30f0499c597 | ||
index.html,1724519372624,990e9c4883f5c2f61d7e820aea835f614698a2ca3c2cbbcb59a3aa137ee87704 | ||
assets/index-BvQ6TMY8.js,1724519372623,50737d9aa1473a057e4bbc149da0f718542e172b0290288c420f30cff296b85d | ||
assets/LeetMigo_banner_main_01-B7g23Qd-.png,1724519372623,4ada8c13ac119d2ab923d7e00d6def14e3326c0b0938c8a79afa7176075f773a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Import the Web5 module from the '@web5/api' package | ||
import { Web5 } from '@web5/api'; | ||
|
||
// Asynchronous function to handle Web5 operations | ||
async function web5Operations() { | ||
// Connect to Web5 and retrieve the DID (Decentralized Identifier) for Alice | ||
const { web5, did: aliceDid } = await Web5.connect(); | ||
|
||
try { | ||
// Create a new record with the specified data and message format | ||
const { record } = await web5.dwn.records.create({ | ||
data: 'Hello Web5', | ||
message: { | ||
dataFormat: 'text/plain', | ||
}, | ||
}); | ||
|
||
// Read the data from the created record | ||
const readResult = await record.data.text(); | ||
|
||
// Log the read result to the console | ||
console.log('Read Result:', readResult); | ||
} catch (error) { | ||
// Handle any errors that occur during record creation or reading | ||
console.error('Error:', error); | ||
} | ||
} | ||
|
||
// Execute the web5Operations function | ||
web5Operations(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters