-
Notifications
You must be signed in to change notification settings - Fork 26
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
1 parent
4ed3f42
commit a67319f
Showing
7 changed files
with
126 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### Introduction | ||
|
||
Demo to try out winsdk | ||
|
||
usage: | ||
``` | ||
# first compile winsdk from the root of the gosdk project | ||
make build-windows | ||
# copy the generated DLLs into the demo folder | ||
cp winsdk/zcn.windows.* winsdk/demo/ | ||
# run demo | ||
cd winsdk/demo | ||
go run main.go | ||
``` |
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 @@ | ||
this is a sample file to test upload |
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,14 @@ | ||
{ | ||
"client_id": "5ad6e4d206d853833e96ff5c833369e567d2ef41ae1d5093141e1f90f1e8dcb0", | ||
"client_key": "06b7735844c07c6918b83bacbd2caa57b41888b5222621fa18ab916160f81a0d3cd574feb6930e7607fd454f4aa2f4dbbfa95532bb9d76cde492b50946eab5a1", | ||
"keys": [ | ||
{ | ||
"public_key": "06b7735844c07c6918b83bacbd2caa57b41888b5222621fa18ab916160f81a0d3cd574feb6930e7607fd454f4aa2f4dbbfa95532bb9d76cde492b50946eab5a1", | ||
"private_key": "0bb11cd6dcfa34acabfee25babe815bfcd6a4870bd7ebd3b205429b24dde2522" | ||
} | ||
], | ||
"mnemonics": "border laptop library theory pave brain decline jeans winner frame throw gadget amused mule farm labor torch slight pride lottery cash youth ocean route", | ||
"version": "1.0", | ||
"date_created": "2023-05-30T01:31:32+02:00", | ||
"nonce": 0 | ||
} |
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,15 @@ | ||
{ | ||
"block_worker": "https://dev.zus.network/dns", | ||
"signature_scheme": "bls0chain", | ||
"min_submit": 50, | ||
"min_confirmation": 50, | ||
"confirmation_chain_length": 3, | ||
"max_txn_query": 5, | ||
"query_sleep_time": 5, | ||
"preferred_blobbers": [], | ||
"chain_id": "0afc093ffb509f059c55478bc1a60351cef7b4e9c008a53a6cc8241ca8617dfe", | ||
"ethereum_node": "https://ropsten.infura.io/v3/xxxxxxxxxxxxxxx", | ||
"zbox_host": "https://0box.dev.zus.network", | ||
"zbox_app_type": "vult", | ||
"sharder_consensous": 2 | ||
} |
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,62 @@ | ||
package main | ||
|
||
// #cgo LDFLAGS: -L. -lzcn.windows | ||
// #include "zcn.windows.h" | ||
import "C" | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func main() { | ||
|
||
buf, err := os.ReadFile("./config.json") | ||
if err != nil { | ||
panic(err) | ||
} | ||
configJson := C.CString(string(buf)) | ||
buf, err = os.ReadFile("./client.json") | ||
if err != nil { | ||
panic(err) | ||
} | ||
clientJson := C.CString(string(buf)) | ||
fmt.Println(clientJson) | ||
C.InitSDKs(configJson) | ||
C.InitWallet(clientJson) | ||
|
||
// caution: make sure that this allocation exists in wallet | ||
allocID := "f4d07362499b2bcfaccbb3a69fdb9642c5b004d08277e04e4359659989d68fd6" | ||
|
||
GetAllocation(allocID) | ||
UploadFile(allocID) | ||
CreateFolder(allocID) | ||
|
||
} | ||
|
||
// GetAllocation gets an allocation | ||
func GetAllocation(allocID string) { | ||
alloc := C.GetAllocation(C.CString(allocID)) | ||
fmt.Println(C.GoString(alloc)) | ||
} | ||
|
||
// UploadFile uploads a file to the specified allocation | ||
func UploadFile(allocID string) { | ||
buf, err := os.ReadFile("./upload.json") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
C.BulkUpload(C.CString(allocID), C.CString(string(buf))) | ||
} | ||
|
||
// CreateFolder creates a folder in the specifed allocation | ||
func CreateFolder(allocID string) { | ||
buf, err := os.ReadFile("./multi.json") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println("started multiOps", allocID, string(buf)) | ||
C.MultiOperation(C.CString(allocID), C.CString(string(buf))) | ||
} |
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,6 @@ | ||
[ | ||
{ | ||
"operationType": "createdir", | ||
"remotePath": "/testfolder" | ||
} | ||
] |
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,12 @@ | ||
[ | ||
{ | ||
"Name": "a.txt", | ||
"Path": "a.txt", | ||
"ThumbnailPath": "a.txt", | ||
"RemotePath": "/", | ||
"Encrypt": false, | ||
"IsUpdate": false, | ||
"ChunkNumber": 0, | ||
"IsWebstreaming": false | ||
} | ||
] |