Skip to content

Commit

Permalink
Merge pull request #1880 from demergent-labs/class_based_cleanup
Browse files Browse the repository at this point in the history
Misc class based syntax clean up
  • Loading branch information
lastmjs authored Jul 15, 2024
2 parents b8e5bd2 + 4326a9c commit 93b5c56
Show file tree
Hide file tree
Showing 231 changed files with 10,535 additions and 1,889 deletions.
26 changes: 2 additions & 24 deletions examples/call_raw/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
import {
Canister,
ic,
nat,
nat64,
Principal,
text,
update
} from 'azle/experimental';
import { Canister, ic, nat, Principal, text, update } from 'azle/experimental';

export default Canister({
executeCallRaw: update(
[Principal, text, text, nat64],
text,
async (canisterId, method, candidArgs, payment) => {
const result = await ic.callRaw(
canisterId,
method,
ic.candidEncode(candidArgs),
payment
);

return ic.candidDecode(result);
}
),
executeCallRaw128: update(
[Principal, text, text, nat],
text,
async (canisterId, method, candidArgs, payment) => {
const result = await ic.callRaw128(
const result = await ic.callRaw(
canisterId,
method,
ic.candidEncode(candidArgs),
Expand Down
23 changes: 0 additions & 23 deletions examples/call_raw/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,5 @@ export function getTests(call_raw_canister: ActorSubclass<_SERVICE>): Test {
expect(result).toMatch('record');
expect(result).toMatch('principal');
});

it('calls raw_rand via execute_call_raw128', async () => {
const result = await call_raw_canister.executeCallRaw128(
Principal.fromText('aaaaa-aa'),
'raw_rand',
'()',
0n
);

expect(result).toMatch('blob');
});

it('calls create_canister via execute_call_raw128', async () => {
const result = await call_raw_canister.executeCallRaw128(
Principal.fromText('aaaaa-aa'),
'create_canister',
'(record { settings = null })',
100_000_000_000n
);

expect(result).toMatch('record');
expect(result).toMatch('principal');
});
};
}
Loading

0 comments on commit 93b5c56

Please sign in to comment.