@@ -368,10 +368,10 @@ Clients use `from` to request only archives that appear after a previously seen
368368
369369```
370370type GetArchivesArgs = record {
371- // The last archive seen by the client.
372- // The producer will return archives coming
373- // after this one if set, otherwise it
374- // will return the first archives.
371+ // The producer will return archives that appear after
372+ // this one in its internal archive ordering if set,
373+ // otherwise it will return the first archives.
374+
375375 from : opt principal;
376376};
377377
@@ -395,7 +395,7 @@ service : {
395395
396396- Archives MUST be returned in strictly increasing order of their start index.
397397- If ` from ` is ` null ` , the producer MUST return the first archive(s).
398- If ` from ` is set, the producer MUST return only the archives whose
398+ - If ` from ` is set, the producer MUST return only the archives whose
399399` canister_id ` appears * after* the specified principal in the producer’s
400400internal archive ordering.
401401
@@ -473,11 +473,11 @@ service : {
473473- Each entry in ` archived_blocks ` :
474474 - MUST have ` args ` describing one or more contiguous ranges of archived
475475 indices, and
476- - MUST provide a ` callback ` which, when called with any subset of the
477- ranges listed in ` args ` , returns the blocks whose ` id ` values lie within
478- the requested ranges, except where constraints such as message size,
479- security limits, or the archive’s own tip boundaries prevent returning
480- the full set.
476+ - MUST provide a ` callback ` which, when called with any subset of the
477+ ranges listed in ` args ` , returns the blocks whose ` id ` values lie within
478+ the requested ranges, except where constraints such as message size,
479+ security limits, or the archive’s own tip boundaries prevent returning
480+ the full set.
481481
482482
483483- Implementations MAY therefore return only a ** partial view** of the blocks in
@@ -697,7 +697,104 @@ An ICRC-3 compatible producer canister MUST expose an endpoint listing all the s
697697
698698
699699
700+ ## Candid Specification
701+
702+ ```
703+ // ICRC-3: Block Log Candid Interface
704+
705+ // Generic representation-independent value type used for blocks.
706+ type Value = variant {
707+ Blob : blob;
708+ Text : text;
709+ Nat : nat;
710+ Int : int;
711+ Array : vec Value;
712+ Map : vec record { text; Value };
713+ };
714+
715+ // Archives
716+
717+ type GetArchivesArgs = record {
718+ // The last archive seen by the client.
719+ // The producer will return archives that appear after
720+ // this one in its internal archive ordering if set,
721+ // otherwise it will return the first archives.
722+ from : opt principal;
723+ };
724+
725+ type GetArchivesResult = vec record {
726+ // The id of the archive canister
727+ canister_id : principal;
728+
729+ // The first block in the archive (inclusive)
730+ start : nat;
731+
732+ // The last block in the archive (inclusive)
733+ end : nat;
734+ };
735+
736+ // Blocks
737+
738+ // Each element describes a half-open range [start, start + length)
739+ type GetBlocksArgs = vec record {
740+ start : nat;
741+ length : nat;
742+ };
743+
744+ type GetBlocksResult = record {
745+ // Total number of blocks in the block log
746+ log_length : nat;
747+
748+ // Blocks found locally on the producer canister
749+ blocks : vec record {
750+ id : nat; // block index
751+ block : Value; // encoded block
752+ };
753+
754+ // Callbacks to fetch archived blocks
755+ archived_blocks : vec record {
756+ // Archived ranges available via this callback
757+ args : GetBlocksArgs;
758+
759+ // Callback to fetch a subset of the above ranges
760+ callback : func (GetBlocksArgs) -> (GetBlocksResult) query;
761+ };
762+ };
763+
764+ // Tip certificate
765+
766+ // See https://internetcomputer.org/docs/current/references/ic-interface-spec#certification
767+ type DataCertificate = record {
768+ // Signature of the root of the hash_tree
769+ certificate : blob;
770+
771+ // CBOR-encoded hash_tree
772+ hash_tree : blob;
773+ };
774+
775+ // Supported block types
776+
777+ type SupportedBlockType = record {
778+ block_type : text; // e.g. "1xfer", "107feecol"
779+ url : text; // canonical URL of the defining spec
780+ };
781+
782+ // ICRC-3 service
783+
784+ service : {
785+ // Returns archive metadata
786+ icrc3_get_archives : (GetArchivesArgs) -> (GetArchivesResult) query;
787+
788+ // Returns blocks and archive callbacks for one or more ranges
789+ icrc3_get_blocks : (GetBlocksArgs) -> (GetBlocksResult) query;
790+
791+ // Returns a certificate for the tip of the block log
792+ icrc3_get_tip_certificate : () -> (opt DataCertificate) query;
700793
794+ // Returns the set of block types this producer may emit
795+ icrc3_supported_block_types : () -> (vec SupportedBlockType) query;
796+ }
797+ ```
701798
702799
703800
@@ -951,19 +1048,19 @@ This example shows an `icrc1_transfer` call where the caller only specifies the
9511048```
9521049variant {
9531050 Map = vec {
954- record { "fee"; variant { nat = 10_000 : nat } };
1051+ record { "fee"; variant { Nat = 10_000 : nat } };
9551052 record {
9561053 "phash";
9571054 variant {
9581055 Blob = blob "\b8\0d\29\e5\91\60\4c\d4\60\3a\2a\7c\c5\33\14\21\27\b8\23\e9\a5\24\b7\14\43\24\4b\2d\d5\b0\86\13"
9591056 };
9601057 };
961- record { "ts"; variant { nat = 1_753_344_727_778_561_060 : nat } };
1058+ record { "ts"; variant { Nat = 1_753_344_727_778_561_060 : nat } };
9621059 record {
9631060 "tx";
9641061 variant {
9651062 Map = vec {
966- record { "amt"; variant { nat = 85_224_322_205 : nat } };
1063+ record { "amt"; variant { Nat = 85_224_322_205 : nat } };
9671064 record { "from"; variant { Array = vec { variant { Blob = blob "\00\00\00\00\02\30\02\17\01\01" } } } };
9681065 record { "op"; variant { Text = "xfer" } };
9691066 record {
@@ -995,12 +1092,12 @@ variant {
9951092 Blob = blob "\c2\b1\32\6a\5e\09\0e\10\ad\be\f3\4c\ba\fd\bc\90\18\3f\38\a7\3e\73\61\cc\0a\fa\99\89\3d\6b\9e\47"
9961093 };
9971094 };
998- record { "ts"; variant { nat = 1_753_344_737_123_456_789 : nat } };
1095+ record { "ts"; variant { Nat = 1_753_344_737_123_456_789 : nat } };
9991096 record {
10001097 "tx";
10011098 variant {
10021099 Map = vec {
1003- record { "amt"; variant { nat = 500_000_000 : nat } };
1100+ record { "amt"; variant { Nat = 500_000_000 : nat } };
10041101 record {
10051102 "to";
10061103 variant {
@@ -1031,12 +1128,12 @@ variant {
10311128 Blob = blob "\7f\89\42\a5\be\4d\af\50\3b\6e\2a\8e\9c\c7\dd\f1\c9\e8\24\f0\98\bb\d7\af\ae\d2\90\10\67\df\1e\c1\0a"
10321129 };
10331130 };
1034- record { "ts"; variant { nat = 1_753_344_740_000_000_000 : nat } };
1131+ record { "ts"; variant { Nat = 1_753_344_740_000_000_000 : nat } };
10351132 record {
10361133 "tx";
10371134 variant {
10381135 Map = vec {
1039- record { "amt"; variant { nat = 42_000_000 : nat } };
1136+ record { "amt"; variant { Nat = 42_000_000 : nat } };
10401137 record {
10411138 "from";
10421139 variant {
@@ -1119,19 +1216,19 @@ This example shows an `icrc2_transfer_from` call where the recipient is a regula
11191216```
11201217variant {
11211218 Map = vec {
1122- record { "fee"; variant { nat = 10_000 : nat } };
1219+ record { "fee"; variant { Nat = 10_000 : nat } };
11231220 record {
11241221 "phash";
11251222 variant {
11261223 Blob = blob "\a0\5f\d2\f3\4c\26\73\58\00\7f\ea\02\18\43\47\70\85\50\2e\d2\1f\23\e0\dc\e6\af\3c\cf\9e\6f\4a\d8"
11271224 };
11281225 };
1129- record { "ts"; variant { nat = 1_753_344_728_820_625_931 : nat } };
1226+ record { "ts"; variant { Nat = 1_753_344_728_820_625_931 : nat } };
11301227 record {
11311228 "tx";
11321229 variant {
11331230 Map = vec {
1134- record { "amt"; variant { nat = 50_419_165_435 : nat } };
1231+ record { "amt"; variant { Nat = 50_419_165_435 : nat } };
11351232 record {
11361233 "from";
11371234 variant {
@@ -1178,12 +1275,12 @@ variant {
11781275 Blob = blob "\9a\cd\20\3f\b0\11\fb\7f\e2\2a\1d\f2\c1\dd\22\6a\2f\1e\f6\88\d3\b0\9f\be\8d\2e\c5\70\f2\b4\a1\77"
11791276 };
11801277 };
1181- record { "ts"; variant { nat = 1_753_344_750_000_000_000 : nat } };
1278+ record { "ts"; variant { Nat = 1_753_344_750_000_000_000 : nat } };
11821279 record {
11831280 "tx";
11841281 variant {
11851282 Map = vec {
1186- record { "amt"; variant { nat = 200_000 : nat } };
1283+ record { "amt"; variant { Nat = 200_000 : nat } };
11871284 record {
11881285 "from";
11891286 variant {
@@ -1221,13 +1318,15 @@ variant { Map = vec {
12211318 record { "tx"; variant { Map = vec {
12221319 record { "op"; variant { Text = "107set_fee_collector" }};
12231320 record { "fee_collector"; variant { Array = vec { }}}; // [] means "burn from now on"
1224- record { "created_at_time"; variant { nat = 1_750_951_728_000_000_000 : nat }};
1321+ record { "created_at_time"; variant { Nat = 1_750_951_728_000_000_000 : nat }};
12251322 record { "caller"; variant { Blob = blob "\00\00\00\00\00\00\00\00\01\01" }};
12261323 }}};
12271324
12281325 // Standard block metadata
1229- record { "ts"; variant { nat = 1_741_312_737_184_874_392 : nat }};
1326+ record { "ts"; variant { Nat = 1_741_312_737_184_874_392 : nat }};
12301327 record { "phash"; variant { Blob = blob "\2d\86\7f\34\c7\2d\1e\2d\00\84\10\a4\00\b0\b6\4c\3e\02\96\c9\e8\55\6f\dd\72\68\e8\df\8d\8e\8a\ee" }};
12311328}}
12321329```
12331330
1331+
1332+
0 commit comments