@junobuild/admin 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/declarations/cmc/index.js +6 -1
  2. package/declarations/console/console.did.d.ts +5 -4
  3. package/declarations/console/console.factory.did.js +3 -2
  4. package/declarations/console/console.factory.did.mjs +3 -2
  5. package/declarations/console/index.js +6 -1
  6. package/declarations/ic/ic.did +131 -18
  7. package/declarations/ic/ic.did.d.ts +184 -53
  8. package/declarations/ic/ic.factory.did.js +167 -24
  9. package/declarations/mission_control/index.js +7 -1
  10. package/declarations/mission_control/mission_control.did.d.ts +1 -0
  11. package/declarations/mission_control/mission_control.factory.did.js +5 -0
  12. package/declarations/observatory/index.js +7 -1
  13. package/declarations/satellite/index.js +6 -1
  14. package/declarations/satellite/satellite.did.d.ts +1 -0
  15. package/declarations/satellite/satellite.factory.did.js +1 -0
  16. package/declarations/satellite/satellite.factory.did.mjs +1 -0
  17. package/dist/browser/index.js +15 -15
  18. package/dist/browser/index.js.map +4 -4
  19. package/dist/declarations/cmc/index.js +6 -1
  20. package/dist/declarations/console/console.did.d.ts +5 -4
  21. package/dist/declarations/console/console.factory.did.js +3 -2
  22. package/dist/declarations/console/console.factory.did.mjs +3 -2
  23. package/dist/declarations/console/index.js +6 -1
  24. package/dist/declarations/ic/ic.did +131 -18
  25. package/dist/declarations/ic/ic.did.d.ts +184 -53
  26. package/dist/declarations/ic/ic.factory.did.js +167 -24
  27. package/dist/declarations/mission_control/index.js +7 -1
  28. package/dist/declarations/mission_control/mission_control.did.d.ts +1 -0
  29. package/dist/declarations/mission_control/mission_control.factory.did.js +5 -0
  30. package/dist/declarations/observatory/index.js +7 -1
  31. package/dist/declarations/satellite/index.js +6 -1
  32. package/dist/declarations/satellite/satellite.did.d.ts +1 -0
  33. package/dist/declarations/satellite/satellite.factory.did.js +1 -0
  34. package/dist/declarations/satellite/satellite.factory.did.mjs +1 -0
  35. package/dist/node/index.mjs +19 -19
  36. package/dist/node/index.mjs.map +4 -4
  37. package/dist/types/api/ic.api.d.ts +1 -1
  38. package/dist/types/constants/config.constants.d.ts +2 -0
  39. package/dist/types/services/mission-control.services.d.ts +1 -1
  40. package/dist/types/services/satellite.services.d.ts +2 -2
  41. package/dist/types/types/config.types.d.ts +9 -3
  42. package/dist/types/types/ic.types.d.ts +2 -1
  43. package/package.json +1 -1
  44. package/declarations/frontend/frontend.did +0 -188
  45. package/declarations/frontend/frontend.did.d.ts +0 -172
  46. package/declarations/frontend/frontend.factory.did.js +0 -210
  47. package/declarations/frontend/index.d.ts +0 -45
  48. package/declarations/frontend/index.js +0 -32
  49. package/declarations/internet_identity/index.d.ts +0 -45
  50. package/declarations/internet_identity/index.js +0 -32
  51. package/declarations/internet_identity/internet_identity.did +0 -378
  52. package/declarations/internet_identity/internet_identity.did.d.ts +0 -231
  53. package/declarations/internet_identity/internet_identity.factory.did.js +0 -277
  54. package/declarations/ledger/index.d.ts +0 -45
  55. package/declarations/ledger/index.js +0 -32
  56. package/declarations/ledger/ledger.did +0 -266
  57. package/declarations/ledger/ledger.did.d.ts +0 -117
  58. package/declarations/ledger/ledger.factory.did.js +0 -115
  59. package/dist/declarations/frontend/frontend.did +0 -188
  60. package/dist/declarations/frontend/frontend.did.d.ts +0 -172
  61. package/dist/declarations/frontend/frontend.factory.did.js +0 -210
  62. package/dist/declarations/frontend/index.d.ts +0 -45
  63. package/dist/declarations/frontend/index.js +0 -32
  64. package/dist/declarations/internet_identity/index.d.ts +0 -45
  65. package/dist/declarations/internet_identity/index.js +0 -32
  66. package/dist/declarations/internet_identity/internet_identity.did +0 -378
  67. package/dist/declarations/internet_identity/internet_identity.did.d.ts +0 -231
  68. package/dist/declarations/internet_identity/internet_identity.factory.did.js +0 -277
  69. package/dist/declarations/ledger/index.d.ts +0 -45
  70. package/dist/declarations/ledger/index.js +0 -32
  71. package/dist/declarations/ledger/ledger.did +0 -266
  72. package/dist/declarations/ledger/ledger.did.d.ts +0 -117
  73. package/dist/declarations/ledger/ledger.factory.did.js +0 -115
@@ -1,277 +0,0 @@
1
- // @ts-ignore
2
- export const idlFactory = ({IDL}) => {
3
- const MetadataMap = IDL.Rec();
4
- const ArchiveConfig = IDL.Record({
5
- polling_interval_ns: IDL.Nat64,
6
- entries_buffer_limit: IDL.Nat64,
7
- module_hash: IDL.Vec(IDL.Nat8),
8
- entries_fetch_limit: IDL.Nat16
9
- });
10
- const RateLimitConfig = IDL.Record({
11
- max_tokens: IDL.Nat64,
12
- time_per_token_ns: IDL.Nat64
13
- });
14
- const InternetIdentityInit = IDL.Record({
15
- max_num_latest_delegation_origins: IDL.Opt(IDL.Nat64),
16
- assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
17
- archive_config: IDL.Opt(ArchiveConfig),
18
- canister_creation_cycles_cost: IDL.Opt(IDL.Nat64),
19
- register_rate_limit: IDL.Opt(RateLimitConfig)
20
- });
21
- const UserNumber = IDL.Nat64;
22
- MetadataMap.fill(
23
- IDL.Vec(
24
- IDL.Tuple(
25
- IDL.Text,
26
- IDL.Variant({
27
- map: MetadataMap,
28
- string: IDL.Text,
29
- bytes: IDL.Vec(IDL.Nat8)
30
- })
31
- )
32
- )
33
- );
34
- const DeviceProtection = IDL.Variant({
35
- unprotected: IDL.Null,
36
- protected: IDL.Null
37
- });
38
- const PublicKey = IDL.Vec(IDL.Nat8);
39
- const DeviceKey = PublicKey;
40
- const KeyType = IDL.Variant({
41
- platform: IDL.Null,
42
- seed_phrase: IDL.Null,
43
- cross_platform: IDL.Null,
44
- unknown: IDL.Null
45
- });
46
- const Purpose = IDL.Variant({
47
- authentication: IDL.Null,
48
- recovery: IDL.Null
49
- });
50
- const CredentialId = IDL.Vec(IDL.Nat8);
51
- const DeviceData = IDL.Record({
52
- alias: IDL.Text,
53
- metadata: IDL.Opt(MetadataMap),
54
- origin: IDL.Opt(IDL.Text),
55
- protection: DeviceProtection,
56
- pubkey: DeviceKey,
57
- key_type: KeyType,
58
- purpose: Purpose,
59
- credential_id: IDL.Opt(CredentialId)
60
- });
61
- const Timestamp = IDL.Nat64;
62
- const AddTentativeDeviceResponse = IDL.Variant({
63
- device_registration_mode_off: IDL.Null,
64
- another_device_tentatively_added: IDL.Null,
65
- added_tentatively: IDL.Record({
66
- verification_code: IDL.Text,
67
- device_registration_timeout: Timestamp
68
- })
69
- });
70
- const ChallengeKey = IDL.Text;
71
- const Challenge = IDL.Record({
72
- png_base64: IDL.Text,
73
- challenge_key: ChallengeKey
74
- });
75
- const DeployArchiveResult = IDL.Variant({
76
- creation_in_progress: IDL.Null,
77
- success: IDL.Principal,
78
- failed: IDL.Text
79
- });
80
- const BufferedArchiveEntry = IDL.Record({
81
- sequence_number: IDL.Nat64,
82
- entry: IDL.Vec(IDL.Nat8),
83
- anchor_number: UserNumber,
84
- timestamp: Timestamp
85
- });
86
- const WebAuthnCredential = IDL.Record({
87
- pubkey: PublicKey,
88
- credential_id: CredentialId
89
- });
90
- const AnchorCredentials = IDL.Record({
91
- recovery_phrases: IDL.Vec(PublicKey),
92
- credentials: IDL.Vec(WebAuthnCredential),
93
- recovery_credentials: IDL.Vec(WebAuthnCredential)
94
- });
95
- const DeviceWithUsage = IDL.Record({
96
- alias: IDL.Text,
97
- last_usage: IDL.Opt(Timestamp),
98
- metadata: IDL.Opt(MetadataMap),
99
- origin: IDL.Opt(IDL.Text),
100
- protection: DeviceProtection,
101
- pubkey: DeviceKey,
102
- key_type: KeyType,
103
- purpose: Purpose,
104
- credential_id: IDL.Opt(CredentialId)
105
- });
106
- const DeviceRegistrationInfo = IDL.Record({
107
- tentative_device: IDL.Opt(DeviceData),
108
- expiration: Timestamp
109
- });
110
- const IdentityAnchorInfo = IDL.Record({
111
- devices: IDL.Vec(DeviceWithUsage),
112
- device_registration: IDL.Opt(DeviceRegistrationInfo)
113
- });
114
- const FrontendHostname = IDL.Text;
115
- const SessionKey = PublicKey;
116
- const Delegation = IDL.Record({
117
- pubkey: PublicKey,
118
- targets: IDL.Opt(IDL.Vec(IDL.Principal)),
119
- expiration: Timestamp
120
- });
121
- const SignedDelegation = IDL.Record({
122
- signature: IDL.Vec(IDL.Nat8),
123
- delegation: Delegation
124
- });
125
- const GetDelegationResponse = IDL.Variant({
126
- no_such_delegation: IDL.Null,
127
- signed_delegation: SignedDelegation
128
- });
129
- const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
130
- const HttpRequest = IDL.Record({
131
- url: IDL.Text,
132
- method: IDL.Text,
133
- body: IDL.Vec(IDL.Nat8),
134
- headers: IDL.Vec(HeaderField)
135
- });
136
- const Token = IDL.Record({});
137
- const StreamingCallbackHttpResponse = IDL.Record({
138
- token: IDL.Opt(Token),
139
- body: IDL.Vec(IDL.Nat8)
140
- });
141
- const StreamingStrategy = IDL.Variant({
142
- Callback: IDL.Record({
143
- token: Token,
144
- callback: IDL.Func([Token], [StreamingCallbackHttpResponse], ['query'])
145
- })
146
- });
147
- const HttpResponse = IDL.Record({
148
- body: IDL.Vec(IDL.Nat8),
149
- headers: IDL.Vec(HeaderField),
150
- upgrade: IDL.Opt(IDL.Bool),
151
- streaming_strategy: IDL.Opt(StreamingStrategy),
152
- status_code: IDL.Nat16
153
- });
154
- const UserKey = PublicKey;
155
- const ChallengeResult = IDL.Record({
156
- key: ChallengeKey,
157
- chars: IDL.Text
158
- });
159
- const RegisterResponse = IDL.Variant({
160
- bad_challenge: IDL.Null,
161
- canister_full: IDL.Null,
162
- registered: IDL.Record({user_number: UserNumber})
163
- });
164
- const DomainActiveAnchorCounter = IDL.Record({
165
- start_timestamp: Timestamp,
166
- internetcomputer_org_counter: IDL.Nat64,
167
- ic0_app_counter: IDL.Nat64,
168
- both_ii_domains_counter: IDL.Nat64
169
- });
170
- const DomainCompletedActiveAnchorStats = IDL.Record({
171
- monthly_active_anchors: IDL.Opt(DomainActiveAnchorCounter),
172
- daily_active_anchors: IDL.Opt(DomainActiveAnchorCounter)
173
- });
174
- const DomainOngoingActiveAnchorStats = IDL.Record({
175
- monthly_active_anchors: IDL.Vec(DomainActiveAnchorCounter),
176
- daily_active_anchors: DomainActiveAnchorCounter
177
- });
178
- const DomainActiveAnchorStatistics = IDL.Record({
179
- completed: DomainCompletedActiveAnchorStats,
180
- ongoing: DomainOngoingActiveAnchorStats
181
- });
182
- const ArchiveInfo = IDL.Record({
183
- archive_config: IDL.Opt(ArchiveConfig),
184
- archive_canister: IDL.Opt(IDL.Principal)
185
- });
186
- const ActiveAnchorCounter = IDL.Record({
187
- counter: IDL.Nat64,
188
- start_timestamp: Timestamp
189
- });
190
- const CompletedActiveAnchorStats = IDL.Record({
191
- monthly_active_anchors: IDL.Opt(ActiveAnchorCounter),
192
- daily_active_anchors: IDL.Opt(ActiveAnchorCounter)
193
- });
194
- const OngoingActiveAnchorStats = IDL.Record({
195
- monthly_active_anchors: IDL.Vec(ActiveAnchorCounter),
196
- daily_active_anchors: ActiveAnchorCounter
197
- });
198
- const ActiveAnchorStatistics = IDL.Record({
199
- completed: CompletedActiveAnchorStats,
200
- ongoing: OngoingActiveAnchorStats
201
- });
202
- const InternetIdentityStats = IDL.Record({
203
- storage_layout_version: IDL.Nat8,
204
- users_registered: IDL.Nat64,
205
- domain_active_anchor_stats: IDL.Opt(DomainActiveAnchorStatistics),
206
- max_num_latest_delegation_origins: IDL.Nat64,
207
- assigned_user_number_range: IDL.Tuple(IDL.Nat64, IDL.Nat64),
208
- latest_delegation_origins: IDL.Vec(FrontendHostname),
209
- archive_info: ArchiveInfo,
210
- canister_creation_cycles_cost: IDL.Nat64,
211
- active_anchor_stats: IDL.Opt(ActiveAnchorStatistics)
212
- });
213
- const VerifyTentativeDeviceResponse = IDL.Variant({
214
- device_registration_mode_off: IDL.Null,
215
- verified: IDL.Null,
216
- wrong_code: IDL.Record({retries_left: IDL.Nat8}),
217
- no_device_to_verify: IDL.Null
218
- });
219
- return IDL.Service({
220
- acknowledge_entries: IDL.Func([IDL.Nat64], [], []),
221
- add: IDL.Func([UserNumber, DeviceData], [], []),
222
- add_tentative_device: IDL.Func([UserNumber, DeviceData], [AddTentativeDeviceResponse], []),
223
- create_challenge: IDL.Func([], [Challenge], []),
224
- deploy_archive: IDL.Func([IDL.Vec(IDL.Nat8)], [DeployArchiveResult], []),
225
- enter_device_registration_mode: IDL.Func([UserNumber], [Timestamp], []),
226
- exit_device_registration_mode: IDL.Func([UserNumber], [], []),
227
- fetch_entries: IDL.Func([], [IDL.Vec(BufferedArchiveEntry)], []),
228
- get_anchor_credentials: IDL.Func([UserNumber], [AnchorCredentials], ['query']),
229
- get_anchor_info: IDL.Func([UserNumber], [IdentityAnchorInfo], []),
230
- get_delegation: IDL.Func(
231
- [UserNumber, FrontendHostname, SessionKey, Timestamp],
232
- [GetDelegationResponse],
233
- ['query']
234
- ),
235
- get_principal: IDL.Func([UserNumber, FrontendHostname], [IDL.Principal], ['query']),
236
- http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
237
- http_request_update: IDL.Func([HttpRequest], [HttpResponse], []),
238
- init_salt: IDL.Func([], [], []),
239
- lookup: IDL.Func([UserNumber], [IDL.Vec(DeviceData)], ['query']),
240
- prepare_delegation: IDL.Func(
241
- [UserNumber, FrontendHostname, SessionKey, IDL.Opt(IDL.Nat64)],
242
- [UserKey, Timestamp],
243
- []
244
- ),
245
- register: IDL.Func(
246
- [DeviceData, ChallengeResult, IDL.Opt(IDL.Principal)],
247
- [RegisterResponse],
248
- []
249
- ),
250
- remove: IDL.Func([UserNumber, DeviceKey], [], []),
251
- replace: IDL.Func([UserNumber, DeviceKey, DeviceData], [], []),
252
- stats: IDL.Func([], [InternetIdentityStats], ['query']),
253
- update: IDL.Func([UserNumber, DeviceKey, DeviceData], [], []),
254
- verify_tentative_device: IDL.Func([UserNumber, IDL.Text], [VerifyTentativeDeviceResponse], [])
255
- });
256
- };
257
- // @ts-ignore
258
- export const init = ({IDL}) => {
259
- const ArchiveConfig = IDL.Record({
260
- polling_interval_ns: IDL.Nat64,
261
- entries_buffer_limit: IDL.Nat64,
262
- module_hash: IDL.Vec(IDL.Nat8),
263
- entries_fetch_limit: IDL.Nat16
264
- });
265
- const RateLimitConfig = IDL.Record({
266
- max_tokens: IDL.Nat64,
267
- time_per_token_ns: IDL.Nat64
268
- });
269
- const InternetIdentityInit = IDL.Record({
270
- max_num_latest_delegation_origins: IDL.Opt(IDL.Nat64),
271
- assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
272
- archive_config: IDL.Opt(ArchiveConfig),
273
- canister_creation_cycles_cost: IDL.Opt(IDL.Nat64),
274
- register_rate_limit: IDL.Opt(RateLimitConfig)
275
- });
276
- return [IDL.Opt(InternetIdentityInit)];
277
- };
@@ -1,45 +0,0 @@
1
- import type {ActorConfig, ActorSubclass, Agent, HttpAgentOptions} from '@dfinity/agent';
2
- import type {IDL} from '@dfinity/candid';
3
- import type {Principal} from '@dfinity/principal';
4
-
5
- import {_SERVICE} from './ledger.did';
6
-
7
- export declare const idlFactory: IDL.InterfaceFactory;
8
- export declare const canisterId: string;
9
-
10
- export declare interface CreateActorOptions {
11
- /**
12
- * @see {@link Agent}
13
- */
14
- agent?: Agent;
15
- /**
16
- * @see {@link HttpAgentOptions}
17
- */
18
- agentOptions?: HttpAgentOptions;
19
- /**
20
- * @see {@link ActorConfig}
21
- */
22
- actorOptions?: ActorConfig;
23
- }
24
-
25
- /**
26
- * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
27
- * @constructs {@link ActorSubClass}
28
- * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
29
- * @param {CreateActorOptions} options - see {@link CreateActorOptions}
30
- * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
31
- * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
32
- * @see {@link HttpAgentOptions}
33
- * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
34
- * @see {@link ActorConfig}
35
- */
36
- export declare const createActor: (
37
- canisterId: string | Principal,
38
- options?: CreateActorOptions
39
- ) => ActorSubclass<_SERVICE>;
40
-
41
- /**
42
- * Intialized Actor using default settings, ready to talk to a canister using its candid interface
43
- * @constructs {@link ActorSubClass}
44
- */
45
- export declare const ledger: ActorSubclass<_SERVICE>;
@@ -1,32 +0,0 @@
1
- import {Actor, HttpAgent} from '@dfinity/agent';
2
-
3
- // Imports and re-exports candid interface
4
- import {idlFactory} from './ledger.did.js';
5
- export {idlFactory} from './ledger.did.js';
6
-
7
- // CANISTER_ID is replaced by webpack based on node environment
8
-
9
- export const createActor = (canisterId, options = {}) => {
10
- const agent = options.agent || new HttpAgent({...options.agentOptions});
11
-
12
- if (options.agent && options.agentOptions) {
13
- console.warn(
14
- 'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
15
- );
16
- }
17
-
18
- // Fetch root key for certificate validation during development
19
- if (process.env.DFX_NETWORK !== 'ic') {
20
- agent.fetchRootKey().catch((err) => {
21
- console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
22
- console.error(err);
23
- });
24
- }
25
-
26
- // Creates an actor with using the candid interface and the HttpAgent
27
- return Actor.createActor(idlFactory, {
28
- agent,
29
- canisterId,
30
- ...options.actorOptions
31
- });
32
- };
@@ -1,266 +0,0 @@
1
- // This is the official Ledger interface that is guaranteed to be backward compatible.
2
-
3
- // Amount of tokens, measured in 10^-8 of a token.
4
- type Tokens = record {
5
- e8s : nat64;
6
- };
7
-
8
- // Number of nanoseconds from the UNIX epoch in UTC timezone.
9
- type TimeStamp = record {
10
- timestamp_nanos: nat64;
11
- };
12
-
13
- // AccountIdentifier is a 32-byte array.
14
- // The first 4 bytes is big-endian encoding of a CRC32 checksum of the last 28 bytes.
15
- type AccountIdentifier = blob;
16
-
17
- // Subaccount is an arbitrary 32-byte byte array.
18
- // Ledger uses subaccounts to compute the source address, which enables one
19
- // principal to control multiple ledger accounts.
20
- type SubAccount = blob;
21
-
22
- // Sequence number of a block produced by the ledger.
23
- type BlockIndex = nat64;
24
-
25
- type Transaction = record {
26
- memo : Memo;
27
- icrc1_memo: opt blob;
28
- operation : opt Operation;
29
- created_at_time : TimeStamp;
30
- };
31
-
32
- // An arbitrary number associated with a transaction.
33
- // The caller can set it in a `transfer` call as a correlation identifier.
34
- type Memo = nat64;
35
-
36
- // Arguments for the `transfer` call.
37
- type TransferArgs = record {
38
- // Transaction memo.
39
- // See comments for the `Memo` type.
40
- memo: Memo;
41
- // The amount that the caller wants to transfer to the destination address.
42
- amount: Tokens;
43
- // The amount that the caller pays for the transaction.
44
- // Must be 10000 e8s.
45
- fee: Tokens;
46
- // The subaccount from which the caller wants to transfer funds.
47
- // If null, the ledger uses the default (all zeros) subaccount to compute the source address.
48
- // See comments for the `SubAccount` type.
49
- from_subaccount: opt SubAccount;
50
- // The destination account.
51
- // If the transfer is successful, the balance of this address increases by `amount`.
52
- to: AccountIdentifier;
53
- // The point in time when the caller created this request.
54
- // If null, the ledger uses current IC time as the timestamp.
55
- created_at_time: opt TimeStamp;
56
- };
57
-
58
- type TransferError = variant {
59
- // The fee that the caller specified in the transfer request was not the one that ledger expects.
60
- // The caller can change the transfer fee to the `expected_fee` and retry the request.
61
- BadFee : record { expected_fee : Tokens; };
62
- // The account specified by the caller doesn't have enough funds.
63
- InsufficientFunds : record { balance: Tokens; };
64
- // The request is too old.
65
- // The ledger only accepts requests created within 24 hours window.
66
- // This is a non-recoverable error.
67
- TxTooOld : record { allowed_window_nanos: nat64 };
68
- // The caller specified `created_at_time` that is too far in future.
69
- // The caller can retry the request later.
70
- TxCreatedInFuture : null;
71
- // The ledger has already executed the request.
72
- // `duplicate_of` field is equal to the index of the block containing the original transaction.
73
- TxDuplicate : record { duplicate_of: BlockIndex; }
74
- };
75
-
76
- type TransferResult = variant {
77
- Ok : BlockIndex;
78
- Err : TransferError;
79
- };
80
-
81
- // Arguments for the `account_balance` call.
82
- type AccountBalanceArgs = record {
83
- account: AccountIdentifier;
84
- };
85
-
86
- type TransferFeeArg = record {};
87
-
88
- type TransferFee = record {
89
- // The fee to pay to perform a transfer
90
- transfer_fee: Tokens;
91
- };
92
-
93
- type GetBlocksArgs = record {
94
- // The index of the first block to fetch.
95
- start : BlockIndex;
96
- // Max number of blocks to fetch.
97
- length : nat64;
98
- };
99
-
100
- type Operation = variant {
101
- Mint : record {
102
- to : AccountIdentifier;
103
- amount : Tokens;
104
- };
105
- Burn : record {
106
- from : AccountIdentifier;
107
- amount : Tokens;
108
- };
109
- Transfer : record {
110
- from : AccountIdentifier;
111
- to : AccountIdentifier;
112
- amount : Tokens;
113
- fee : Tokens;
114
- };
115
- Approve : record {
116
- from : AccountIdentifier;
117
- spender : AccountIdentifier;
118
- allowance_e8s : int;
119
- fee : Tokens;
120
- expires_at : opt TimeStamp;
121
- };
122
- TransferFrom : record {
123
- from : AccountIdentifier;
124
- to : AccountIdentifier;
125
- spender : AccountIdentifier;
126
- amount : Tokens;
127
- fee : Tokens;
128
- };
129
- };
130
-
131
-
132
-
133
- type Block = record {
134
- parent_hash : opt blob;
135
- transaction : Transaction;
136
- timestamp : TimeStamp;
137
- };
138
-
139
- // A prefix of the block range specified in the [GetBlocksArgs] request.
140
- type BlockRange = record {
141
- // A prefix of the requested block range.
142
- // The index of the first block is equal to [GetBlocksArgs.from].
143
- //
144
- // Note that the number of blocks might be less than the requested
145
- // [GetBlocksArgs.len] for various reasons, for example:
146
- //
147
- // 1. The query might have hit the replica with an outdated state
148
- // that doesn't have the full block range yet.
149
- // 2. The requested range is too large to fit into a single reply.
150
- //
151
- // NOTE: the list of blocks can be empty if:
152
- // 1. [GetBlocksArgs.len] was zero.
153
- // 2. [GetBlocksArgs.from] was larger than the last block known to the canister.
154
- blocks : vec Block;
155
- };
156
-
157
- // An error indicating that the arguments passed to [QueryArchiveFn] were invalid.
158
- type QueryArchiveError = variant {
159
- // [GetBlocksArgs.from] argument was smaller than the first block
160
- // served by the canister that received the request.
161
- BadFirstBlockIndex : record {
162
- requested_index : BlockIndex;
163
- first_valid_index : BlockIndex;
164
- };
165
-
166
- // Reserved for future use.
167
- Other : record {
168
- error_code : nat64;
169
- error_message : text;
170
- };
171
- };
172
-
173
- type QueryArchiveResult = variant {
174
- // Successfully fetched zero or more blocks.
175
- Ok : BlockRange;
176
- // The [GetBlocksArgs] request was invalid.
177
- Err : QueryArchiveError;
178
- };
179
-
180
- // A function that is used for fetching archived ledger blocks.
181
- type QueryArchiveFn = func (GetBlocksArgs) -> (QueryArchiveResult) query;
182
-
183
- // The result of a "query_blocks" call.
184
- //
185
- // The structure of the result is somewhat complicated because the main ledger canister might
186
- // not have all the blocks that the caller requested: One or more "archive" canisters might
187
- // store some of the requested blocks.
188
- //
189
- // Note: as of Q4 2021 when this interface is authored, the IC doesn't support making nested
190
- // query calls within a query call.
191
- type QueryBlocksResponse = record {
192
- // The total number of blocks in the chain.
193
- // If the chain length is positive, the index of the last block is `chain_len - 1`.
194
- chain_length : nat64;
195
-
196
- // System certificate for the hash of the latest block in the chain.
197
- // Only present if `query_blocks` is called in a non-replicated query context.
198
- certificate : opt blob;
199
-
200
- // List of blocks that were available in the ledger when it processed the call.
201
- //
202
- // The blocks form a contiguous range, with the first block having index
203
- // [first_block_index] (see below), and the last block having index
204
- // [first_block_index] + len(blocks) - 1.
205
- //
206
- // The block range can be an arbitrary sub-range of the originally requested range.
207
- blocks : vec Block;
208
-
209
- // The index of the first block in "blocks".
210
- // If the blocks vector is empty, the exact value of this field is not specified.
211
- first_block_index : BlockIndex;
212
-
213
- // Encoding of instructions for fetching archived blocks whose indices fall into the
214
- // requested range.
215
- //
216
- // For each entry `e` in [archived_blocks], `[e.from, e.from + len)` is a sub-range
217
- // of the originally requested block range.
218
- archived_blocks : vec record {
219
- // The index of the first archived block that can be fetched using the callback.
220
- start : BlockIndex;
221
-
222
- // The number of blocks that can be fetch using the callback.
223
- length : nat64;
224
-
225
- // The function that should be called to fetch the archived blocks.
226
- // The range of the blocks accessible using this function is given by [from]
227
- // and [len] fields above.
228
- callback : QueryArchiveFn;
229
- };
230
- };
231
-
232
- type Archive = record {
233
- canister_id: principal;
234
- };
235
-
236
- type Archives = record {
237
- archives: vec Archive;
238
- };
239
-
240
- service : {
241
- // Transfers tokens from a subaccount of the caller to the destination address.
242
- // The source address is computed from the principal of the caller and the specified subaccount.
243
- // When successful, returns the index of the block containing the transaction.
244
- transfer : (TransferArgs) -> (TransferResult);
245
-
246
- // Returns the amount of Tokens on the specified account.
247
- account_balance : (AccountBalanceArgs) -> (Tokens) query;
248
-
249
- // Returns the current transfer_fee.
250
- transfer_fee : (TransferFeeArg) -> (TransferFee) query;
251
-
252
- // Queries blocks in the specified range.
253
- query_blocks : (GetBlocksArgs) -> (QueryBlocksResponse) query;
254
-
255
- // Returns token symbol.
256
- symbol : () -> (record { symbol: text }) query;
257
-
258
- // Returns token name.
259
- name : () -> (record { name: text }) query;
260
-
261
- // Returns token decimals.
262
- decimals : () -> (record { decimals: nat32 }) query;
263
-
264
- // Returns the existing archive canisters information.
265
- archives : () -> (Archives) query;
266
- }