Skip to content

Commit

Permalink
final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jul 2, 2024
1 parent e12a91e commit dd2f8ee
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 53 deletions.
4 changes: 2 additions & 2 deletions src/lib/stable/system_types/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { IDL } from '..';
export function Result<T extends IDL.Type<any>, E extends IDL.Type<any>>(
Ok: T,
Err: E
): IDL.RecordClass {
return IDL.Record({
): IDL.VariantClass {
return IDL.Variant({
Ok: Ok,
Err: Err
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/async_await.ts",
"candid": "src/async_await.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/async_await",
"node_compatibility": true
Expand Down
1 change: 0 additions & 1 deletion tests/end_to_end/candid_rpc/class_syntax/bitcoin/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/bitcoin",
"node_compatibility": true
Expand Down
2 changes: 1 addition & 1 deletion tests/end_to_end/candid_rpc/class_syntax/canister/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["SOME_CANISTER_PRINCIPAL"],
"assets": [["src/some_canister.did", "candid/some_canister.did"]],
"declarations": {
"output": "test/dfx_generated/canister",
Expand Down
2 changes: 1 addition & 1 deletion tests/end_to_end/candid_rpc/class_syntax/ckbtc/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"main": "wallet/backend/index.ts",
"candid": "wallet/backend/index.did",
"candid_gen": "custom",
"env": ["CK_BTC_PRINCIPAL", "MINTER_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["CK_BTC_PRINCIPAL", "MINTER_PRINCIPAL"],
"assets": [["minter/minter.did", "minter/minter.did"]],
"declarations": {
"node_compatibility": true,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class {
async getBalance() {
return await call(getCkBtcPrincipal(), 'icrc1_balance_of', {
paramIdls: [Account],
returnIdl: IDL.Nat64,
returnIdl: IDL.Nat,
args: [
{
owner: id(),
Expand Down Expand Up @@ -50,33 +50,6 @@ export default class {
);

return updateBalanceResult;

// TODO get rid of Result
// if ('Err' in updateBalanceResult) {
// const err = updateBalanceResult.Err;
// if ('TemporarilyUnavailable' in err) {
// throw new Error(
// `Temporarily Unavailable: ${err.TemporarilyUnavailable}`
// );
// }
// if ('AlreadyProcessing' in err) {
// throw new Error('Already processing');
// }
// if ('GenericError' in err) {
// throw new Error(
// `Error: ${err.GenericError.error_code}: ${err.GenericError.error_message}`
// );
// }
// if ('NoNewUtxos' in err) {
// throw new Error(
// `No new UTXOs: ${err.NoNewUtxos.current_confirmations}/${err.NoNewUtxos.required_confirmations}`
// );
// }
// }

// if ('Ok' in updateBalanceResult) {
// return updateBalanceResult.Ok;
// }
}

@update([], IDL.Text)
Expand Down Expand Up @@ -130,6 +103,7 @@ function padPrincipalWithZeros(blob: Uint8Array): Uint8Array {

function getCkBtcPrincipal(): string {
if (process.env.CK_BTC_PRINCIPAL !== undefined) {
console.log(process.env.CK_BTC_PRINCIPAL);
return process.env.CK_BTC_PRINCIPAL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"env": [
"CANISTER1_PRINCIPAL",
"CANISTER2_PRINCIPAL",
"CANISTER3_PRINCIPAL",
"AZLE_TEST_FETCH"
"CANISTER3_PRINCIPAL"
],
"assets": [
["src/canister2/index.did", "candid/canister2.did"],
Expand All @@ -25,7 +24,7 @@
"main": "src/canister2/index.ts",
"candid": "src/canister2/index.did",
"candid_gen": "custom",
"env": ["CANISTER3_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["CANISTER3_PRINCIPAL"],
"assets": [["src/canister3/index.did", "candid/canister3.did"]],
"declarations": {
"output": "test/dfx_generated/canister2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/canister1/index.ts",
"candid": "src/canister1/index.did",
"candid_gen": "custom",
"env": ["CANISTER2_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["CANISTER2_PRINCIPAL"],
"assets": [["src/canister2/index.did", "candid/canister2.did"]],
"declarations": {
"output": "test/dfx_generated/canister1",
Expand Down
2 changes: 1 addition & 1 deletion tests/end_to_end/candid_rpc/class_syntax/cycles/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "src/intermediary/index.ts",
"candid": "src/intermediary/index.did",
"candid_gen": "custom",
"env": ["CYCLES_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["CYCLES_PRINCIPAL"],
"assets": [["src/cycles/index.did", "candid/cycles.did"]],
"declarations": {
"output": "test/dfx_generated/intermediary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/ethereum_json_rpc",
"node_compatibility": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "canisters/func_types/index.ts",
"candid": "canisters/func_types/index.did",
"candid_gen": "custom",
"env": ["NOTIFIERS_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["NOTIFIERS_PRINCIPAL"],
"assets": [
["canisters/notifiers/index.did", "candid/notifiers.did"]
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/heartbeat_async/index.ts",
"candid": "src/heartbeat_async/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/heartbeat_async",
"node_compatibility": true
Expand Down
2 changes: 1 addition & 1 deletion tests/end_to_end/candid_rpc/class_syntax/icrc/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "canisters/proxy/index.ts",
"candid": "canisters/proxy/index.did",
"candid_gen": "custom",
"env": ["ICRC_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["ICRC_PRINCIPAL"],
"declarations": {
"output": "test/dfx_generated/proxy",
"node_compatibility": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/ledger_canister/index.ts",
"candid": "src/ledger_canister/index.did",
"candid_gen": "custom",
"env": ["ICP_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["ICP_CANISTER_PRINCIPAL"],
"assets": [["src/icp_ledger/ledger.public.did", "src/ledger.did"]],
"declarations": {
"output": "test/dfx_generated/ledger_canister",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/management_canister",
"node_compatibility": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/threshold_ecdsa",
"node_compatibility": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/whoami",
"node_compatibility": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/outgoing_http_requests",
"node_compatibility": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/recursion/index.ts",
"candid": "src/recursion/index.did",
"candid_gen": "custom",
"env": ["MY_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["MY_CANISTER_PRINCIPAL"],
"assets": [
[
"src/recursive_canister/index.did",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/rejections/index.ts",
"candid": "src/rejections/index.did",
"candid_gen": "custom",
"env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"],
"env": ["SOME_CANISTER_PRINCIPAL"],
"assets": [
["src/some_canister/index.did", "candid/some_canister.did"],
["src/nonexistent.did", "candid/nonexistent.did"]
Expand Down
1 change: 0 additions & 1 deletion tests/end_to_end/candid_rpc/class_syntax/timers/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "src/timers.ts",
"candid": "src/timers.did",
"candid_gen": "custom",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/timers",
"node_compatibility": true
Expand Down

0 comments on commit dd2f8ee

Please sign in to comment.