call
This section is a work in progress.
Examples:
- async_await
- bitcoin
- composite_queries
- cross_canister_calls
- cycles
- ethereum_json_rpc
- func_types
- heartbeat
- inline_types
- ledger_canister
- management_canister
- outgoing_http_requests
- threshold_ecdsa
- rejections
- timers
- tuple_types
- whoami
import {
Canister,
ic,
init,
nat64,
Principal,
update
} from 'azle/experimental';
const TokenCanister = Canister({
transfer: update([Principal, nat64], nat64)
});
let tokenCanister: typeof TokenCanister;
export default Canister({
init: init([], setup),
postDeploy: init([], setup),
payout: update([Principal, nat64], nat64, async (to, amount) => {
return await ic.call(tokenCanister.transfer, {
args: [to, amount]
});
})
});
function setup() {
tokenCanister = TokenCanister(
Principal.fromText('r7inp-6aaaa-aaaaa-aaabq-cai')
);
}