Skip to content

Commit

Permalink
add in replicated execution
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 13, 2025
1 parent 1990398 commit 81eb0b9
Show file tree
Hide file tree
Showing 25 changed files with 3,167 additions and 0 deletions.
Binary file modified canister_templates/experimental.wasm
Binary file not shown.
Binary file modified canister_templates/stable.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export default Canister({
id: query([], Principal, () => {
return ic.id();
}),
// returns true if the canister is in replicated execution
inReplicatedExecution: update([], bool, () => {
return ic.inReplicatedExecution();
}),
// determines whether the given principal is a controller of the canister
isController: query([Principal], bool, (principal) => {
return ic.isController(principal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ export function getTests(icApiCanister: ActorSubclass<_SERVICE>): Test {
expect(result.toText()).toBe(icApiCanisterId);
});

it('calls inReplicatedExecution on the ic object', async () => {
const result = await icApiCanister.inReplicatedExecution();

expect(result).toBe(true);
});

it('calls isController on the ic object', async () => {
const principal = Principal.fromText(
execSync(`dfx identity get-principal`).toString().trim()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.azle
.dfx
dfx_generated
node_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"canisters": {
"canister": {
"type": "azle",
"main": "src/index.ts",
"declarations": {
"output": "test/dfx_generated/canister",
"node_compatibility": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 100_000_000,
transform: {
'^.+\\.ts$': ['ts-jest', { isolatedModules: true }],
'^.+\\.js$': 'ts-jest'
},
transformIgnorePatterns: ['/node_modules/(?!(azle)/)'] // Make sure azle is transformed
};
Loading

0 comments on commit 81eb0b9

Please sign in to comment.