Skip to content

Commit ac30468

Browse files
authored
Merge branch 'master' into kai/fix-svelte-starter
2 parents 82e53a1 + 164c677 commit ac30468

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5311
-10001
lines changed

svelte/svelte-motoko-starter/deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did

+520
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"canisters": {
3+
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
4+
"arg_str": "(null)",
5+
"arg_raw": "4449444c0a6e016c069ad9a8dc0402caed93df0403c8d99dab0702dfe1a5de0705f7f5cbfb0702f8d995c60f086e786e046c02007801786e066c04c3f9fca002788beea8c5047881cfaef40a0787eb979d0d7a6d7b6e096c02d5f5c5e909789fedfdc50d78010000"
6+
}
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"canisters": {
3+
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
4+
"name": "internet-identity",
5+
"wasm_hash": "1ae98d1141204d1aa51a7bf2a01561358b21692dc5c65fc3ab893c41d54763f0",
6+
"init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details.",
7+
"candid_args": "(opt InternetIdentityInit)",
8+
"gzip": true
9+
}
10+
}
11+
}

svelte/svelte-motoko-starter/dfx.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
"main": "src/backend/main.mo",
55
"type": "motoko"
66
},
7+
"internet-identity": {
8+
"type": "pull",
9+
"id": "rdmx6-jaaaa-aaaaa-aaadq-cai"
10+
},
711
"frontend": {
812
"dependencies": [
9-
"backend"
13+
"backend",
14+
"internet-identity"
1015
],
11-
"frontend": {
12-
"entrypoint": "src/frontend/public/index.html"
13-
},
1416
"source": [
15-
"src/frontend/public"
17+
"src/frontend/dist"
1618
],
1719
"type": "assets"
1820
}
@@ -23,6 +25,6 @@
2325
"packtool": ""
2426
}
2527
},
26-
"dfx": "0.12.0",
28+
"output_env_file": "src/frontend/.env",
2729
"version": 1
2830
}
Submodule internet-identity deleted from 58a6336
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
import type { Principal } from '@dfinity/principal';
2-
export interface _SERVICE { 'whoami' : () => Promise<Principal> }
2+
import type { ActorMethod } from '@dfinity/agent';
3+
4+
export interface _SERVICE { 'whoami' : ActorMethod<[], Principal> }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Version: 1.0.0
2+
actor {
3+
4+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Version: 1.0.0
2+
actor {
3+
4+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
service : {
2+
whoami: () -> (principal) query;
3+
}

svelte/svelte-motoko-starter/src/declarations/backend/index.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ export { idlFactory } from './backend.did.js';
77
export const canisterId = process.env.BACKEND_CANISTER_ID;
88

99
/**
10-
*
10+
* @deprecated since dfx 0.11.1
11+
* Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface.
1112
* @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent
12-
* @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig}} [options]
13+
* @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options]
1314
* @return {import("@dfinity/agent").ActorSubclass<import("./backend.did.js")._SERVICE>}
1415
*/
15-
export const createActor = (canisterId, options) => {
16-
const agent = new HttpAgent({ ...options?.agentOptions });
16+
export const createActor = (canisterId, options = {}) => {
17+
console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings.
18+
19+
See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`);
20+
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
1721

1822
// Fetch root key for certificate validation during development
19-
if(process.env.NODE_ENV !== "production") {
20-
agent.fetchRootKey().catch(err=>{
23+
if (process.env.DFX_NETWORK !== "ic") {
24+
agent.fetchRootKey().catch(err => {
2125
console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
2226
console.error(err);
2327
});
@@ -27,12 +31,12 @@ export const canisterId = process.env.BACKEND_CANISTER_ID;
2731
return Actor.createActor(idlFactory, {
2832
agent,
2933
canisterId,
30-
...options?.actorOptions,
34+
...(options ? options.actorOptions : {}),
3135
});
3236
};
3337

3438
/**
3539
* A ready-to-use agent for the backend canister
3640
* @type {import("@dfinity/agent").ActorSubclass<import("./backend.did.js")._SERVICE>}
3741
*/
38-
export const backend = createActor(canisterId);
42+
export const backend = createActor(canisterId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
service : {
2+
whoami: () -> (principal) query;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import type { Principal } from '@dfinity/principal';
2+
import type { ActorMethod } from '@dfinity/agent';
3+
4+
export interface _SERVICE { 'whoami' : ActorMethod<[], Principal> }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const idlFactory = ({ IDL }) => {
2+
return IDL.Service({ 'whoami' : IDL.Func([], [IDL.Principal], ['query']) });
3+
};
4+
export const init = ({ IDL }) => { return []; };

svelte/svelte-motoko-starter/src/declarations/frontend/assetstorage.did

+124-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ type Time = int;
66
type CreateAssetArguments = record {
77
key: Key;
88
content_type: text;
9+
max_age: opt nat64;
10+
headers: opt vec HeaderField;
11+
enable_aliasing: opt bool;
12+
allow_raw_access: opt bool;
913
};
1014

1115
// Add or change content for an asset, by content encoding
@@ -34,19 +38,41 @@ type BatchOperationKind = variant {
3438
CreateAsset: CreateAssetArguments;
3539
SetAssetContent: SetAssetContentArguments;
3640

41+
SetAssetProperties: SetAssetPropertiesArguments;
42+
3743
UnsetAssetContent: UnsetAssetContentArguments;
3844
DeleteAsset: DeleteAssetArguments;
3945

4046
Clear: ClearArguments;
4147
};
4248

49+
type CommitBatchArguments = record {
50+
batch_id: BatchId;
51+
operations: vec BatchOperationKind
52+
};
53+
54+
type CommitProposedBatchArguments = record {
55+
batch_id: BatchId;
56+
evidence: blob;
57+
};
58+
59+
type ComputeEvidenceArguments = record {
60+
batch_id: BatchId;
61+
max_iterations: opt nat16
62+
};
63+
64+
type DeleteBatchArguments = record {
65+
batch_id: BatchId;
66+
};
67+
4368
type HeaderField = record { text; text; };
4469

4570
type HttpRequest = record {
4671
method: text;
4772
url: text;
4873
headers: vec HeaderField;
4974
body: blob;
75+
certificate_version: opt nat16;
5076
};
5177

5278
type HttpResponse = record {
@@ -75,7 +101,64 @@ type StreamingStrategy = variant {
75101
};
76102
};
77103

78-
service: {
104+
type SetAssetPropertiesArguments = record {
105+
key: Key;
106+
max_age: opt opt nat64;
107+
headers: opt opt vec HeaderField;
108+
allow_raw_access: opt opt bool;
109+
is_aliased: opt opt bool;
110+
};
111+
112+
type ConfigurationResponse = record {
113+
max_batches: opt nat64;
114+
max_chunks: opt nat64;
115+
max_bytes: opt nat64;
116+
};
117+
118+
type ConfigureArguments = record {
119+
max_batches: opt opt nat64;
120+
max_chunks: opt opt nat64;
121+
max_bytes: opt opt nat64;
122+
};
123+
124+
type Permission = variant {
125+
Commit;
126+
ManagePermissions;
127+
Prepare;
128+
};
129+
130+
type GrantPermission = record {
131+
to_principal: principal;
132+
permission: Permission;
133+
};
134+
type RevokePermission = record {
135+
of_principal: principal;
136+
permission: Permission;
137+
};
138+
type ListPermitted = record { permission: Permission };
139+
140+
type ValidationResult = variant { Ok : text; Err : text };
141+
142+
type AssetCanisterArgs = variant {
143+
Init: InitArgs;
144+
Upgrade: UpgradeArgs;
145+
};
146+
147+
type InitArgs = record {};
148+
149+
type UpgradeArgs = record {
150+
set_permissions: opt SetPermissions;
151+
};
152+
153+
/// Sets the list of principals granted each permission.
154+
type SetPermissions = record {
155+
prepare: vec principal;
156+
commit: vec principal;
157+
manage_permissions: vec principal;
158+
};
159+
160+
service: (asset_canister_args: opt AssetCanisterArgs) -> {
161+
api_version: () -> (nat16) query;
79162

80163
get: (record {
81164
key: Key;
@@ -108,12 +191,29 @@ service: {
108191
};
109192
}) query;
110193

194+
certified_tree : (record {}) -> (record {
195+
certificate: blob;
196+
tree: blob;
197+
}) query;
198+
111199
create_batch : (record {}) -> (record { batch_id: BatchId });
112200

113201
create_chunk: (record { batch_id: BatchId; content: blob }) -> (record { chunk_id: ChunkId });
114202

115203
// Perform all operations successfully, or reject
116-
commit_batch: (record { batch_id: BatchId; operations: vec BatchOperationKind }) -> ();
204+
commit_batch: (CommitBatchArguments) -> ();
205+
206+
// Save the batch operations for later commit
207+
propose_commit_batch: (CommitBatchArguments) -> ();
208+
209+
// Given a batch already proposed, perform all operations successfully, or reject
210+
commit_proposed_batch: (CommitProposedBatchArguments) -> ();
211+
212+
// Compute a hash over the CommitBatchArguments. Call until it returns Some(evidence).
213+
compute_evidence: (ComputeEvidenceArguments) -> (opt blob);
214+
215+
// Delete a batch that has been created, or proposed for commit, but not yet committed
216+
delete_batch: (DeleteBatchArguments) -> ();
117217

118218
create_asset: (CreateAssetArguments) -> ();
119219
set_asset_content: (SetAssetContentArguments) -> ();
@@ -137,4 +237,26 @@ service: {
137237
http_request_streaming_callback: (token: StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query;
138238

139239
authorize: (principal) -> ();
240+
deauthorize: (principal) -> ();
241+
list_authorized: () -> (vec principal);
242+
grant_permission: (GrantPermission) -> ();
243+
revoke_permission: (RevokePermission) -> ();
244+
list_permitted: (ListPermitted) -> (vec principal);
245+
take_ownership: () -> ();
246+
247+
get_asset_properties : (key: Key) -> (record {
248+
max_age: opt nat64;
249+
headers: opt vec HeaderField;
250+
allow_raw_access: opt bool;
251+
is_aliased: opt bool; } ) query;
252+
set_asset_properties: (SetAssetPropertiesArguments) -> ();
253+
254+
get_configuration: () -> (ConfigurationResponse);
255+
configure: (ConfigureArguments) -> ();
256+
257+
validate_grant_permission: (GrantPermission) -> (ValidationResult);
258+
validate_revoke_permission: (RevokePermission) -> (ValidationResult);
259+
validate_take_ownership: () -> (ValidationResult);
260+
validate_commit_proposed_batch: (CommitProposedBatchArguments) -> (ValidationResult);
261+
validate_configure: (ConfigureArguments) -> (ValidationResult);
140262
}
Binary file not shown.

0 commit comments

Comments
 (0)