init
This commit is contained in:
18
Assets/Web3Unity/Scripts/Prefabs/IPFS/IPFSUploadExample.cs
Normal file
18
Assets/Web3Unity/Scripts/Prefabs/IPFS/IPFSUploadExample.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Web3Unity.Scripts.Library.IPFS;
|
||||
|
||||
public class IPFSUploadExample : MonoBehaviour
|
||||
{
|
||||
private const string apiKey = "YOUR_CHAINSAFE_STORE_API_KEY";
|
||||
|
||||
async void Start()
|
||||
{
|
||||
var data = System.Text.Encoding.UTF8.GetBytes("YOUR_DATA");
|
||||
|
||||
var ipfs = new IPFS(apiKey);
|
||||
var cid = await ipfs.Upload("BUCKET_ID", "/PATH", "FILENAME.ext", data, "application/octet-stream");
|
||||
print(cid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c21d8011b8fc440b9ca370987c9b813
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user