-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
46,993 additions
and
10,678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
tests/end_to_end/candid_rpc/class_syntax/async_await/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
tests/end_to_end/candid_rpc/class_syntax/canister/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/end_to_end/candid_rpc/class_syntax/cycles/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 29 additions & 21 deletions
50
tests/end_to_end/candid_rpc/class_syntax/cycles/src/intermediary/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,63 @@ | ||
import { call, IDL, init, query, update } from 'azle'; | ||
|
||
import Cycles from '../cycles'; | ||
|
||
let cyclesCanister: typeof Cycles; | ||
import { | ||
call, | ||
canisterBalance, | ||
canisterBalance128, | ||
IDL, | ||
msgCyclesRefunded128, | ||
notify, | ||
query, | ||
trap, | ||
update | ||
} from 'azle'; | ||
|
||
export default class { | ||
@init([]) | ||
init() { | ||
cyclesCanister = Cycles(Principal.fromText(getCyclesPrincipal())); | ||
} | ||
// Reports the number of cycles returned from the Cycles canister | ||
@update([], IDL.Nat64) | ||
async sendCycles() { | ||
return await call(cyclesCanister.receiveCycles, { | ||
cycles: 1_000_000n | ||
return await call(getCyclesPrincipal(), 'receiveCycles', { | ||
returnIdl: IDL.Nat64, | ||
payment: 1_000_000n | ||
}); | ||
} | ||
|
||
@update([]) | ||
sendCyclesNotify() { | ||
return ic.notify(cyclesCanister.receiveCycles, { | ||
cycles: 1_000_000n | ||
return notify(getCyclesPrincipal(), 'receiveCycles', { | ||
payment: 1_000_000n | ||
}); | ||
} | ||
|
||
// Reports the number of cycles returned from the Cycles canister | ||
@update([], IDL.Nat) | ||
async sendCycles128() { | ||
await call(cyclesCanister.receiveCycles128, { | ||
cycles128: 1_000_000n | ||
await call(getCyclesPrincipal(), 'receiveCycles128', { | ||
payment: 1_000_000n | ||
}); | ||
|
||
return ic.msgCyclesRefunded128(); | ||
return msgCyclesRefunded128(); | ||
} | ||
|
||
@update([]) | ||
sendCycles128Notify() { | ||
return ic.notify(cyclesCanister.receiveCycles128, { | ||
cycles: 1_000_000n | ||
return notify(getCyclesPrincipal(), 'receiveCycles128', { | ||
payment: 1_000_000n | ||
}); | ||
} | ||
|
||
@query([], IDL.Nat64) | ||
getCanisterBalance() { | ||
return ic.canisterBalance(); | ||
return canisterBalance(); | ||
} | ||
|
||
@query([], IDL.Nat) | ||
getCanisterBalance128() { | ||
return ic.canisterBalance128(); | ||
return canisterBalance128(); | ||
} | ||
} | ||
|
||
function getCyclesPrincipal(): string { | ||
return ( | ||
process.env.CYCLES_PRINCIPAL ?? | ||
ic.trap('process.env.CYCLES_PRINCIPAL is undefined') | ||
trap('process.env.CYCLES_PRINCIPAL is undefined') | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
tests/end_to_end/candid_rpc/class_syntax/date/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
tests/end_to_end/candid_rpc/class_syntax/ethereum_json_rpc/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/end_to_end/candid_rpc/class_syntax/func_types/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
tests/end_to_end/candid_rpc/class_syntax/func_types/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tests/end_to_end/candid_rpc/class_syntax/guard_functions/test/pretest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/end_to_end/candid_rpc/class_syntax/icrc/canisters/proxy/index.did
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
service: () -> { | ||
icrc1_balance_of: (record {owner:principal; subaccount:opt vec nat8}) -> (nat) query; | ||
icrc1_decimals: () -> (nat8) query; | ||
icrc1_fee: () -> (nat) query; | ||
icrc1_metadata: () -> (vec record {text; variant {Int:int; Nat:nat; Blob:vec nat8; Text:text}}) query; | ||
icrc1_minting_account: () -> (opt record {owner:principal; subaccount:opt vec nat8}) query; | ||
icrc1_name: () -> (text) query; | ||
icrc1_supported_standards: () -> (vec record {url:text; name:text}) query; | ||
icrc1_symbol: () -> (text) query; | ||
icrc1_total_supply: () -> (nat) query; | ||
icrc1_transfer: (record {to:record {owner:principal; subaccount:opt vec nat8}; fee:opt nat; memo:opt vec nat8; from_subaccount:opt vec nat8; created_at_time:opt nat64; amount:nat}) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; BadBurn:record {min_burn_amount:nat}; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; InsufficientFunds:record {balance:nat}}}); | ||
icrc2_allowance: (record {account:record {owner:principal; subaccount:opt vec nat8}; spender:record {owner:principal; subaccount:opt vec nat8}}) -> (record {allowance:nat; expires_at:opt nat64}); | ||
icrc2_approve: (record {fee:opt nat; memo:opt vec nat8; from_subaccount:opt vec nat8; created_at_time:opt nat64; amount:nat; expected_allowance:opt nat; expires_at:opt nat64; spender:record {owner:principal; subaccount:opt vec nat8}}) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; AllowanceChanged:record {current_allowance:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; Expired:record {ledger_time:nat64}; InsufficientFunds:record {balance:nat}}}); | ||
icrc2_transfer_from: (record {to:record {owner:principal; subaccount:opt vec nat8}; fee:opt nat; spender_subaccount:opt vec nat8; from:record {owner:principal; subaccount:opt vec nat8}; memo:opt vec nat8; created_at_time:opt nat64; amount:nat}) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; InsufficientAllowance:record {allowance:nat}; BadBurn:record {min_burn_amount:nat}; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; InsufficientFunds:record {balance:nat}}}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.