Created
February 25, 2023 00:06
-
-
Save SuddenlyHazel/139e38b044e0c7f932ac4bc17a925f7f to your computer and use it in GitHub Desktop.
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
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; | |
}; | |
Burn : record { | |
from : AccountIdentifier; | |
amount : Tokens; | |
}; | |
Transfer : record { | |
from : AccountIdentifier; | |
to : AccountIdentifier; | |
amount : Tokens; | |
fee : Tokens; | |
}; | |
}; | |
type Transaction = record { | |
memo : Memo; | |
// Optional to support potential future variant extensions. | |
operation : Operation; | |
created_at_time : Timestamp; | |
}; | |
type Block = record { | |
parent_hash : opt blob; | |
transaction : Transaction; | |
timestamp : Timestamp; | |
}; | |
type GetBlocksArgs = record { | |
start : BlockIndex; | |
length : nat64; | |
}; | |
type BlockRange = record { | |
blocks : vec Block; | |
}; | |
type GetBlocksError = variant { | |
/// The [GetBlocksArgs.start] is below the first block that | |
/// archive node stores. | |
BadFirstBlockIndex : record { | |
requested_index : BlockIndex; | |
first_valid_index : BlockIndex; | |
}; | |
/// Reserved for future use. | |
Other : record { | |
error_code : nat64; | |
error_message : text; | |
}; | |
}; | |
type GetBlocksResult = variant { | |
Ok : BlockRange; | |
Err : GetBlocksError; | |
}; | |
service : { | |
get_blocks : (GetBlocksArgs) -> (GetBlocksResult) query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment