-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Irys Arweave bundler usage to
taco-demo
(#503)
- Loading branch information
Showing
11 changed files
with
1,250 additions
and
74 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
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
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
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
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
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
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
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,25 @@ | ||
import { WebIrys } from '@irys/sdk'; | ||
import { providers } from 'ethers'; | ||
|
||
import { IRYS_NODE_URL, RPC_URL } from './config'; | ||
|
||
export const getWebIrys = async (provider: providers.Provider) => { | ||
const token = 'matic'; | ||
const wallet = { rpcUrl: RPC_URL, name: 'ethersv5', provider }; | ||
const webIrys = new WebIrys({ url: IRYS_NODE_URL, token, wallet }); | ||
await webIrys.ready(); | ||
return webIrys; | ||
}; | ||
|
||
export const uploadData = async (webIrys: WebIrys, data: unknown): Promise<string> => { | ||
const dataToUpload = JSON.stringify(data); | ||
const receipt = await webIrys.upload(dataToUpload); | ||
console.log(`Data uploaded ==> https://gateway.irys.xyz/${receipt.id}`); | ||
return receipt.id; | ||
}; | ||
|
||
export const downloadData = async (receiptId: string): Promise<unknown> => { | ||
const response = await fetch(`https://gateway.irys.xyz/${receiptId}`); | ||
const dataJson = await response.text(); | ||
return JSON.parse(dataJson); | ||
}; |
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
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
Oops, something went wrong.