Skip to content

Instantly share code, notes, and snippets.

View SuddenlyHazel's full-sized avatar

Hazel SuddenlyHazel

View GitHub Profile
import Blob "mo:base/Blob";
import Debug "mo:base/Debug";
import Text "mo:base/Text";
actor {
type HeaderField = (Text, Text);
type HttpRequest = {
method: Text;
url: Text;
var reader = new FileReader()
var fileByteArray = []
reader.readAsArrayBuffer(file)
reader.onloadend = function (evt) {
if (evt.target.readyState == FileReader.DONE) {
var arrayBuffer = evt.target.result,
array = new Uint8Array(arrayBuffer)
for (var i = 0; i < array.length; i++) {
fileByteArray.push(array[i])
@SuddenlyHazel
SuddenlyHazel / nft-0.0.1.did
Created July 29, 2021 20:06
nft-0.0.1.did
type Value =
variant {
Bool: bool;
Class: vec Property;
Empty;
Float: float64;
Int: int;
Nat: nat;
Principal: principal;
Text: text;
type BlockIndex = nat64;
type Memo = nat64;
type AccountIdentifier = blob;
type Tokens = record { e8s : nat64 };
type Timestamp = record { timestamp_nanos : nat64 };
type Operation = variant {
Mint : record {
to : AccountIdentifier;
amount : Tokens;
type Account = record { owner : principal; subaccount : opt vec nat8 };
type AccountBalanceArgs = record { account : text };
type ArchiveInfo = record { canister_id : principal };
type ArchiveOptions = record {
num_blocks_to_archive : nat64;
max_transactions_per_response : opt nat64;
trigger_threshold : nat64;
max_message_size_bytes : opt nat64;
cycles_for_archive_creation : opt nat64;
node_max_memory_size_bytes : opt nat64;