From e77f3dcb28f6f54b4f48eaceaa301e5586dc4db4 Mon Sep 17 00:00:00 2001 From: Altynbek Orumbayev Date: Fri, 26 Sep 2025 13:56:57 +0200 Subject: [PATCH 1/4] chore: refactor --- .github/workflows/api_ci.yml | 9 +- .github/workflows/api_openapi_sync.yml | 2 +- Cargo.lock | 21 + Cargo.toml | 1 + api/README.md | 29 +- .../rust_oas_generator/generator/filters.py | 2 + .../rust_oas_generator/parser/oas_parser.py | 32 +- .../templates/apis/client.rs.j2 | 8 +- .../templates/models/model.rs.j2 | 16 +- .../templates/base/src/core/request.ts.j2 | 2 + .../templates/models/model.ts.j2 | 15 + api/scripts/convert-openapi.ts | 42 +- api/specs/kmd.oas3.json | 1907 +++++++++++++++++ crates/algokit_utils/Cargo.toml | 1 + .../src/clients/client_manager.rs | 129 ++ crates/algokit_utils/tests/common/fixture.rs | 25 +- .../tests/common/local_net_dispenser.rs | 199 +- .../tests/common/test_account.rs | 28 + .../algokit_utils/tests/kmd/key_management.rs | 109 + crates/algokit_utils/tests/kmd/mod.rs | 2 + .../tests/kmd/wallet_lifecycle.rs | 56 + crates/algokit_utils/tests/kmd_tests.rs | 1 + .../composer/inner_fee_coverage.rs | 3 +- .../composer/resource_population.rs | 2 +- crates/kmd_client/Cargo.toml | 44 + crates/kmd_client/README.md | 280 +++ crates/kmd_client/src/apis/client.rs | 341 +++ crates/kmd_client/src/apis/create_wallet.rs | 87 + crates/kmd_client/src/apis/delete_key.rs | 87 + crates/kmd_client/src/apis/delete_multisig.rs | 87 + crates/kmd_client/src/apis/export_key.rs | 87 + .../kmd_client/src/apis/export_master_key.rs | 87 + crates/kmd_client/src/apis/export_multisig.rs | 87 + crates/kmd_client/src/apis/generate_key.rs | 87 + crates/kmd_client/src/apis/get_version.rs | 87 + crates/kmd_client/src/apis/get_wallet_info.rs | 87 + crates/kmd_client/src/apis/import_key.rs | 87 + crates/kmd_client/src/apis/import_multisig.rs | 87 + .../src/apis/init_wallet_handle_token.rs | 87 + .../src/apis/list_keys_in_wallet.rs | 87 + crates/kmd_client/src/apis/list_multisg.rs | 87 + crates/kmd_client/src/apis/list_wallets.rs | 87 + crates/kmd_client/src/apis/mod.rs | 337 +++ .../src/apis/release_wallet_handle_token.rs | 87 + crates/kmd_client/src/apis/rename_wallet.rs | 87 + .../src/apis/renew_wallet_handle_token.rs | 87 + .../src/apis/sign_multisig_program.rs | 87 + .../src/apis/sign_multisig_transaction.rs | 87 + crates/kmd_client/src/apis/sign_program.rs | 87 + .../kmd_client/src/apis/sign_transaction.rs | 87 + crates/kmd_client/src/apis/swagger_handler.rs | 79 + crates/kmd_client/src/lib.rs | 11 + .../src/models/apiv1_delete_key_response.rs | 30 + .../models/apiv1_delete_multisig_response.rs | 30 + .../src/models/apiv1_get_wallets_response.rs | 34 + .../models/apiv1_post_key_export_response.rs | 35 + .../models/apiv1_post_key_import_response.rs | 32 + .../models/apiv1_post_key_list_response.rs | 32 + .../src/models/apiv1_post_key_response.rs | 32 + .../apiv1_post_master_key_export_response.rs | 37 + .../apiv1_post_multisig_export_response.rs | 38 + .../apiv1_post_multisig_import_response.rs | 32 + .../apiv1_post_multisig_list_response.rs | 32 + ...iv1_post_multisig_program_sign_response.rs | 35 + ...post_multisig_transaction_sign_response.rs | 35 + .../apiv1_post_program_sign_response.rs | 35 + .../apiv1_post_transaction_sign_response.rs | 35 + .../models/apiv1_post_wallet_info_response.rs | 34 + .../models/apiv1_post_wallet_init_response.rs | 35 + .../apiv1_post_wallet_release_response.rs | 30 + .../apiv1_post_wallet_rename_response.rs | 34 + .../apiv1_post_wallet_renew_response.rs | 34 + .../src/models/apiv1_post_wallet_response.rs | 34 + crates/kmd_client/src/models/apiv1_wallet.rs | 39 + .../src/models/apiv1_wallet_handle.rs | 32 + .../src/models/create_wallet_request.rs | 38 + .../src/models/delete_key_request.rs | 34 + .../src/models/delete_multisig_request.rs | 34 + crates/kmd_client/src/models/digest.rs | 14 + .../src/models/ed25519_private_key.rs | 14 + .../src/models/ed25519_public_key.rs | 14 + .../src/models/ed25519_signature.rs | 14 + .../src/models/export_key_request.rs | 34 + .../src/models/export_master_key_request.rs | 32 + .../src/models/export_multisig_request.rs | 32 + .../src/models/generate_key_request.rs | 32 + .../src/models/import_key_request.rs | 35 + .../src/models/import_multisig_request.rs | 38 + .../init_wallet_handle_token_request.rs | 29 + .../src/models/list_keys_request.rs | 30 + .../src/models/list_multisig_request.rs | 30 + .../src/models/list_wallets_request.rs | 24 + .../src/models/master_derivation_key.rs | 15 + crates/kmd_client/src/models/mod.rs | 130 ++ crates/kmd_client/src/models/multisig_sig.rs | 33 + .../kmd_client/src/models/multisig_subsig.rs | 33 + crates/kmd_client/src/models/private_key.rs | 16 + crates/kmd_client/src/models/public_key.rs | 16 + .../release_wallet_handle_token_request.rs | 30 + .../src/models/rename_wallet_request.rs | 31 + .../renew_wallet_handle_token_request.rs | 30 + .../src/models/sign_multisig_request.rs | 47 + .../models/sign_program_multisig_request.rs | 48 + .../src/models/sign_program_request.rs | 39 + .../src/models/sign_transaction_request.rs | 45 + crates/kmd_client/src/models/signature.rs | 16 + crates/kmd_client/src/models/tx_type.rs | 15 + .../kmd_client/src/models/versions_request.rs | 24 + .../src/models/versions_response.rs | 28 + .../src/models/wallet_info_request.rs | 30 + docs/book/contributing/contributing_guide.md | 9 +- packages/README.md | 25 - .../typescript/algokit_utils/package.json | 3 +- .../algokit_utils/tests/kmd/helpers.ts | 30 + .../tests/kmd/keyManagement.test.ts | 69 + .../tests/kmd/walletLifecycle.test.ts | 29 + packages/typescript/kmd_client/README.md | 3 + .../typescript/kmd_client/eslint.config.mjs | 3 + packages/typescript/kmd_client/package.json | 47 + .../typescript/kmd_client/rolldown.config.ts | 4 + .../kmd_client/src/apis/api.service.ts | 855 ++++++++ .../typescript/kmd_client/src/apis/index.ts | 2 + packages/typescript/kmd_client/src/client.ts | 10 + .../kmd_client/src/core/api-error.ts | 12 + .../kmd_client/src/core/base-http-request.ts | 22 + .../kmd_client/src/core/client-config.ts | 14 + .../typescript/kmd_client/src/core/codecs.ts | 13 + .../kmd_client/src/core/fetch-http-request.ts | 8 + .../kmd_client/src/core/model-runtime.ts | 264 +++ .../typescript/kmd_client/src/core/request.ts | 122 ++ .../kmd_client/src/core/serialization.ts | 26 + packages/typescript/kmd_client/src/index.ts | 12 + .../src/models/apiv1-deletekey-response.ts | 31 + .../models/apiv1-deletemultisig-response.ts | 31 + .../src/models/apiv1-getwallets-response.ts | 41 + .../models/apiv1-postkey-export-response.ts | 39 + .../models/apiv1-postkey-import-response.ts | 39 + .../src/models/apiv1-postkey-list-response.ts | 39 + .../src/models/apiv1-postkey-response.ts | 39 + .../apiv1-postmaster-key-export-response.ts | 41 + .../apiv1-postmultisig-export-response.ts | 57 + .../apiv1-postmultisig-import-response.ts | 39 + .../apiv1-postmultisig-list-response.ts | 39 + ...piv1-postmultisig-program-sign-response.ts | 39 + ...-postmultisig-transaction-sign-response.ts | 39 + .../models/apiv1-postprogram-sign-response.ts | 39 + .../apiv1-posttransaction-sign-response.ts | 39 + .../models/apiv1-postwallet-info-response.ts | 41 + .../models/apiv1-postwallet-init-response.ts | 39 + .../apiv1-postwallet-release-response.ts | 31 + .../apiv1-postwallet-rename-response.ts | 41 + .../models/apiv1-postwallet-renew-response.ts | 41 + .../src/models/apiv1-postwallet-response.ts | 41 + .../src/models/apiv1-wallet-handle.ts | 33 + .../kmd_client/src/models/apiv1-wallet.ts | 64 + .../src/models/create-wallet-request.ts | 48 + .../src/models/delete-key-request.ts | 38 + .../src/models/delete-multisig-request.ts | 38 + .../kmd_client/src/models/digest.ts | 9 + .../src/models/ed25519-private-key.ts | 9 + .../src/models/ed25519-public-key.ts | 9 + .../src/models/ed25519-signature.ts | 9 + .../src/models/export-key-request.ts | 38 + .../src/models/export-master-key-request.ts | 30 + .../src/models/export-multisig-request.ts | 30 + .../src/models/generate-key-request.ts | 30 + .../src/models/import-key-request.ts | 30 + .../src/models/import-multisig-request.ts | 48 + .../typescript/kmd_client/src/models/index.ts | 114 + .../init-wallet-handle-token-request.ts | 30 + .../src/models/list-keys-request.ts | 22 + .../src/models/list-multisig-request.ts | 22 + .../src/models/list-wallets-request.ts | 12 + .../src/models/master-derivation-key.ts | 12 + .../kmd_client/src/models/multisig-sig.ts | 40 + .../kmd_client/src/models/multisig-subsig.ts | 35 + .../kmd_client/src/models/private-key.ts | 10 + .../kmd_client/src/models/public-key.ts | 10 + .../release-wallet-handle-token-request.ts | 22 + .../src/models/rename-wallet-request.ts | 38 + .../renew-wallet-handle-token-request.ts | 22 + .../src/models/sign-multisig-request.ts | 68 + .../models/sign-program-multisig-request.ts | 74 + .../src/models/sign-program-request.ts | 46 + .../src/models/sign-transaction-request.ts | 55 + .../kmd_client/src/models/signature.ts | 10 + .../kmd_client/src/models/tx-type.ts | 12 + .../kmd_client/src/models/versions-request.ts | 12 + .../src/models/versions-response.ts | 23 + .../src/models/wallet-info-request.ts | 22 + .../typescript/kmd_client/tsconfig.build.json | 5 + packages/typescript/kmd_client/tsconfig.json | 8 + .../typescript/kmd_client/tsconfig.test.json | 6 + packages/typescript/package-lock.json | 38 +- packages/typescript/package.json | 3 +- packages/typescript/tsconfig.json | 2 +- tools/api_tools/src/main.rs | 48 + 197 files changed, 11091 insertions(+), 127 deletions(-) create mode 100644 api/specs/kmd.oas3.json create mode 100644 crates/algokit_utils/tests/kmd/key_management.rs create mode 100644 crates/algokit_utils/tests/kmd/mod.rs create mode 100644 crates/algokit_utils/tests/kmd/wallet_lifecycle.rs create mode 100644 crates/algokit_utils/tests/kmd_tests.rs create mode 100644 crates/kmd_client/Cargo.toml create mode 100644 crates/kmd_client/README.md create mode 100644 crates/kmd_client/src/apis/client.rs create mode 100644 crates/kmd_client/src/apis/create_wallet.rs create mode 100644 crates/kmd_client/src/apis/delete_key.rs create mode 100644 crates/kmd_client/src/apis/delete_multisig.rs create mode 100644 crates/kmd_client/src/apis/export_key.rs create mode 100644 crates/kmd_client/src/apis/export_master_key.rs create mode 100644 crates/kmd_client/src/apis/export_multisig.rs create mode 100644 crates/kmd_client/src/apis/generate_key.rs create mode 100644 crates/kmd_client/src/apis/get_version.rs create mode 100644 crates/kmd_client/src/apis/get_wallet_info.rs create mode 100644 crates/kmd_client/src/apis/import_key.rs create mode 100644 crates/kmd_client/src/apis/import_multisig.rs create mode 100644 crates/kmd_client/src/apis/init_wallet_handle_token.rs create mode 100644 crates/kmd_client/src/apis/list_keys_in_wallet.rs create mode 100644 crates/kmd_client/src/apis/list_multisg.rs create mode 100644 crates/kmd_client/src/apis/list_wallets.rs create mode 100644 crates/kmd_client/src/apis/mod.rs create mode 100644 crates/kmd_client/src/apis/release_wallet_handle_token.rs create mode 100644 crates/kmd_client/src/apis/rename_wallet.rs create mode 100644 crates/kmd_client/src/apis/renew_wallet_handle_token.rs create mode 100644 crates/kmd_client/src/apis/sign_multisig_program.rs create mode 100644 crates/kmd_client/src/apis/sign_multisig_transaction.rs create mode 100644 crates/kmd_client/src/apis/sign_program.rs create mode 100644 crates/kmd_client/src/apis/sign_transaction.rs create mode 100644 crates/kmd_client/src/apis/swagger_handler.rs create mode 100644 crates/kmd_client/src/lib.rs create mode 100644 crates/kmd_client/src/models/apiv1_delete_key_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_delete_multisig_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_get_wallets_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_key_export_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_key_import_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_key_list_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_key_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_program_sign_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_post_wallet_response.rs create mode 100644 crates/kmd_client/src/models/apiv1_wallet.rs create mode 100644 crates/kmd_client/src/models/apiv1_wallet_handle.rs create mode 100644 crates/kmd_client/src/models/create_wallet_request.rs create mode 100644 crates/kmd_client/src/models/delete_key_request.rs create mode 100644 crates/kmd_client/src/models/delete_multisig_request.rs create mode 100644 crates/kmd_client/src/models/digest.rs create mode 100644 crates/kmd_client/src/models/ed25519_private_key.rs create mode 100644 crates/kmd_client/src/models/ed25519_public_key.rs create mode 100644 crates/kmd_client/src/models/ed25519_signature.rs create mode 100644 crates/kmd_client/src/models/export_key_request.rs create mode 100644 crates/kmd_client/src/models/export_master_key_request.rs create mode 100644 crates/kmd_client/src/models/export_multisig_request.rs create mode 100644 crates/kmd_client/src/models/generate_key_request.rs create mode 100644 crates/kmd_client/src/models/import_key_request.rs create mode 100644 crates/kmd_client/src/models/import_multisig_request.rs create mode 100644 crates/kmd_client/src/models/init_wallet_handle_token_request.rs create mode 100644 crates/kmd_client/src/models/list_keys_request.rs create mode 100644 crates/kmd_client/src/models/list_multisig_request.rs create mode 100644 crates/kmd_client/src/models/list_wallets_request.rs create mode 100644 crates/kmd_client/src/models/master_derivation_key.rs create mode 100644 crates/kmd_client/src/models/mod.rs create mode 100644 crates/kmd_client/src/models/multisig_sig.rs create mode 100644 crates/kmd_client/src/models/multisig_subsig.rs create mode 100644 crates/kmd_client/src/models/private_key.rs create mode 100644 crates/kmd_client/src/models/public_key.rs create mode 100644 crates/kmd_client/src/models/release_wallet_handle_token_request.rs create mode 100644 crates/kmd_client/src/models/rename_wallet_request.rs create mode 100644 crates/kmd_client/src/models/renew_wallet_handle_token_request.rs create mode 100644 crates/kmd_client/src/models/sign_multisig_request.rs create mode 100644 crates/kmd_client/src/models/sign_program_multisig_request.rs create mode 100644 crates/kmd_client/src/models/sign_program_request.rs create mode 100644 crates/kmd_client/src/models/sign_transaction_request.rs create mode 100644 crates/kmd_client/src/models/signature.rs create mode 100644 crates/kmd_client/src/models/tx_type.rs create mode 100644 crates/kmd_client/src/models/versions_request.rs create mode 100644 crates/kmd_client/src/models/versions_response.rs create mode 100644 crates/kmd_client/src/models/wallet_info_request.rs create mode 100644 packages/typescript/algokit_utils/tests/kmd/helpers.ts create mode 100644 packages/typescript/algokit_utils/tests/kmd/keyManagement.test.ts create mode 100644 packages/typescript/algokit_utils/tests/kmd/walletLifecycle.test.ts create mode 100644 packages/typescript/kmd_client/README.md create mode 100644 packages/typescript/kmd_client/eslint.config.mjs create mode 100644 packages/typescript/kmd_client/package.json create mode 100644 packages/typescript/kmd_client/rolldown.config.ts create mode 100644 packages/typescript/kmd_client/src/apis/api.service.ts create mode 100644 packages/typescript/kmd_client/src/apis/index.ts create mode 100644 packages/typescript/kmd_client/src/client.ts create mode 100644 packages/typescript/kmd_client/src/core/api-error.ts create mode 100644 packages/typescript/kmd_client/src/core/base-http-request.ts create mode 100644 packages/typescript/kmd_client/src/core/client-config.ts create mode 100644 packages/typescript/kmd_client/src/core/codecs.ts create mode 100644 packages/typescript/kmd_client/src/core/fetch-http-request.ts create mode 100644 packages/typescript/kmd_client/src/core/model-runtime.ts create mode 100644 packages/typescript/kmd_client/src/core/request.ts create mode 100644 packages/typescript/kmd_client/src/core/serialization.ts create mode 100644 packages/typescript/kmd_client/src/index.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts create mode 100644 packages/typescript/kmd_client/src/models/apiv1-wallet.ts create mode 100644 packages/typescript/kmd_client/src/models/create-wallet-request.ts create mode 100644 packages/typescript/kmd_client/src/models/delete-key-request.ts create mode 100644 packages/typescript/kmd_client/src/models/delete-multisig-request.ts create mode 100644 packages/typescript/kmd_client/src/models/digest.ts create mode 100644 packages/typescript/kmd_client/src/models/ed25519-private-key.ts create mode 100644 packages/typescript/kmd_client/src/models/ed25519-public-key.ts create mode 100644 packages/typescript/kmd_client/src/models/ed25519-signature.ts create mode 100644 packages/typescript/kmd_client/src/models/export-key-request.ts create mode 100644 packages/typescript/kmd_client/src/models/export-master-key-request.ts create mode 100644 packages/typescript/kmd_client/src/models/export-multisig-request.ts create mode 100644 packages/typescript/kmd_client/src/models/generate-key-request.ts create mode 100644 packages/typescript/kmd_client/src/models/import-key-request.ts create mode 100644 packages/typescript/kmd_client/src/models/import-multisig-request.ts create mode 100644 packages/typescript/kmd_client/src/models/index.ts create mode 100644 packages/typescript/kmd_client/src/models/init-wallet-handle-token-request.ts create mode 100644 packages/typescript/kmd_client/src/models/list-keys-request.ts create mode 100644 packages/typescript/kmd_client/src/models/list-multisig-request.ts create mode 100644 packages/typescript/kmd_client/src/models/list-wallets-request.ts create mode 100644 packages/typescript/kmd_client/src/models/master-derivation-key.ts create mode 100644 packages/typescript/kmd_client/src/models/multisig-sig.ts create mode 100644 packages/typescript/kmd_client/src/models/multisig-subsig.ts create mode 100644 packages/typescript/kmd_client/src/models/private-key.ts create mode 100644 packages/typescript/kmd_client/src/models/public-key.ts create mode 100644 packages/typescript/kmd_client/src/models/release-wallet-handle-token-request.ts create mode 100644 packages/typescript/kmd_client/src/models/rename-wallet-request.ts create mode 100644 packages/typescript/kmd_client/src/models/renew-wallet-handle-token-request.ts create mode 100644 packages/typescript/kmd_client/src/models/sign-multisig-request.ts create mode 100644 packages/typescript/kmd_client/src/models/sign-program-multisig-request.ts create mode 100644 packages/typescript/kmd_client/src/models/sign-program-request.ts create mode 100644 packages/typescript/kmd_client/src/models/sign-transaction-request.ts create mode 100644 packages/typescript/kmd_client/src/models/signature.ts create mode 100644 packages/typescript/kmd_client/src/models/tx-type.ts create mode 100644 packages/typescript/kmd_client/src/models/versions-request.ts create mode 100644 packages/typescript/kmd_client/src/models/versions-response.ts create mode 100644 packages/typescript/kmd_client/src/models/wallet-info-request.ts create mode 100644 packages/typescript/kmd_client/tsconfig.build.json create mode 100644 packages/typescript/kmd_client/tsconfig.json create mode 100644 packages/typescript/kmd_client/tsconfig.test.json diff --git a/.github/workflows/api_ci.yml b/.github/workflows/api_ci.yml index 5ceaa6e4f..a35cf882b 100644 --- a/.github/workflows/api_ci.yml +++ b/.github/workflows/api_ci.yml @@ -47,7 +47,7 @@ jobs: needs: oas_lint_and_test strategy: matrix: - client: [algod, indexer] + client: [algod, indexer, kmd] include: - client: algod output_dir: crates/algod_client @@ -77,7 +77,7 @@ jobs: needs: oas_lint_and_test strategy: matrix: - client: [algod, indexer] + client: [algod, indexer, kmd] include: - client: algod package_dir: packages/typescript/algod_client @@ -89,6 +89,11 @@ jobs: package_subdir: indexer_client workspace: "@algorandfoundation/indexer-client" algokit_utils_test_filter: tests/indexer + - client: kmd + package_dir: packages/typescript/kmd_client + package_subdir: kmd_client + workspace: "@algorandfoundation/kmd-client" + algokit_utils_test_filter: tests/kmd steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-api-tools diff --git a/.github/workflows/api_openapi_sync.yml b/.github/workflows/api_openapi_sync.yml index 964f96880..1df0f59eb 100644 --- a/.github/workflows/api_openapi_sync.yml +++ b/.github/workflows/api_openapi_sync.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - spec: [algod, indexer] + spec: [algod, indexer, kmd] steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-api-tools diff --git a/Cargo.lock b/Cargo.lock index 874ba050f..50443d44a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,6 +139,7 @@ dependencies = [ "hex", "indexer_client", "insta", + "kmd_client", "lazy_static", "log", "num-bigint", @@ -1912,6 +1913,26 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kmd_client" +version = "0.0.1" +dependencies = [ + "algokit_http_client", + "algokit_transact_ffi", + "base64 0.22.1", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "serde_with", + "snafu", + "tokio", + "tokio-test", + "uniffi", + "url", + "uuid", +] + [[package]] name = "kqueue" version = "1.1.1" diff --git a/Cargo.toml b/Cargo.toml index 95d0ae091..7f6288b90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ members = [ "crates/ffi_macros", "crates/algod_client", "crates/indexer_client", + "crates/kmd_client", "tools/build_pkgs", "crates/uniffi-bindgen", "docs", diff --git a/api/README.md b/api/README.md index 277afa34c..12341ef45 100644 --- a/api/README.md +++ b/api/README.md @@ -27,7 +27,7 @@ npm install ### Convert OpenAPI 2.0 to OpenAPI 3.0 -Converts both Algod and Indexer OpenAPI 2.0 specs to OpenAPI 3.0: +Converts the Algod, Indexer, and KMD OpenAPI 2.0 specs to OpenAPI 3.0: ```bash cargo api convert-openapi @@ -39,18 +39,22 @@ Convert individual specifications: # Convert only algod spec cargo api convert-algod -# Convert only indexer spec +# Convert only indexer spec cargo api convert-indexer + +# Convert only kmd spec +cargo api convert-kmd ``` The converted specs will be available at: - `specs/algod.oas3.json` - `specs/indexer.oas3.json` +- `specs/kmd.oas3.json` ### Generate Rust API Clients -Generate both Rust API clients using the custom Jinja2-based generator: +Generate all Rust API clients using the custom Jinja2-based generator: ```bash cargo api generate-all @@ -64,16 +68,20 @@ cargo api generate-algod # Generate indexer client only cargo api generate-indexer + +# Generate kmd client only +cargo api generate-kmd ``` The generated Rust clients will be available at: - `../crates/algod_client/` - `../crates/indexer_client/` +- `../crates/kmd_client/` ### Generate TypeScript API Clients -Generate both TypeScript API clients using the TypeScript generator: +Generate all TypeScript API clients using the TypeScript generator: ```bash cargo api generate-ts-all @@ -87,12 +95,16 @@ cargo api generate-ts-algod # Generate indexer client only cargo api generate-ts-indexer + +# Generate kmd client only +cargo api generate-ts-kmd ``` The generated TypeScript clients will be available at: - `../packages/typescript/algod_client/` - `../packages/typescript/indexer_client/` +- `../packages/typescript/kmd_client/` ### Development Scripts @@ -109,6 +121,7 @@ cargo api lint-oas # Format generated Rust code cargo api format-algod cargo api format-indexer +cargo api format-kmd ``` ## Custom Rust OAS Generator @@ -128,7 +141,7 @@ The project uses a custom Jinja2-based generator located in `oas_generator/` tha The generator creates complete Rust crates with the following structure: ``` -crates/{algod_client,indexer_client}/ +crates/{algod_client,indexer_client,kmd_client}/ ├── Cargo.toml ├── README.md └── src/ @@ -152,13 +165,17 @@ The `algod.oas2.json` is taken directly from [go-algorand](https://github.com/al The `indexer.oas2.json` is taken directly from [indexer](https://github.com/algorand/indexer/blob/master/api/indexer.oas2.json). To convert the spec to OpenAPI 3.0, use `cargo api convert-indexer` which runs the same TypeScript conversion script. +### KMD + +The KMD Swagger 2.0 specification is sourced from [go-algorand](https://github.com/algorand/go-algorand/blob/master/daemon/kmd/api/swagger.json). Convert it to OpenAPI 3.0 with `cargo api convert-kmd` which invokes [scripts/convert-openapi.ts](scripts/convert-openapi.ts). + The current approach is to manually edit and tweak the OAS2 specs fixing known issues from the source repositories, then use the custom Rust OAS generator to generate clients from the v3 specs. OpenAPI v3 is preferred for client generation as it offers enhanced schema features, better component reusability, and improved type definitions compared to v2. ## Generator Configuration The custom Rust generator is configured with: -- **Package names**: `algod_client`, `indexer_client` +- **Package names**: `algod_client`, `indexer_client`, `kmd_client` - **Msgpack detection**: Automatic handling of binary-encoded fields - **Algorand extensions**: Support for signed transaction via a vendor extension - **Type safety**: Complete OpenAPI to Rust type mapping diff --git a/api/oas_generator/rust_oas_generator/generator/filters.py b/api/oas_generator/rust_oas_generator/generator/filters.py index 0eb232934..7cc52f2f3 100644 --- a/api/oas_generator/rust_oas_generator/generator/filters.py +++ b/api/oas_generator/rust_oas_generator/generator/filters.py @@ -284,6 +284,8 @@ def detect_client_type(spec_title: str) -> str: return "Algod" if "indexer" in title_lower: return "Indexer" + if "kmd" in title_lower: + return "Kmd" # Fallback: extract first word and capitalize first_word = spec_title.split()[0] if spec_title.split() else "Api" diff --git a/api/oas_generator/rust_oas_generator/parser/oas_parser.py b/api/oas_generator/rust_oas_generator/parser/oas_parser.py index f5e6d43a6..718f6cba0 100644 --- a/api/oas_generator/rust_oas_generator/parser/oas_parser.py +++ b/api/oas_generator/rust_oas_generator/parser/oas_parser.py @@ -30,6 +30,9 @@ None: "u64", "int32": "u32", "int64": "u64", + "uint8": "u8", + "uint16": "u16", + "uint32": "u32", "uint64": "u64", }, "number": { @@ -887,11 +890,26 @@ def _parse_schemas(self) -> dict[str, Schema]: def _parse_schema(self, name: str, schema_data: dict[str, Any]) -> Schema | None: """Parse a single schema.""" + vendor_extensions = self._extract_vendor_extensions(schema_data) + + # Handle pure $ref schemas as aliases to other types + if "$ref" in schema_data and not schema_data.get("properties"): + alias_rust_type = rust_type_from_openapi(schema_data, self.schemas, set()) + return Schema( + name=name, + schema_type="alias", + description=schema_data.get("description"), + properties=[], + required_fields=[], + vendor_extensions=vendor_extensions, + underlying_rust_type=alias_rust_type, + enum_values=[], + ) + schema_type = schema_data.get("type", "object") properties_data = schema_data.get("properties", {}) required_fields = schema_data.get("required", []) - vendor_extensions = self._extract_vendor_extensions(schema_data) enum_values = self._extract_enum_values(schema_type, schema_data) underlying_rust_type = None @@ -899,6 +917,18 @@ def _parse_schema(self, name: str, schema_data: dict[str, Any]) -> Schema | None if schema_type == "array": underlying_rust_type = self._handle_array_schema(schema_data) + elif schema_type in {"string", "integer", "number", "boolean"} and not enum_values: + underlying_rust_type = rust_type_from_openapi(schema_data, self.schemas, set()) + return Schema( + name=name, + schema_type="alias", + description=schema_data.get("description"), + properties=[], + required_fields=[], + vendor_extensions=vendor_extensions, + underlying_rust_type=underlying_rust_type, + enum_values=enum_values, + ) else: properties = self._parse_properties(properties_data, required_fields) diff --git a/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 b/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 index c0868d6a4..34b9209aa 100644 --- a/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 +++ b/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 @@ -77,7 +77,7 @@ impl {{ client_type }}Client { #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] pub fn testnet() -> Self { let http_client = Arc::new(DefaultHttpClient::new( - {% if client_type == "Indexer" %}"https://testnet-idx.4160.nodely.dev"{% else %}"https://testnet-api.4160.nodely.dev"{% endif %} + {% if client_type == "Indexer" %}"https://testnet-idx.4160.nodely.dev"{% elif client_type == "Kmd" %}"http://localhost:7833"{% else %}"https://testnet-api.4160.nodely.dev"{% endif %} )); Self::new(http_client) } @@ -87,7 +87,7 @@ impl {{ client_type }}Client { #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] pub fn mainnet() -> Self { let http_client = Arc::new(DefaultHttpClient::new( - {% if client_type == "Indexer" %}"https://mainnet-idx.4160.nodely.dev"{% else %}"https://mainnet-api.4160.nodely.dev"{% endif %} + {% if client_type == "Indexer" %}"https://mainnet-idx.4160.nodely.dev"{% elif client_type == "Kmd" %}"http://localhost:7833"{% else %}"https://mainnet-api.4160.nodely.dev"{% endif %} )); Self::new(http_client) } @@ -97,8 +97,8 @@ impl {{ client_type }}Client { #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] pub fn localnet() -> Self { let http_client = Arc::new(DefaultHttpClient::with_header( - {% if client_type == "Indexer" %}"http://localhost:8980"{% else %}"http://localhost:4001"{% endif %}, - {% if client_type == "Indexer" %}"X-Indexer-API-Token"{% else %}"X-Algo-API-Token"{% endif %}, + {% if client_type == "Indexer" %}"http://localhost:8980"{% elif client_type == "Kmd" %}"http://localhost:4002"{% else %}"http://localhost:4001"{% endif %}, + {% if client_type == "Indexer" %}"X-Indexer-API-Token"{% elif client_type == "Kmd" %}"X-KMD-API-Token"{% else %}"X-Algo-API-Token"{% endif %}, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ).expect("Failed to create HTTP client with API token header")); Self::new(http_client) diff --git a/api/oas_generator/rust_oas_generator/templates/models/model.rs.j2 b/api/oas_generator/rust_oas_generator/templates/models/model.rs.j2 index e6703fd2d..e06747876 100644 --- a/api/oas_generator/rust_oas_generator/templates/models/model.rs.j2 +++ b/api/oas_generator/rust_oas_generator/templates/models/model.rs.j2 @@ -57,18 +57,20 @@ use algokit_transact::AlgorandMsgpack; {% for custom_type in custom_types %} use crate::models::{{ custom_type }}; {% endfor %} -{# If this is an alias to a Vec, ensure Something is imported #} -{% if schema.schema_type == 'array' and schema.underlying_rust_type %} +{# If this is an alias schema, ensure referenced types are imported #} +{% if schema.underlying_rust_type %} {% if schema.underlying_rust_type.startswith('Vec<') %} {% set alias_inner = schema.underlying_rust_type[4:-1] %} - {% if alias_inner and alias_inner[0].isupper() and '::' not in alias_inner %} + {% if alias_inner and alias_inner[0].isupper() and '::' not in alias_inner and alias_inner not in ['String'] %} use crate::models::{{ alias_inner }}; {% endif %} + {% elif schema.underlying_rust_type[0].isupper() and '::' not in schema.underlying_rust_type and schema.underlying_rust_type not in ['String'] %} +use crate::models::{{ schema.underlying_rust_type }}; {% endif %} {% endif %} {# Handle top-level array schemas as type aliases instead of empty structs #} -{% if schema.schema_type == 'array' and schema.underlying_rust_type %} +{% if schema.underlying_rust_type and schema.schema_type in ['array', 'alias'] %} {% if schema.description %} {{ schema.description | rust_doc_comment }} {% endif %} @@ -181,7 +183,7 @@ impl Default for {{ schema.rust_struct_name }} { } {% endif %} -{% if schema.vendor_extensions.get('x-algokit-signed-txn') %} +{% if schema.vendor_extensions.get('x-algokit-signed-txn') and not schema.underlying_rust_type %} impl From for {{ schema.rust_struct_name }} { fn from(signed_tx: AlgokitSignedTransaction) -> Self { // Convert AlgoKit SignedTransaction to this struct @@ -206,7 +208,7 @@ impl TryFrom<{{ schema.rust_struct_name }}> for AlgokitSignedTransaction { } {% endif %} -{% if schema.implements_algokit_msgpack and not (schema.schema_type == 'array' and schema.underlying_rust_type) and not schema.is_string_enum %} +{% if schema.implements_algokit_msgpack and not schema.underlying_rust_type and not schema.is_string_enum %} impl AlgorandMsgpack for {{ schema.rust_struct_name }} { {% if schema.vendor_extensions.get('x-algokit-signed-txn') %} const PREFIX: &'static [u8] = b""; // No prefix for SignedTransaction @@ -216,7 +218,7 @@ impl AlgorandMsgpack for {{ schema.rust_struct_name }} { } {% endif %} -{% if not (schema.schema_type == 'array' and schema.underlying_rust_type) and not schema.is_string_enum %} +{% if not schema.underlying_rust_type and not schema.is_string_enum %} impl {{ schema.rust_struct_name }} { {% if schema.has_required_fields %} /// Constructor for {{ schema.rust_struct_name }} diff --git a/api/oas_generator/ts_oas_generator/templates/base/src/core/request.ts.j2 b/api/oas_generator/ts_oas_generator/templates/base/src/core/request.ts.j2 index 69db7dd46..af6a1f142 100644 --- a/api/oas_generator/ts_oas_generator/templates/base/src/core/request.ts.j2 +++ b/api/oas_generator/ts_oas_generator/templates/base/src/core/request.ts.j2 @@ -48,6 +48,8 @@ export async function request(config: ClientConfig, options: { if (apiToken) { {% if client_class_name == 'IndexerClient' %} headers['X-Indexer-API-Token'] = apiToken; + {% elif client_class_name == 'KmdClient' %} + headers['X-KMD-API-Token'] = apiToken; {% else %} headers['X-Algo-API-Token'] = apiToken; {% endif %} diff --git a/api/oas_generator/ts_oas_generator/templates/models/model.ts.j2 b/api/oas_generator/ts_oas_generator/templates/models/model.ts.j2 index fc309e640..f6680f2ad 100644 --- a/api/oas_generator/ts_oas_generator/templates/models/model.ts.j2 +++ b/api/oas_generator/ts_oas_generator/templates/models/model.ts.j2 @@ -38,9 +38,24 @@ import type { ModelMetadata } from '../core/model-runtime'; {% if uses_signed_txn %} import type { SignedTransaction } from '@algorandfoundation/algokit-transact'; {% endif %} +{% set ns = namespace(refs_with_meta=[]) %} +{% if descriptor.is_object %} +{% for f in descriptor.fields %} +{% if f.ref_model and f.ref_model not in ns.refs_with_meta %} +{% set ns.refs_with_meta = ns.refs_with_meta + [f.ref_model] %} +{% endif %} +{% endfor %} +{% endif %} +{% if descriptor.is_array and descriptor.array_item_ref %} +{% if descriptor.array_item_ref not in ns.refs_with_meta %} +{% set ns.refs_with_meta = ns.refs_with_meta + [descriptor.array_item_ref] %} +{% endif %} +{% endif %} {% for r in refTypes %} import type { {{ r }} } from './{{ r | ts_kebab_case }}'; +{% if r in ns.refs_with_meta %} import { {{ r }}Meta } from './{{ r | ts_kebab_case }}'; +{% endif %} {% endfor %} {{ schema.description | ts_doc_comment }} diff --git a/api/scripts/convert-openapi.ts b/api/scripts/convert-openapi.ts index 50a76c36d..7f0dec824 100644 --- a/api/scripts/convert-openapi.ts +++ b/api/scripts/convert-openapi.ts @@ -817,10 +817,10 @@ async function getLatestIndexerTag(): Promise { } /** - * Process specifications for both algod and indexer + * Process specifications for algod, indexer, and kmd */ async function processAlgorandSpecs() { - await Promise.all([processAlgodSpec(), processIndexerSpec()]); + await Promise.all([processAlgodSpec(), processIndexerSpec(), processKmdSpec()]); } async function processAlgodSpec() { @@ -906,6 +906,38 @@ async function processAlgodSpec() { await processAlgorandSpec(config); } +async function processKmdSpec() { + console.log("\n🔄 Processing KMD specification..."); + + const stableTag = await getLatestStableTag(); + + const config: ProcessingConfig = { + sourceUrl: `https://raw.githubusercontent.com/algorand/go-algorand/${stableTag}/daemon/kmd/api/swagger.json`, + outputPath: join(process.cwd(), "specs", "kmd.oas3.json"), + fieldTransforms: [ + { + fieldName: "private_key", + removeItems: ["$ref"], + addItems: { + "type": "string", + "x-algokit-bytes-base64": true, + }, + }, + ], + vendorExtensionTransforms: [ + { + sourceProperty: "format", + sourceValue: "uint64", + targetProperty: "x-algokit-bigint", + targetValue: true, + removeSource: false, + }, + ], + }; + + await processAlgorandSpec(config); +} + async function processIndexerSpec() { console.log("\n🔄 Processing Indexer specification..."); @@ -988,13 +1020,15 @@ async function main() { try { const args = process.argv.slice(2); - // Support for individual spec processing or both + // Support for individual spec processing or all if (args.includes("--algod-only")) { await processAlgodSpec(); } else if (args.includes("--indexer-only")) { await processIndexerSpec(); + } else if (args.includes("--kmd-only")) { + await processKmdSpec(); } else { - // Process both by default + // Process all by default await processAlgorandSpecs(); } } catch (error) { diff --git a/api/specs/kmd.oas3.json b/api/specs/kmd.oas3.json new file mode 100644 index 000000000..ebbd9c49d --- /dev/null +++ b/api/specs/kmd.oas3.json @@ -0,0 +1,1907 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "for KMD HTTP API", + "description": "API for KMD (Key Management Daemon)", + "contact": { + "email": "contact@algorand.com" + }, + "version": "0.0.1" + }, + "servers": [ + { + "url": "http://localhost/" + } + ], + "security": [ + { + "api_key": [] + } + ], + "paths": { + "/swagger.json": { + "get": { + "summary": "Gets the current swagger spec.", + "description": "Returns the entire swagger spec in json.", + "operationId": "SwaggerHandler", + "responses": { + "200": { + "description": "The current swagger spec", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "default": { + "description": "Unknown Error", + "content": {} + } + } + } + }, + "/v1/key": { + "post": { + "summary": "Generate a key", + "description": "Generates the next key in the deterministic key sequence (as determined by the master derivation key) and adds it to the wallet, returning the public key.\n", + "operationId": "GenerateKey", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateKeyRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/key`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Generate Key Request" + }, + "delete": { + "summary": "Delete a key", + "description": "Deletes the key with the passed public key from the wallet.", + "operationId": "DeleteKey", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeyRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `DELETE /v1/key`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1DELETEKeyResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Delete Key Request" + } + }, + "/v1/key/export": { + "post": { + "summary": "Export a key", + "description": "Export the secret key associated with the passed public key.", + "operationId": "ExportKey", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExportKeyRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/key/export`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyExportResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Export Key Request" + } + }, + "/v1/key/import": { + "post": { + "summary": "Import a key", + "description": "Import an externally generated key into the wallet. Note that if you wish to back up the imported key, you must do so by backing up the entire wallet database, because imported keys were not derived from the wallet's master derivation key.\n", + "operationId": "ImportKey", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImportKeyRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/key/import`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyImportResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Import Key Request" + } + }, + "/v1/key/list": { + "post": { + "summary": "List keys in wallet", + "description": "Lists all of the public keys in this wallet. All of them have a stored private key.", + "operationId": "ListKeysInWallet", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListKeysRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/key/list`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyListResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "List Keys Request" + } + }, + "/v1/master-key/export": { + "post": { + "summary": "Export the master derivation key from a wallet", + "description": "Export the master derivation key from the wallet. This key is a master \"backup\" key for the underlying wallet. With it, you can regenerate all of the wallets that have been generated with this wallet's `POST /v1/key` endpoint. This key will not allow you to recover keys imported from other wallets, however.\n", + "operationId": "ExportMasterKey", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExportMasterKeyRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/master-key/export`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMasterKeyExportResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Export Master Key Request" + } + }, + "/v1/multisig": { + "delete": { + "summary": "Delete a multisig", + "description": "Deletes multisig preimage information for the passed address from the wallet.\n", + "operationId": "DeleteMultisig", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteMultisigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to POST /v1/multisig/delete", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1DELETEMultisigResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Delete Multisig Request" + } + }, + "/v1/multisig/export": { + "post": { + "summary": "Export multisig address metadata", + "description": "Given a multisig address whose preimage this wallet stores, returns the information used to generate the address, including public keys, threshold, and multisig version.\n", + "operationId": "ExportMultisig", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExportMultisigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/multisig/export`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigExportResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Export Multisig Request" + } + }, + "/v1/multisig/import": { + "post": { + "summary": "Import a multisig account", + "description": "Generates a multisig account from the passed public keys array and multisig metadata, and stores all of this in the wallet.\n", + "operationId": "ImportMultisig", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImportMultisigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/multisig/import`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigImportResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Import Multisig Request" + } + }, + "/v1/multisig/list": { + "post": { + "summary": "List multisig accounts", + "description": "Lists all of the multisig accounts whose preimages this wallet stores", + "operationId": "ListMultisg", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListMultisigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/multisig/list`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigListResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "List Multisig Request" + } + }, + "/v1/multisig/sign": { + "post": { + "summary": "Sign a multisig transaction", + "description": "Start a multisig signature, or add a signature to a partially completed multisig signature object.\n", + "operationId": "SignMultisigTransaction", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignMultisigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/multisig/sign`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigTransactionSignResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Sign Multisig Transaction Request" + } + }, + "/v1/multisig/signprogram": { + "post": { + "summary": "Sign a program for a multisig account", + "description": "Start a multisig signature, or add a signature to a partially completed multisig signature object.\n", + "operationId": "SignMultisigProgram", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignProgramMultisigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/multisig/signdata`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigProgramSignResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Sign Multisig Program Request" + } + }, + "/v1/program/sign": { + "post": { + "summary": "Sign program", + "description": "Signs the passed program with a key from the wallet, determined by the account named in the request.\n", + "operationId": "SignProgram", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignProgramRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/data/sign`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTProgramSignResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Sign Program Request" + } + }, + "/v1/transaction/sign": { + "post": { + "summary": "Sign a transaction", + "description": "Signs the passed transaction with a key from the wallet, determined by the sender encoded in the transaction.\n", + "operationId": "SignTransaction", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignTransactionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/transaction/sign`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTTransactionSignResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Sign Transaction Request" + } + }, + "/v1/wallet": { + "post": { + "summary": "Create a wallet", + "description": "Create a new wallet (collection of keys) with the given parameters.", + "operationId": "CreateWallet", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateWalletRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/wallet`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Create Wallet Request" + } + }, + "/v1/wallet/info": { + "post": { + "summary": "Get wallet info", + "description": "Returns information about the wallet associated with the passed wallet handle token. Additionally returns expiration information about the token itself.\n", + "operationId": "GetWalletInfo", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WalletInfoRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/wallet/info`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletInfoResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Get Wallet Info Request" + } + }, + "/v1/wallet/init": { + "post": { + "summary": "Initialize a wallet handle token", + "description": "Unlock the wallet and return a wallet handle token that can be used for subsequent operations. These tokens expire periodically and must be renewed. You can `POST` the token to `/v1/wallet/info` to see how much time remains until expiration, and renew it with `/v1/wallet/renew`. When you're done, you can invalidate the token with `/v1/wallet/release`.\n", + "operationId": "InitWalletHandleToken", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitWalletHandleTokenRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/wallet/init`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletInitResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Initialize Wallet Handle Token Request" + } + }, + "/v1/wallet/release": { + "post": { + "summary": "Release a wallet handle token", + "description": "Invalidate the passed wallet handle token, making it invalid for use in subsequent requests.", + "operationId": "ReleaseWalletHandleToken", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReleaseWalletHandleTokenRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/wallet/release`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletReleaseResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Release Wallet Handle Token Request" + } + }, + "/v1/wallet/rename": { + "post": { + "summary": "Rename a wallet", + "description": "Rename the underlying wallet to something else", + "operationId": "RenameWallet", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RenameWalletRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response to `POST /v1/wallet/rename`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletRenameResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Rename Wallet Request" + } + }, + "/v1/wallet/renew": { + "post": { + "summary": "Renew a wallet handle token", + "description": "Renew a wallet handle token, increasing its expiration duration to its initial value", + "operationId": "RenewWalletHandleToken", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RenewWalletHandleTokenRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Response `POST /v1/wallet/renew`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletRenewResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Renew Wallet Handle Token Request" + } + }, + "/v1/wallets": { + "get": { + "summary": "List wallets", + "description": "Lists all of the wallets that kmd is aware of.", + "operationId": "ListWallets", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListWalletsRequest" + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "Response to `GET /v1/wallets`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1GETWalletsResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "List Wallet Request" + } + }, + "/versions": { + "get": { + "summary": "Retrieves the current version", + "operationId": "GetVersion", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionsRequest" + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "Response to `GET /versions`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionsResponse" + } + } + } + } + }, + "x-codegen-request-body-name": "Versions Request" + } + } + }, + "components": { + "schemas": { + "APIV1DELETEKeyResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1DELETEKeyResponse is the response to `DELETE /v1/key`\nfriendly:DeleteKeyResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1DELETEMultisigResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete`\nfriendly:DeleteMultisigResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1GETWalletsResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "wallets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/APIV1Wallet" + }, + "x-go-name": "Wallets" + } + }, + "description": "APIV1GETWalletsResponse is the response to `GET /v1/wallets`\nfriendly:ListWalletsResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTKeyExportResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "private_key": { + "type": "string", + "x-algokit-bytes-base64": true + } + }, + "description": "APIV1POSTKeyExportResponse is the response to `POST /v1/key/export`\nfriendly:ExportKeyResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTKeyImportResponse": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTKeyImportResponse is the response to `POST /v1/key/import`\nfriendly:ImportKeyResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTKeyListResponse": { + "type": "object", + "properties": { + "addresses": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Addresses" + }, + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTKeyListResponse is the response to `POST /v1/key/list`\nfriendly:ListKeysResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTKeyResponse": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTKeyResponse is the response to `POST /v1/key`\nfriendly:GenerateKeyResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTMasterKeyExportResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "master_derivation_key": { + "$ref": "#/components/schemas/MasterDerivationKey" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export`\nfriendly:ExportMasterKeyResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTMultisigExportResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "multisig_version": { + "type": "integer", + "format": "uint8", + "x-go-name": "Version" + }, + "pks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicKey" + }, + "x-go-name": "PKs" + }, + "threshold": { + "type": "integer", + "format": "uint8", + "x-go-name": "Threshold" + } + }, + "description": "APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export`\nfriendly:ExportMultisigResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTMultisigImportResponse": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import`\nfriendly:ImportMultisigResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTMultisigListResponse": { + "type": "object", + "properties": { + "addresses": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Addresses" + }, + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list`\nfriendly:ListMultisigResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTMultisigProgramSignResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "multisig": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "Multisig" + } + }, + "description": "APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata`\nfriendly:SignProgramMultisigResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTMultisigTransactionSignResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "multisig": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "Multisig" + } + }, + "description": "APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign`\nfriendly:SignMultisigResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTProgramSignResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "sig": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "Signature" + } + }, + "description": "APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign`\nfriendly:SignProgramResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTTransactionSignResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "signed_transaction": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "SignedTransaction" + } + }, + "description": "APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign`\nfriendly:SignTransactionResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTWalletInfoResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "wallet_handle": { + "$ref": "#/components/schemas/APIV1WalletHandle" + } + }, + "description": "APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info`\nfriendly:WalletInfoResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTWalletInitResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init`\nfriendly:InitWalletHandleTokenResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTWalletReleaseResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "description": "APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release`\nfriendly:ReleaseWalletHandleTokenResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTWalletRenameResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "wallet": { + "$ref": "#/components/schemas/APIV1Wallet" + } + }, + "description": "APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename`\nfriendly:RenameWalletResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTWalletRenewResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "wallet_handle": { + "$ref": "#/components/schemas/APIV1WalletHandle" + } + }, + "description": "APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew`\nfriendly:RenewWalletHandleTokenResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1POSTWalletResponse": { + "type": "object", + "properties": { + "error": { + "type": "boolean", + "x-go-name": "Error" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "wallet": { + "$ref": "#/components/schemas/APIV1Wallet" + } + }, + "description": "APIV1POSTWalletResponse is the response to `POST /v1/wallet`\nfriendly:CreateWalletResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1Wallet": { + "type": "object", + "properties": { + "driver_name": { + "type": "string", + "x-go-name": "DriverName" + }, + "driver_version": { + "type": "integer", + "format": "uint32", + "x-go-name": "DriverVersion" + }, + "id": { + "type": "string", + "x-go-name": "ID" + }, + "mnemonic_ux": { + "type": "boolean", + "x-go-name": "SupportsMnemonicUX" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "supported_txs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TxType" + }, + "x-go-name": "SupportedTransactions" + } + }, + "description": "APIV1Wallet is the API's representation of a wallet", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "APIV1WalletHandle": { + "type": "object", + "properties": { + "expires_seconds": { + "type": "integer", + "format": "int64", + "x-go-name": "ExpiresSeconds" + }, + "wallet": { + "$ref": "#/components/schemas/APIV1Wallet" + } + }, + "description": "APIV1WalletHandle includes the wallet the handle corresponds to\nand the number of number of seconds to expiration", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "CreateWalletRequest": { + "type": "object", + "properties": { + "master_derivation_key": { + "$ref": "#/components/schemas/MasterDerivationKey" + }, + "wallet_driver_name": { + "type": "string", + "x-go-name": "WalletDriverName" + }, + "wallet_name": { + "type": "string", + "x-go-name": "WalletName" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTWalletRequest is the request for `POST /v1/wallet`", + "x-go-name": "APIV1POSTWalletRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "DeleteKeyRequest": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1DELETEKeyRequest is the request for `DELETE /v1/key`", + "x-go-name": "APIV1DELETEKeyRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "DeleteMultisigRequest": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1DELETEMultisigRequest is the request for `DELETE /v1/multisig`", + "x-go-name": "APIV1DELETEMultisigRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "Digest": { + "title": "Digest represents a 32-byte value holding the 256-bit Hash digest.", + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + }, + "x-go-package": "github.com/algorand/go-algorand/crypto" + }, + "ExportKeyRequest": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTKeyExportRequest is the request for `POST /v1/key/export`", + "x-go-name": "APIV1POSTKeyExportRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ExportMasterKeyRequest": { + "type": "object", + "properties": { + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTMasterKeyExportRequest is the request for `POST /v1/master-key/export`", + "x-go-name": "APIV1POSTMasterKeyExportRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ExportMultisigRequest": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTMultisigExportRequest is the request for `POST /v1/multisig/export`", + "x-go-name": "APIV1POSTMultisigExportRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "GenerateKeyRequest": { + "type": "object", + "properties": { + "display_mnemonic": { + "type": "boolean", + "x-go-name": "DisplayMnemonic" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTKeyRequest is the request for `POST /v1/key`", + "x-go-name": "APIV1POSTKeyRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ImportKeyRequest": { + "type": "object", + "properties": { + "private_key": { + "type": "string", + "x-algokit-bytes-base64": true + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTKeyImportRequest is the request for `POST /v1/key/import`", + "x-go-name": "APIV1POSTKeyImportRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ImportMultisigRequest": { + "type": "object", + "properties": { + "multisig_version": { + "type": "integer", + "format": "uint8", + "x-go-name": "Version" + }, + "pks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicKey" + }, + "x-go-name": "PKs" + }, + "threshold": { + "type": "integer", + "format": "uint8", + "x-go-name": "Threshold" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTMultisigImportRequest is the request for `POST /v1/multisig/import`", + "x-go-name": "APIV1POSTMultisigImportRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "InitWalletHandleTokenRequest": { + "type": "object", + "properties": { + "wallet_id": { + "type": "string", + "x-go-name": "WalletID" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTWalletInitRequest is the request for `POST /v1/wallet/init`", + "x-go-name": "APIV1POSTWalletInitRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ListKeysRequest": { + "type": "object", + "properties": { + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTKeyListRequest is the request for `POST /v1/key/list`", + "x-go-name": "APIV1POSTKeyListRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ListMultisigRequest": { + "type": "object", + "properties": { + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTMultisigListRequest is the request for `POST /v1/multisig/list`", + "x-go-name": "APIV1POSTMultisigListRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ListWalletsRequest": { + "type": "object", + "description": "APIV1GETWalletsRequest is the request for `GET /v1/wallets`", + "x-go-name": "APIV1GETWalletsRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "MasterDerivationKey": { + "type": "array", + "description": "MasterDerivationKey is used to derive ed25519 keys for use in wallets", + "items": { + "type": "integer", + "format": "uint8" + }, + "x-go-package": "github.com/algorand/go-algorand/crypto" + }, + "MultisigSig": { + "type": "object", + "properties": { + "Subsigs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MultisigSubsig" + } + }, + "Threshold": { + "type": "integer", + "format": "uint8" + }, + "Version": { + "type": "integer", + "format": "uint8" + } + }, + "description": "MultisigSig is the structure that holds multiple Subsigs", + "x-go-package": "github.com/algorand/go-algorand/crypto" + }, + "MultisigSubsig": { + "type": "object", + "properties": { + "Key": { + "$ref": "#/components/schemas/PublicKey" + }, + "Sig": { + "$ref": "#/components/schemas/Signature" + } + }, + "description": "MultisigSubsig is a struct that holds a pair of public key and signatures\nsignatures may be empty", + "x-go-package": "github.com/algorand/go-algorand/crypto" + }, + "PrivateKey": { + "$ref": "#/components/schemas/ed25519PrivateKey" + }, + "PublicKey": { + "$ref": "#/components/schemas/ed25519PublicKey" + }, + "ReleaseWalletHandleTokenRequest": { + "type": "object", + "properties": { + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTWalletReleaseRequest is the request for `POST /v1/wallet/release`", + "x-go-name": "APIV1POSTWalletReleaseRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "RenameWalletRequest": { + "type": "object", + "properties": { + "wallet_id": { + "type": "string", + "x-go-name": "WalletID" + }, + "wallet_name": { + "type": "string", + "x-go-name": "NewWalletName" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTWalletRenameRequest is the request for `POST /v1/wallet/rename`", + "x-go-name": "APIV1POSTWalletRenameRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "RenewWalletHandleTokenRequest": { + "type": "object", + "properties": { + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTWalletRenewRequest is the request for `POST /v1/wallet/renew`", + "x-go-name": "APIV1POSTWalletRenewRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "SignMultisigRequest": { + "type": "object", + "properties": { + "partial_multisig": { + "$ref": "#/components/schemas/MultisigSig" + }, + "public_key": { + "$ref": "#/components/schemas/PublicKey" + }, + "signer": { + "$ref": "#/components/schemas/Digest" + }, + "transaction": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "Transaction" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTMultisigTransactionSignRequest is the request for `POST /v1/multisig/sign`", + "x-go-name": "APIV1POSTMultisigTransactionSignRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "SignProgramMultisigRequest": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "data": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "Program" + }, + "partial_multisig": { + "$ref": "#/components/schemas/MultisigSig" + }, + "public_key": { + "$ref": "#/components/schemas/PublicKey" + }, + "use_legacy_msig": { + "type": "boolean", + "x-go-name": "UseLegacyMsig" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTMultisigProgramSignRequest is the request for `POST /v1/multisig/signprogram`", + "x-go-name": "APIV1POSTMultisigProgramSignRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "SignProgramRequest": { + "type": "object", + "properties": { + "address": { + "type": "string", + "x-go-name": "Address" + }, + "data": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "format": "byte", + "x-go-name": "Program" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTProgramSignRequest is the request for `POST /v1/program/sign`", + "x-go-name": "APIV1POSTProgramSignRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "SignTransactionRequest": { + "type": "object", + "properties": { + "public_key": { + "$ref": "#/components/schemas/PublicKey" + }, + "transaction": { + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$", + "type": "string", + "description": "Base64 encoding of msgpack encoding of a `Transaction` object\nNote: SDK and goal usually generate `SignedTxn` objects\nin that case, the field `txn` / `Transaction` of the\ngenerated `SignedTxn` object needs to be used", + "format": "byte", + "x-go-name": "Transaction" + }, + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + }, + "wallet_password": { + "type": "string", + "x-go-name": "WalletPassword" + } + }, + "description": "APIV1POSTTransactionSignRequest is the request for `POST /v1/transaction/sign`", + "x-go-name": "APIV1POSTTransactionSignRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "Signature": { + "$ref": "#/components/schemas/ed25519Signature" + }, + "TxType": { + "type": "string", + "description": "TxType is the type of the transaction written to the ledger", + "x-go-package": "github.com/algorand/go-algorand/protocol" + }, + "VersionsRequest": { + "type": "object", + "description": "VersionsRequest is the request for `GET /versions`", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "VersionsResponse": { + "type": "object", + "properties": { + "versions": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Versions" + } + }, + "description": "VersionsResponse is the response to `GET /versions`\nfriendly:VersionsResponse", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "WalletInfoRequest": { + "type": "object", + "properties": { + "wallet_handle_token": { + "type": "string", + "x-go-name": "WalletHandleToken" + } + }, + "description": "APIV1POSTWalletInfoRequest is the request for `POST /v1/wallet/info`", + "x-go-name": "APIV1POSTWalletInfoRequest", + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + }, + "ed25519PrivateKey": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + }, + "x-go-package": "github.com/algorand/go-algorand/crypto" + }, + "ed25519PublicKey": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + }, + "x-go-package": "github.com/algorand/go-algorand/crypto" + }, + "ed25519Signature": { + "title": "Classical signatures */", + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + }, + "x-go-package": "github.com/algorand/go-algorand/crypto" + } + }, + "responses": { + "CreateWalletResponse": { + "description": "Response to `POST /v1/wallet`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletResponse" + } + } + } + }, + "DeleteKeyResponse": { + "description": "Response to `DELETE /v1/key`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1DELETEKeyResponse" + } + } + } + }, + "DeleteMultisigResponse": { + "description": "Response to POST /v1/multisig/delete", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1DELETEMultisigResponse" + } + } + } + }, + "ExportKeyResponse": { + "description": "Response to `POST /v1/key/export`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyExportResponse" + } + } + } + }, + "ExportMasterKeyResponse": { + "description": "Response to `POST /v1/master-key/export`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMasterKeyExportResponse" + } + } + } + }, + "ExportMultisigResponse": { + "description": "Response to `POST /v1/multisig/export`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigExportResponse" + } + } + } + }, + "GenerateKeyResponse": { + "description": "Response to `POST /v1/key`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyResponse" + } + } + } + }, + "ImportKeyResponse": { + "description": "Response to `POST /v1/key/import`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyImportResponse" + } + } + } + }, + "ImportMultisigResponse": { + "description": "Response to `POST /v1/multisig/import`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigImportResponse" + } + } + } + }, + "InitWalletHandleTokenResponse": { + "description": "Response to `POST /v1/wallet/init`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletInitResponse" + } + } + } + }, + "ListKeysResponse": { + "description": "Response to `POST /v1/key/list`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTKeyListResponse" + } + } + } + }, + "ListMultisigResponse": { + "description": "Response to `POST /v1/multisig/list`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigListResponse" + } + } + } + }, + "ListWalletsResponse": { + "description": "Response to `GET /v1/wallets`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1GETWalletsResponse" + } + } + } + }, + "ReleaseWalletHandleTokenResponse": { + "description": "Response to `POST /v1/wallet/release`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletReleaseResponse" + } + } + } + }, + "RenameWalletResponse": { + "description": "Response to `POST /v1/wallet/rename`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletRenameResponse" + } + } + } + }, + "RenewWalletHandleTokenResponse": { + "description": "Response `POST /v1/wallet/renew`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletRenewResponse" + } + } + } + }, + "SignMultisigResponse": { + "description": "Response to `POST /v1/multisig/sign`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigTransactionSignResponse" + } + } + } + }, + "SignProgramMultisigResponse": { + "description": "Response to `POST /v1/multisig/signdata`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTMultisigProgramSignResponse" + } + } + } + }, + "SignProgramResponse": { + "description": "Response to `POST /v1/data/sign`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTProgramSignResponse" + } + } + } + }, + "SignTransactionResponse": { + "description": "Response to `POST /v1/transaction/sign`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTTransactionSignResponse" + } + } + } + }, + "VersionsResponse": { + "description": "Response to `GET /versions`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionsResponse" + } + } + } + }, + "WalletInfoResponse": { + "description": "Response to `POST /v1/wallet/info`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIV1POSTWalletInfoResponse" + } + } + } + } + }, + "securitySchemes": { + "api_key": { + "type": "apiKey", + "description": "Generated header parameter. This value can be found in `/kmd/data/dir/kmd.token`. Example value: '330b2e4fc9b20f4f89812cf87f1dabeb716d23e3f11aec97a61ff5f750563b78'", + "name": "X-KMD-API-Token", + "in": "header" + } + } + }, + "x-original-swagger-version": "2.0" +} \ No newline at end of file diff --git a/crates/algokit_utils/Cargo.toml b/crates/algokit_utils/Cargo.toml index d6e4d2b61..c114137d5 100644 --- a/crates/algokit_utils/Cargo.toml +++ b/crates/algokit_utils/Cargo.toml @@ -19,6 +19,7 @@ algokit_http_client = { version = "0.1.0", path = "../algokit_http_client", defa algokit_transact = { version = "0.1.0", path = "../algokit_transact", features = [ "test_utils", ] } +kmd_client = { path = "../kmd_client" } async-trait = { version = "0.1.88" } base64 = "0.22.1" derive_more = { version = "2.0.1", features = ["full"] } diff --git a/crates/algokit_utils/src/clients/client_manager.rs b/crates/algokit_utils/src/clients/client_manager.rs index f3b25ccbc..39a80c858 100644 --- a/crates/algokit_utils/src/clients/client_manager.rs +++ b/crates/algokit_utils/src/clients/client_manager.rs @@ -12,6 +12,7 @@ use algokit_abi::Arc56Contract; use algokit_http_client::DefaultHttpClient; use base64::{Engine, engine::general_purpose}; use indexer_client::IndexerClient; +use kmd_client::KmdClient; use snafu::Snafu; use std::{collections::HashMap, env, sync::Arc}; use tokio::sync::RwLock; @@ -27,6 +28,9 @@ pub enum ClientManagerError { #[snafu(display("Indexer Error: {message}"))] IndexerError { message: String }, + #[snafu(display("KMD Error: {message}"))] + KmdError { message: String }, + #[snafu(display("Algod client error: {source}"))] AlgodClientError { source: AlgodError }, } @@ -40,6 +44,7 @@ impl From for ClientManagerError { pub struct ClientManager { algod: Arc, indexer: Option>, + kmd: Option>, cached_network_details: RwLock>>, } @@ -51,6 +56,10 @@ impl ClientManager { Some(indexer_config) => Some(Arc::new(Self::get_indexer_client(indexer_config)?)), None => None, }, + kmd: match config.kmd_config.as_ref() { + Some(kmd_config) => Some(Arc::new(Self::get_kmd_client(kmd_config)?)), + None => None, + }, cached_network_details: RwLock::new(None), }) } @@ -68,6 +77,23 @@ impl ClientManager { }) } + pub fn indexer_if_present(&self) -> Option> { + self.indexer.as_ref().map(Arc::clone) + } + + pub fn kmd(&self) -> Result, ClientManagerError> { + self.kmd + .as_ref() + .map(Arc::clone) + .ok_or(ClientManagerError::KmdError { + message: "KMD client not configured".to_string(), + }) + } + + pub fn kmd_if_present(&self) -> Option> { + self.kmd.as_ref().map(Arc::clone) + } + pub async fn network(&self) -> Result, ClientManagerError> { // Fast path: multiple readers can access concurrently { @@ -177,6 +203,31 @@ impl ClientManager { }) } + pub fn get_kmd_config_from_environment() -> Result { + let server = env::var("KMD_SERVER") + .or_else(|_| env::var("ALGOD_SERVER")) + .map_err(|_| ClientManagerError::EnvironmentError { + message: String::from("KMD_SERVER environment variable not found"), + })?; + + let port = env::var("KMD_PORT") + .ok() + .and_then(|p| p.parse().ok()) + .or_else(|| env::var("ALGOD_PORT").ok().and_then(|p| p.parse().ok())) + .or(Some(4002)); + + let token = env::var("KMD_TOKEN") + .ok() + .map(TokenHeader::String) + .or_else(|| env::var("ALGOD_TOKEN").ok().map(TokenHeader::String)); + + Ok(AlgoClientConfig { + server, + port, + token, + }) + } + pub fn get_algonode_config(network: &str, service: AlgorandService) -> AlgoClientConfig { let subdomain = match service { AlgorandService::Algod => "api", @@ -295,6 +346,43 @@ impl ClientManager { Self::get_indexer_client(&config) } + pub fn get_kmd_client(config: &AlgoClientConfig) -> Result { + let base_url = if let Some(port) = config.port { + format!("{}:{}", config.server, port) + } else { + config.server.clone() + }; + + let token_value = match &config.token { + Some(TokenHeader::String(token)) => token.clone(), + Some(TokenHeader::Headers(headers)) => { + headers.values().next().cloned().unwrap_or_default() + } + None => String::new(), + }; + + let http_client = if token_value.is_empty() { + Arc::new(DefaultHttpClient::new(&base_url)) + } else { + Arc::new( + DefaultHttpClient::with_header(&base_url, "X-KMD-API-Token", &token_value) + .map_err(|e| ClientManagerError::HttpClientError { + message: format!( + "Failed to create HTTP client with KMD token header: {:?}", + e + ), + })?, + ) + }; + + Ok(KmdClient::new(http_client)) + } + + pub fn get_kmd_client_from_environment() -> Result { + let config = Self::get_kmd_config_from_environment()?; + Self::get_kmd_client(&config) + } + #[allow(clippy::too_many_arguments)] pub fn get_app_factory( &self, @@ -492,4 +580,45 @@ mod tests { assert!(!ClientManager::genesis_id_is_localnet("testnet-v1.0")); assert!(!ClientManager::genesis_id_is_localnet("mainnet-v1.0")); } + + #[test] + fn test_kmd_optional_accessors_when_configured() { + let config = AlgoConfig { + algod_config: AlgoClientConfig { + server: "http://localhost".to_string(), + port: Some(4001), + token: None, + }, + indexer_config: None, + kmd_config: Some(AlgoClientConfig { + server: "http://localhost".to_string(), + port: Some(4002), + token: Some(TokenHeader::String("kmd-token".to_string())), + }), + }; + + let manager = ClientManager::new(&config).unwrap(); + assert!(manager.kmd_if_present().is_some()); + assert!(manager.kmd().is_ok()); + } + + #[test] + fn test_kmd_optional_accessors_when_missing() { + let config = AlgoConfig { + algod_config: AlgoClientConfig { + server: "http://localhost".to_string(), + port: Some(4001), + token: None, + }, + indexer_config: None, + kmd_config: None, + }; + + let manager = ClientManager::new(&config).unwrap(); + assert!(matches!( + manager.kmd(), + Err(ClientManagerError::KmdError { .. }) + )); + assert!(manager.kmd_if_present().is_none()); + } } diff --git a/crates/algokit_utils/tests/common/fixture.rs b/crates/algokit_utils/tests/common/fixture.rs index 028c79004..3ed8d7aa5 100644 --- a/crates/algokit_utils/tests/common/fixture.rs +++ b/crates/algokit_utils/tests/common/fixture.rs @@ -11,11 +11,13 @@ use algokit_utils::clients::algorand_client::AlgorandClientParams; use algokit_utils::transactions::TransactionComposerConfig; use algokit_utils::{AlgoConfig, AlgorandClient, ClientManager}; use indexer_client::IndexerClient; +use kmd_client::KmdClient; use rstest::*; pub struct AlgorandFixture { pub algod: Arc, pub indexer: Arc, + pub kmd: Arc, pub algorand_client: AlgorandClient, pub test_account: TestAccount, } @@ -41,11 +43,22 @@ impl AlgorandFixture { ) .unwrap(), ); + let kmd = Arc::new( + ClientManager::get_kmd_client( + ¶ms + .client_config + .kmd_config + .as_ref() + .expect("KMD config required for localnet tests"), + ) + .unwrap(), + ); let mut algorand_client = AlgorandClient::new(params); let test_account = Self::generate_account_internal( algod.clone(), + kmd.clone(), &mut algorand_client, Some(TestAccountConfig { initial_funds: 10_000_000, @@ -59,6 +72,7 @@ impl AlgorandFixture { Ok(Self { algod, indexer, + kmd, algorand_client, test_account, }) @@ -66,11 +80,12 @@ impl AlgorandFixture { async fn generate_account_internal( algod: Arc, + kmd: Arc, algorand_client: &mut AlgorandClient, config: Option, ) -> Result> { let config = config.unwrap_or_default(); - let mut dispenser = LocalNetDispenser::new(algod.clone()); + let mut dispenser = LocalNetDispenser::new(algod.clone(), kmd.clone()); // Generate new account using ed25519_dalek let test_account = TestAccount::generate()?; @@ -107,7 +122,13 @@ impl AlgorandFixture { &mut self, config: Option, ) -> Result> { - Self::generate_account_internal(self.algod.clone(), &mut self.algorand_client, config).await + Self::generate_account_internal( + self.algod.clone(), + self.kmd.clone(), + &mut self.algorand_client, + config, + ) + .await } } diff --git a/crates/algokit_utils/tests/common/local_net_dispenser.rs b/crates/algokit_utils/tests/common/local_net_dispenser.rs index 8a03e58a3..f71aeb7a9 100644 --- a/crates/algokit_utils/tests/common/local_net_dispenser.rs +++ b/crates/algokit_utils/tests/common/local_net_dispenser.rs @@ -1,111 +1,180 @@ -use std::{process::Command, sync::Arc}; +use std::{env, sync::Arc}; use algod_client::AlgodClient; use algokit_transact::{ AlgorandMsgpack, PaymentTransactionBuilder, Transaction, TransactionHeaderBuilder, }; use algokit_utils::TransactionSigner; -use regex::Regex; +use kmd_client::KmdClient; +use kmd_client::models::{ + ExportKeyRequest, GenerateKeyRequest, InitWalletHandleTokenRequest, ListKeysRequest, + ListWalletsRequest, ReleaseWalletHandleTokenRequest, +}; use crate::common::TestAccount; -/// LocalNet dispenser for funding test accounts using AlgoKit CLI +/// LocalNet dispenser for funding test accounts using KMD pub struct LocalNetDispenser { client: Arc, + kmd_client: Arc, + kmd_wallet_name: String, dispenser_account: Option, } -// TODO: we only use Algokit CLI to fund test account because we don't support KMD yet -// once KMD is implemented, we should remove this impl LocalNetDispenser { /// Create a new LocalNet dispenser - pub fn new(client: Arc) -> Self { + pub fn new(client: Arc, kmd_client: Arc) -> Self { + let kmd_wallet_name = env::var("KMD_WALLET_NAME") + .unwrap_or_else(|_| "unencrypted-default-wallet".to_string()); + Self { client, + kmd_client, + kmd_wallet_name, dispenser_account: None, } } - /// Get the LocalNet dispenser account from AlgoKit CLI + /// Get the LocalNet dispenser account using KMD pub async fn get_dispenser_account( &mut self, ) -> Result<&TestAccount, Box> { if self.dispenser_account.is_none() { - self.dispenser_account = Some(self.fetch_dispenser_from_algokit().await?); + self.dispenser_account = Some(self.fetch_dispenser_from_kmd().await?); } Ok(self.dispenser_account.as_ref().unwrap()) } - /// Fetch the dispenser account using AlgoKit CLI - async fn fetch_dispenser_from_algokit( + /// Fetch the dispenser account using KMD + async fn fetch_dispenser_from_kmd( &self, ) -> Result> { - // Get list of accounts to find the one with highest balance - let output = Command::new("algokit") - .args(["goal", "account", "list"]) - .output() - .map_err(|e| format!("Failed to run algokit goal account list: {}", e))?; - - if !output.status.success() { - return Err(format!( - "algokit goal account list failed: {}", - String::from_utf8_lossy(&output.stderr) - ) - .into()); - } + let wallets_response = self + .kmd_client + .list_wallets(Some(ListWalletsRequest::new())) + .await + .map_err(|e| format!("Failed to list KMD wallets: {:?}", e))?; + + let wallets = wallets_response.wallets.unwrap_or_default(); + + let selected_wallet = wallets + .iter() + .find(|wallet| wallet.name.as_deref() == Some(self.kmd_wallet_name.as_str())) + .or_else(|| wallets.first()) + .ok_or("No wallets available via KMD")?; + + let wallet_id = selected_wallet + .id + .clone() + .ok_or("KMD wallet is missing an id")?; + + let init_response = self + .kmd_client + .init_wallet_handle_token(InitWalletHandleTokenRequest { + wallet_id: Some(wallet_id.clone()), + wallet_password: None, + }) + .await + .map_err(|e| format!("Failed to initialize KMD wallet handle: {:?}", e))?; + + let wallet_handle_token = init_response + .wallet_handle_token + .ok_or("KMD did not return a wallet handle token")?; + + let release_request = ReleaseWalletHandleTokenRequest { + wallet_handle_token: Some(wallet_handle_token.clone()), + }; + + let result = async { + let mut addresses = self + .kmd_client + .list_keys_in_wallet(ListKeysRequest { + wallet_handle_token: Some(wallet_handle_token.clone()), + }) + .await + .map_err(|e| format!("Failed to list keys in KMD wallet: {:?}", e))? + .addresses + .unwrap_or_default(); + + if addresses.is_empty() { + let generated = self + .kmd_client + .generate_key(GenerateKeyRequest { + display_mnemonic: Some(false), + wallet_handle_token: Some(wallet_handle_token.clone()), + }) + .await + .map_err(|e| format!("Failed to generate key in KMD wallet: {:?}", e))?; + + if let Some(address) = generated.address { + addresses.push(address); + } + } - let accounts_output = String::from_utf8_lossy(&output.stdout); + if addresses.is_empty() { + return Err("KMD wallet does not contain any keys".into()); + } - // Parse output to find account with highest balance - let re = Regex::new(r"([A-Z0-9]{58})\s+(\d+)\s+microAlgos")?; - let mut highest_balance = 0u64; - let mut dispenser_address = String::new(); + let mut best_address = None; + let mut highest_balance = 0u64; + + for address in &addresses { + match self.client.account_information(address, None, None).await { + Ok(info) => { + if info.amount > highest_balance { + highest_balance = info.amount; + best_address = Some(address.clone()); + } + } + Err(err) => { + println!( + "Warning: failed to fetch balance for {}: {:?}", + address, err + ); + } + } + } - for cap in re.captures_iter(&accounts_output) { - let address = cap[1].to_string(); - let balance: u64 = cap[2].parse().unwrap_or(0); + let dispenser_address = best_address.unwrap_or_else(|| addresses[0].clone()); - if balance > highest_balance { - highest_balance = balance; - dispenser_address = address; - } - } + let export_response = self + .kmd_client + .export_key(ExportKeyRequest { + address: Some(dispenser_address.clone()), + wallet_handle_token: Some(wallet_handle_token.clone()), + wallet_password: None, + }) + .await + .map_err(|e| format!("Failed to export dispenser key via KMD: {:?}", e))?; - if dispenser_address.is_empty() { - return Err("No funded accounts found in LocalNet".into()); - } + let private_key = export_response + .private_key + .ok_or("KMD export did not return a private key")?; - println!( - "Found LocalNet dispenser account: {} with {} microALGOs", - dispenser_address, highest_balance - ); + let dispenser = TestAccount::from_secret_key(&private_key)?; - // Export the account to get its mnemonic - let output = Command::new("algokit") - .args(["goal", "account", "export", "-a", &dispenser_address]) - .output() - .map_err(|e| format!("Failed to export account {}: {}", dispenser_address, e))?; - - if !output.status.success() { - return Err(format!( - "Failed to export account {}: {}", - dispenser_address, - String::from_utf8_lossy(&output.stderr) - ) - .into()); - } + println!( + "Found LocalNet dispenser account: {} with {} microALGOs", + dispenser_address, highest_balance + ); - let export_output = String::from_utf8_lossy(&output.stdout); + Ok(dispenser) + } + .await; - // Parse mnemonic from output - let mnemonic = export_output - .split('"') - .nth(1) - .ok_or("Could not extract mnemonic from algokit output")?; + if let Err(err) = self + .kmd_client + .release_wallet_handle_token(release_request) + .await + { + println!( + "Warning: failed to release KMD wallet handle token: {:?}", + err + ); + } - // Create account from mnemonic using proper Algorand mnemonic parsing - TestAccount::from_mnemonic(mnemonic) + result } /// Fund an account with ALGOs using the dispenser diff --git a/crates/algokit_utils/tests/common/test_account.rs b/crates/algokit_utils/tests/common/test_account.rs index 8eba8a4d8..94b13d453 100644 --- a/crates/algokit_utils/tests/common/test_account.rs +++ b/crates/algokit_utils/tests/common/test_account.rs @@ -112,6 +112,34 @@ impl TestAccount { Ok(Self { secret_key }) } + /// Create an account directly from a 64-byte secret key (private + public key material) + pub fn from_secret_key( + secret_key: &[u8], + ) -> Result> { + let key_slice = match secret_key.len() { + ALGORAND_SECRET_KEY_BYTE_LENGTH => secret_key, + len if len == ALGORAND_SECRET_KEY_BYTE_LENGTH * 2 => { + &secret_key[..ALGORAND_SECRET_KEY_BYTE_LENGTH] + } + other => { + return Err(format!( + "Secret key must be {} or {} bytes, got {}", + ALGORAND_SECRET_KEY_BYTE_LENGTH, + ALGORAND_SECRET_KEY_BYTE_LENGTH * 2, + other + ) + .into()); + } + }; + + let mut key_bytes = [0u8; ALGORAND_SECRET_KEY_BYTE_LENGTH]; + key_bytes.copy_from_slice(key_slice); + + Ok(Self { + secret_key: key_bytes, + }) + } + /// Get the account's address using algokit_transact pub fn account(&self) -> KeyPairAccount { let signing_key = SigningKey::from_bytes(&self.secret_key); diff --git a/crates/algokit_utils/tests/kmd/key_management.rs b/crates/algokit_utils/tests/kmd/key_management.rs new file mode 100644 index 000000000..352d13b3b --- /dev/null +++ b/crates/algokit_utils/tests/kmd/key_management.rs @@ -0,0 +1,109 @@ +use kmd_client::apis::client::KmdClient; +use kmd_client::models::{ + CreateWalletRequest, GenerateKeyRequest, InitWalletHandleTokenRequest, ListKeysRequest, + ReleaseWalletHandleTokenRequest, +}; +use rand::{Rng, distributions::Alphanumeric}; + +// Wallet key management flow: create wallet -> init handle token -> list keys -> generate key -> list keys (increment) -> release token +#[tokio::test] +async fn key_management_flow() -> Result<(), Box> { + let client = KmdClient::localnet(); + + let wallet_name: String = format!( + "test_wallet_keys_{}", + rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(12) + .map(char::from) + .collect::() + .to_lowercase() + ); + + // Create wallet + let create_response = client + .create_wallet(CreateWalletRequest { + wallet_name: Some(wallet_name.clone()), + wallet_driver_name: Some("sqlite".to_string()), + wallet_password: Some("testpass".to_string()), + ..Default::default() + }) + .await + .map_err(|e| { + format!( + "Failed to create wallet (possible KMD token/availability issue): {}", + e + ) + })?; + + let created_wallet = create_response + .wallet + .as_ref() + .expect("Expected created wallet in response"); + + let wallet_id = created_wallet + .id + .as_ref() + .expect("Wallet id should be present"); + assert_eq!( + created_wallet.name.as_ref().map(|s| s.as_str()), + Some(wallet_name.as_str()) + ); + + // Init wallet handle token + let init_response = client + .init_wallet_handle_token(InitWalletHandleTokenRequest { + wallet_id: Some(wallet_id.clone()), + wallet_password: Some("testpass".to_string()), + ..Default::default() + }) + .await?; + let wallet_handle_token = init_response + .wallet_handle_token + .as_ref() + .expect("Wallet handle token should be present") + .clone(); + + // Baseline keys list + let list_before = client + .list_keys_in_wallet(ListKeysRequest { + wallet_handle_token: Some(wallet_handle_token.clone()), + ..Default::default() + }) + .await?; + let before_addresses = list_before.addresses.unwrap_or_default(); + + // Generate new key + let _generate_response = client + .generate_key(GenerateKeyRequest { + wallet_handle_token: Some(wallet_handle_token.clone()), + display_mnemonic: Some(false), + ..Default::default() + }) + .await?; + + // List after + let list_after = client + .list_keys_in_wallet(ListKeysRequest { + wallet_handle_token: Some(wallet_handle_token.clone()), + ..Default::default() + }) + .await?; + let after_addresses = list_after.addresses.unwrap_or_default(); + + assert_eq!( + after_addresses.len(), + before_addresses.len() + 1, + "Expected one additional key after generation" + ); + + // Release handle token + let _release_response = client + .release_wallet_handle_token(ReleaseWalletHandleTokenRequest { + wallet_handle_token: Some(wallet_handle_token.clone()), + ..Default::default() + }) + .await?; + + Ok(()) +} diff --git a/crates/algokit_utils/tests/kmd/mod.rs b/crates/algokit_utils/tests/kmd/mod.rs new file mode 100644 index 000000000..38bf29994 --- /dev/null +++ b/crates/algokit_utils/tests/kmd/mod.rs @@ -0,0 +1,2 @@ +pub mod key_management; +pub mod wallet_lifecycle; diff --git a/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs b/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs new file mode 100644 index 000000000..2cdce1677 --- /dev/null +++ b/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs @@ -0,0 +1,56 @@ +use kmd_client::apis::client::KmdClient; +use kmd_client::models::CreateWalletRequest; +use rand::{Rng, distributions::Alphanumeric}; + +// Basic wallet lifecycle: create wallet, ensure it appears in list +#[tokio::test] +async fn wallet_lifecycle() -> Result<(), Box> { + // Arrange + let client = KmdClient::localnet(); + + let wallet_name: String = format!( + "test_wallet_{}", + rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(12) + .map(char::from) + .collect::() + .to_lowercase() + ); + + // Act: create wallet + let create_response = client + .create_wallet(CreateWalletRequest { + wallet_name: Some(wallet_name.clone()), + wallet_driver_name: Some("sqlite".to_string()), + wallet_password: Some("testpass".to_string()), + ..Default::default() + }) + .await + .map_err(|e| { + format!( + "Failed to create wallet (possible KMD token/availability issue): {}", + e + ) + })?; + + // Assert create response basic invariants + let created_wallet = create_response + .wallet + .as_ref() + .expect("Expected created wallet in response"); + assert_eq!( + created_wallet.name.as_ref().map(|s| s.as_str()), + Some(wallet_name.as_str()) + ); + + // List wallets and ensure presence + let list_response = client.list_wallets(None).await?; + let wallets = list_response.wallets.unwrap_or_default(); + let found = wallets + .iter() + .any(|w| w.name.as_ref().map(|n| n.as_str()) == Some(wallet_name.as_str())); + assert!(found, "Created wallet should be present in list of wallets"); + + Ok(()) +} diff --git a/crates/algokit_utils/tests/kmd_tests.rs b/crates/algokit_utils/tests/kmd_tests.rs new file mode 100644 index 000000000..7bb21d00b --- /dev/null +++ b/crates/algokit_utils/tests/kmd_tests.rs @@ -0,0 +1 @@ +mod kmd; diff --git a/crates/algokit_utils/tests/transactions/composer/inner_fee_coverage.rs b/crates/algokit_utils/tests/transactions/composer/inner_fee_coverage.rs index 6b8d4ac87..2d3a69ce0 100644 --- a/crates/algokit_utils/tests/transactions/composer/inner_fee_coverage.rs +++ b/crates/algokit_utils/tests/transactions/composer/inner_fee_coverage.rs @@ -1802,7 +1802,8 @@ async fn fund_app_accounts( app_ids: &Vec, amount: u64, ) -> Result<(), Box> { - let mut dispenser = LocalNetDispenser::new(algorand_fixture.algod.clone()); + let mut dispenser = + LocalNetDispenser::new(algorand_fixture.algod.clone(), algorand_fixture.kmd.clone()); for app_id in app_ids { let app_address = Address::from_app_id(app_id); diff --git a/crates/algokit_utils/tests/transactions/composer/resource_population.rs b/crates/algokit_utils/tests/transactions/composer/resource_population.rs index c06b395f7..fb1adfd2e 100644 --- a/crates/algokit_utils/tests/transactions/composer/resource_population.rs +++ b/crates/algokit_utils/tests/transactions/composer/resource_population.rs @@ -1173,7 +1173,7 @@ async fn fund_app_account( app_id: u64, amount: u64, ) -> Result<(), Box> { - let mut dispenser = LocalNetDispenser::new(context.algod.clone()); + let mut dispenser = LocalNetDispenser::new(context.algod.clone(), context.kmd.clone()); let app_address = Address::from_app_id(&app_id); dispenser .fund_account(&app_address.to_string(), amount) diff --git a/crates/kmd_client/Cargo.toml b/crates/kmd_client/Cargo.toml new file mode 100644 index 000000000..347490f27 --- /dev/null +++ b/crates/kmd_client/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "kmd_client" +version = "0.0.1" +authors = ["AlgoKit Core Team"] +description = "API client for kmd interaction." +license = "MIT" +edition = "2024" + +[features] +default = ["default_client"] +default_client = ["algokit_http_client/default_client"] +ffi_uniffi = ["dep:uniffi", "algokit_http_client/ffi_uniffi", "dep:algokit_transact_ffi"] + +[dependencies] +# Core serialization +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = [ + "base64", + "std", + "macros", +] } +serde_json = "^1.0" +serde_repr = "^0.1" +serde_bytes = "^0.11" + +# HTTP client +algokit_http_client = { path = "../algokit_http_client", features = ["ffi_uniffi"] } +url = "^2.5" + +# Uniffi for FFI bindings +uniffi = { workspace = true, optional = true } +algokit_transact_ffi = { optional = true, version = "0.1.0", path = "../algokit_transact_ffi" } + + +# Error handling +snafu = { workspace = true } + +# Utilities +base64 = "^0.22" +uuid = { version = "^1.0", features = ["v4"] } + +[dev-dependencies] +tokio = { version = "1.0", features = ["full"] } +tokio-test = "^0.4" \ No newline at end of file diff --git a/crates/kmd_client/README.md b/crates/kmd_client/README.md new file mode 100644 index 000000000..965e5a665 --- /dev/null +++ b/crates/kmd_client/README.md @@ -0,0 +1,280 @@ +# for KMD HTTP API + +API for KMD (Key Management Daemon) + +**Version:** 0.0.1 +**Contact:** contact@algorand.com + +This Rust crate provides a client library for the for KMD HTTP API API. + +## Installation + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +kmd_client = "0.0.1" +``` + +## Usage + +```rust +use kmd_client::KmdClient; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Initialize client (choose one based on your network) + let client = KmdClient::localnet(); // For local development + // let client = KmdClient::testnet(); // For TestNet + // let client = KmdClient::mainnet(); // For MainNet + + // Example: Get network status + let status = client.get_status().await?; + println!("Network status: {:?}", status); + + // Example: Get transaction parameters + let params = client.transaction_params().await?; + println!("Min fee: {}", params.min_fee); + println!("Last round: {}", params.last_round); + + // Example: Get account information + let account_address = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + let account_info = client.account_information( + None, // format + account_address, + None, // exclude + ).await?; + println!("Account balance: {}", account_info.amount); + + Ok(()) +} +``` + +## Configuration + +The client provides convenient constructors for different networks: + +```rust +use kmd_client::KmdClient; + +// For local development (uses localhost:4001 with default API token) +let client = KmdClient::localnet(); + +// For Algorand TestNet +let client = KmdClient::testnet(); + +// For Algorand MainNet +let client = KmdClient::mainnet(); +``` + +For custom configurations, you can use a custom HTTP client: + +```rust +use kmd_client::KmdClient; +use algokit_http_client::DefaultHttpClient; +use std::sync::Arc; + +// Custom endpoint with API token +let http_client = Arc::new( + DefaultHttpClient::with_header( + "http://localhost/", + "X-API-Key", + "your-api-key" + )? +); +let client = KmdClient::new(http_client); +``` + +## Complete Example + +Here's a more comprehensive example showing how to check network status, get account information, and prepare for transactions: + +```rust +use kmd_client::KmdClient; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Connect to localnet + let client = KmdClient::localnet(); + + // Check if the node is healthy and ready + client.health_check().await?; + client.get_ready().await?; + println!("✓ Node is healthy and ready"); + + // Get network information + let status = client.get_status().await?; + println!("✓ Connected to network"); + println!(" Last round: {}", status.last_round); + println!(" Catching up: {}", status.catchup_time.unwrap_or(0)); + + // Get transaction parameters needed for building transactions + let params = client.transaction_params().await?; + println!("✓ Retrieved transaction parameters"); + println!(" Genesis ID: {}", params.genesis_id); + println!(" Min fee: {}", params.min_fee); + + // Example: Get account information + let test_address = "7ZUECA7HFLZTXENRV24SHLU4AVPUTMTTDUFUBNBD64C73F3UHRTHAIOF6Q"; + match client.account_information(None, test_address, None).await { + Ok(account) => { + println!("✓ Account information retrieved"); + println!(" Address: {}", account.address); + println!(" Balance: {} microAlgos", account.amount); + println!(" Min balance: {} microAlgos", account.min_balance); + } + Err(e) => { + println!("⚠ Could not retrieve account info: {}", e); + } + } + + Ok(()) +} +``` + +## API Operations + +This client provides access to 23 API operations: + +- `swagger_handler` - Gets the current swagger spec. +- `generate_key` - Generate a key +- `delete_key` - Delete a key +- `export_key` - Export a key +- `import_key` - Import a key +- `list_keys_in_wallet` - List keys in wallet +- `export_master_key` - Export the master derivation key from a wallet +- `delete_multisig` - Delete a multisig +- `export_multisig` - Export multisig address metadata +- `import_multisig` - Import a multisig account +- `list_multisg` - List multisig accounts +- `sign_multisig_transaction` - Sign a multisig transaction +- `sign_multisig_program` - Sign a program for a multisig account +- `sign_program` - Sign program +- `sign_transaction` - Sign a transaction +- `create_wallet` - Create a wallet +- `get_wallet_info` - Get wallet info +- `init_wallet_handle_token` - Initialize a wallet handle token +- `release_wallet_handle_token` - Release a wallet handle token +- `rename_wallet` - Rename a wallet +- `renew_wallet_handle_token` - Renew a wallet handle token +- `list_wallets` - List wallets +- `get_version` - Retrieves the current version + +## Models + +The following data models are available: + +- `Apiv1DeleteKeyResponse` - APIV1DELETEKeyResponse is the response to `DELETE /v1/key` +friendly:DeleteKeyResponse +- `Apiv1DeleteMultisigResponse` - APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` +friendly:DeleteMultisigResponse +- `Apiv1GetWalletsResponse` - APIV1GETWalletsResponse is the response to `GET /v1/wallets` +friendly:ListWalletsResponse +- `Apiv1PostKeyExportResponse` - APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` +friendly:ExportKeyResponse +- `Apiv1PostKeyImportResponse` - APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` +friendly:ImportKeyResponse +- `Apiv1PostKeyListResponse` - APIV1POSTKeyListResponse is the response to `POST /v1/key/list` +friendly:ListKeysResponse +- `Apiv1PostKeyResponse` - APIV1POSTKeyResponse is the response to `POST /v1/key` +friendly:GenerateKeyResponse +- `Apiv1PostMasterKeyExportResponse` - APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` +friendly:ExportMasterKeyResponse +- `Apiv1PostMultisigExportResponse` - APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` +friendly:ExportMultisigResponse +- `Apiv1PostMultisigImportResponse` - APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` +friendly:ImportMultisigResponse +- `Apiv1PostMultisigListResponse` - APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` +friendly:ListMultisigResponse +- `Apiv1PostMultisigProgramSignResponse` - APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` +friendly:SignProgramMultisigResponse +- `Apiv1PostMultisigTransactionSignResponse` - APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` +friendly:SignMultisigResponse +- `Apiv1PostProgramSignResponse` - APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` +friendly:SignProgramResponse +- `Apiv1PostTransactionSignResponse` - APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` +friendly:SignTransactionResponse +- `Apiv1PostWalletInfoResponse` - APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` +friendly:WalletInfoResponse +- `Apiv1PostWalletInitResponse` - APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` +friendly:InitWalletHandleTokenResponse +- `Apiv1PostWalletReleaseResponse` - APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` +friendly:ReleaseWalletHandleTokenResponse +- `Apiv1PostWalletRenameResponse` - APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` +friendly:RenameWalletResponse +- `Apiv1PostWalletRenewResponse` - APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` +friendly:RenewWalletHandleTokenResponse +- `Apiv1PostWalletResponse` - APIV1POSTWalletResponse is the response to `POST /v1/wallet` +friendly:CreateWalletResponse +- `Apiv1Wallet` - APIV1Wallet is the API's representation of a wallet +- `Apiv1WalletHandle` - APIV1WalletHandle includes the wallet the handle corresponds to +and the number of number of seconds to expiration +- `CreateWalletRequest` - APIV1POSTWalletRequest is the request for `POST /v1/wallet` +- `DeleteKeyRequest` - APIV1DELETEKeyRequest is the request for `DELETE /v1/key` +- `DeleteMultisigRequest` - APIV1DELETEMultisigRequest is the request for `DELETE /v1/multisig` +- `Digest` - No description +- `ExportKeyRequest` - APIV1POSTKeyExportRequest is the request for `POST /v1/key/export` +- `ExportMasterKeyRequest` - APIV1POSTMasterKeyExportRequest is the request for `POST /v1/master-key/export` +- `ExportMultisigRequest` - APIV1POSTMultisigExportRequest is the request for `POST /v1/multisig/export` +- `GenerateKeyRequest` - APIV1POSTKeyRequest is the request for `POST /v1/key` +- `ImportKeyRequest` - APIV1POSTKeyImportRequest is the request for `POST /v1/key/import` +- `ImportMultisigRequest` - APIV1POSTMultisigImportRequest is the request for `POST /v1/multisig/import` +- `InitWalletHandleTokenRequest` - APIV1POSTWalletInitRequest is the request for `POST /v1/wallet/init` +- `ListKeysRequest` - APIV1POSTKeyListRequest is the request for `POST /v1/key/list` +- `ListMultisigRequest` - APIV1POSTMultisigListRequest is the request for `POST /v1/multisig/list` +- `ListWalletsRequest` - APIV1GETWalletsRequest is the request for `GET /v1/wallets` +- `MasterDerivationKey` - MasterDerivationKey is used to derive ed25519 keys for use in wallets +- `MultisigSig` - MultisigSig is the structure that holds multiple Subsigs +- `MultisigSubsig` - MultisigSubsig is a struct that holds a pair of public key and signatures +signatures may be empty +- `PrivateKey` - No description +- `PublicKey` - No description +- `ReleaseWalletHandleTokenRequest` - APIV1POSTWalletReleaseRequest is the request for `POST /v1/wallet/release` +- `RenameWalletRequest` - APIV1POSTWalletRenameRequest is the request for `POST /v1/wallet/rename` +- `RenewWalletHandleTokenRequest` - APIV1POSTWalletRenewRequest is the request for `POST /v1/wallet/renew` +- `SignMultisigRequest` - APIV1POSTMultisigTransactionSignRequest is the request for `POST /v1/multisig/sign` +- `SignProgramMultisigRequest` - APIV1POSTMultisigProgramSignRequest is the request for `POST /v1/multisig/signprogram` +- `SignProgramRequest` - APIV1POSTProgramSignRequest is the request for `POST /v1/program/sign` +- `SignTransactionRequest` - APIV1POSTTransactionSignRequest is the request for `POST /v1/transaction/sign` +- `Signature` - No description +- `TxType` - TxType is the type of the transaction written to the ledger +- `VersionsRequest` - VersionsRequest is the request for `GET /versions` +- `VersionsResponse` - VersionsResponse is the response to `GET /versions` +friendly:VersionsResponse +- `WalletInfoRequest` - APIV1POSTWalletInfoRequest is the request for `POST /v1/wallet/info` +- `Ed25519PrivateKey` - No description +- `Ed25519PublicKey` - No description +- `Ed25519Signature` - No description + +## Error Handling + +All API operations return a `Result` type. Errors include: + +- Network errors (connection issues, timeouts) +- HTTP errors (4xx, 5xx status codes) +- Serialization errors (invalid JSON responses) + +```rust +// Example error handling +match client.get_status().await { + Ok(status) => { + println!("Node is running on round: {}", status.last_round); + } + Err(error) => { + eprintln!("Failed to get node status: {:?}", error); + // Handle specific error types if needed + } +} + +// Or use the ? operator for early returns +let params = client.transaction_params().await + .map_err(|e| format!("Failed to get transaction params: {}", e))?; +``` + +## Generated Code + +This client was generated from an OpenAPI specification using a custom Rust code generator. + +**Generated on:** Generated by Rust OpenAPI Generator +**OpenAPI Version:** 3.0.0 +**Generator:** Rust OpenAPI Generator diff --git a/crates/kmd_client/src/apis/client.rs b/crates/kmd_client/src/apis/client.rs new file mode 100644 index 000000000..153d17d02 --- /dev/null +++ b/crates/kmd_client/src/apis/client.rs @@ -0,0 +1,341 @@ +#![allow(clippy::let_and_return)] + +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use super::Error; +use crate::models::{ + Apiv1DeleteKeyResponse, Apiv1DeleteMultisigResponse, Apiv1GetWalletsResponse, + Apiv1PostKeyExportResponse, Apiv1PostKeyImportResponse, Apiv1PostKeyListResponse, + Apiv1PostKeyResponse, Apiv1PostMasterKeyExportResponse, Apiv1PostMultisigExportResponse, + Apiv1PostMultisigImportResponse, Apiv1PostMultisigListResponse, + Apiv1PostMultisigProgramSignResponse, Apiv1PostMultisigTransactionSignResponse, + Apiv1PostProgramSignResponse, Apiv1PostTransactionSignResponse, Apiv1PostWalletInfoResponse, + Apiv1PostWalletInitResponse, Apiv1PostWalletReleaseResponse, Apiv1PostWalletRenameResponse, + Apiv1PostWalletRenewResponse, Apiv1PostWalletResponse, CreateWalletRequest, DeleteKeyRequest, + DeleteMultisigRequest, ExportKeyRequest, ExportMasterKeyRequest, ExportMultisigRequest, + GenerateKeyRequest, ImportKeyRequest, ImportMultisigRequest, InitWalletHandleTokenRequest, + ListKeysRequest, ListMultisigRequest, ListWalletsRequest, ReleaseWalletHandleTokenRequest, + RenameWalletRequest, RenewWalletHandleTokenRequest, SignMultisigRequest, + SignProgramMultisigRequest, SignProgramRequest, SignTransactionRequest, VersionsRequest, + VersionsResponse, WalletInfoRequest, +}; +use algokit_http_client::{DefaultHttpClient, HttpClient}; +use std::sync::Arc; + +/// The main Kmd API client. +/// +/// This client provides convenient access to all Kmd API endpoints. +/// It wraps the lower-level endpoint functions with a more ergonomic interface. +/// All methods return a unified `Error` type that can represent any endpoint error. +#[derive(Clone)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Object))] +pub struct KmdClient { + http_client: Arc, +} + +#[cfg_attr(feature = "ffi_uniffi", uniffi::export)] +impl KmdClient { + /// Create a new KmdClient with a custom http client. + #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] + pub fn new(http_client: Arc) -> Self { + Self { http_client } + } + + /// Create a new KmdClient for Algorand TestNet. + #[cfg(feature = "default_client")] + #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] + pub fn testnet() -> Self { + let http_client = Arc::new(DefaultHttpClient::new("http://localhost:7833")); + Self::new(http_client) + } + + /// Create a new KmdClient for Algorand MainNet. + #[cfg(feature = "default_client")] + #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] + pub fn mainnet() -> Self { + let http_client = Arc::new(DefaultHttpClient::new("http://localhost:7833")); + Self::new(http_client) + } + + /// Create a new KmdClient for a local localnet environment. + #[cfg(feature = "default_client")] + #[cfg_attr(feature = "ffi_uniffi", uniffi::constructor)] + pub fn localnet() -> Self { + let http_client = Arc::new( + DefaultHttpClient::with_header( + "http://localhost:4002", + "X-KMD-API-Token", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + .expect("Failed to create HTTP client with API token header"), + ); + Self::new(http_client) + } + /// Gets the current swagger spec. + pub async fn swagger_handler(&self) -> Result { + let result = super::swagger_handler::swagger_handler(self.http_client.as_ref()).await; + + result + } + + /// Generate a key + pub async fn generate_key( + &self, + request: GenerateKeyRequest, + ) -> Result { + let result = super::generate_key::generate_key(self.http_client.as_ref(), request).await; + + result + } + + /// Delete a key + pub async fn delete_key( + &self, + request: DeleteKeyRequest, + ) -> Result { + let result = super::delete_key::delete_key(self.http_client.as_ref(), request).await; + + result + } + + /// Export a key + pub async fn export_key( + &self, + request: ExportKeyRequest, + ) -> Result { + let result = super::export_key::export_key(self.http_client.as_ref(), request).await; + + result + } + + /// Import a key + pub async fn import_key( + &self, + request: ImportKeyRequest, + ) -> Result { + let result = super::import_key::import_key(self.http_client.as_ref(), request).await; + + result + } + + /// List keys in wallet + pub async fn list_keys_in_wallet( + &self, + request: ListKeysRequest, + ) -> Result { + let result = + super::list_keys_in_wallet::list_keys_in_wallet(self.http_client.as_ref(), request) + .await; + + result + } + + /// Export the master derivation key from a wallet + pub async fn export_master_key( + &self, + request: ExportMasterKeyRequest, + ) -> Result { + let result = + super::export_master_key::export_master_key(self.http_client.as_ref(), request).await; + + result + } + + /// Delete a multisig + pub async fn delete_multisig( + &self, + request: DeleteMultisigRequest, + ) -> Result { + let result = + super::delete_multisig::delete_multisig(self.http_client.as_ref(), request).await; + + result + } + + /// Export multisig address metadata + pub async fn export_multisig( + &self, + request: ExportMultisigRequest, + ) -> Result { + let result = + super::export_multisig::export_multisig(self.http_client.as_ref(), request).await; + + result + } + + /// Import a multisig account + pub async fn import_multisig( + &self, + request: ImportMultisigRequest, + ) -> Result { + let result = + super::import_multisig::import_multisig(self.http_client.as_ref(), request).await; + + result + } + + /// List multisig accounts + pub async fn list_multisg( + &self, + request: ListMultisigRequest, + ) -> Result { + let result = super::list_multisg::list_multisg(self.http_client.as_ref(), request).await; + + result + } + + /// Sign a multisig transaction + pub async fn sign_multisig_transaction( + &self, + request: SignMultisigRequest, + ) -> Result { + let result = super::sign_multisig_transaction::sign_multisig_transaction( + self.http_client.as_ref(), + request, + ) + .await; + + result + } + + /// Sign a program for a multisig account + pub async fn sign_multisig_program( + &self, + request: SignProgramMultisigRequest, + ) -> Result { + let result = + super::sign_multisig_program::sign_multisig_program(self.http_client.as_ref(), request) + .await; + + result + } + + /// Sign program + pub async fn sign_program( + &self, + request: SignProgramRequest, + ) -> Result { + let result = super::sign_program::sign_program(self.http_client.as_ref(), request).await; + + result + } + + /// Sign a transaction + pub async fn sign_transaction( + &self, + request: SignTransactionRequest, + ) -> Result { + let result = + super::sign_transaction::sign_transaction(self.http_client.as_ref(), request).await; + + result + } + + /// Create a wallet + pub async fn create_wallet( + &self, + request: CreateWalletRequest, + ) -> Result { + let result = super::create_wallet::create_wallet(self.http_client.as_ref(), request).await; + + result + } + + /// Get wallet info + pub async fn get_wallet_info( + &self, + request: WalletInfoRequest, + ) -> Result { + let result = + super::get_wallet_info::get_wallet_info(self.http_client.as_ref(), request).await; + + result + } + + /// Initialize a wallet handle token + pub async fn init_wallet_handle_token( + &self, + request: InitWalletHandleTokenRequest, + ) -> Result { + let result = super::init_wallet_handle_token::init_wallet_handle_token( + self.http_client.as_ref(), + request, + ) + .await; + + result + } + + /// Release a wallet handle token + pub async fn release_wallet_handle_token( + &self, + request: ReleaseWalletHandleTokenRequest, + ) -> Result { + let result = super::release_wallet_handle_token::release_wallet_handle_token( + self.http_client.as_ref(), + request, + ) + .await; + + result + } + + /// Rename a wallet + pub async fn rename_wallet( + &self, + request: RenameWalletRequest, + ) -> Result { + let result = super::rename_wallet::rename_wallet(self.http_client.as_ref(), request).await; + + result + } + + /// Renew a wallet handle token + pub async fn renew_wallet_handle_token( + &self, + request: RenewWalletHandleTokenRequest, + ) -> Result { + let result = super::renew_wallet_handle_token::renew_wallet_handle_token( + self.http_client.as_ref(), + request, + ) + .await; + + result + } + + /// List wallets + pub async fn list_wallets( + &self, + request: Option, + ) -> Result { + let result = super::list_wallets::list_wallets(self.http_client.as_ref(), request).await; + + result + } + + /// Retrieves the current version + pub async fn get_version( + &self, + request: Option, + ) -> Result { + let result = super::get_version::get_version(self.http_client.as_ref(), request).await; + + result + } +} + +#[cfg(not(feature = "ffi_uniffi"))] +impl KmdClient {} + +#[cfg_attr(feature = "ffi_uniffi", uniffi::export)] +#[cfg(feature = "ffi_uniffi")] +impl KmdClient {} diff --git a/crates/kmd_client/src/apis/create_wallet.rs b/crates/kmd_client/src/apis/create_wallet.rs new file mode 100644 index 000000000..c410c13fd --- /dev/null +++ b/crates/kmd_client/src/apis/create_wallet.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostWalletResponse; + +// Import request body type if needed +use crate::models::CreateWalletRequest; + +/// struct for typed errors of method [`create_wallet`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum CreateWalletError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Create a new wallet (collection of keys) with the given parameters. +pub async fn create_wallet( + http_client: &dyn HttpClient, + request: CreateWalletRequest, +) -> Result { + let p_request = request; + + let path = "/v1/wallet".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/delete_key.rs b/crates/kmd_client/src/apis/delete_key.rs new file mode 100644 index 000000000..e2c7710cb --- /dev/null +++ b/crates/kmd_client/src/apis/delete_key.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1DeleteKeyResponse; + +// Import request body type if needed +use crate::models::DeleteKeyRequest; + +/// struct for typed errors of method [`delete_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum DeleteKeyError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Deletes the key with the passed public key from the wallet. +pub async fn delete_key( + http_client: &dyn HttpClient, + request: DeleteKeyRequest, +) -> Result { + let p_request = request; + + let path = "/v1/key".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Delete, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/delete_multisig.rs b/crates/kmd_client/src/apis/delete_multisig.rs new file mode 100644 index 000000000..b7e2f5f05 --- /dev/null +++ b/crates/kmd_client/src/apis/delete_multisig.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1DeleteMultisigResponse; + +// Import request body type if needed +use crate::models::DeleteMultisigRequest; + +/// struct for typed errors of method [`delete_multisig`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum DeleteMultisigError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Deletes multisig preimage information for the passed address from the wallet. +pub async fn delete_multisig( + http_client: &dyn HttpClient, + request: DeleteMultisigRequest, +) -> Result { + let p_request = request; + + let path = "/v1/multisig".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Delete, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/export_key.rs b/crates/kmd_client/src/apis/export_key.rs new file mode 100644 index 000000000..d23854392 --- /dev/null +++ b/crates/kmd_client/src/apis/export_key.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostKeyExportResponse; + +// Import request body type if needed +use crate::models::ExportKeyRequest; + +/// struct for typed errors of method [`export_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ExportKeyError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Export the secret key associated with the passed public key. +pub async fn export_key( + http_client: &dyn HttpClient, + request: ExportKeyRequest, +) -> Result { + let p_request = request; + + let path = "/v1/key/export".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/export_master_key.rs b/crates/kmd_client/src/apis/export_master_key.rs new file mode 100644 index 000000000..fc3735a57 --- /dev/null +++ b/crates/kmd_client/src/apis/export_master_key.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostMasterKeyExportResponse; + +// Import request body type if needed +use crate::models::ExportMasterKeyRequest; + +/// struct for typed errors of method [`export_master_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ExportMasterKeyError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Export the master derivation key from the wallet. This key is a master "backup" key for the underlying wallet. With it, you can regenerate all of the wallets that have been generated with this wallet's `POST /v1/key` endpoint. This key will not allow you to recover keys imported from other wallets, however. +pub async fn export_master_key( + http_client: &dyn HttpClient, + request: ExportMasterKeyRequest, +) -> Result { + let p_request = request; + + let path = "/v1/master-key/export".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/export_multisig.rs b/crates/kmd_client/src/apis/export_multisig.rs new file mode 100644 index 000000000..75a6b8d5d --- /dev/null +++ b/crates/kmd_client/src/apis/export_multisig.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostMultisigExportResponse; + +// Import request body type if needed +use crate::models::ExportMultisigRequest; + +/// struct for typed errors of method [`export_multisig`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ExportMultisigError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Given a multisig address whose preimage this wallet stores, returns the information used to generate the address, including public keys, threshold, and multisig version. +pub async fn export_multisig( + http_client: &dyn HttpClient, + request: ExportMultisigRequest, +) -> Result { + let p_request = request; + + let path = "/v1/multisig/export".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/generate_key.rs b/crates/kmd_client/src/apis/generate_key.rs new file mode 100644 index 000000000..5f7abf9e6 --- /dev/null +++ b/crates/kmd_client/src/apis/generate_key.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostKeyResponse; + +// Import request body type if needed +use crate::models::GenerateKeyRequest; + +/// struct for typed errors of method [`generate_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum GenerateKeyError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Generates the next key in the deterministic key sequence (as determined by the master derivation key) and adds it to the wallet, returning the public key. +pub async fn generate_key( + http_client: &dyn HttpClient, + request: GenerateKeyRequest, +) -> Result { + let p_request = request; + + let path = "/v1/key".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/get_version.rs b/crates/kmd_client/src/apis/get_version.rs new file mode 100644 index 000000000..b1c8b75ca --- /dev/null +++ b/crates/kmd_client/src/apis/get_version.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::VersionsResponse; + +// Import request body type if needed +use crate::models::VersionsRequest; + +/// struct for typed errors of method [`get_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum GetVersionError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Retrieves the current version +pub async fn get_version( + http_client: &dyn HttpClient, + request: Option, +) -> Result { + let p_request = request; + + let path = "/versions".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Get, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/get_wallet_info.rs b/crates/kmd_client/src/apis/get_wallet_info.rs new file mode 100644 index 000000000..3967e0e96 --- /dev/null +++ b/crates/kmd_client/src/apis/get_wallet_info.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostWalletInfoResponse; + +// Import request body type if needed +use crate::models::WalletInfoRequest; + +/// struct for typed errors of method [`get_wallet_info`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum GetWalletInfoError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Returns information about the wallet associated with the passed wallet handle token. Additionally returns expiration information about the token itself. +pub async fn get_wallet_info( + http_client: &dyn HttpClient, + request: WalletInfoRequest, +) -> Result { + let p_request = request; + + let path = "/v1/wallet/info".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/import_key.rs b/crates/kmd_client/src/apis/import_key.rs new file mode 100644 index 000000000..9192622e2 --- /dev/null +++ b/crates/kmd_client/src/apis/import_key.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostKeyImportResponse; + +// Import request body type if needed +use crate::models::ImportKeyRequest; + +/// struct for typed errors of method [`import_key`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ImportKeyError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Import an externally generated key into the wallet. Note that if you wish to back up the imported key, you must do so by backing up the entire wallet database, because imported keys were not derived from the wallet's master derivation key. +pub async fn import_key( + http_client: &dyn HttpClient, + request: ImportKeyRequest, +) -> Result { + let p_request = request; + + let path = "/v1/key/import".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/import_multisig.rs b/crates/kmd_client/src/apis/import_multisig.rs new file mode 100644 index 000000000..841c84d9f --- /dev/null +++ b/crates/kmd_client/src/apis/import_multisig.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostMultisigImportResponse; + +// Import request body type if needed +use crate::models::ImportMultisigRequest; + +/// struct for typed errors of method [`import_multisig`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ImportMultisigError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Generates a multisig account from the passed public keys array and multisig metadata, and stores all of this in the wallet. +pub async fn import_multisig( + http_client: &dyn HttpClient, + request: ImportMultisigRequest, +) -> Result { + let p_request = request; + + let path = "/v1/multisig/import".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/init_wallet_handle_token.rs b/crates/kmd_client/src/apis/init_wallet_handle_token.rs new file mode 100644 index 000000000..216cec455 --- /dev/null +++ b/crates/kmd_client/src/apis/init_wallet_handle_token.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostWalletInitResponse; + +// Import request body type if needed +use crate::models::InitWalletHandleTokenRequest; + +/// struct for typed errors of method [`init_wallet_handle_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum InitWalletHandleTokenError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Unlock the wallet and return a wallet handle token that can be used for subsequent operations. These tokens expire periodically and must be renewed. You can `POST` the token to `/v1/wallet/info` to see how much time remains until expiration, and renew it with `/v1/wallet/renew`. When you're done, you can invalidate the token with `/v1/wallet/release`. +pub async fn init_wallet_handle_token( + http_client: &dyn HttpClient, + request: InitWalletHandleTokenRequest, +) -> Result { + let p_request = request; + + let path = "/v1/wallet/init".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/list_keys_in_wallet.rs b/crates/kmd_client/src/apis/list_keys_in_wallet.rs new file mode 100644 index 000000000..e8adcb9d2 --- /dev/null +++ b/crates/kmd_client/src/apis/list_keys_in_wallet.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostKeyListResponse; + +// Import request body type if needed +use crate::models::ListKeysRequest; + +/// struct for typed errors of method [`list_keys_in_wallet`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ListKeysInWalletError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Lists all of the public keys in this wallet. All of them have a stored private key. +pub async fn list_keys_in_wallet( + http_client: &dyn HttpClient, + request: ListKeysRequest, +) -> Result { + let p_request = request; + + let path = "/v1/key/list".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/list_multisg.rs b/crates/kmd_client/src/apis/list_multisg.rs new file mode 100644 index 000000000..58bcbea37 --- /dev/null +++ b/crates/kmd_client/src/apis/list_multisg.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostMultisigListResponse; + +// Import request body type if needed +use crate::models::ListMultisigRequest; + +/// struct for typed errors of method [`list_multisg`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ListMultisgError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Lists all of the multisig accounts whose preimages this wallet stores +pub async fn list_multisg( + http_client: &dyn HttpClient, + request: ListMultisigRequest, +) -> Result { + let p_request = request; + + let path = "/v1/multisig/list".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/list_wallets.rs b/crates/kmd_client/src/apis/list_wallets.rs new file mode 100644 index 000000000..2002c8eb0 --- /dev/null +++ b/crates/kmd_client/src/apis/list_wallets.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1GetWalletsResponse; + +// Import request body type if needed +use crate::models::ListWalletsRequest; + +/// struct for typed errors of method [`list_wallets`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ListWalletsError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Lists all of the wallets that kmd is aware of. +pub async fn list_wallets( + http_client: &dyn HttpClient, + request: Option, +) -> Result { + let p_request = request; + + let path = "/v1/wallets".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Get, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/mod.rs b/crates/kmd_client/src/apis/mod.rs new file mode 100644 index 000000000..2632fdb7b --- /dev/null +++ b/crates/kmd_client/src/apis/mod.rs @@ -0,0 +1,337 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +// Consolidated client +pub mod client; + +// Individual endpoint modules +pub mod create_wallet; +pub mod delete_key; +pub mod delete_multisig; +pub mod export_key; +pub mod export_master_key; +pub mod export_multisig; +pub mod generate_key; +pub mod get_version; +pub mod get_wallet_info; +pub mod import_key; +pub mod import_multisig; +pub mod init_wallet_handle_token; +pub mod list_keys_in_wallet; +pub mod list_multisg; +pub mod list_wallets; +pub mod release_wallet_handle_token; +pub mod rename_wallet; +pub mod renew_wallet_handle_token; +pub mod sign_multisig_program; +pub mod sign_multisig_transaction; +pub mod sign_program; +pub mod sign_transaction; +pub mod swagger_handler; + +use snafu::Snafu; + +/// Unified error type that can represent any API error from any endpoint +#[derive(Debug, Snafu)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum KmdApiError { + #[snafu(display("Swagger_handler error: {error:?}"))] + SwaggerHandler { + error: swagger_handler::SwaggerHandlerError, + }, + #[snafu(display("Generate_key error: {error:?}"))] + GenerateKey { + error: generate_key::GenerateKeyError, + }, + #[snafu(display("Delete_key error: {error:?}"))] + DeleteKey { error: delete_key::DeleteKeyError }, + #[snafu(display("Export_key error: {error:?}"))] + ExportKey { error: export_key::ExportKeyError }, + #[snafu(display("Import_key error: {error:?}"))] + ImportKey { error: import_key::ImportKeyError }, + #[snafu(display("List_keys_in_wallet error: {error:?}"))] + ListKeysInWallet { + error: list_keys_in_wallet::ListKeysInWalletError, + }, + #[snafu(display("Export_master_key error: {error:?}"))] + ExportMasterKey { + error: export_master_key::ExportMasterKeyError, + }, + #[snafu(display("Delete_multisig error: {error:?}"))] + DeleteMultisig { + error: delete_multisig::DeleteMultisigError, + }, + #[snafu(display("Export_multisig error: {error:?}"))] + ExportMultisig { + error: export_multisig::ExportMultisigError, + }, + #[snafu(display("Import_multisig error: {error:?}"))] + ImportMultisig { + error: import_multisig::ImportMultisigError, + }, + #[snafu(display("List_multisg error: {error:?}"))] + ListMultisg { + error: list_multisg::ListMultisgError, + }, + #[snafu(display("Sign_multisig_transaction error: {error:?}"))] + SignMultisigTransaction { + error: sign_multisig_transaction::SignMultisigTransactionError, + }, + #[snafu(display("Sign_multisig_program error: {error:?}"))] + SignMultisigProgram { + error: sign_multisig_program::SignMultisigProgramError, + }, + #[snafu(display("Sign_program error: {error:?}"))] + SignProgram { + error: sign_program::SignProgramError, + }, + #[snafu(display("Sign_transaction error: {error:?}"))] + SignTransaction { + error: sign_transaction::SignTransactionError, + }, + #[snafu(display("Create_wallet error: {error:?}"))] + CreateWallet { + error: create_wallet::CreateWalletError, + }, + #[snafu(display("Get_wallet_info error: {error:?}"))] + GetWalletInfo { + error: get_wallet_info::GetWalletInfoError, + }, + #[snafu(display("Init_wallet_handle_token error: {error:?}"))] + InitWalletHandleToken { + error: init_wallet_handle_token::InitWalletHandleTokenError, + }, + #[snafu(display("Release_wallet_handle_token error: {error:?}"))] + ReleaseWalletHandleToken { + error: release_wallet_handle_token::ReleaseWalletHandleTokenError, + }, + #[snafu(display("Rename_wallet error: {error:?}"))] + RenameWallet { + error: rename_wallet::RenameWalletError, + }, + #[snafu(display("Renew_wallet_handle_token error: {error:?}"))] + RenewWalletHandleToken { + error: renew_wallet_handle_token::RenewWalletHandleTokenError, + }, + #[snafu(display("List_wallets error: {error:?}"))] + ListWallets { + error: list_wallets::ListWalletsError, + }, + #[snafu(display("Get_version error: {error:?}"))] + GetVersion { error: get_version::GetVersionError }, + #[snafu(display("Unknown API error: {message}"))] + Unknown { message: String }, +} + +impl From for KmdApiError { + fn from(err: swagger_handler::SwaggerHandlerError) -> Self { + KmdApiError::SwaggerHandler { error: err } + } +} + +impl From for KmdApiError { + fn from(err: generate_key::GenerateKeyError) -> Self { + KmdApiError::GenerateKey { error: err } + } +} + +impl From for KmdApiError { + fn from(err: delete_key::DeleteKeyError) -> Self { + KmdApiError::DeleteKey { error: err } + } +} + +impl From for KmdApiError { + fn from(err: export_key::ExportKeyError) -> Self { + KmdApiError::ExportKey { error: err } + } +} + +impl From for KmdApiError { + fn from(err: import_key::ImportKeyError) -> Self { + KmdApiError::ImportKey { error: err } + } +} + +impl From for KmdApiError { + fn from(err: list_keys_in_wallet::ListKeysInWalletError) -> Self { + KmdApiError::ListKeysInWallet { error: err } + } +} + +impl From for KmdApiError { + fn from(err: export_master_key::ExportMasterKeyError) -> Self { + KmdApiError::ExportMasterKey { error: err } + } +} + +impl From for KmdApiError { + fn from(err: delete_multisig::DeleteMultisigError) -> Self { + KmdApiError::DeleteMultisig { error: err } + } +} + +impl From for KmdApiError { + fn from(err: export_multisig::ExportMultisigError) -> Self { + KmdApiError::ExportMultisig { error: err } + } +} + +impl From for KmdApiError { + fn from(err: import_multisig::ImportMultisigError) -> Self { + KmdApiError::ImportMultisig { error: err } + } +} + +impl From for KmdApiError { + fn from(err: list_multisg::ListMultisgError) -> Self { + KmdApiError::ListMultisg { error: err } + } +} + +impl From for KmdApiError { + fn from(err: sign_multisig_transaction::SignMultisigTransactionError) -> Self { + KmdApiError::SignMultisigTransaction { error: err } + } +} + +impl From for KmdApiError { + fn from(err: sign_multisig_program::SignMultisigProgramError) -> Self { + KmdApiError::SignMultisigProgram { error: err } + } +} + +impl From for KmdApiError { + fn from(err: sign_program::SignProgramError) -> Self { + KmdApiError::SignProgram { error: err } + } +} + +impl From for KmdApiError { + fn from(err: sign_transaction::SignTransactionError) -> Self { + KmdApiError::SignTransaction { error: err } + } +} + +impl From for KmdApiError { + fn from(err: create_wallet::CreateWalletError) -> Self { + KmdApiError::CreateWallet { error: err } + } +} + +impl From for KmdApiError { + fn from(err: get_wallet_info::GetWalletInfoError) -> Self { + KmdApiError::GetWalletInfo { error: err } + } +} + +impl From for KmdApiError { + fn from(err: init_wallet_handle_token::InitWalletHandleTokenError) -> Self { + KmdApiError::InitWalletHandleToken { error: err } + } +} + +impl From for KmdApiError { + fn from(err: release_wallet_handle_token::ReleaseWalletHandleTokenError) -> Self { + KmdApiError::ReleaseWalletHandleToken { error: err } + } +} + +impl From for KmdApiError { + fn from(err: rename_wallet::RenameWalletError) -> Self { + KmdApiError::RenameWallet { error: err } + } +} + +impl From for KmdApiError { + fn from(err: renew_wallet_handle_token::RenewWalletHandleTokenError) -> Self { + KmdApiError::RenewWalletHandleToken { error: err } + } +} + +impl From for KmdApiError { + fn from(err: list_wallets::ListWalletsError) -> Self { + KmdApiError::ListWallets { error: err } + } +} + +impl From for KmdApiError { + fn from(err: get_version::GetVersionError) -> Self { + KmdApiError::GetVersion { error: err } + } +} + +/// The main error type for all kmd client operations +#[derive(Debug, Snafu)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum Error { + #[snafu(display("HTTP error: {source}"))] + Http { + source: algokit_http_client::HttpError, + }, + #[snafu(display("Serialization error: {message}"))] + Serde { message: String }, + #[snafu(display("API error: {source}"))] + Api { source: KmdApiError }, +} + +#[derive(Debug, PartialEq, Eq)] +pub enum ContentType { + Json, + MsgPack, + Text, + Unsupported(String), +} + +impl From<&str> for ContentType { + fn from(content_type: &str) -> Self { + if content_type.contains("application/json") { + ContentType::Json + } else if content_type.contains("application/msgpack") { + ContentType::MsgPack + } else if content_type.contains("text/plain") { + ContentType::Text + } else { + ContentType::Unsupported(content_type.to_string()) + } + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +// Re-export the consolidated client +pub use client::KmdClient; + +// Re-export all endpoint functions +pub use create_wallet::{CreateWalletError, create_wallet}; +pub use delete_key::{DeleteKeyError, delete_key}; +pub use delete_multisig::{DeleteMultisigError, delete_multisig}; +pub use export_key::{ExportKeyError, export_key}; +pub use export_master_key::{ExportMasterKeyError, export_master_key}; +pub use export_multisig::{ExportMultisigError, export_multisig}; +pub use generate_key::{GenerateKeyError, generate_key}; +pub use get_version::{GetVersionError, get_version}; +pub use get_wallet_info::{GetWalletInfoError, get_wallet_info}; +pub use import_key::{ImportKeyError, import_key}; +pub use import_multisig::{ImportMultisigError, import_multisig}; +pub use init_wallet_handle_token::{InitWalletHandleTokenError, init_wallet_handle_token}; +pub use list_keys_in_wallet::{ListKeysInWalletError, list_keys_in_wallet}; +pub use list_multisg::{ListMultisgError, list_multisg}; +pub use list_wallets::{ListWalletsError, list_wallets}; +pub use release_wallet_handle_token::{ReleaseWalletHandleTokenError, release_wallet_handle_token}; +pub use rename_wallet::{RenameWalletError, rename_wallet}; +pub use renew_wallet_handle_token::{RenewWalletHandleTokenError, renew_wallet_handle_token}; +pub use sign_multisig_program::{SignMultisigProgramError, sign_multisig_program}; +pub use sign_multisig_transaction::{SignMultisigTransactionError, sign_multisig_transaction}; +pub use sign_program::{SignProgramError, sign_program}; +pub use sign_transaction::{SignTransactionError, sign_transaction}; +pub use swagger_handler::{SwaggerHandlerError, swagger_handler}; diff --git a/crates/kmd_client/src/apis/release_wallet_handle_token.rs b/crates/kmd_client/src/apis/release_wallet_handle_token.rs new file mode 100644 index 000000000..5ef65462e --- /dev/null +++ b/crates/kmd_client/src/apis/release_wallet_handle_token.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostWalletReleaseResponse; + +// Import request body type if needed +use crate::models::ReleaseWalletHandleTokenRequest; + +/// struct for typed errors of method [`release_wallet_handle_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum ReleaseWalletHandleTokenError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Invalidate the passed wallet handle token, making it invalid for use in subsequent requests. +pub async fn release_wallet_handle_token( + http_client: &dyn HttpClient, + request: ReleaseWalletHandleTokenRequest, +) -> Result { + let p_request = request; + + let path = "/v1/wallet/release".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/rename_wallet.rs b/crates/kmd_client/src/apis/rename_wallet.rs new file mode 100644 index 000000000..bdf152222 --- /dev/null +++ b/crates/kmd_client/src/apis/rename_wallet.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostWalletRenameResponse; + +// Import request body type if needed +use crate::models::RenameWalletRequest; + +/// struct for typed errors of method [`rename_wallet`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum RenameWalletError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Rename the underlying wallet to something else +pub async fn rename_wallet( + http_client: &dyn HttpClient, + request: RenameWalletRequest, +) -> Result { + let p_request = request; + + let path = "/v1/wallet/rename".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/renew_wallet_handle_token.rs b/crates/kmd_client/src/apis/renew_wallet_handle_token.rs new file mode 100644 index 000000000..0fc6ee4e8 --- /dev/null +++ b/crates/kmd_client/src/apis/renew_wallet_handle_token.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostWalletRenewResponse; + +// Import request body type if needed +use crate::models::RenewWalletHandleTokenRequest; + +/// struct for typed errors of method [`renew_wallet_handle_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum RenewWalletHandleTokenError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Renew a wallet handle token, increasing its expiration duration to its initial value +pub async fn renew_wallet_handle_token( + http_client: &dyn HttpClient, + request: RenewWalletHandleTokenRequest, +) -> Result { + let p_request = request; + + let path = "/v1/wallet/renew".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/sign_multisig_program.rs b/crates/kmd_client/src/apis/sign_multisig_program.rs new file mode 100644 index 000000000..652221381 --- /dev/null +++ b/crates/kmd_client/src/apis/sign_multisig_program.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostMultisigProgramSignResponse; + +// Import request body type if needed +use crate::models::SignProgramMultisigRequest; + +/// struct for typed errors of method [`sign_multisig_program`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum SignMultisigProgramError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Start a multisig signature, or add a signature to a partially completed multisig signature object. +pub async fn sign_multisig_program( + http_client: &dyn HttpClient, + request: SignProgramMultisigRequest, +) -> Result { + let p_request = request; + + let path = "/v1/multisig/signprogram".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/sign_multisig_transaction.rs b/crates/kmd_client/src/apis/sign_multisig_transaction.rs new file mode 100644 index 000000000..ab2910414 --- /dev/null +++ b/crates/kmd_client/src/apis/sign_multisig_transaction.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostMultisigTransactionSignResponse; + +// Import request body type if needed +use crate::models::SignMultisigRequest; + +/// struct for typed errors of method [`sign_multisig_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum SignMultisigTransactionError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Start a multisig signature, or add a signature to a partially completed multisig signature object. +pub async fn sign_multisig_transaction( + http_client: &dyn HttpClient, + request: SignMultisigRequest, +) -> Result { + let p_request = request; + + let path = "/v1/multisig/sign".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/sign_program.rs b/crates/kmd_client/src/apis/sign_program.rs new file mode 100644 index 000000000..153310d3f --- /dev/null +++ b/crates/kmd_client/src/apis/sign_program.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostProgramSignResponse; + +// Import request body type if needed +use crate::models::SignProgramRequest; + +/// struct for typed errors of method [`sign_program`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum SignProgramError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Signs the passed program with a key from the wallet, determined by the account named in the request. +pub async fn sign_program( + http_client: &dyn HttpClient, + request: SignProgramRequest, +) -> Result { + let p_request = request; + + let path = "/v1/program/sign".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/sign_transaction.rs b/crates/kmd_client/src/apis/sign_transaction.rs new file mode 100644 index 000000000..e678fce5f --- /dev/null +++ b/crates/kmd_client/src/apis/sign_transaction.rs @@ -0,0 +1,87 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint +use crate::models::Apiv1PostTransactionSignResponse; + +// Import request body type if needed +use crate::models::SignTransactionRequest; + +/// struct for typed errors of method [`sign_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum SignTransactionError { + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Signs the passed transaction with a key from the wallet, determined by the sender encoded in the transaction. +pub async fn sign_transaction( + http_client: &dyn HttpClient, + request: SignTransactionRequest, +) -> Result { + let p_request = request; + + let path = "/v1/transaction/sign".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { + message: e.to_string(), + })?); + + let response = http_client + .request( + HttpMethod::Post, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/apis/swagger_handler.rs b/crates/kmd_client/src/apis/swagger_handler.rs new file mode 100644 index 000000000..650219993 --- /dev/null +++ b/crates/kmd_client/src/apis/swagger_handler.rs @@ -0,0 +1,79 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use algokit_http_client::{HttpClient, HttpMethod}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +use super::{ContentType, Error, KmdApiError}; + +// Import all custom types used by this endpoint + +// Import request body type if needed + +/// struct for typed errors of method [`swagger_handler`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Error))] +pub enum SwaggerHandlerError { + Statusdefault(), + DefaultResponse(), + UnknownValue(crate::models::UnknownJsonValue), +} + +/// Returns the entire swagger spec in json. +pub async fn swagger_handler(http_client: &dyn HttpClient) -> Result { + let path = "/swagger.json".to_string(); + + let query_params: HashMap = HashMap::new(); + + let mut headers: HashMap = HashMap::new(); + headers.insert("Content-Type".to_string(), "application/json".to_string()); + headers.insert("Accept".to_string(), "application/json".to_string()); + + let body = None; + + let response = http_client + .request( + HttpMethod::Get, + path, + Some(query_params), + body, + Some(headers), + ) + .await + .map_err(|e| Error::Http { source: e })?; + + let content_type = response + .headers + .get("content-type") + .map(|s| s.as_str()) + .unwrap_or("application/json"); + + match ContentType::from(content_type) { + ContentType::Json => serde_json::from_slice(&response.body).map_err(|e| Error::Serde { + message: e.to_string(), + }), + ContentType::MsgPack => Err(Error::Serde { + message: "MsgPack not supported".to_string(), + }), + ContentType::Text => { + let text = String::from_utf8(response.body).map_err(|e| Error::Serde { + message: e.to_string(), + })?; + Err(Error::Serde { + message: format!("Unexpected text response: {}", text), + }) + } + ContentType::Unsupported(ct) => Err(Error::Serde { + message: format!("Unsupported content type: {}", ct), + }), + } +} diff --git a/crates/kmd_client/src/lib.rs b/crates/kmd_client/src/lib.rs new file mode 100644 index 000000000..8920d62cc --- /dev/null +++ b/crates/kmd_client/src/lib.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +#![allow(clippy::too_many_arguments)] + +#[cfg(feature = "ffi_uniffi")] +uniffi::setup_scaffolding!(); + +pub mod apis; +pub mod models; + +// Re-export the main client for convenience +pub use apis::KmdClient; diff --git a/crates/kmd_client/src/models/apiv1_delete_key_response.rs b/crates/kmd_client/src/models/apiv1_delete_key_response.rs new file mode 100644 index 000000000..11d7e6d0b --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_delete_key_response.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1DELETEKeyResponse is the response to `DELETE /v1/key` +/// friendly:DeleteKeyResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1DeleteKeyResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1DeleteKeyResponse { + /// Default constructor for Apiv1DeleteKeyResponse + pub fn new() -> Apiv1DeleteKeyResponse { + Apiv1DeleteKeyResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_delete_multisig_response.rs b/crates/kmd_client/src/models/apiv1_delete_multisig_response.rs new file mode 100644 index 000000000..05956dc11 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_delete_multisig_response.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` +/// friendly:DeleteMultisigResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1DeleteMultisigResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1DeleteMultisigResponse { + /// Default constructor for Apiv1DeleteMultisigResponse + pub fn new() -> Apiv1DeleteMultisigResponse { + Apiv1DeleteMultisigResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_get_wallets_response.rs b/crates/kmd_client/src/models/apiv1_get_wallets_response.rs new file mode 100644 index 000000000..3dbce058f --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_get_wallets_response.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Apiv1Wallet; + +/// APIV1GETWalletsResponse is the response to `GET /v1/wallets` +/// friendly:ListWalletsResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1GetWalletsResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "wallets", skip_serializing_if = "Option::is_none")] + pub wallets: Option>, +} + +impl Apiv1GetWalletsResponse { + /// Default constructor for Apiv1GetWalletsResponse + pub fn new() -> Apiv1GetWalletsResponse { + Apiv1GetWalletsResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_key_export_response.rs b/crates/kmd_client/src/models/apiv1_post_key_export_response.rs new file mode 100644 index 000000000..ed2ccbd6f --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_key_export_response.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` +/// friendly:ExportKeyResponse +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostKeyExportResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde_as(as = "Option")] + #[serde(rename = "private_key", skip_serializing_if = "Option::is_none")] + pub private_key: Option>, +} + +impl Apiv1PostKeyExportResponse { + /// Default constructor for Apiv1PostKeyExportResponse + pub fn new() -> Apiv1PostKeyExportResponse { + Apiv1PostKeyExportResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_key_import_response.rs b/crates/kmd_client/src/models/apiv1_post_key_import_response.rs new file mode 100644 index 000000000..c997074f0 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_key_import_response.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` +/// friendly:ImportKeyResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostKeyImportResponse { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostKeyImportResponse { + /// Default constructor for Apiv1PostKeyImportResponse + pub fn new() -> Apiv1PostKeyImportResponse { + Apiv1PostKeyImportResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_key_list_response.rs b/crates/kmd_client/src/models/apiv1_post_key_list_response.rs new file mode 100644 index 000000000..34c7e2bed --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_key_list_response.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTKeyListResponse is the response to `POST /v1/key/list` +/// friendly:ListKeysResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostKeyListResponse { + #[serde(rename = "addresses", skip_serializing_if = "Option::is_none")] + pub addresses: Option>, + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostKeyListResponse { + /// Default constructor for Apiv1PostKeyListResponse + pub fn new() -> Apiv1PostKeyListResponse { + Apiv1PostKeyListResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_key_response.rs b/crates/kmd_client/src/models/apiv1_post_key_response.rs new file mode 100644 index 000000000..399919dba --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_key_response.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTKeyResponse is the response to `POST /v1/key` +/// friendly:GenerateKeyResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostKeyResponse { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostKeyResponse { + /// Default constructor for Apiv1PostKeyResponse + pub fn new() -> Apiv1PostKeyResponse { + Apiv1PostKeyResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs b/crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs new file mode 100644 index 000000000..feb093ffc --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs @@ -0,0 +1,37 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::MasterDerivationKey; + +/// APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` +/// friendly:ExportMasterKeyResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostMasterKeyExportResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde( + rename = "master_derivation_key", + skip_serializing_if = "Option::is_none" + )] + pub master_derivation_key: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostMasterKeyExportResponse { + /// Default constructor for Apiv1PostMasterKeyExportResponse + pub fn new() -> Apiv1PostMasterKeyExportResponse { + Apiv1PostMasterKeyExportResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs b/crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs new file mode 100644 index 000000000..264aeb2ed --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs @@ -0,0 +1,38 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::PublicKey; + +/// APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` +/// friendly:ExportMultisigResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostMultisigExportResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "multisig_version", skip_serializing_if = "Option::is_none")] + pub multisig_version: Option, + #[serde(rename = "pks", skip_serializing_if = "Option::is_none")] + pub pks: Option>, + #[serde(rename = "threshold", skip_serializing_if = "Option::is_none")] + pub threshold: Option, +} + +impl Apiv1PostMultisigExportResponse { + /// Default constructor for Apiv1PostMultisigExportResponse + pub fn new() -> Apiv1PostMultisigExportResponse { + Apiv1PostMultisigExportResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs b/crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs new file mode 100644 index 000000000..423fe976d --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` +/// friendly:ImportMultisigResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostMultisigImportResponse { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostMultisigImportResponse { + /// Default constructor for Apiv1PostMultisigImportResponse + pub fn new() -> Apiv1PostMultisigImportResponse { + Apiv1PostMultisigImportResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs b/crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs new file mode 100644 index 000000000..aaae916e2 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` +/// friendly:ListMultisigResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostMultisigListResponse { + #[serde(rename = "addresses", skip_serializing_if = "Option::is_none")] + pub addresses: Option>, + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostMultisigListResponse { + /// Default constructor for Apiv1PostMultisigListResponse + pub fn new() -> Apiv1PostMultisigListResponse { + Apiv1PostMultisigListResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs b/crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs new file mode 100644 index 000000000..810ef1d08 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` +/// friendly:SignProgramMultisigResponse +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostMultisigProgramSignResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde_as(as = "Option")] + #[serde(rename = "multisig", skip_serializing_if = "Option::is_none")] + pub multisig: Option>, +} + +impl Apiv1PostMultisigProgramSignResponse { + /// Default constructor for Apiv1PostMultisigProgramSignResponse + pub fn new() -> Apiv1PostMultisigProgramSignResponse { + Apiv1PostMultisigProgramSignResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs b/crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs new file mode 100644 index 000000000..dc261ce44 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` +/// friendly:SignMultisigResponse +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostMultisigTransactionSignResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde_as(as = "Option")] + #[serde(rename = "multisig", skip_serializing_if = "Option::is_none")] + pub multisig: Option>, +} + +impl Apiv1PostMultisigTransactionSignResponse { + /// Default constructor for Apiv1PostMultisigTransactionSignResponse + pub fn new() -> Apiv1PostMultisigTransactionSignResponse { + Apiv1PostMultisigTransactionSignResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_program_sign_response.rs b/crates/kmd_client/src/models/apiv1_post_program_sign_response.rs new file mode 100644 index 000000000..f4411003a --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_program_sign_response.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` +/// friendly:SignProgramResponse +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostProgramSignResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde_as(as = "Option")] + #[serde(rename = "sig", skip_serializing_if = "Option::is_none")] + pub sig: Option>, +} + +impl Apiv1PostProgramSignResponse { + /// Default constructor for Apiv1PostProgramSignResponse + pub fn new() -> Apiv1PostProgramSignResponse { + Apiv1PostProgramSignResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs b/crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs new file mode 100644 index 000000000..c459551d0 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` +/// friendly:SignTransactionResponse +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostTransactionSignResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde_as(as = "Option")] + #[serde(rename = "signed_transaction", skip_serializing_if = "Option::is_none")] + pub signed_transaction: Option>, +} + +impl Apiv1PostTransactionSignResponse { + /// Default constructor for Apiv1PostTransactionSignResponse + pub fn new() -> Apiv1PostTransactionSignResponse { + Apiv1PostTransactionSignResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs b/crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs new file mode 100644 index 000000000..c782b4ec1 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Apiv1WalletHandle; + +/// APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` +/// friendly:WalletInfoResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostWalletInfoResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "wallet_handle", skip_serializing_if = "Option::is_none")] + pub wallet_handle: Option, +} + +impl Apiv1PostWalletInfoResponse { + /// Default constructor for Apiv1PostWalletInfoResponse + pub fn new() -> Apiv1PostWalletInfoResponse { + Apiv1PostWalletInfoResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs b/crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs new file mode 100644 index 000000000..9121da280 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` +/// friendly:InitWalletHandleTokenResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostWalletInitResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl Apiv1PostWalletInitResponse { + /// Default constructor for Apiv1PostWalletInitResponse + pub fn new() -> Apiv1PostWalletInitResponse { + Apiv1PostWalletInitResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs b/crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs new file mode 100644 index 000000000..96ec79980 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` +/// friendly:ReleaseWalletHandleTokenResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostWalletReleaseResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl Apiv1PostWalletReleaseResponse { + /// Default constructor for Apiv1PostWalletReleaseResponse + pub fn new() -> Apiv1PostWalletReleaseResponse { + Apiv1PostWalletReleaseResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs b/crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs new file mode 100644 index 000000000..96d757dc2 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Apiv1Wallet; + +/// APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` +/// friendly:RenameWalletResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostWalletRenameResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "wallet", skip_serializing_if = "Option::is_none")] + pub wallet: Option, +} + +impl Apiv1PostWalletRenameResponse { + /// Default constructor for Apiv1PostWalletRenameResponse + pub fn new() -> Apiv1PostWalletRenameResponse { + Apiv1PostWalletRenameResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs b/crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs new file mode 100644 index 000000000..75058eaf0 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Apiv1WalletHandle; + +/// APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` +/// friendly:RenewWalletHandleTokenResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostWalletRenewResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "wallet_handle", skip_serializing_if = "Option::is_none")] + pub wallet_handle: Option, +} + +impl Apiv1PostWalletRenewResponse { + /// Default constructor for Apiv1PostWalletRenewResponse + pub fn new() -> Apiv1PostWalletRenewResponse { + Apiv1PostWalletRenewResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_response.rs b/crates/kmd_client/src/models/apiv1_post_wallet_response.rs new file mode 100644 index 000000000..7cf8fa7b9 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_post_wallet_response.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Apiv1Wallet; + +/// APIV1POSTWalletResponse is the response to `POST /v1/wallet` +/// friendly:CreateWalletResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1PostWalletResponse { + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "wallet", skip_serializing_if = "Option::is_none")] + pub wallet: Option, +} + +impl Apiv1PostWalletResponse { + /// Default constructor for Apiv1PostWalletResponse + pub fn new() -> Apiv1PostWalletResponse { + Apiv1PostWalletResponse::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_wallet.rs b/crates/kmd_client/src/models/apiv1_wallet.rs new file mode 100644 index 000000000..8375ec4b4 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_wallet.rs @@ -0,0 +1,39 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::TxType; + +/// APIV1Wallet is the API's representation of a wallet +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1Wallet { + #[serde(rename = "driver_name", skip_serializing_if = "Option::is_none")] + pub driver_name: Option, + #[serde(rename = "driver_version", skip_serializing_if = "Option::is_none")] + pub driver_version: Option, + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "mnemonic_ux", skip_serializing_if = "Option::is_none")] + pub mnemonic_ux: Option, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "supported_txs", skip_serializing_if = "Option::is_none")] + pub supported_txs: Option>, +} + +impl Apiv1Wallet { + /// Default constructor for Apiv1Wallet + pub fn new() -> Apiv1Wallet { + Apiv1Wallet::default() + } +} diff --git a/crates/kmd_client/src/models/apiv1_wallet_handle.rs b/crates/kmd_client/src/models/apiv1_wallet_handle.rs new file mode 100644 index 000000000..aac6a8336 --- /dev/null +++ b/crates/kmd_client/src/models/apiv1_wallet_handle.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Apiv1Wallet; + +/// APIV1WalletHandle includes the wallet the handle corresponds to +/// and the number of number of seconds to expiration +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct Apiv1WalletHandle { + #[serde(rename = "expires_seconds", skip_serializing_if = "Option::is_none")] + pub expires_seconds: Option, + #[serde(rename = "wallet", skip_serializing_if = "Option::is_none")] + pub wallet: Option, +} + +impl Apiv1WalletHandle { + /// Default constructor for Apiv1WalletHandle + pub fn new() -> Apiv1WalletHandle { + Apiv1WalletHandle::default() + } +} diff --git a/crates/kmd_client/src/models/create_wallet_request.rs b/crates/kmd_client/src/models/create_wallet_request.rs new file mode 100644 index 000000000..89580cfff --- /dev/null +++ b/crates/kmd_client/src/models/create_wallet_request.rs @@ -0,0 +1,38 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::MasterDerivationKey; + +/// APIV1POSTWalletRequest is the request for `POST /v1/wallet` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct CreateWalletRequest { + #[serde( + rename = "master_derivation_key", + skip_serializing_if = "Option::is_none" + )] + pub master_derivation_key: Option, + #[serde(rename = "wallet_driver_name", skip_serializing_if = "Option::is_none")] + pub wallet_driver_name: Option, + #[serde(rename = "wallet_name", skip_serializing_if = "Option::is_none")] + pub wallet_name: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl CreateWalletRequest { + /// Default constructor for CreateWalletRequest + pub fn new() -> CreateWalletRequest { + CreateWalletRequest::default() + } +} diff --git a/crates/kmd_client/src/models/delete_key_request.rs b/crates/kmd_client/src/models/delete_key_request.rs new file mode 100644 index 000000000..5d628240b --- /dev/null +++ b/crates/kmd_client/src/models/delete_key_request.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1DELETEKeyRequest is the request for `DELETE /v1/key` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct DeleteKeyRequest { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl DeleteKeyRequest { + /// Default constructor for DeleteKeyRequest + pub fn new() -> DeleteKeyRequest { + DeleteKeyRequest::default() + } +} diff --git a/crates/kmd_client/src/models/delete_multisig_request.rs b/crates/kmd_client/src/models/delete_multisig_request.rs new file mode 100644 index 000000000..6d3719801 --- /dev/null +++ b/crates/kmd_client/src/models/delete_multisig_request.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1DELETEMultisigRequest is the request for `DELETE /v1/multisig` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct DeleteMultisigRequest { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl DeleteMultisigRequest { + /// Default constructor for DeleteMultisigRequest + pub fn new() -> DeleteMultisigRequest { + DeleteMultisigRequest::default() + } +} diff --git a/crates/kmd_client/src/models/digest.rs b/crates/kmd_client/src/models/digest.rs new file mode 100644 index 000000000..9837a14ce --- /dev/null +++ b/crates/kmd_client/src/models/digest.rs @@ -0,0 +1,14 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +pub type Digest = Vec; diff --git a/crates/kmd_client/src/models/ed25519_private_key.rs b/crates/kmd_client/src/models/ed25519_private_key.rs new file mode 100644 index 000000000..a317ec288 --- /dev/null +++ b/crates/kmd_client/src/models/ed25519_private_key.rs @@ -0,0 +1,14 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +pub type Ed25519PrivateKey = Vec; diff --git a/crates/kmd_client/src/models/ed25519_public_key.rs b/crates/kmd_client/src/models/ed25519_public_key.rs new file mode 100644 index 000000000..58a582fc2 --- /dev/null +++ b/crates/kmd_client/src/models/ed25519_public_key.rs @@ -0,0 +1,14 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +pub type Ed25519PublicKey = Vec; diff --git a/crates/kmd_client/src/models/ed25519_signature.rs b/crates/kmd_client/src/models/ed25519_signature.rs new file mode 100644 index 000000000..fe49d4682 --- /dev/null +++ b/crates/kmd_client/src/models/ed25519_signature.rs @@ -0,0 +1,14 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +pub type Ed25519Signature = Vec; diff --git a/crates/kmd_client/src/models/export_key_request.rs b/crates/kmd_client/src/models/export_key_request.rs new file mode 100644 index 000000000..5052bea26 --- /dev/null +++ b/crates/kmd_client/src/models/export_key_request.rs @@ -0,0 +1,34 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTKeyExportRequest is the request for `POST /v1/key/export` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ExportKeyRequest { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl ExportKeyRequest { + /// Default constructor for ExportKeyRequest + pub fn new() -> ExportKeyRequest { + ExportKeyRequest::default() + } +} diff --git a/crates/kmd_client/src/models/export_master_key_request.rs b/crates/kmd_client/src/models/export_master_key_request.rs new file mode 100644 index 000000000..2d1746c99 --- /dev/null +++ b/crates/kmd_client/src/models/export_master_key_request.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTMasterKeyExportRequest is the request for `POST /v1/master-key/export` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ExportMasterKeyRequest { + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl ExportMasterKeyRequest { + /// Default constructor for ExportMasterKeyRequest + pub fn new() -> ExportMasterKeyRequest { + ExportMasterKeyRequest::default() + } +} diff --git a/crates/kmd_client/src/models/export_multisig_request.rs b/crates/kmd_client/src/models/export_multisig_request.rs new file mode 100644 index 000000000..64b90fbf0 --- /dev/null +++ b/crates/kmd_client/src/models/export_multisig_request.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTMultisigExportRequest is the request for `POST /v1/multisig/export` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ExportMultisigRequest { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl ExportMultisigRequest { + /// Default constructor for ExportMultisigRequest + pub fn new() -> ExportMultisigRequest { + ExportMultisigRequest::default() + } +} diff --git a/crates/kmd_client/src/models/generate_key_request.rs b/crates/kmd_client/src/models/generate_key_request.rs new file mode 100644 index 000000000..935324673 --- /dev/null +++ b/crates/kmd_client/src/models/generate_key_request.rs @@ -0,0 +1,32 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTKeyRequest is the request for `POST /v1/key` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct GenerateKeyRequest { + #[serde(rename = "display_mnemonic", skip_serializing_if = "Option::is_none")] + pub display_mnemonic: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl GenerateKeyRequest { + /// Default constructor for GenerateKeyRequest + pub fn new() -> GenerateKeyRequest { + GenerateKeyRequest::default() + } +} diff --git a/crates/kmd_client/src/models/import_key_request.rs b/crates/kmd_client/src/models/import_key_request.rs new file mode 100644 index 000000000..e649d4c90 --- /dev/null +++ b/crates/kmd_client/src/models/import_key_request.rs @@ -0,0 +1,35 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTKeyImportRequest is the request for `POST /v1/key/import` +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ImportKeyRequest { + #[serde_as(as = "Option")] + #[serde(rename = "private_key", skip_serializing_if = "Option::is_none")] + pub private_key: Option>, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl ImportKeyRequest { + /// Default constructor for ImportKeyRequest + pub fn new() -> ImportKeyRequest { + ImportKeyRequest::default() + } +} diff --git a/crates/kmd_client/src/models/import_multisig_request.rs b/crates/kmd_client/src/models/import_multisig_request.rs new file mode 100644 index 000000000..73999919e --- /dev/null +++ b/crates/kmd_client/src/models/import_multisig_request.rs @@ -0,0 +1,38 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::PublicKey; + +/// APIV1POSTMultisigImportRequest is the request for `POST /v1/multisig/import` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ImportMultisigRequest { + #[serde(rename = "multisig_version", skip_serializing_if = "Option::is_none")] + pub multisig_version: Option, + #[serde(rename = "pks", skip_serializing_if = "Option::is_none")] + pub pks: Option>, + #[serde(rename = "threshold", skip_serializing_if = "Option::is_none")] + pub threshold: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl ImportMultisigRequest { + /// Default constructor for ImportMultisigRequest + pub fn new() -> ImportMultisigRequest { + ImportMultisigRequest::default() + } +} diff --git a/crates/kmd_client/src/models/init_wallet_handle_token_request.rs b/crates/kmd_client/src/models/init_wallet_handle_token_request.rs new file mode 100644 index 000000000..acfa7db87 --- /dev/null +++ b/crates/kmd_client/src/models/init_wallet_handle_token_request.rs @@ -0,0 +1,29 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletInitRequest is the request for `POST /v1/wallet/init` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct InitWalletHandleTokenRequest { + #[serde(rename = "wallet_id", skip_serializing_if = "Option::is_none")] + pub wallet_id: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl InitWalletHandleTokenRequest { + /// Default constructor for InitWalletHandleTokenRequest + pub fn new() -> InitWalletHandleTokenRequest { + InitWalletHandleTokenRequest::default() + } +} diff --git a/crates/kmd_client/src/models/list_keys_request.rs b/crates/kmd_client/src/models/list_keys_request.rs new file mode 100644 index 000000000..12c57081b --- /dev/null +++ b/crates/kmd_client/src/models/list_keys_request.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTKeyListRequest is the request for `POST /v1/key/list` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ListKeysRequest { + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl ListKeysRequest { + /// Default constructor for ListKeysRequest + pub fn new() -> ListKeysRequest { + ListKeysRequest::default() + } +} diff --git a/crates/kmd_client/src/models/list_multisig_request.rs b/crates/kmd_client/src/models/list_multisig_request.rs new file mode 100644 index 000000000..d540c2eda --- /dev/null +++ b/crates/kmd_client/src/models/list_multisig_request.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTMultisigListRequest is the request for `POST /v1/multisig/list` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ListMultisigRequest { + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl ListMultisigRequest { + /// Default constructor for ListMultisigRequest + pub fn new() -> ListMultisigRequest { + ListMultisigRequest::default() + } +} diff --git a/crates/kmd_client/src/models/list_wallets_request.rs b/crates/kmd_client/src/models/list_wallets_request.rs new file mode 100644 index 000000000..6f6c49e4f --- /dev/null +++ b/crates/kmd_client/src/models/list_wallets_request.rs @@ -0,0 +1,24 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1GETWalletsRequest is the request for `GET /v1/wallets` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ListWalletsRequest {} + +impl ListWalletsRequest { + /// Default constructor for ListWalletsRequest + pub fn new() -> ListWalletsRequest { + ListWalletsRequest::default() + } +} diff --git a/crates/kmd_client/src/models/master_derivation_key.rs b/crates/kmd_client/src/models/master_derivation_key.rs new file mode 100644 index 000000000..db9e9ee30 --- /dev/null +++ b/crates/kmd_client/src/models/master_derivation_key.rs @@ -0,0 +1,15 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// MasterDerivationKey is used to derive ed25519 keys for use in wallets +pub type MasterDerivationKey = Vec; diff --git a/crates/kmd_client/src/models/mod.rs b/crates/kmd_client/src/models/mod.rs new file mode 100644 index 000000000..e5b879a96 --- /dev/null +++ b/crates/kmd_client/src/models/mod.rs @@ -0,0 +1,130 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +#[cfg(feature = "ffi_uniffi")] +pub type UnknownJsonValue = String; + +#[cfg(not(feature = "ffi_uniffi"))] +pub type UnknownJsonValue = serde_json::Value; + +pub mod apiv1_delete_key_response; +pub use self::apiv1_delete_key_response::Apiv1DeleteKeyResponse; +pub mod apiv1_delete_multisig_response; +pub use self::apiv1_delete_multisig_response::Apiv1DeleteMultisigResponse; +pub mod apiv1_get_wallets_response; +pub use self::apiv1_get_wallets_response::Apiv1GetWalletsResponse; +pub mod apiv1_post_key_export_response; +pub use self::apiv1_post_key_export_response::Apiv1PostKeyExportResponse; +pub mod apiv1_post_key_import_response; +pub use self::apiv1_post_key_import_response::Apiv1PostKeyImportResponse; +pub mod apiv1_post_key_list_response; +pub use self::apiv1_post_key_list_response::Apiv1PostKeyListResponse; +pub mod apiv1_post_key_response; +pub use self::apiv1_post_key_response::Apiv1PostKeyResponse; +pub mod apiv1_post_master_key_export_response; +pub use self::apiv1_post_master_key_export_response::Apiv1PostMasterKeyExportResponse; +pub mod apiv1_post_multisig_export_response; +pub use self::apiv1_post_multisig_export_response::Apiv1PostMultisigExportResponse; +pub mod apiv1_post_multisig_import_response; +pub use self::apiv1_post_multisig_import_response::Apiv1PostMultisigImportResponse; +pub mod apiv1_post_multisig_list_response; +pub use self::apiv1_post_multisig_list_response::Apiv1PostMultisigListResponse; +pub mod apiv1_post_multisig_program_sign_response; +pub use self::apiv1_post_multisig_program_sign_response::Apiv1PostMultisigProgramSignResponse; +pub mod apiv1_post_multisig_transaction_sign_response; +pub use self::apiv1_post_multisig_transaction_sign_response::Apiv1PostMultisigTransactionSignResponse; +pub mod apiv1_post_program_sign_response; +pub use self::apiv1_post_program_sign_response::Apiv1PostProgramSignResponse; +pub mod apiv1_post_transaction_sign_response; +pub use self::apiv1_post_transaction_sign_response::Apiv1PostTransactionSignResponse; +pub mod apiv1_post_wallet_info_response; +pub use self::apiv1_post_wallet_info_response::Apiv1PostWalletInfoResponse; +pub mod apiv1_post_wallet_init_response; +pub use self::apiv1_post_wallet_init_response::Apiv1PostWalletInitResponse; +pub mod apiv1_post_wallet_release_response; +pub use self::apiv1_post_wallet_release_response::Apiv1PostWalletReleaseResponse; +pub mod apiv1_post_wallet_rename_response; +pub use self::apiv1_post_wallet_rename_response::Apiv1PostWalletRenameResponse; +pub mod apiv1_post_wallet_renew_response; +pub use self::apiv1_post_wallet_renew_response::Apiv1PostWalletRenewResponse; +pub mod apiv1_post_wallet_response; +pub use self::apiv1_post_wallet_response::Apiv1PostWalletResponse; +pub mod apiv1_wallet; +pub use self::apiv1_wallet::Apiv1Wallet; +pub mod apiv1_wallet_handle; +pub use self::apiv1_wallet_handle::Apiv1WalletHandle; +pub mod create_wallet_request; +pub use self::create_wallet_request::CreateWalletRequest; +pub mod delete_key_request; +pub use self::delete_key_request::DeleteKeyRequest; +pub mod delete_multisig_request; +pub use self::delete_multisig_request::DeleteMultisigRequest; +pub mod digest; +pub use self::digest::Digest; +pub mod export_key_request; +pub use self::export_key_request::ExportKeyRequest; +pub mod export_master_key_request; +pub use self::export_master_key_request::ExportMasterKeyRequest; +pub mod export_multisig_request; +pub use self::export_multisig_request::ExportMultisigRequest; +pub mod generate_key_request; +pub use self::generate_key_request::GenerateKeyRequest; +pub mod import_key_request; +pub use self::import_key_request::ImportKeyRequest; +pub mod import_multisig_request; +pub use self::import_multisig_request::ImportMultisigRequest; +pub mod init_wallet_handle_token_request; +pub use self::init_wallet_handle_token_request::InitWalletHandleTokenRequest; +pub mod list_keys_request; +pub use self::list_keys_request::ListKeysRequest; +pub mod list_multisig_request; +pub use self::list_multisig_request::ListMultisigRequest; +pub mod list_wallets_request; +pub use self::list_wallets_request::ListWalletsRequest; +pub mod master_derivation_key; +pub use self::master_derivation_key::MasterDerivationKey; +pub mod multisig_sig; +pub use self::multisig_sig::MultisigSig; +pub mod multisig_subsig; +pub use self::multisig_subsig::MultisigSubsig; +pub mod private_key; +pub use self::private_key::PrivateKey; +pub mod public_key; +pub use self::public_key::PublicKey; +pub mod release_wallet_handle_token_request; +pub use self::release_wallet_handle_token_request::ReleaseWalletHandleTokenRequest; +pub mod rename_wallet_request; +pub use self::rename_wallet_request::RenameWalletRequest; +pub mod renew_wallet_handle_token_request; +pub use self::renew_wallet_handle_token_request::RenewWalletHandleTokenRequest; +pub mod sign_multisig_request; +pub use self::sign_multisig_request::SignMultisigRequest; +pub mod sign_program_multisig_request; +pub use self::sign_program_multisig_request::SignProgramMultisigRequest; +pub mod sign_program_request; +pub use self::sign_program_request::SignProgramRequest; +pub mod sign_transaction_request; +pub use self::sign_transaction_request::SignTransactionRequest; +pub mod signature; +pub use self::signature::Signature; +pub mod tx_type; +pub use self::tx_type::TxType; +pub mod versions_request; +pub use self::versions_request::VersionsRequest; +pub mod versions_response; +pub use self::versions_response::VersionsResponse; +pub mod wallet_info_request; +pub use self::wallet_info_request::WalletInfoRequest; +pub mod ed25519_private_key; +pub use self::ed25519_private_key::Ed25519PrivateKey; +pub mod ed25519_public_key; +pub use self::ed25519_public_key::Ed25519PublicKey; +pub mod ed25519_signature; +pub use self::ed25519_signature::Ed25519Signature; diff --git a/crates/kmd_client/src/models/multisig_sig.rs b/crates/kmd_client/src/models/multisig_sig.rs new file mode 100644 index 000000000..ac3aa4594 --- /dev/null +++ b/crates/kmd_client/src/models/multisig_sig.rs @@ -0,0 +1,33 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::MultisigSubsig; + +/// MultisigSig is the structure that holds multiple Subsigs +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct MultisigSig { + #[serde(rename = "Subsigs", skip_serializing_if = "Option::is_none")] + pub subsigs: Option>, + #[serde(rename = "Threshold", skip_serializing_if = "Option::is_none")] + pub threshold: Option, + #[serde(rename = "Version", skip_serializing_if = "Option::is_none")] + pub version: Option, +} + +impl MultisigSig { + /// Default constructor for MultisigSig + pub fn new() -> MultisigSig { + MultisigSig::default() + } +} diff --git a/crates/kmd_client/src/models/multisig_subsig.rs b/crates/kmd_client/src/models/multisig_subsig.rs new file mode 100644 index 000000000..54517a679 --- /dev/null +++ b/crates/kmd_client/src/models/multisig_subsig.rs @@ -0,0 +1,33 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::PublicKey; +use crate::models::Signature; + +/// MultisigSubsig is a struct that holds a pair of public key and signatures +/// signatures may be empty +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct MultisigSubsig { + #[serde(rename = "Key", skip_serializing_if = "Option::is_none")] + pub key: Option, + #[serde(rename = "Sig", skip_serializing_if = "Option::is_none")] + pub sig: Option, +} + +impl MultisigSubsig { + /// Default constructor for MultisigSubsig + pub fn new() -> MultisigSubsig { + MultisigSubsig::default() + } +} diff --git a/crates/kmd_client/src/models/private_key.rs b/crates/kmd_client/src/models/private_key.rs new file mode 100644 index 000000000..739075e79 --- /dev/null +++ b/crates/kmd_client/src/models/private_key.rs @@ -0,0 +1,16 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Ed25519PrivateKey; + +pub type PrivateKey = Ed25519PrivateKey; diff --git a/crates/kmd_client/src/models/public_key.rs b/crates/kmd_client/src/models/public_key.rs new file mode 100644 index 000000000..8651880bc --- /dev/null +++ b/crates/kmd_client/src/models/public_key.rs @@ -0,0 +1,16 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Ed25519PublicKey; + +pub type PublicKey = Ed25519PublicKey; diff --git a/crates/kmd_client/src/models/release_wallet_handle_token_request.rs b/crates/kmd_client/src/models/release_wallet_handle_token_request.rs new file mode 100644 index 000000000..3047396d6 --- /dev/null +++ b/crates/kmd_client/src/models/release_wallet_handle_token_request.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletReleaseRequest is the request for `POST /v1/wallet/release` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct ReleaseWalletHandleTokenRequest { + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl ReleaseWalletHandleTokenRequest { + /// Default constructor for ReleaseWalletHandleTokenRequest + pub fn new() -> ReleaseWalletHandleTokenRequest { + ReleaseWalletHandleTokenRequest::default() + } +} diff --git a/crates/kmd_client/src/models/rename_wallet_request.rs b/crates/kmd_client/src/models/rename_wallet_request.rs new file mode 100644 index 000000000..bbfedc9a5 --- /dev/null +++ b/crates/kmd_client/src/models/rename_wallet_request.rs @@ -0,0 +1,31 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletRenameRequest is the request for `POST /v1/wallet/rename` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct RenameWalletRequest { + #[serde(rename = "wallet_id", skip_serializing_if = "Option::is_none")] + pub wallet_id: Option, + #[serde(rename = "wallet_name", skip_serializing_if = "Option::is_none")] + pub wallet_name: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl RenameWalletRequest { + /// Default constructor for RenameWalletRequest + pub fn new() -> RenameWalletRequest { + RenameWalletRequest::default() + } +} diff --git a/crates/kmd_client/src/models/renew_wallet_handle_token_request.rs b/crates/kmd_client/src/models/renew_wallet_handle_token_request.rs new file mode 100644 index 000000000..59f50026f --- /dev/null +++ b/crates/kmd_client/src/models/renew_wallet_handle_token_request.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletRenewRequest is the request for `POST /v1/wallet/renew` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct RenewWalletHandleTokenRequest { + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl RenewWalletHandleTokenRequest { + /// Default constructor for RenewWalletHandleTokenRequest + pub fn new() -> RenewWalletHandleTokenRequest { + RenewWalletHandleTokenRequest::default() + } +} diff --git a/crates/kmd_client/src/models/sign_multisig_request.rs b/crates/kmd_client/src/models/sign_multisig_request.rs new file mode 100644 index 000000000..20fb1af4b --- /dev/null +++ b/crates/kmd_client/src/models/sign_multisig_request.rs @@ -0,0 +1,47 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +use crate::models::Digest; +use crate::models::MultisigSig; +use crate::models::PublicKey; + +/// APIV1POSTMultisigTransactionSignRequest is the request for `POST /v1/multisig/sign` +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct SignMultisigRequest { + #[serde(rename = "partial_multisig", skip_serializing_if = "Option::is_none")] + pub partial_multisig: Option, + #[serde(rename = "public_key", skip_serializing_if = "Option::is_none")] + pub public_key: Option, + #[serde(rename = "signer", skip_serializing_if = "Option::is_none")] + pub signer: Option, + #[serde_as(as = "Option")] + #[serde(rename = "transaction", skip_serializing_if = "Option::is_none")] + pub transaction: Option>, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl SignMultisigRequest { + /// Default constructor for SignMultisigRequest + pub fn new() -> SignMultisigRequest { + SignMultisigRequest::default() + } +} diff --git a/crates/kmd_client/src/models/sign_program_multisig_request.rs b/crates/kmd_client/src/models/sign_program_multisig_request.rs new file mode 100644 index 000000000..074168046 --- /dev/null +++ b/crates/kmd_client/src/models/sign_program_multisig_request.rs @@ -0,0 +1,48 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +use crate::models::MultisigSig; +use crate::models::PublicKey; + +/// APIV1POSTMultisigProgramSignRequest is the request for `POST /v1/multisig/signprogram` +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct SignProgramMultisigRequest { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde_as(as = "Option")] + #[serde(rename = "data", skip_serializing_if = "Option::is_none")] + pub data: Option>, + #[serde(rename = "partial_multisig", skip_serializing_if = "Option::is_none")] + pub partial_multisig: Option, + #[serde(rename = "public_key", skip_serializing_if = "Option::is_none")] + pub public_key: Option, + #[serde(rename = "use_legacy_msig", skip_serializing_if = "Option::is_none")] + pub use_legacy_msig: Option, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl SignProgramMultisigRequest { + /// Default constructor for SignProgramMultisigRequest + pub fn new() -> SignProgramMultisigRequest { + SignProgramMultisigRequest::default() + } +} diff --git a/crates/kmd_client/src/models/sign_program_request.rs b/crates/kmd_client/src/models/sign_program_request.rs new file mode 100644 index 000000000..a282f2fc6 --- /dev/null +++ b/crates/kmd_client/src/models/sign_program_request.rs @@ -0,0 +1,39 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +/// APIV1POSTProgramSignRequest is the request for `POST /v1/program/sign` +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct SignProgramRequest { + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, + #[serde_as(as = "Option")] + #[serde(rename = "data", skip_serializing_if = "Option::is_none")] + pub data: Option>, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl SignProgramRequest { + /// Default constructor for SignProgramRequest + pub fn new() -> SignProgramRequest { + SignProgramRequest::default() + } +} diff --git a/crates/kmd_client/src/models/sign_transaction_request.rs b/crates/kmd_client/src/models/sign_transaction_request.rs new file mode 100644 index 000000000..b439f02dc --- /dev/null +++ b/crates/kmd_client/src/models/sign_transaction_request.rs @@ -0,0 +1,45 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; +use serde_with::{Bytes, serde_as}; + +use crate::models::PublicKey; + +/// APIV1POSTTransactionSignRequest is the request for `POST /v1/transaction/sign` +#[serde_as] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct SignTransactionRequest { + #[serde(rename = "public_key", skip_serializing_if = "Option::is_none")] + pub public_key: Option, + /// Base64 encoding of msgpack encoding of a `Transaction` object + /// Note: SDK and goal usually generate `SignedTxn` objects + /// in that case, the field `txn` / `Transaction` of the + /// generated `SignedTxn` object needs to be used + #[serde_as(as = "Option")] + #[serde(rename = "transaction", skip_serializing_if = "Option::is_none")] + pub transaction: Option>, + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, + #[serde(rename = "wallet_password", skip_serializing_if = "Option::is_none")] + pub wallet_password: Option, +} + +impl SignTransactionRequest { + /// Default constructor for SignTransactionRequest + pub fn new() -> SignTransactionRequest { + SignTransactionRequest::default() + } +} diff --git a/crates/kmd_client/src/models/signature.rs b/crates/kmd_client/src/models/signature.rs new file mode 100644 index 000000000..6debb7ca6 --- /dev/null +++ b/crates/kmd_client/src/models/signature.rs @@ -0,0 +1,16 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use crate::models::Ed25519Signature; + +pub type Signature = Ed25519Signature; diff --git a/crates/kmd_client/src/models/tx_type.rs b/crates/kmd_client/src/models/tx_type.rs new file mode 100644 index 000000000..e8e1730ea --- /dev/null +++ b/crates/kmd_client/src/models/tx_type.rs @@ -0,0 +1,15 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// TxType is the type of the transaction written to the ledger +pub type TxType = String; diff --git a/crates/kmd_client/src/models/versions_request.rs b/crates/kmd_client/src/models/versions_request.rs new file mode 100644 index 000000000..2359dba21 --- /dev/null +++ b/crates/kmd_client/src/models/versions_request.rs @@ -0,0 +1,24 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// VersionsRequest is the request for `GET /versions` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct VersionsRequest {} + +impl VersionsRequest { + /// Default constructor for VersionsRequest + pub fn new() -> VersionsRequest { + VersionsRequest::default() + } +} diff --git a/crates/kmd_client/src/models/versions_response.rs b/crates/kmd_client/src/models/versions_response.rs new file mode 100644 index 000000000..cc68c3dd6 --- /dev/null +++ b/crates/kmd_client/src/models/versions_response.rs @@ -0,0 +1,28 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// VersionsResponse is the response to `GET /versions` +/// friendly:VersionsResponse +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct VersionsResponse { + #[serde(rename = "versions", skip_serializing_if = "Option::is_none")] + pub versions: Option>, +} + +impl VersionsResponse { + /// Default constructor for VersionsResponse + pub fn new() -> VersionsResponse { + VersionsResponse::default() + } +} diff --git a/crates/kmd_client/src/models/wallet_info_request.rs b/crates/kmd_client/src/models/wallet_info_request.rs new file mode 100644 index 000000000..7572083fd --- /dev/null +++ b/crates/kmd_client/src/models/wallet_info_request.rs @@ -0,0 +1,30 @@ +/* + * for KMD HTTP API + * + * API for KMD (Key Management Daemon) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: contact@algorand.com + * Generated by: Rust OpenAPI Generator + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// APIV1POSTWalletInfoRequest is the request for `POST /v1/wallet/info` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] +pub struct WalletInfoRequest { + #[serde( + rename = "wallet_handle_token", + skip_serializing_if = "Option::is_none" + )] + pub wallet_handle_token: Option, +} + +impl WalletInfoRequest { + /// Default constructor for WalletInfoRequest + pub fn new() -> WalletInfoRequest { + WalletInfoRequest::default() + } +} diff --git a/docs/book/contributing/contributing_guide.md b/docs/book/contributing/contributing_guide.md index 7be15b3c0..c49057aa0 100644 --- a/docs/book/contributing/contributing_guide.md +++ b/docs/book/contributing/contributing_guide.md @@ -37,9 +37,12 @@ cargo api - `test-oas` - Test the OAS generator - `format-oas` - Format the OAS generator code - `lint-oas` - Lint and type-check the OAS generator -- `format-algod` - Format generated Rust code -- `generate-algod` - Generate algod API client -- `convert-openapi` - Convert OpenAPI specification +- `format-algod` / `format-indexer` / `format-kmd` - Format generated Rust clients +- `generate-algod` / `generate-indexer` / `generate-kmd` - Generate Rust API clients +- `generate-ts-algod` / `generate-ts-indexer` / `generate-ts-kmd` - Generate TypeScript API clients +- `generate-all` / `generate-ts-all` - Generate all Rust or TypeScript clients +- `convert-openapi` - Convert all OpenAPI specifications +- `convert-algod` / `convert-indexer` / `convert-kmd` - Convert individual OpenAPI specs #### 3. Documentation Building diff --git a/packages/README.md b/packages/README.md index c70eddd62..838035c5f 100644 --- a/packages/README.md +++ b/packages/README.md @@ -66,28 +66,3 @@ To install, follow the below: 4. Remove `@algorandfoundation:registry=https://npm.pkg.github.com` from `~/.npmrc`, so NPM hosted `@algorandfoundation` packages can be resolved. Note: You will need to perform steps 2-4 each time your either install a package for the first time or update a GitHub package hosted dependency. Installing from the lock file only requires the token. - -## Per-model DTO codecs (TypeScript clients) - -The generated TypeScript API clients now emit per-model codecs alongside each TypeScript model type. For a given model `Foo` you will get: - -- `type Foo`: domain model with camelCase keys and rich types (e.g. `Uint8Array`, `bigint`) -- `type FooDto`: JSON-serializable shape with wire keys (e.g. `kebab-case`) and JSON-safe primitives -- `Foo.toDto(value: Foo): FooDto` and `Foo.fromDto(dto: FooDto): Foo` -- `Foo.encodeMsgpack(value: Foo): Uint8Array` and `Foo.decodeMsgpack(bytes: Uint8Array): Foo` -- `Foo.encodeJson(value: Foo): unknown` and `Foo.decodeJson(raw: unknown): Foo` - -Behavioral rules: - -- Key rename: camelCase in `Foo` is mapped to wire keys in `FooDto` -- Bytes fields: represented as `Uint8Array` in `Foo`; JSON uses base64 strings; msgpack passes through bytes -- Big integers: represented as `bigint` in `Foo`; JSON encodes as strings and decodes back to `bigint` -- Nested refs/arrays: codecs recurse into child model codecs automatically -- Signed transactions: encoded/decoded using `@algorandfoundation/algokit-transact`; for JSON arrays (e.g. simulate) raw object forms are preserved when already in DTO shape - -Services call these codecs automatically: - -- Request bodies: JSON uses `Model.encodeJson`, msgpack uses `Model.encodeMsgpack` (or passes `Uint8Array` through) -- Responses: JSON uses `Model.decodeJson`, msgpack uses `Model.decodeMsgpack` - -This replaces centralized transformer/rename maps; only small runtime helpers remain (e.g. `json.ts` base64 and `msgpack.ts`). diff --git a/packages/typescript/algokit_utils/package.json b/packages/typescript/algokit_utils/package.json index 43d1e4291..35d86709d 100644 --- a/packages/typescript/algokit_utils/package.json +++ b/packages/typescript/algokit_utils/package.json @@ -53,7 +53,8 @@ "@algorandfoundation/algokit-abi": "../algokit_abi/dist", "@algorandfoundation/algokit-common": "../algokit_common/dist", "@algorandfoundation/algokit-transact": "../algokit_transact/dist", - "@algorandfoundation/indexer-client": "../indexer_client/dist" + "@algorandfoundation/indexer-client": "../indexer_client/dist", + "@algorandfoundation/kmd-client": "../kmd_client/dist" }, "publishConfig": { "registry": "https://npm.pkg.github.com" diff --git a/packages/typescript/algokit_utils/tests/kmd/helpers.ts b/packages/typescript/algokit_utils/tests/kmd/helpers.ts new file mode 100644 index 000000000..cd21b4b26 --- /dev/null +++ b/packages/typescript/algokit_utils/tests/kmd/helpers.ts @@ -0,0 +1,30 @@ +import { randomBytes } from 'node:crypto' +import { KmdClient, type ClientConfig } from '@algorandfoundation/kmd-client' + +export interface KmdTestConfig { + kmdBaseUrl: string + kmdApiToken?: string + walletPassword: string +} + +export function getKmdEnv(): KmdTestConfig { + return { + kmdBaseUrl: process.env.KMD_BASE_URL ?? 'http://localhost:4002', + kmdApiToken: process.env.KMD_API_TOKEN ?? 'a'.repeat(64), + walletPassword: process.env.KMD_WALLET_PASSWORD ?? 'testpass', + } +} + +export function createKmdClient(config: KmdTestConfig): KmdClient { + const url = new URL(config.kmdBaseUrl) + const baseUrl = `${url.protocol}//${url.host}` + return new KmdClient({ + baseUrl, + apiToken: config.kmdApiToken, + } satisfies ClientConfig) +} + +export function randomWalletName(prefix = 'test_wallet'): string { + const suffix = randomBytes(6).toString('hex') + return `${prefix}_${suffix}` +} diff --git a/packages/typescript/algokit_utils/tests/kmd/keyManagement.test.ts b/packages/typescript/algokit_utils/tests/kmd/keyManagement.test.ts new file mode 100644 index 000000000..5f7ea1856 --- /dev/null +++ b/packages/typescript/algokit_utils/tests/kmd/keyManagement.test.ts @@ -0,0 +1,69 @@ +import { describe, expect, it } from 'vitest' +import type { + CreateWalletRequest, + InitWalletHandleTokenRequest, + ListKeysRequest, + ReleaseWalletHandleTokenRequest, + GenerateKeyRequest, +} from '@algorandfoundation/kmd-client' +import { createKmdClient, getKmdEnv, randomWalletName } from './helpers' + +const WALLET_DRIVER = 'sqlite' + +describe('KMD key management', () => { + it('generates and lists keys with a wallet handle token', async () => { + const env = getKmdEnv() + const client = createKmdClient(env) + const walletName = randomWalletName('wallet_keys') + + const createWalletResponse = await client.createWallet({ + body: { + walletName, + walletDriverName: WALLET_DRIVER, + walletPassword: env.walletPassword, + } satisfies CreateWalletRequest, + }) + + const walletId = createWalletResponse.wallet?.id + expect(walletId).toBeDefined() + + const initHandleResponse = await client.initWalletHandleToken({ + body: { + walletId, + walletPassword: env.walletPassword, + } satisfies InitWalletHandleTokenRequest, + }) + + const walletHandleToken = initHandleResponse.walletHandleToken + expect(walletHandleToken).toBeDefined() + + const listBeforeResponse = await client.listKeysInWallet({ + body: { + walletHandleToken, + } satisfies ListKeysRequest, + }) + const beforeAddresses = listBeforeResponse.addresses ?? [] + + await client.generateKey({ + body: { + walletHandleToken, + displayMnemonic: false, + } satisfies GenerateKeyRequest, + }) + + const listAfterResponse = await client.listKeysInWallet({ + body: { + walletHandleToken, + } satisfies ListKeysRequest, + }) + const afterAddresses = listAfterResponse.addresses ?? [] + + expect(afterAddresses.length).toBe(beforeAddresses.length + 1) + + await client.releaseWalletHandleToken({ + body: { + walletHandleToken, + } satisfies ReleaseWalletHandleTokenRequest, + }) + }) +}) diff --git a/packages/typescript/algokit_utils/tests/kmd/walletLifecycle.test.ts b/packages/typescript/algokit_utils/tests/kmd/walletLifecycle.test.ts new file mode 100644 index 000000000..4681c0d4f --- /dev/null +++ b/packages/typescript/algokit_utils/tests/kmd/walletLifecycle.test.ts @@ -0,0 +1,29 @@ +import { describe, expect, it } from 'vitest' +import { CreateWalletRequest } from '@algorandfoundation/kmd-client' +import { createKmdClient, getKmdEnv, randomWalletName } from './helpers' + +const WALLET_DRIVER = 'sqlite' + +describe('KMD wallet lifecycle', () => { + it('creates a wallet and lists it', async () => { + const env = getKmdEnv() + const client = createKmdClient(env) + const walletName = randomWalletName('wallet_lifecycle') + + const createResponse = await client.createWallet({ + body: { + walletName, + walletDriverName: WALLET_DRIVER, + walletPassword: env.walletPassword, + } satisfies CreateWalletRequest, + }) + + expect(createResponse.wallet?.name).toBe(walletName) + + const listResponse = await client.listWallets() + const wallets = listResponse.wallets ?? [] + const found = wallets.some((wallet) => wallet.name === walletName) + + expect(found).toBe(true) + }) +}) diff --git a/packages/typescript/kmd_client/README.md b/packages/typescript/kmd_client/README.md new file mode 100644 index 000000000..fb8ff5ff9 --- /dev/null +++ b/packages/typescript/kmd_client/README.md @@ -0,0 +1,3 @@ +# AlgoKit KMD Client + +This package contains the generated TypeScript client for interacting with Algorand's Key Management Daemon (KMD). diff --git a/packages/typescript/kmd_client/eslint.config.mjs b/packages/typescript/kmd_client/eslint.config.mjs new file mode 100644 index 000000000..cc8d7e9b7 --- /dev/null +++ b/packages/typescript/kmd_client/eslint.config.mjs @@ -0,0 +1,3 @@ +import config from '../eslint.config.mjs' + +export default config diff --git a/packages/typescript/kmd_client/package.json b/packages/typescript/kmd_client/package.json new file mode 100644 index 000000000..2c35ba666 --- /dev/null +++ b/packages/typescript/kmd_client/package.json @@ -0,0 +1,47 @@ +{ + "name": "@algorandfoundation/kmd-client", + "version": "0.1.0", + "private": true, + "description": "Client library for interacting with kmd.", + "author": "Algorand Foundation", + "license": "MIT", + "engines": { + "node": ">=20.0" + }, + "type": "commonjs", + "main": "index.js", + "module": "index.mjs", + "types": "index.d.ts", + "files": [ + "**/*" + ], + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js" + }, + "./index.d.ts": "./index.d.ts", + "./package.json": "./package.json" + }, + "scripts": { + "build": "run-s lint build:*", + "build-watch": "rolldown --watch -c", + "build:0-clean": "rimraf dist coverage", + "build:1-compile": "rolldown -c", + "build:3-copy-pkg-json": "npx --yes @makerx/ts-toolkit@4.0.0-beta.22 copy-package-json --custom-sections module main type types exports", + "build:4-copy-readme": "cpy README.md dist", + "test": "vitest run --coverage --passWithNoTests", + "test:watch": "vitest watch --coverage --passWithNoTests", + "lint": "eslint ./src/ --max-warnings=0", + "lint:fix": "eslint ./src/ --fix", + "check-types": "tsc --noEmit", + "audit": "better-npm-audit audit", + "format": "prettier --config ../.prettierrc.cjs --ignore-path ../../../.prettierignore --write .", + "pre-commit": "run-s check-types audit test" + }, + "peerDependencies": {}, + "devDependencies": { + "@algorandfoundation/algokit-transact": "../algokit_transact/dist" + } +} diff --git a/packages/typescript/kmd_client/rolldown.config.ts b/packages/typescript/kmd_client/rolldown.config.ts new file mode 100644 index 000000000..7f4fa6b94 --- /dev/null +++ b/packages/typescript/kmd_client/rolldown.config.ts @@ -0,0 +1,4 @@ +import createConfig from '../rolldown' +import pkg from './package.json' with { type: 'json' } + +export default createConfig([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]) diff --git a/packages/typescript/kmd_client/src/apis/api.service.ts b/packages/typescript/kmd_client/src/apis/api.service.ts new file mode 100644 index 000000000..fe9bc61c2 --- /dev/null +++ b/packages/typescript/kmd_client/src/apis/api.service.ts @@ -0,0 +1,855 @@ +import type { BaseHttpRequest, ApiRequestOptions } from '../core/base-http-request' +import { AlgorandSerializer } from '../core/model-runtime' +import type { + Apiv1DeletekeyResponse, + Apiv1DeletemultisigResponse, + Apiv1GetwalletsResponse, + Apiv1PostkeyExportResponse, + Apiv1PostkeyImportResponse, + Apiv1PostkeyListResponse, + Apiv1PostkeyResponse, + Apiv1PostmasterKeyExportResponse, + Apiv1PostmultisigExportResponse, + Apiv1PostmultisigImportResponse, + Apiv1PostmultisigListResponse, + Apiv1PostmultisigProgramSignResponse, + Apiv1PostmultisigTransactionSignResponse, + Apiv1PostprogramSignResponse, + Apiv1PosttransactionSignResponse, + Apiv1PostwalletInfoResponse, + Apiv1PostwalletInitResponse, + Apiv1PostwalletReleaseResponse, + Apiv1PostwalletRenameResponse, + Apiv1PostwalletRenewResponse, + Apiv1PostwalletResponse, + CreateWalletRequest, + DeleteKeyRequest, + DeleteMultisigRequest, + ExportKeyRequest, + ExportMasterKeyRequest, + ExportMultisigRequest, + GenerateKeyRequest, + ImportKeyRequest, + ImportMultisigRequest, + InitWalletHandleTokenRequest, + ListKeysRequest, + ListMultisigRequest, + ListWalletsRequest, + ReleaseWalletHandleTokenRequest, + RenameWalletRequest, + RenewWalletHandleTokenRequest, + SignMultisigRequest, + SignProgramMultisigRequest, + SignProgramRequest, + SignTransactionRequest, + VersionsRequest, + VersionsResponse, + WalletInfoRequest, +} from '../models/index' +import { + Apiv1DeletekeyResponseMeta, + Apiv1DeletemultisigResponseMeta, + Apiv1GetwalletsResponseMeta, + Apiv1PostkeyExportResponseMeta, + Apiv1PostkeyImportResponseMeta, + Apiv1PostkeyListResponseMeta, + Apiv1PostkeyResponseMeta, + Apiv1PostmasterKeyExportResponseMeta, + Apiv1PostmultisigExportResponseMeta, + Apiv1PostmultisigImportResponseMeta, + Apiv1PostmultisigListResponseMeta, + Apiv1PostmultisigProgramSignResponseMeta, + Apiv1PostmultisigTransactionSignResponseMeta, + Apiv1PostprogramSignResponseMeta, + Apiv1PosttransactionSignResponseMeta, + Apiv1PostwalletInfoResponseMeta, + Apiv1PostwalletInitResponseMeta, + Apiv1PostwalletReleaseResponseMeta, + Apiv1PostwalletRenameResponseMeta, + Apiv1PostwalletRenewResponseMeta, + Apiv1PostwalletResponseMeta, + CreateWalletRequestMeta, + DeleteKeyRequestMeta, + DeleteMultisigRequestMeta, + ExportKeyRequestMeta, + ExportMasterKeyRequestMeta, + ExportMultisigRequestMeta, + GenerateKeyRequestMeta, + ImportKeyRequestMeta, + ImportMultisigRequestMeta, + InitWalletHandleTokenRequestMeta, + ListKeysRequestMeta, + ListMultisigRequestMeta, + ListWalletsRequestMeta, + ReleaseWalletHandleTokenRequestMeta, + RenameWalletRequestMeta, + RenewWalletHandleTokenRequestMeta, + SignMultisigRequestMeta, + SignProgramMultisigRequestMeta, + SignProgramRequestMeta, + SignTransactionRequestMeta, + VersionsRequestMeta, + VersionsResponseMeta, + WalletInfoRequestMeta, +} from '../models/index' + +export class KmdApi { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * Create a new wallet (collection of keys) with the given parameters. + */ + async createWallet(params?: { body: CreateWalletRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = CreateWalletRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/wallet', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostwalletResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostwalletResponse + } + + /** + * Deletes the key with the passed public key from the wallet. + */ + async deleteKey(params?: { body: DeleteKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = DeleteKeyRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'DELETE', + url: '/v1/key', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1DeletekeyResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1DeletekeyResponse + } + + /** + * Deletes multisig preimage information for the passed address from the wallet. + */ + async deleteMultisig(params?: { body: DeleteMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = DeleteMultisigRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'DELETE', + url: '/v1/multisig', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1DeletemultisigResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1DeletemultisigResponse + } + + /** + * Export the secret key associated with the passed public key. + */ + async exportKey(params?: { body: ExportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ExportKeyRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/key/export', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostkeyExportResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostkeyExportResponse + } + + /** + * Export the master derivation key from the wallet. This key is a master "backup" key for the underlying wallet. With it, you can regenerate all of the wallets that have been generated with this wallet's `POST /v1/key` endpoint. This key will not allow you to recover keys imported from other wallets, however. + */ + async exportMasterKey( + params?: { body: ExportMasterKeyRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ExportMasterKeyRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/master-key/export', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostmasterKeyExportResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostmasterKeyExportResponse + } + + /** + * Given a multisig address whose preimage this wallet stores, returns the information used to generate the address, including public keys, threshold, and multisig version. + */ + async exportMultisig( + params?: { body: ExportMultisigRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ExportMultisigRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/multisig/export', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostmultisigExportResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostmultisigExportResponse + } + + /** + * Generates the next key in the deterministic key sequence (as determined by the master derivation key) and adds it to the wallet, returning the public key. + */ + async generateKey(params?: { body: GenerateKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = GenerateKeyRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/key', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostkeyResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostkeyResponse + } + + async getVersion(params?: { body?: VersionsRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = VersionsRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'GET', + url: '/versions', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = VersionsResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as VersionsResponse + } + + /** + * Returns information about the wallet associated with the passed wallet handle token. Additionally returns expiration information about the token itself. + */ + async getWalletInfo(params?: { body: WalletInfoRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = WalletInfoRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/wallet/info', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostwalletInfoResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostwalletInfoResponse + } + + /** + * Import an externally generated key into the wallet. Note that if you wish to back up the imported key, you must do so by backing up the entire wallet database, because imported keys were not derived from the wallet's master derivation key. + */ + async importKey(params?: { body: ImportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ImportKeyRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/key/import', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostkeyImportResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostkeyImportResponse + } + + /** + * Generates a multisig account from the passed public keys array and multisig metadata, and stores all of this in the wallet. + */ + async importMultisig( + params?: { body: ImportMultisigRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ImportMultisigRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/multisig/import', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostmultisigImportResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostmultisigImportResponse + } + + /** + * Unlock the wallet and return a wallet handle token that can be used for subsequent operations. These tokens expire periodically and must be renewed. You can `POST` the token to `/v1/wallet/info` to see how much time remains until expiration, and renew it with `/v1/wallet/renew`. When you're done, you can invalidate the token with `/v1/wallet/release`. + */ + async initWalletHandleToken( + params?: { body: InitWalletHandleTokenRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = InitWalletHandleTokenRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/wallet/init', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostwalletInitResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostwalletInitResponse + } + + /** + * Lists all of the public keys in this wallet. All of them have a stored private key. + */ + async listKeysInWallet(params?: { body: ListKeysRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ListKeysRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/key/list', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostkeyListResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostkeyListResponse + } + + /** + * Lists all of the multisig accounts whose preimages this wallet stores + */ + async listMultisg(params?: { body: ListMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ListMultisigRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/multisig/list', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostmultisigListResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostmultisigListResponse + } + + /** + * Lists all of the wallets that kmd is aware of. + */ + async listWallets(params?: { body?: ListWalletsRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ListWalletsRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'GET', + url: '/v1/wallets', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1GetwalletsResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1GetwalletsResponse + } + + /** + * Invalidate the passed wallet handle token, making it invalid for use in subsequent requests. + */ + async releaseWalletHandleToken( + params?: { body: ReleaseWalletHandleTokenRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = ReleaseWalletHandleTokenRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/wallet/release', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostwalletReleaseResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostwalletReleaseResponse + } + + /** + * Rename the underlying wallet to something else + */ + async renameWallet(params?: { body: RenameWalletRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = RenameWalletRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/wallet/rename', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostwalletRenameResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostwalletRenameResponse + } + + /** + * Renew a wallet handle token, increasing its expiration duration to its initial value + */ + async renewWalletHandleToken( + params?: { body: RenewWalletHandleTokenRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = RenewWalletHandleTokenRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/wallet/renew', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostwalletRenewResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostwalletRenewResponse + } + + /** + * Start a multisig signature, or add a signature to a partially completed multisig signature object. + */ + async signMultisigProgram( + params?: { body: SignProgramMultisigRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = SignProgramMultisigRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/multisig/signprogram', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostmultisigProgramSignResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostmultisigProgramSignResponse + } + + /** + * Start a multisig signature, or add a signature to a partially completed multisig signature object. + */ + async signMultisigTransaction( + params?: { body: SignMultisigRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = SignMultisigRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/multisig/sign', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostmultisigTransactionSignResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostmultisigTransactionSignResponse + } + + /** + * Signs the passed program with a key from the wallet, determined by the account named in the request. + */ + async signProgram(params?: { body: SignProgramRequest }, requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = SignProgramRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/program/sign', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PostprogramSignResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PostprogramSignResponse + } + + /** + * Signs the passed transaction with a key from the wallet, determined by the sender encoded in the transaction. + */ + async signTransaction( + params?: { body: SignTransactionRequest }, + requestOptions?: ApiRequestOptions, + ): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const bodyMeta = SignTransactionRequestMeta + const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined + if (mediaType) headers['Content-Type'] = mediaType + const serializedBody = + bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body + + const payload = await this.httpRequest.request({ + method: 'POST', + url: '/v1/transaction/sign', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = Apiv1PosttransactionSignResponseMeta + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as Apiv1PosttransactionSignResponse + } + + /** + * Returns the entire swagger spec in json. + */ + async swaggerHandler(requestOptions?: ApiRequestOptions): Promise { + const headers: Record = {} + const responseFormat: 'json' | 'msgpack' = 'json' + headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' + + const serializedBody = undefined + const mediaType = undefined + + const payload = await this.httpRequest.request({ + method: 'GET', + url: '/swagger.json', + path: {}, + query: {}, + headers, + body: serializedBody, + mediaType: mediaType, + ...(requestOptions ?? {}), + }) + + const responseMeta = undefined + if (responseMeta) { + return AlgorandSerializer.decode(payload, responseMeta, responseFormat) + } + return payload as string + } +} diff --git a/packages/typescript/kmd_client/src/apis/index.ts b/packages/typescript/kmd_client/src/apis/index.ts new file mode 100644 index 000000000..e871b41c6 --- /dev/null +++ b/packages/typescript/kmd_client/src/apis/index.ts @@ -0,0 +1,2 @@ +// Barrel file for services +export { KmdApi } from './api.service' diff --git a/packages/typescript/kmd_client/src/client.ts b/packages/typescript/kmd_client/src/client.ts new file mode 100644 index 000000000..1f00fe25d --- /dev/null +++ b/packages/typescript/kmd_client/src/client.ts @@ -0,0 +1,10 @@ +import type { ClientConfig } from './core/client-config' +import type { BaseHttpRequest } from './core/base-http-request' +import { FetchHttpRequest } from './core/fetch-http-request' +import { KmdApi } from './apis/api.service' + +export class KmdClient extends KmdApi { + constructor(config: ClientConfig, request?: BaseHttpRequest) { + super(request ?? new FetchHttpRequest(config)) + } +} diff --git a/packages/typescript/kmd_client/src/core/api-error.ts b/packages/typescript/kmd_client/src/core/api-error.ts new file mode 100644 index 000000000..8293ffb76 --- /dev/null +++ b/packages/typescript/kmd_client/src/core/api-error.ts @@ -0,0 +1,12 @@ +export class ApiError extends Error { + public readonly url: string + public readonly status: number + public readonly body: T | undefined + + constructor(url: string, status: number, body?: T) { + super(`Request to ${url} failed with status ${status}`) + this.url = url + this.status = status + this.body = body + } +} diff --git a/packages/typescript/kmd_client/src/core/base-http-request.ts b/packages/typescript/kmd_client/src/core/base-http-request.ts new file mode 100644 index 000000000..110606ade --- /dev/null +++ b/packages/typescript/kmd_client/src/core/base-http-request.ts @@ -0,0 +1,22 @@ +import type { ClientConfig } from './client-config' + +export type QueryValue = string | number | bigint | boolean +export type QueryParams = Record + +export type BodyValue = Uint8Array | Record | unknown[] | string | number | boolean | null + +export interface ApiRequestOptions { + method: string + url: string + path?: Record + query?: QueryParams + headers?: Record + body?: BodyValue + mediaType?: string + responseHeader?: string +} + +export abstract class BaseHttpRequest { + constructor(public readonly config: ClientConfig) {} + abstract request(options: ApiRequestOptions): Promise +} diff --git a/packages/typescript/kmd_client/src/core/client-config.ts b/packages/typescript/kmd_client/src/core/client-config.ts new file mode 100644 index 000000000..9f3a1a5de --- /dev/null +++ b/packages/typescript/kmd_client/src/core/client-config.ts @@ -0,0 +1,14 @@ +/* Minimal client runtime config holder */ +export type BaseURL = string + +export interface ClientConfig { + // Prefer idiomatic camelCase going forward + baseUrl: BaseURL + credentials?: 'include' | 'omit' | 'same-origin' + token?: string | (() => string | Promise) + apiToken?: string + username?: string + password?: string + headers?: Record | (() => Record | Promise>) + encodePath?: (path: string) => string +} diff --git a/packages/typescript/kmd_client/src/core/codecs.ts b/packages/typescript/kmd_client/src/core/codecs.ts new file mode 100644 index 000000000..a70a67bc7 --- /dev/null +++ b/packages/typescript/kmd_client/src/core/codecs.ts @@ -0,0 +1,13 @@ +import { encode as msgpackEncode, decode as msgpackDecode } from '@msgpack/msgpack' + +export function encodeMsgPack(value: unknown): Uint8Array { + return msgpackEncode(value, { + sortKeys: true, + ignoreUndefined: true, + useBigInt64: true, + }) +} + +export function decodeMsgPack(buffer: Uint8Array): T { + return msgpackDecode(buffer, { useBigInt64: true }) as T +} diff --git a/packages/typescript/kmd_client/src/core/fetch-http-request.ts b/packages/typescript/kmd_client/src/core/fetch-http-request.ts new file mode 100644 index 000000000..d57c1e667 --- /dev/null +++ b/packages/typescript/kmd_client/src/core/fetch-http-request.ts @@ -0,0 +1,8 @@ +import { BaseHttpRequest, type ApiRequestOptions } from './base-http-request' +import { request } from './request' + +export class FetchHttpRequest extends BaseHttpRequest { + async request(options: ApiRequestOptions): Promise { + return request(this.config, options) + } +} diff --git a/packages/typescript/kmd_client/src/core/model-runtime.ts b/packages/typescript/kmd_client/src/core/model-runtime.ts new file mode 100644 index 000000000..87c8bfaf9 --- /dev/null +++ b/packages/typescript/kmd_client/src/core/model-runtime.ts @@ -0,0 +1,264 @@ +import { + encodeSignedTransaction as transactEncodeSignedTransaction, + decodeSignedTransaction as transactDecodeSignedTransaction, + type SignedTransaction, +} from '@algorandfoundation/algokit-transact' +import { encodeMsgPack, decodeMsgPack } from './codecs' +import { toBase64, fromBase64 } from './serialization' + +export type BodyFormat = 'json' | 'msgpack' + +export interface ScalarFieldType { + readonly kind: 'scalar' + readonly isBytes?: boolean + readonly isBigint?: boolean +} + +export interface CodecFieldType { + readonly kind: 'codec' + readonly codecKey: string +} + +export interface ModelFieldType { + readonly kind: 'model' + readonly meta: ModelMetadata | (() => ModelMetadata) +} + +export interface ArrayFieldType { + readonly kind: 'array' + readonly item: FieldType +} + +export interface RecordFieldType { + readonly kind: 'record' + readonly value: FieldType +} + +export type FieldType = ScalarFieldType | CodecFieldType | ModelFieldType | ArrayFieldType | RecordFieldType + +export interface FieldMetadata { + readonly name: string + readonly wireKey: string + readonly optional: boolean + readonly nullable: boolean + readonly type: FieldType +} + +export type ModelKind = 'object' | 'array' | 'passthrough' + +export interface ModelMetadata { + readonly name: string + readonly kind: ModelKind + readonly fields?: readonly FieldMetadata[] + readonly arrayItems?: FieldType + readonly codecKey?: string + readonly additionalProperties?: FieldType + readonly passThrough?: FieldType +} + +export interface TypeCodec { + encode(value: TValue, format: BodyFormat): unknown + decode(value: unknown, format: BodyFormat): TValue +} + +const codecRegistry = new Map>() + +export function registerCodec(key: string, codec: TypeCodec): void { + codecRegistry.set(key, codec as TypeCodec) +} + +export function getCodec(key: string): TypeCodec | undefined { + return codecRegistry.get(key) as TypeCodec | undefined +} + +export class AlgorandSerializer { + static encode(value: unknown, meta: ModelMetadata, format: BodyFormat = 'msgpack'): Uint8Array | string { + const wire = this.transform(value, meta, { direction: 'encode', format }) + if (format === 'msgpack') { + return wire instanceof Uint8Array ? wire : encodeMsgPack(wire) + } + return typeof wire === 'string' ? wire : JSON.stringify(wire) + } + + static decode(payload: unknown, meta: ModelMetadata, format: BodyFormat = 'msgpack'): T { + let wire: unknown = payload + if (format === 'msgpack') { + if (payload instanceof Uint8Array) { + wire = decodeMsgPack(payload) + } + } else if (typeof payload === 'string') { + wire = JSON.parse(payload) + } + return this.transform(wire, meta, { direction: 'decode', format }) as T + } + + private static transform(value: unknown, meta: ModelMetadata, ctx: TransformContext): unknown { + if (value === undefined || value === null) { + return value + } + + if (meta.codecKey) { + return this.applyCodec(value, meta.codecKey, ctx) + } + + switch (meta.kind) { + case 'object': + return this.transformObject(value, meta, ctx) + case 'array': + return this.transformType(value, { kind: 'array', item: meta.arrayItems ?? { kind: 'scalar' } }, ctx) + case 'passthrough': + default: + return this.transformType(value, meta.passThrough ?? { kind: 'scalar' }, ctx) + } + } + + private static transformObject(value: unknown, meta: ModelMetadata, ctx: TransformContext): unknown { + const fields = meta.fields ?? [] + if (ctx.direction === 'encode') { + const src = value as Record + const out: Record = {} + for (const field of fields) { + const fieldValue = src[field.name] + if (fieldValue === undefined) continue + const encoded = this.transformType(fieldValue, field.type, ctx) + if (encoded === undefined && fieldValue === undefined) continue + out[field.wireKey] = encoded + } + if (meta.additionalProperties) { + for (const [key, val] of Object.entries(src)) { + if (fields.some((f) => f.name === key)) continue + out[key] = this.transformType(val, meta.additionalProperties, ctx) + } + } + return out + } + + const src = value as Record + const out: Record = {} + const fieldByWire = new Map(fields.map((field) => [field.wireKey, field])) + + for (const [wireKey, wireValue] of Object.entries(src)) { + const field = fieldByWire.get(wireKey) + if (field) { + const decoded = this.transformType(wireValue, field.type, ctx) + out[field.name] = decoded + continue + } + if (meta.additionalProperties) { + out[wireKey] = this.transformType(wireValue, meta.additionalProperties, ctx) + continue + } + out[wireKey] = wireValue + } + + return out + } + + private static transformType(value: unknown, type: FieldType, ctx: TransformContext): unknown { + if (value === undefined || value === null) return value + + switch (type.kind) { + case 'scalar': + return this.transformScalar(value, type, ctx) + case 'codec': + return this.applyCodec(value, type.codecKey, ctx) + case 'model': + return this.transform(value, typeof type.meta === 'function' ? type.meta() : type.meta, ctx) + case 'array': + if (!Array.isArray(value)) return value + return value.map((item) => this.transformType(item, type.item, ctx)) + case 'record': + if (typeof value !== 'object' || value === null) return value + return Object.fromEntries( + Object.entries(value as Record).map(([k, v]) => [k, this.transformType(v, type.value, ctx)]), + ) + default: + return value + } + } + + private static transformScalar(value: unknown, meta: ScalarFieldType, ctx: TransformContext): unknown { + if (ctx.direction === 'encode') { + if (meta.isBytes && ctx.format === 'json') { + if (value instanceof Uint8Array) return toBase64(value) + } + if (meta.isBigint && ctx.format === 'json') { + if (typeof value === 'bigint') return value.toString() + if (typeof value === 'number') return Math.trunc(value).toString() + if (typeof value === 'string') return value + } + return value + } + + if (meta.isBytes && ctx.format === 'json' && typeof value === 'string') { + return fromBase64(value) + } + + if (meta.isBigint) { + if (typeof value === 'string') { + try { + return BigInt(value) + } catch { + return value + } + } + if (typeof value === 'number' && Number.isInteger(value)) { + return BigInt(value) + } + } + + return value + } + + private static applyCodec(value: unknown, codecKey: string, ctx: TransformContext): unknown { + const codec = codecRegistry.get(codecKey) + if (!codec) { + throw new Error(`Codec for "${codecKey}" is not registered`) + } + return ctx.direction === 'encode' ? codec.encode(value, ctx.format) : codec.decode(value, ctx.format) + } +} + +type TransformDirection = 'encode' | 'decode' + +interface TransformContext { + readonly direction: TransformDirection + readonly format: BodyFormat +} + +const encodeSignedTransactionImpl = (value: unknown): Uint8Array => transactEncodeSignedTransaction(value as SignedTransaction) +const decodeSignedTransactionImpl = (value: Uint8Array): SignedTransaction => transactDecodeSignedTransaction(value) + +class SignedTransactionCodec implements TypeCodec { + encode(value: unknown, format: BodyFormat): unknown { + if (value == null) return value + if (format === 'json') { + if (value instanceof Uint8Array) return toBase64(value) + return toBase64(encodeSignedTransactionImpl(value)) + } + if (value instanceof Uint8Array) { + // Already canonical bytes; decode to structured map so parent encoding keeps map semantics + return decodeMsgPack(value) + } + // Convert signed transaction object into canonical map representation + return decodeMsgPack(encodeSignedTransactionImpl(value)) + } + + decode(value: unknown, format: BodyFormat): unknown { + if (value == null) return value + if (format === 'json') { + if (typeof value === 'string') return decodeSignedTransactionImpl(fromBase64(value)) + if (value instanceof Uint8Array) return decodeSignedTransactionImpl(value) + return value + } + if (value instanceof Uint8Array) return decodeSignedTransactionImpl(value) + // Value is a decoded map; re-encode to bytes before handing to transact decoder + try { + return decodeSignedTransactionImpl(encodeMsgPack(value)) + } catch { + return value + } + } +} + +registerCodec('SignedTransaction', new SignedTransactionCodec()) diff --git a/packages/typescript/kmd_client/src/core/request.ts b/packages/typescript/kmd_client/src/core/request.ts new file mode 100644 index 000000000..7be1898eb --- /dev/null +++ b/packages/typescript/kmd_client/src/core/request.ts @@ -0,0 +1,122 @@ +import type { ClientConfig } from './client-config' +import { ApiError } from './api-error' +import { decodeMsgPack, encodeMsgPack } from './codecs' +import type { QueryParams, BodyValue } from './base-http-request' + +const encodeURIPath = (path: string): string => encodeURI(path).replace(/%5B/g, '[').replace(/%5D/g, ']') + +export async function request( + config: ClientConfig, + options: { + method: string + url: string + path?: Record + query?: QueryParams + headers?: Record + body?: BodyValue + mediaType?: string + responseHeader?: string + }, +): Promise { + let rawPath = options.url + if (options.path) { + for (const [key, value] of Object.entries(options.path)) { + const raw = typeof value === 'bigint' ? value.toString() : String(value) + const replace = config.encodePath ? config.encodePath(raw) : encodeURIPath(raw) + rawPath = rawPath.replace(`{${key}}`, replace) + } + } + + const url = new URL(rawPath, config.baseUrl) + + if (options.query) { + for (const [key, value] of Object.entries(options.query)) { + if (value === undefined || value === null) continue + if (Array.isArray(value)) { + for (const item of value) { + url.searchParams.append(key, item.toString()) + } + } else { + url.searchParams.append(key, value.toString()) + } + } + } + + const headers: Record = { + ...(typeof config.headers === 'function' ? await config.headers() : (config.headers ?? {})), + ...(options.headers ?? {}), + } + + const apiToken = config.apiToken + if (apiToken) { + headers['X-KMD-API-Token'] = apiToken + } + + const token = typeof config.token === 'function' ? await config.token() : config.token + if (token) headers['Authorization'] = `Bearer ${token}` + if (!token && config.username && config.password) { + headers['Authorization'] = `Basic ${btoa(`${config.username}:${config.password}`)}` + } + + let body: BodyValue | undefined = undefined + if (options.body != null) { + if (options.body instanceof Uint8Array || typeof options.body === 'string') { + body = options.body + } else if (options.mediaType?.includes('msgpack')) { + body = encodeMsgPack(options.body) + } else if (options.mediaType?.includes('json')) { + body = JSON.stringify(options.body) + } else { + body = options.body + } + } + + const response = await fetch(url.toString(), { + method: options.method, + headers, + body, + credentials: config.credentials, + }) + + if (!response.ok) { + let errorBody: unknown + try { + const ct = response.headers.get('content-type') ?? '' + if (ct.includes('application/msgpack')) { + errorBody = decodeMsgPack(new Uint8Array(await response.arrayBuffer())) + } else if (ct.includes('application/json')) { + errorBody = JSON.parse(await response.text()) + } else { + errorBody = await response.text() + } + } catch { + errorBody = undefined + } + throw new ApiError(url.toString(), response.status, errorBody) + } + + if (options.responseHeader) { + const value = response.headers.get(options.responseHeader) + return value as unknown as T + } + + const contentType = response.headers.get('content-type') ?? '' + + if (contentType.includes('application/msgpack')) { + return new Uint8Array(await response.arrayBuffer()) as unknown as T + } + + if (contentType.includes('application/octet-stream') || contentType.includes('application/x-binary')) { + return new Uint8Array(await response.arrayBuffer()) as unknown as T + } + + if (contentType.includes('application/json')) { + return (await response.text()) as unknown as T + } + + if (!contentType) { + return new Uint8Array(await response.arrayBuffer()) as unknown as T + } + + return (await response.text()) as unknown as T +} diff --git a/packages/typescript/kmd_client/src/core/serialization.ts b/packages/typescript/kmd_client/src/core/serialization.ts new file mode 100644 index 000000000..6be054287 --- /dev/null +++ b/packages/typescript/kmd_client/src/core/serialization.ts @@ -0,0 +1,26 @@ +export function toBase64(bytes: Uint8Array): string { + if (typeof Buffer !== 'undefined') { + return Buffer.from(bytes).toString('base64') + } + const globalRef: Record = globalThis as unknown as Record + const btoaFn = globalRef.btoa as ((value: string) => string) | undefined + if (typeof btoaFn === 'function') { + return btoaFn(String.fromCharCode(...bytes)) + } + throw new Error('Base64 encoding not supported in this environment') +} + +export function fromBase64(s: string): Uint8Array { + if (typeof Buffer !== 'undefined') { + return new Uint8Array(Buffer.from(s, 'base64')) + } + const globalRef: Record = globalThis as unknown as Record + const atobFn = globalRef.atob as ((value: string) => string) | undefined + if (typeof atobFn === 'function') { + const bin = atobFn(s) + const out = new Uint8Array(bin.length) + for (let i = 0; i < bin.length; i += 1) out[i] = bin.charCodeAt(i) + return out + } + throw new Error('Base64 decoding not supported in this environment') +} diff --git a/packages/typescript/kmd_client/src/index.ts b/packages/typescript/kmd_client/src/index.ts new file mode 100644 index 000000000..915506d52 --- /dev/null +++ b/packages/typescript/kmd_client/src/index.ts @@ -0,0 +1,12 @@ +export * from './core/client-config' +export * from './core/base-http-request' +export * from './core/fetch-http-request' +export * from './core/api-error' +export * from './core/serialization' +export * from './core/codecs' +export * from './core/model-runtime' + +// Generated +export * from './models' +export * from './apis' +export * from './client' diff --git a/packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts b/packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts new file mode 100644 index 000000000..726b80ed7 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts @@ -0,0 +1,31 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1DELETEKeyResponse is the response to `DELETE /v1/key` + * friendly:DeleteKeyResponse + */ +export type Apiv1DeletekeyResponse = { + error?: boolean + message?: string +} + +export const Apiv1DeletekeyResponseMeta: ModelMetadata = { + name: 'Apiv1DeletekeyResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts b/packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts new file mode 100644 index 000000000..d42d9e906 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts @@ -0,0 +1,31 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` + * friendly:DeleteMultisigResponse + */ +export type Apiv1DeletemultisigResponse = { + error?: boolean + message?: string +} + +export const Apiv1DeletemultisigResponseMeta: ModelMetadata = { + name: 'Apiv1DeletemultisigResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts b/packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts new file mode 100644 index 000000000..0991b0981 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts @@ -0,0 +1,41 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Apiv1Wallet } from './apiv1-wallet' +import { Apiv1WalletMeta } from './apiv1-wallet' + +/** + * APIV1GETWalletsResponse is the response to `GET /v1/wallets` + * friendly:ListWalletsResponse + */ +export type Apiv1GetwalletsResponse = { + error?: boolean + message?: string + wallets?: Apiv1Wallet[] +} + +export const Apiv1GetwalletsResponseMeta: ModelMetadata = { + name: 'Apiv1GetwalletsResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'wallets', + wireKey: 'wallets', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'model', meta: () => Apiv1WalletMeta } }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts new file mode 100644 index 000000000..108783a79 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` + * friendly:ExportKeyResponse + */ +export type Apiv1PostkeyExportResponse = { + error?: boolean + message?: string + privateKey?: Uint8Array +} + +export const Apiv1PostkeyExportResponseMeta: ModelMetadata = { + name: 'Apiv1PostkeyExportResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'privateKey', + wireKey: 'private_key', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts new file mode 100644 index 000000000..c39745a2c --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` + * friendly:ImportKeyResponse + */ +export type Apiv1PostkeyImportResponse = { + address?: string + error?: boolean + message?: string +} + +export const Apiv1PostkeyImportResponseMeta: ModelMetadata = { + name: 'Apiv1PostkeyImportResponse', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts new file mode 100644 index 000000000..c4ac3b3f0 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyListResponse is the response to `POST /v1/key/list` + * friendly:ListKeysResponse + */ +export type Apiv1PostkeyListResponse = { + addresses?: string[] + error?: boolean + message?: string +} + +export const Apiv1PostkeyListResponseMeta: ModelMetadata = { + name: 'Apiv1PostkeyListResponse', + kind: 'object', + fields: [ + { + name: 'addresses', + wireKey: 'addresses', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'scalar' } }, + }, + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts new file mode 100644 index 000000000..397e86612 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyResponse is the response to `POST /v1/key` + * friendly:GenerateKeyResponse + */ +export type Apiv1PostkeyResponse = { + address?: string + error?: boolean + message?: string +} + +export const Apiv1PostkeyResponseMeta: ModelMetadata = { + name: 'Apiv1PostkeyResponse', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts new file mode 100644 index 000000000..9ba2cf06c --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts @@ -0,0 +1,41 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { MasterDerivationKey } from './master-derivation-key' +import { MasterDerivationKeyMeta } from './master-derivation-key' + +/** + * APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` + * friendly:ExportMasterKeyResponse + */ +export type Apiv1PostmasterKeyExportResponse = { + error?: boolean + masterDerivationKey?: MasterDerivationKey + message?: string +} + +export const Apiv1PostmasterKeyExportResponseMeta: ModelMetadata = { + name: 'Apiv1PostmasterKeyExportResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'masterDerivationKey', + wireKey: 'master_derivation_key', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => MasterDerivationKeyMeta }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts new file mode 100644 index 000000000..101ae4b47 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts @@ -0,0 +1,57 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { PublicKey } from './public-key' +import { PublicKeyMeta } from './public-key' + +/** + * APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` + * friendly:ExportMultisigResponse + */ +export type Apiv1PostmultisigExportResponse = { + error?: boolean + message?: string + multisigVersion?: bigint + pks?: PublicKey[] + threshold?: bigint +} + +export const Apiv1PostmultisigExportResponseMeta: ModelMetadata = { + name: 'Apiv1PostmultisigExportResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'multisigVersion', + wireKey: 'multisig_version', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'pks', + wireKey: 'pks', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'model', meta: () => PublicKeyMeta } }, + }, + { + name: 'threshold', + wireKey: 'threshold', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts new file mode 100644 index 000000000..fca833c02 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` + * friendly:ImportMultisigResponse + */ +export type Apiv1PostmultisigImportResponse = { + address?: string + error?: boolean + message?: string +} + +export const Apiv1PostmultisigImportResponseMeta: ModelMetadata = { + name: 'Apiv1PostmultisigImportResponse', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts new file mode 100644 index 000000000..1f95eb37c --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` + * friendly:ListMultisigResponse + */ +export type Apiv1PostmultisigListResponse = { + addresses?: string[] + error?: boolean + message?: string +} + +export const Apiv1PostmultisigListResponseMeta: ModelMetadata = { + name: 'Apiv1PostmultisigListResponse', + kind: 'object', + fields: [ + { + name: 'addresses', + wireKey: 'addresses', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'scalar' } }, + }, + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts new file mode 100644 index 000000000..26cc3998f --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` + * friendly:SignProgramMultisigResponse + */ +export type Apiv1PostmultisigProgramSignResponse = { + error?: boolean + message?: string + multisig?: Uint8Array +} + +export const Apiv1PostmultisigProgramSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostmultisigProgramSignResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'multisig', + wireKey: 'multisig', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts new file mode 100644 index 000000000..fd455e4ff --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` + * friendly:SignMultisigResponse + */ +export type Apiv1PostmultisigTransactionSignResponse = { + error?: boolean + message?: string + multisig?: Uint8Array +} + +export const Apiv1PostmultisigTransactionSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostmultisigTransactionSignResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'multisig', + wireKey: 'multisig', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts new file mode 100644 index 000000000..3d62ab02a --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` + * friendly:SignProgramResponse + */ +export type Apiv1PostprogramSignResponse = { + error?: boolean + message?: string + sig?: Uint8Array +} + +export const Apiv1PostprogramSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostprogramSignResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'sig', + wireKey: 'sig', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts new file mode 100644 index 000000000..0777957c4 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` + * friendly:SignTransactionResponse + */ +export type Apiv1PosttransactionSignResponse = { + error?: boolean + message?: string + signedTransaction?: Uint8Array +} + +export const Apiv1PosttransactionSignResponseMeta: ModelMetadata = { + name: 'Apiv1PosttransactionSignResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'signedTransaction', + wireKey: 'signed_transaction', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts new file mode 100644 index 000000000..d39d85525 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts @@ -0,0 +1,41 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Apiv1WalletHandle } from './apiv1-wallet-handle' +import { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' + +/** + * APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` + * friendly:WalletInfoResponse + */ +export type Apiv1PostwalletInfoResponse = { + error?: boolean + message?: string + walletHandle?: Apiv1WalletHandle +} + +export const Apiv1PostwalletInfoResponseMeta: ModelMetadata = { + name: 'Apiv1PostwalletInfoResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandle', + wireKey: 'wallet_handle', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => Apiv1WalletHandleMeta }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts new file mode 100644 index 000000000..2a859e8b9 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts @@ -0,0 +1,39 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` + * friendly:InitWalletHandleTokenResponse + */ +export type Apiv1PostwalletInitResponse = { + error?: boolean + message?: string + walletHandleToken?: string +} + +export const Apiv1PostwalletInitResponseMeta: ModelMetadata = { + name: 'Apiv1PostwalletInitResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts new file mode 100644 index 000000000..25ea5a83f --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts @@ -0,0 +1,31 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` + * friendly:ReleaseWalletHandleTokenResponse + */ +export type Apiv1PostwalletReleaseResponse = { + error?: boolean + message?: string +} + +export const Apiv1PostwalletReleaseResponseMeta: ModelMetadata = { + name: 'Apiv1PostwalletReleaseResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts new file mode 100644 index 000000000..c094819ca --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts @@ -0,0 +1,41 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Apiv1Wallet } from './apiv1-wallet' +import { Apiv1WalletMeta } from './apiv1-wallet' + +/** + * APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` + * friendly:RenameWalletResponse + */ +export type Apiv1PostwalletRenameResponse = { + error?: boolean + message?: string + wallet?: Apiv1Wallet +} + +export const Apiv1PostwalletRenameResponseMeta: ModelMetadata = { + name: 'Apiv1PostwalletRenameResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'wallet', + wireKey: 'wallet', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => Apiv1WalletMeta }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts new file mode 100644 index 000000000..431a05791 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts @@ -0,0 +1,41 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Apiv1WalletHandle } from './apiv1-wallet-handle' +import { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' + +/** + * APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` + * friendly:RenewWalletHandleTokenResponse + */ +export type Apiv1PostwalletRenewResponse = { + error?: boolean + message?: string + walletHandle?: Apiv1WalletHandle +} + +export const Apiv1PostwalletRenewResponseMeta: ModelMetadata = { + name: 'Apiv1PostwalletRenewResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandle', + wireKey: 'wallet_handle', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => Apiv1WalletHandleMeta }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts b/packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts new file mode 100644 index 000000000..d459d7026 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts @@ -0,0 +1,41 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Apiv1Wallet } from './apiv1-wallet' +import { Apiv1WalletMeta } from './apiv1-wallet' + +/** + * APIV1POSTWalletResponse is the response to `POST /v1/wallet` + * friendly:CreateWalletResponse + */ +export type Apiv1PostwalletResponse = { + error?: boolean + message?: string + wallet?: Apiv1Wallet +} + +export const Apiv1PostwalletResponseMeta: ModelMetadata = { + name: 'Apiv1PostwalletResponse', + kind: 'object', + fields: [ + { + name: 'error', + wireKey: 'error', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'message', + wireKey: 'message', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'wallet', + wireKey: 'wallet', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => Apiv1WalletMeta }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts b/packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts new file mode 100644 index 000000000..7b77162ef --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts @@ -0,0 +1,33 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Apiv1Wallet } from './apiv1-wallet' +import { Apiv1WalletMeta } from './apiv1-wallet' + +/** + * APIV1WalletHandle includes the wallet the handle corresponds to + * and the number of number of seconds to expiration + */ +export type Apiv1WalletHandle = { + expiresSeconds?: bigint + wallet?: Apiv1Wallet +} + +export const Apiv1WalletHandleMeta: ModelMetadata = { + name: 'Apiv1WalletHandle', + kind: 'object', + fields: [ + { + name: 'expiresSeconds', + wireKey: 'expires_seconds', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'wallet', + wireKey: 'wallet', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => Apiv1WalletMeta }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/apiv1-wallet.ts b/packages/typescript/kmd_client/src/models/apiv1-wallet.ts new file mode 100644 index 000000000..a674ca339 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/apiv1-wallet.ts @@ -0,0 +1,64 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { TxType } from './tx-type' +import { TxTypeMeta } from './tx-type' + +/** + * APIV1Wallet is the API's representation of a wallet + */ +export type Apiv1Wallet = { + driverName?: string + driverVersion?: bigint + id?: string + mnemonicUx?: boolean + name?: string + supportedTxs?: TxType[] +} + +export const Apiv1WalletMeta: ModelMetadata = { + name: 'Apiv1Wallet', + kind: 'object', + fields: [ + { + name: 'driverName', + wireKey: 'driver_name', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'driverVersion', + wireKey: 'driver_version', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'id', + wireKey: 'id', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'mnemonicUx', + wireKey: 'mnemonic_ux', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'name', + wireKey: 'name', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'supportedTxs', + wireKey: 'supported_txs', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'model', meta: () => TxTypeMeta } }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/create-wallet-request.ts b/packages/typescript/kmd_client/src/models/create-wallet-request.ts new file mode 100644 index 000000000..364921bf6 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/create-wallet-request.ts @@ -0,0 +1,48 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { MasterDerivationKey } from './master-derivation-key' +import { MasterDerivationKeyMeta } from './master-derivation-key' + +/** + * APIV1POSTWalletRequest is the request for `POST /v1/wallet` + */ +export type CreateWalletRequest = { + masterDerivationKey?: MasterDerivationKey + walletDriverName?: string + walletName?: string + walletPassword?: string +} + +export const CreateWalletRequestMeta: ModelMetadata = { + name: 'CreateWalletRequest', + kind: 'object', + fields: [ + { + name: 'masterDerivationKey', + wireKey: 'master_derivation_key', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => MasterDerivationKeyMeta }, + }, + { + name: 'walletDriverName', + wireKey: 'wallet_driver_name', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletName', + wireKey: 'wallet_name', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/delete-key-request.ts b/packages/typescript/kmd_client/src/models/delete-key-request.ts new file mode 100644 index 000000000..a92800113 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/delete-key-request.ts @@ -0,0 +1,38 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1DELETEKeyRequest is the request for `DELETE /v1/key` + */ +export type DeleteKeyRequest = { + address?: string + walletHandleToken?: string + walletPassword?: string +} + +export const DeleteKeyRequestMeta: ModelMetadata = { + name: 'DeleteKeyRequest', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/delete-multisig-request.ts b/packages/typescript/kmd_client/src/models/delete-multisig-request.ts new file mode 100644 index 000000000..d4eab7db1 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/delete-multisig-request.ts @@ -0,0 +1,38 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1DELETEMultisigRequest is the request for `DELETE /v1/multisig` + */ +export type DeleteMultisigRequest = { + address?: string + walletHandleToken?: string + walletPassword?: string +} + +export const DeleteMultisigRequestMeta: ModelMetadata = { + name: 'DeleteMultisigRequest', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/digest.ts b/packages/typescript/kmd_client/src/models/digest.ts new file mode 100644 index 000000000..067ce9c2e --- /dev/null +++ b/packages/typescript/kmd_client/src/models/digest.ts @@ -0,0 +1,9 @@ +import type { ModelMetadata } from '../core/model-runtime' + +export type Digest = bigint[] + +export const DigestMeta: ModelMetadata = { + name: 'Digest', + kind: 'array', + arrayItems: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/ed25519-private-key.ts b/packages/typescript/kmd_client/src/models/ed25519-private-key.ts new file mode 100644 index 000000000..5824b57a8 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/ed25519-private-key.ts @@ -0,0 +1,9 @@ +import type { ModelMetadata } from '../core/model-runtime' + +export type Ed25519PrivateKey = bigint[] + +export const Ed25519PrivateKeyMeta: ModelMetadata = { + name: 'Ed25519PrivateKey', + kind: 'array', + arrayItems: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/ed25519-public-key.ts b/packages/typescript/kmd_client/src/models/ed25519-public-key.ts new file mode 100644 index 000000000..64d8f81bd --- /dev/null +++ b/packages/typescript/kmd_client/src/models/ed25519-public-key.ts @@ -0,0 +1,9 @@ +import type { ModelMetadata } from '../core/model-runtime' + +export type Ed25519PublicKey = bigint[] + +export const Ed25519PublicKeyMeta: ModelMetadata = { + name: 'Ed25519PublicKey', + kind: 'array', + arrayItems: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/ed25519-signature.ts b/packages/typescript/kmd_client/src/models/ed25519-signature.ts new file mode 100644 index 000000000..26e7aced4 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/ed25519-signature.ts @@ -0,0 +1,9 @@ +import type { ModelMetadata } from '../core/model-runtime' + +export type Ed25519Signature = bigint[] + +export const Ed25519SignatureMeta: ModelMetadata = { + name: 'Ed25519Signature', + kind: 'array', + arrayItems: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/export-key-request.ts b/packages/typescript/kmd_client/src/models/export-key-request.ts new file mode 100644 index 000000000..6edae3f64 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/export-key-request.ts @@ -0,0 +1,38 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyExportRequest is the request for `POST /v1/key/export` + */ +export type ExportKeyRequest = { + address?: string + walletHandleToken?: string + walletPassword?: string +} + +export const ExportKeyRequestMeta: ModelMetadata = { + name: 'ExportKeyRequest', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/export-master-key-request.ts b/packages/typescript/kmd_client/src/models/export-master-key-request.ts new file mode 100644 index 000000000..87e6e0d5b --- /dev/null +++ b/packages/typescript/kmd_client/src/models/export-master-key-request.ts @@ -0,0 +1,30 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMasterKeyExportRequest is the request for `POST /v1/master-key/export` + */ +export type ExportMasterKeyRequest = { + walletHandleToken?: string + walletPassword?: string +} + +export const ExportMasterKeyRequestMeta: ModelMetadata = { + name: 'ExportMasterKeyRequest', + kind: 'object', + fields: [ + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/export-multisig-request.ts b/packages/typescript/kmd_client/src/models/export-multisig-request.ts new file mode 100644 index 000000000..eb06a4272 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/export-multisig-request.ts @@ -0,0 +1,30 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMultisigExportRequest is the request for `POST /v1/multisig/export` + */ +export type ExportMultisigRequest = { + address?: string + walletHandleToken?: string +} + +export const ExportMultisigRequestMeta: ModelMetadata = { + name: 'ExportMultisigRequest', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/generate-key-request.ts b/packages/typescript/kmd_client/src/models/generate-key-request.ts new file mode 100644 index 000000000..aad560ebe --- /dev/null +++ b/packages/typescript/kmd_client/src/models/generate-key-request.ts @@ -0,0 +1,30 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyRequest is the request for `POST /v1/key` + */ +export type GenerateKeyRequest = { + displayMnemonic?: boolean + walletHandleToken?: string +} + +export const GenerateKeyRequestMeta: ModelMetadata = { + name: 'GenerateKeyRequest', + kind: 'object', + fields: [ + { + name: 'displayMnemonic', + wireKey: 'display_mnemonic', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/import-key-request.ts b/packages/typescript/kmd_client/src/models/import-key-request.ts new file mode 100644 index 000000000..28fd7c70f --- /dev/null +++ b/packages/typescript/kmd_client/src/models/import-key-request.ts @@ -0,0 +1,30 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyImportRequest is the request for `POST /v1/key/import` + */ +export type ImportKeyRequest = { + privateKey?: Uint8Array + walletHandleToken?: string +} + +export const ImportKeyRequestMeta: ModelMetadata = { + name: 'ImportKeyRequest', + kind: 'object', + fields: [ + { + name: 'privateKey', + wireKey: 'private_key', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/import-multisig-request.ts b/packages/typescript/kmd_client/src/models/import-multisig-request.ts new file mode 100644 index 000000000..9abfa0c9c --- /dev/null +++ b/packages/typescript/kmd_client/src/models/import-multisig-request.ts @@ -0,0 +1,48 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { PublicKey } from './public-key' +import { PublicKeyMeta } from './public-key' + +/** + * APIV1POSTMultisigImportRequest is the request for `POST /v1/multisig/import` + */ +export type ImportMultisigRequest = { + multisigVersion?: bigint + pks?: PublicKey[] + threshold?: bigint + walletHandleToken?: string +} + +export const ImportMultisigRequestMeta: ModelMetadata = { + name: 'ImportMultisigRequest', + kind: 'object', + fields: [ + { + name: 'multisigVersion', + wireKey: 'multisig_version', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'pks', + wireKey: 'pks', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'model', meta: () => PublicKeyMeta } }, + }, + { + name: 'threshold', + wireKey: 'threshold', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/index.ts b/packages/typescript/kmd_client/src/models/index.ts new file mode 100644 index 000000000..521e50f68 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/index.ts @@ -0,0 +1,114 @@ +export type { Apiv1DeletekeyResponse } from './apiv1-deletekey-response' +export { Apiv1DeletekeyResponseMeta } from './apiv1-deletekey-response' +export type { Apiv1DeletemultisigResponse } from './apiv1-deletemultisig-response' +export { Apiv1DeletemultisigResponseMeta } from './apiv1-deletemultisig-response' +export type { Apiv1GetwalletsResponse } from './apiv1-getwallets-response' +export { Apiv1GetwalletsResponseMeta } from './apiv1-getwallets-response' +export type { Apiv1PostkeyExportResponse } from './apiv1-postkey-export-response' +export { Apiv1PostkeyExportResponseMeta } from './apiv1-postkey-export-response' +export type { Apiv1PostkeyImportResponse } from './apiv1-postkey-import-response' +export { Apiv1PostkeyImportResponseMeta } from './apiv1-postkey-import-response' +export type { Apiv1PostkeyListResponse } from './apiv1-postkey-list-response' +export { Apiv1PostkeyListResponseMeta } from './apiv1-postkey-list-response' +export type { Apiv1PostkeyResponse } from './apiv1-postkey-response' +export { Apiv1PostkeyResponseMeta } from './apiv1-postkey-response' +export type { Apiv1PostmasterKeyExportResponse } from './apiv1-postmaster-key-export-response' +export { Apiv1PostmasterKeyExportResponseMeta } from './apiv1-postmaster-key-export-response' +export type { Apiv1PostmultisigExportResponse } from './apiv1-postmultisig-export-response' +export { Apiv1PostmultisigExportResponseMeta } from './apiv1-postmultisig-export-response' +export type { Apiv1PostmultisigImportResponse } from './apiv1-postmultisig-import-response' +export { Apiv1PostmultisigImportResponseMeta } from './apiv1-postmultisig-import-response' +export type { Apiv1PostmultisigListResponse } from './apiv1-postmultisig-list-response' +export { Apiv1PostmultisigListResponseMeta } from './apiv1-postmultisig-list-response' +export type { Apiv1PostmultisigProgramSignResponse } from './apiv1-postmultisig-program-sign-response' +export { Apiv1PostmultisigProgramSignResponseMeta } from './apiv1-postmultisig-program-sign-response' +export type { Apiv1PostmultisigTransactionSignResponse } from './apiv1-postmultisig-transaction-sign-response' +export { Apiv1PostmultisigTransactionSignResponseMeta } from './apiv1-postmultisig-transaction-sign-response' +export type { Apiv1PostprogramSignResponse } from './apiv1-postprogram-sign-response' +export { Apiv1PostprogramSignResponseMeta } from './apiv1-postprogram-sign-response' +export type { Apiv1PosttransactionSignResponse } from './apiv1-posttransaction-sign-response' +export { Apiv1PosttransactionSignResponseMeta } from './apiv1-posttransaction-sign-response' +export type { Apiv1PostwalletInfoResponse } from './apiv1-postwallet-info-response' +export { Apiv1PostwalletInfoResponseMeta } from './apiv1-postwallet-info-response' +export type { Apiv1PostwalletInitResponse } from './apiv1-postwallet-init-response' +export { Apiv1PostwalletInitResponseMeta } from './apiv1-postwallet-init-response' +export type { Apiv1PostwalletReleaseResponse } from './apiv1-postwallet-release-response' +export { Apiv1PostwalletReleaseResponseMeta } from './apiv1-postwallet-release-response' +export type { Apiv1PostwalletRenameResponse } from './apiv1-postwallet-rename-response' +export { Apiv1PostwalletRenameResponseMeta } from './apiv1-postwallet-rename-response' +export type { Apiv1PostwalletRenewResponse } from './apiv1-postwallet-renew-response' +export { Apiv1PostwalletRenewResponseMeta } from './apiv1-postwallet-renew-response' +export type { Apiv1PostwalletResponse } from './apiv1-postwallet-response' +export { Apiv1PostwalletResponseMeta } from './apiv1-postwallet-response' +export type { Apiv1Wallet } from './apiv1-wallet' +export { Apiv1WalletMeta } from './apiv1-wallet' +export type { Apiv1WalletHandle } from './apiv1-wallet-handle' +export { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' +export type { CreateWalletRequest } from './create-wallet-request' +export { CreateWalletRequestMeta } from './create-wallet-request' +export type { DeleteKeyRequest } from './delete-key-request' +export { DeleteKeyRequestMeta } from './delete-key-request' +export type { DeleteMultisigRequest } from './delete-multisig-request' +export { DeleteMultisigRequestMeta } from './delete-multisig-request' +export type { Digest } from './digest' +export { DigestMeta } from './digest' +export type { ExportKeyRequest } from './export-key-request' +export { ExportKeyRequestMeta } from './export-key-request' +export type { ExportMasterKeyRequest } from './export-master-key-request' +export { ExportMasterKeyRequestMeta } from './export-master-key-request' +export type { ExportMultisigRequest } from './export-multisig-request' +export { ExportMultisigRequestMeta } from './export-multisig-request' +export type { GenerateKeyRequest } from './generate-key-request' +export { GenerateKeyRequestMeta } from './generate-key-request' +export type { ImportKeyRequest } from './import-key-request' +export { ImportKeyRequestMeta } from './import-key-request' +export type { ImportMultisigRequest } from './import-multisig-request' +export { ImportMultisigRequestMeta } from './import-multisig-request' +export type { InitWalletHandleTokenRequest } from './init-wallet-handle-token-request' +export { InitWalletHandleTokenRequestMeta } from './init-wallet-handle-token-request' +export type { ListKeysRequest } from './list-keys-request' +export { ListKeysRequestMeta } from './list-keys-request' +export type { ListMultisigRequest } from './list-multisig-request' +export { ListMultisigRequestMeta } from './list-multisig-request' +export type { ListWalletsRequest } from './list-wallets-request' +export { ListWalletsRequestMeta } from './list-wallets-request' +export type { MasterDerivationKey } from './master-derivation-key' +export { MasterDerivationKeyMeta } from './master-derivation-key' +export type { MultisigSig } from './multisig-sig' +export { MultisigSigMeta } from './multisig-sig' +export type { MultisigSubsig } from './multisig-subsig' +export { MultisigSubsigMeta } from './multisig-subsig' +export type { PrivateKey } from './private-key' +export { PrivateKeyMeta } from './private-key' +export type { PublicKey } from './public-key' +export { PublicKeyMeta } from './public-key' +export type { ReleaseWalletHandleTokenRequest } from './release-wallet-handle-token-request' +export { ReleaseWalletHandleTokenRequestMeta } from './release-wallet-handle-token-request' +export type { RenameWalletRequest } from './rename-wallet-request' +export { RenameWalletRequestMeta } from './rename-wallet-request' +export type { RenewWalletHandleTokenRequest } from './renew-wallet-handle-token-request' +export { RenewWalletHandleTokenRequestMeta } from './renew-wallet-handle-token-request' +export type { SignMultisigRequest } from './sign-multisig-request' +export { SignMultisigRequestMeta } from './sign-multisig-request' +export type { SignProgramMultisigRequest } from './sign-program-multisig-request' +export { SignProgramMultisigRequestMeta } from './sign-program-multisig-request' +export type { SignProgramRequest } from './sign-program-request' +export { SignProgramRequestMeta } from './sign-program-request' +export type { SignTransactionRequest } from './sign-transaction-request' +export { SignTransactionRequestMeta } from './sign-transaction-request' +export type { Signature } from './signature' +export { SignatureMeta } from './signature' +export type { TxType } from './tx-type' +export { TxTypeMeta } from './tx-type' +export type { VersionsRequest } from './versions-request' +export { VersionsRequestMeta } from './versions-request' +export type { VersionsResponse } from './versions-response' +export { VersionsResponseMeta } from './versions-response' +export type { WalletInfoRequest } from './wallet-info-request' +export { WalletInfoRequestMeta } from './wallet-info-request' +export type { Ed25519PrivateKey } from './ed25519-private-key' +export { Ed25519PrivateKeyMeta } from './ed25519-private-key' +export type { Ed25519PublicKey } from './ed25519-public-key' +export { Ed25519PublicKeyMeta } from './ed25519-public-key' +export type { Ed25519Signature } from './ed25519-signature' +export { Ed25519SignatureMeta } from './ed25519-signature' diff --git a/packages/typescript/kmd_client/src/models/init-wallet-handle-token-request.ts b/packages/typescript/kmd_client/src/models/init-wallet-handle-token-request.ts new file mode 100644 index 000000000..d2f86bbbf --- /dev/null +++ b/packages/typescript/kmd_client/src/models/init-wallet-handle-token-request.ts @@ -0,0 +1,30 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletInitRequest is the request for `POST /v1/wallet/init` + */ +export type InitWalletHandleTokenRequest = { + walletId?: string + walletPassword?: string +} + +export const InitWalletHandleTokenRequestMeta: ModelMetadata = { + name: 'InitWalletHandleTokenRequest', + kind: 'object', + fields: [ + { + name: 'walletId', + wireKey: 'wallet_id', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/list-keys-request.ts b/packages/typescript/kmd_client/src/models/list-keys-request.ts new file mode 100644 index 000000000..07e3687a7 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/list-keys-request.ts @@ -0,0 +1,22 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTKeyListRequest is the request for `POST /v1/key/list` + */ +export type ListKeysRequest = { + walletHandleToken?: string +} + +export const ListKeysRequestMeta: ModelMetadata = { + name: 'ListKeysRequest', + kind: 'object', + fields: [ + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/list-multisig-request.ts b/packages/typescript/kmd_client/src/models/list-multisig-request.ts new file mode 100644 index 000000000..9df0ce23a --- /dev/null +++ b/packages/typescript/kmd_client/src/models/list-multisig-request.ts @@ -0,0 +1,22 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTMultisigListRequest is the request for `POST /v1/multisig/list` + */ +export type ListMultisigRequest = { + walletHandleToken?: string +} + +export const ListMultisigRequestMeta: ModelMetadata = { + name: 'ListMultisigRequest', + kind: 'object', + fields: [ + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/list-wallets-request.ts b/packages/typescript/kmd_client/src/models/list-wallets-request.ts new file mode 100644 index 000000000..3993c2025 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/list-wallets-request.ts @@ -0,0 +1,12 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1GETWalletsRequest is the request for `GET /v1/wallets` + */ +export type ListWalletsRequest = Record + +export const ListWalletsRequestMeta: ModelMetadata = { + name: 'ListWalletsRequest', + kind: 'object', + fields: [], +} diff --git a/packages/typescript/kmd_client/src/models/master-derivation-key.ts b/packages/typescript/kmd_client/src/models/master-derivation-key.ts new file mode 100644 index 000000000..aa97d978b --- /dev/null +++ b/packages/typescript/kmd_client/src/models/master-derivation-key.ts @@ -0,0 +1,12 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * MasterDerivationKey is used to derive ed25519 keys for use in wallets + */ +export type MasterDerivationKey = bigint[] + +export const MasterDerivationKeyMeta: ModelMetadata = { + name: 'MasterDerivationKey', + kind: 'array', + arrayItems: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/multisig-sig.ts b/packages/typescript/kmd_client/src/models/multisig-sig.ts new file mode 100644 index 000000000..456be8a93 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/multisig-sig.ts @@ -0,0 +1,40 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { MultisigSubsig } from './multisig-subsig' +import { MultisigSubsigMeta } from './multisig-subsig' + +/** + * MultisigSig is the structure that holds multiple Subsigs + */ +export type MultisigSig = { + subsigs?: MultisigSubsig[] + threshold?: bigint + version?: bigint +} + +export const MultisigSigMeta: ModelMetadata = { + name: 'MultisigSig', + kind: 'object', + fields: [ + { + name: 'subsigs', + wireKey: 'Subsigs', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'model', meta: () => MultisigSubsigMeta } }, + }, + { + name: 'threshold', + wireKey: 'Threshold', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'version', + wireKey: 'Version', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/multisig-subsig.ts b/packages/typescript/kmd_client/src/models/multisig-subsig.ts new file mode 100644 index 000000000..2f4250829 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/multisig-subsig.ts @@ -0,0 +1,35 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { PublicKey } from './public-key' +import { PublicKeyMeta } from './public-key' +import type { Signature } from './signature' +import { SignatureMeta } from './signature' + +/** + * MultisigSubsig is a struct that holds a pair of public key and signatures + * signatures may be empty + */ +export type MultisigSubsig = { + key?: PublicKey + sig?: Signature +} + +export const MultisigSubsigMeta: ModelMetadata = { + name: 'MultisigSubsig', + kind: 'object', + fields: [ + { + name: 'key', + wireKey: 'Key', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => PublicKeyMeta }, + }, + { + name: 'sig', + wireKey: 'Sig', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => SignatureMeta }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/private-key.ts b/packages/typescript/kmd_client/src/models/private-key.ts new file mode 100644 index 000000000..ac3b88fe6 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/private-key.ts @@ -0,0 +1,10 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Ed25519PrivateKey } from './ed25519-private-key' + +export type PrivateKey = Ed25519PrivateKey + +export const PrivateKeyMeta: ModelMetadata = { + name: 'PrivateKey', + kind: 'passthrough', + passThrough: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/public-key.ts b/packages/typescript/kmd_client/src/models/public-key.ts new file mode 100644 index 000000000..e6bf80c79 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/public-key.ts @@ -0,0 +1,10 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Ed25519PublicKey } from './ed25519-public-key' + +export type PublicKey = Ed25519PublicKey + +export const PublicKeyMeta: ModelMetadata = { + name: 'PublicKey', + kind: 'passthrough', + passThrough: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/release-wallet-handle-token-request.ts b/packages/typescript/kmd_client/src/models/release-wallet-handle-token-request.ts new file mode 100644 index 000000000..1e64d5add --- /dev/null +++ b/packages/typescript/kmd_client/src/models/release-wallet-handle-token-request.ts @@ -0,0 +1,22 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletReleaseRequest is the request for `POST /v1/wallet/release` + */ +export type ReleaseWalletHandleTokenRequest = { + walletHandleToken?: string +} + +export const ReleaseWalletHandleTokenRequestMeta: ModelMetadata = { + name: 'ReleaseWalletHandleTokenRequest', + kind: 'object', + fields: [ + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/rename-wallet-request.ts b/packages/typescript/kmd_client/src/models/rename-wallet-request.ts new file mode 100644 index 000000000..913ca8fb3 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/rename-wallet-request.ts @@ -0,0 +1,38 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletRenameRequest is the request for `POST /v1/wallet/rename` + */ +export type RenameWalletRequest = { + walletId?: string + walletName?: string + walletPassword?: string +} + +export const RenameWalletRequestMeta: ModelMetadata = { + name: 'RenameWalletRequest', + kind: 'object', + fields: [ + { + name: 'walletId', + wireKey: 'wallet_id', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletName', + wireKey: 'wallet_name', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/renew-wallet-handle-token-request.ts b/packages/typescript/kmd_client/src/models/renew-wallet-handle-token-request.ts new file mode 100644 index 000000000..005793bd3 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/renew-wallet-handle-token-request.ts @@ -0,0 +1,22 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletRenewRequest is the request for `POST /v1/wallet/renew` + */ +export type RenewWalletHandleTokenRequest = { + walletHandleToken?: string +} + +export const RenewWalletHandleTokenRequestMeta: ModelMetadata = { + name: 'RenewWalletHandleTokenRequest', + kind: 'object', + fields: [ + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/sign-multisig-request.ts b/packages/typescript/kmd_client/src/models/sign-multisig-request.ts new file mode 100644 index 000000000..2f798e252 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/sign-multisig-request.ts @@ -0,0 +1,68 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Digest } from './digest' +import { DigestMeta } from './digest' +import type { MultisigSig } from './multisig-sig' +import { MultisigSigMeta } from './multisig-sig' +import type { PublicKey } from './public-key' +import { PublicKeyMeta } from './public-key' + +/** + * APIV1POSTMultisigTransactionSignRequest is the request for `POST /v1/multisig/sign` + */ +export type SignMultisigRequest = { + partialMultisig?: MultisigSig + publicKey?: PublicKey + signer?: Digest + transaction?: Uint8Array + walletHandleToken?: string + walletPassword?: string +} + +export const SignMultisigRequestMeta: ModelMetadata = { + name: 'SignMultisigRequest', + kind: 'object', + fields: [ + { + name: 'partialMultisig', + wireKey: 'partial_multisig', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => MultisigSigMeta }, + }, + { + name: 'publicKey', + wireKey: 'public_key', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => PublicKeyMeta }, + }, + { + name: 'signer', + wireKey: 'signer', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => DigestMeta }, + }, + { + name: 'transaction', + wireKey: 'transaction', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/sign-program-multisig-request.ts b/packages/typescript/kmd_client/src/models/sign-program-multisig-request.ts new file mode 100644 index 000000000..f92243e21 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/sign-program-multisig-request.ts @@ -0,0 +1,74 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { MultisigSig } from './multisig-sig' +import { MultisigSigMeta } from './multisig-sig' +import type { PublicKey } from './public-key' +import { PublicKeyMeta } from './public-key' + +/** + * APIV1POSTMultisigProgramSignRequest is the request for `POST /v1/multisig/signprogram` + */ +export type SignProgramMultisigRequest = { + address?: string + data?: Uint8Array + partialMultisig?: MultisigSig + publicKey?: PublicKey + useLegacyMsig?: boolean + walletHandleToken?: string + walletPassword?: string +} + +export const SignProgramMultisigRequestMeta: ModelMetadata = { + name: 'SignProgramMultisigRequest', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'data', + wireKey: 'data', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + { + name: 'partialMultisig', + wireKey: 'partial_multisig', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => MultisigSigMeta }, + }, + { + name: 'publicKey', + wireKey: 'public_key', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => PublicKeyMeta }, + }, + { + name: 'useLegacyMsig', + wireKey: 'use_legacy_msig', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/sign-program-request.ts b/packages/typescript/kmd_client/src/models/sign-program-request.ts new file mode 100644 index 000000000..6ffe6b3cc --- /dev/null +++ b/packages/typescript/kmd_client/src/models/sign-program-request.ts @@ -0,0 +1,46 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTProgramSignRequest is the request for `POST /v1/program/sign` + */ +export type SignProgramRequest = { + address?: string + data?: Uint8Array + walletHandleToken?: string + walletPassword?: string +} + +export const SignProgramRequestMeta: ModelMetadata = { + name: 'SignProgramRequest', + kind: 'object', + fields: [ + { + name: 'address', + wireKey: 'address', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'data', + wireKey: 'data', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/sign-transaction-request.ts b/packages/typescript/kmd_client/src/models/sign-transaction-request.ts new file mode 100644 index 000000000..14d4cf480 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/sign-transaction-request.ts @@ -0,0 +1,55 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { PublicKey } from './public-key' +import { PublicKeyMeta } from './public-key' + +/** + * APIV1POSTTransactionSignRequest is the request for `POST /v1/transaction/sign` + */ +export type SignTransactionRequest = { + publicKey?: PublicKey + + /** + * Base64 encoding of msgpack encoding of a `Transaction` object + * Note: SDK and goal usually generate `SignedTxn` objects + * in that case, the field `txn` / `Transaction` of the + * generated `SignedTxn` object needs to be used + */ + transaction?: Uint8Array + walletHandleToken?: string + walletPassword?: string +} + +export const SignTransactionRequestMeta: ModelMetadata = { + name: 'SignTransactionRequest', + kind: 'object', + fields: [ + { + name: 'publicKey', + wireKey: 'public_key', + optional: true, + nullable: false, + type: { kind: 'model', meta: () => PublicKeyMeta }, + }, + { + name: 'transaction', + wireKey: 'transaction', + optional: true, + nullable: false, + type: { kind: 'scalar', isBytes: true }, + }, + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + { + name: 'walletPassword', + wireKey: 'wallet_password', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/signature.ts b/packages/typescript/kmd_client/src/models/signature.ts new file mode 100644 index 000000000..e211e5b5a --- /dev/null +++ b/packages/typescript/kmd_client/src/models/signature.ts @@ -0,0 +1,10 @@ +import type { ModelMetadata } from '../core/model-runtime' +import type { Ed25519Signature } from './ed25519-signature' + +export type Signature = Ed25519Signature + +export const SignatureMeta: ModelMetadata = { + name: 'Signature', + kind: 'passthrough', + passThrough: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/tx-type.ts b/packages/typescript/kmd_client/src/models/tx-type.ts new file mode 100644 index 000000000..af1d334ed --- /dev/null +++ b/packages/typescript/kmd_client/src/models/tx-type.ts @@ -0,0 +1,12 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * TxType is the type of the transaction written to the ledger + */ +export type TxType = string + +export const TxTypeMeta: ModelMetadata = { + name: 'TxType', + kind: 'passthrough', + passThrough: { kind: 'scalar' }, +} diff --git a/packages/typescript/kmd_client/src/models/versions-request.ts b/packages/typescript/kmd_client/src/models/versions-request.ts new file mode 100644 index 000000000..9321e4fa0 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/versions-request.ts @@ -0,0 +1,12 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * VersionsRequest is the request for `GET /versions` + */ +export type VersionsRequest = Record + +export const VersionsRequestMeta: ModelMetadata = { + name: 'VersionsRequest', + kind: 'object', + fields: [], +} diff --git a/packages/typescript/kmd_client/src/models/versions-response.ts b/packages/typescript/kmd_client/src/models/versions-response.ts new file mode 100644 index 000000000..692ff9db4 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/versions-response.ts @@ -0,0 +1,23 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * VersionsResponse is the response to `GET /versions` + * friendly:VersionsResponse + */ +export type VersionsResponse = { + versions?: string[] +} + +export const VersionsResponseMeta: ModelMetadata = { + name: 'VersionsResponse', + kind: 'object', + fields: [ + { + name: 'versions', + wireKey: 'versions', + optional: true, + nullable: false, + type: { kind: 'array', item: { kind: 'scalar' } }, + }, + ], +} diff --git a/packages/typescript/kmd_client/src/models/wallet-info-request.ts b/packages/typescript/kmd_client/src/models/wallet-info-request.ts new file mode 100644 index 000000000..097a63356 --- /dev/null +++ b/packages/typescript/kmd_client/src/models/wallet-info-request.ts @@ -0,0 +1,22 @@ +import type { ModelMetadata } from '../core/model-runtime' + +/** + * APIV1POSTWalletInfoRequest is the request for `POST /v1/wallet/info` + */ +export type WalletInfoRequest = { + walletHandleToken?: string +} + +export const WalletInfoRequestMeta: ModelMetadata = { + name: 'WalletInfoRequest', + kind: 'object', + fields: [ + { + name: 'walletHandleToken', + wireKey: 'wallet_handle_token', + optional: true, + nullable: false, + type: { kind: 'scalar' }, + }, + ], +} diff --git a/packages/typescript/kmd_client/tsconfig.build.json b/packages/typescript/kmd_client/tsconfig.build.json new file mode 100644 index 000000000..0e149d398 --- /dev/null +++ b/packages/typescript/kmd_client/tsconfig.build.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "tests/**/*.*"] +} diff --git a/packages/typescript/kmd_client/tsconfig.json b/packages/typescript/kmd_client/tsconfig.json new file mode 100644 index 000000000..8947a5922 --- /dev/null +++ b/packages/typescript/kmd_client/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist", + "tsBuildInfoFile": "build/.tsbuildinfo" + }, + "include": ["src/**/*.ts", "tests/**/*.ts"] +} diff --git a/packages/typescript/kmd_client/tsconfig.test.json b/packages/typescript/kmd_client/tsconfig.test.json new file mode 100644 index 000000000..4b8f61b29 --- /dev/null +++ b/packages/typescript/kmd_client/tsconfig.test.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "isolatedModules": true + } +} diff --git a/packages/typescript/package-lock.json b/packages/typescript/package-lock.json index c12699502..d6ed2e04e 100644 --- a/packages/typescript/package-lock.json +++ b/packages/typescript/package-lock.json @@ -13,7 +13,8 @@ "algokit_transact", "algod_client", "algokit_utils", - "indexer_client" + "indexer_client", + "kmd_client" ], "dependencies": { "@msgpack/msgpack": "^3.1.2", @@ -163,7 +164,8 @@ "@algorandfoundation/algokit-abi": "../algokit_abi/dist", "@algorandfoundation/algokit-common": "../algokit_common/dist", "@algorandfoundation/algokit-transact": "../algokit_transact/dist", - "@algorandfoundation/indexer-client": "../indexer_client/dist" + "@algorandfoundation/indexer-client": "../indexer_client/dist", + "@algorandfoundation/kmd-client": "../kmd_client/dist" }, "engines": { "node": ">=20.0" @@ -189,6 +191,10 @@ "resolved": "indexer_client/dist", "link": true }, + "algokit_utils/node_modules/@algorandfoundation/kmd-client": { + "resolved": "kmd_client/dist", + "link": true + }, "indexer_client": { "name": "@algorandfoundation/indexer-client", "version": "0.1.0", @@ -224,6 +230,30 @@ "resolved": "algokit_transact/dist", "link": true }, + "kmd_client": { + "name": "@algorandfoundation/kmd-client", + "version": "0.1.0", + "license": "MIT", + "devDependencies": { + "@algorandfoundation/algokit-transact": "../algokit_transact/dist" + }, + "engines": { + "node": ">=20.0" + } + }, + "kmd_client/dist": { + "name": "@algorandfoundation/kmd-client", + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0" + } + }, + "kmd_client/node_modules/@algorandfoundation/algokit-transact": { + "resolved": "algokit_transact/dist", + "link": true + }, "node_modules/@algorandfoundation/algod-client": { "resolved": "algod_client", "link": true @@ -248,6 +278,10 @@ "resolved": "indexer_client", "link": true }, + "node_modules/@algorandfoundation/kmd-client": { + "resolved": "kmd_client", + "link": true + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", diff --git a/packages/typescript/package.json b/packages/typescript/package.json index b76f496eb..af9e8c32e 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -9,7 +9,8 @@ "algokit_transact", "algod_client", "algokit_utils", - "indexer_client" + "indexer_client", + "kmd_client" ], "scripts": { "build": "npm run build --workspaces --if-present", diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index 94891adeb..0e293bc8d 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -1,4 +1,4 @@ { "files": [], - "references": [{ "path": "./algokit_common" }, { "path": "./algokit_abi" }, { "path": "./algokit_transact" }, { "path": "./algod_client" }, { "path": "./algokit_utils" }] + "references": [{ "path": "./algokit_common" }, { "path": "./algokit_abi" }, { "path": "./algokit_transact" }, { "path": "./algod_client" }, { "path": "./algokit_utils" }, { "path": "./kmd_client" }] } diff --git a/tools/api_tools/src/main.rs b/tools/api_tools/src/main.rs index 68dd8b038..a09efd99f 100644 --- a/tools/api_tools/src/main.rs +++ b/tools/api_tools/src/main.rs @@ -45,12 +45,18 @@ enum Commands { /// Format generated indexer Rust code #[command(name = "format-indexer")] FormatIndexer, + /// Format generated KMD Rust code + #[command(name = "format-kmd")] + FormatKmd, /// Generate algod API client #[command(name = "generate-algod")] GenerateAlgod, /// Generate indexer API client #[command(name = "generate-indexer")] GenerateIndexer, + /// Generate KMD API client + #[command(name = "generate-kmd")] + GenerateKmd, /// Generate both algod and indexer API clients #[command(name = "generate-all")] GenerateAll, @@ -60,6 +66,9 @@ enum Commands { /// Generate TypeScript indexer client #[command(name = "generate-ts-indexer")] GenerateTsIndexer, + /// Generate TypeScript KMD client + #[command(name = "generate-ts-kmd")] + GenerateTsKmd, /// Generate both TypeScript clients (algod and indexer) #[command(name = "generate-ts-all")] GenerateTsAll, @@ -72,6 +81,9 @@ enum Commands { /// Convert indexer OpenAPI specification only #[command(name = "convert-indexer")] ConvertIndexer, + /// Convert kmd OpenAPI specification only + #[command(name = "convert-kmd")] + ConvertKmd, } fn repo_root() -> &'static Path { @@ -159,6 +171,13 @@ const INDEXER_RS_CLIENT: RsClientConfig = RsClientConfig { description: "API client for indexer interaction.", }; +const KMD_RS_CLIENT: RsClientConfig = RsClientConfig { + spec: "kmd", + output_rel: "crates/kmd_client", + package_name: "kmd_client", + description: "API client for kmd interaction.", +}; + fn generate_rs_client(config: &RsClientConfig) -> Result<()> { run( &format!( @@ -203,6 +222,13 @@ const INDEXER_TS_CLIENT: TsClientConfig = TsClientConfig { description: "TypeScript client for indexer interaction.", }; +const KMD_TS_CLIENT: TsClientConfig = TsClientConfig { + spec: "kmd", + output_rel: "packages/typescript/kmd_client", + package_name: "kmd_client", + description: "TypeScript client for kmd interaction.", +}; + fn generate_ts_client(config: &TsClientConfig) -> Result<()> { clean_ts_package(config.output_rel)?; @@ -261,15 +287,26 @@ fn execute_command(command: &Commands) -> Result<()> { None, )?; } + Commands::FormatKmd => { + run( + "cargo fmt --manifest-path Cargo.toml -p kmd_client", + None, + None, + )?; + } Commands::GenerateAlgod => { generate_rs_client(&ALGOD_RS_CLIENT)?; } Commands::GenerateIndexer => { generate_rs_client(&INDEXER_RS_CLIENT)?; } + Commands::GenerateKmd => { + generate_rs_client(&KMD_RS_CLIENT)?; + } Commands::GenerateAll => { generate_rs_client(&ALGOD_RS_CLIENT)?; generate_rs_client(&INDEXER_RS_CLIENT)?; + generate_rs_client(&KMD_RS_CLIENT)?; } Commands::GenerateTsAlgod => { generate_ts_client(&ALGOD_TS_CLIENT)?; @@ -277,9 +314,13 @@ fn execute_command(command: &Commands) -> Result<()> { Commands::GenerateTsIndexer => { generate_ts_client(&INDEXER_TS_CLIENT)?; } + Commands::GenerateTsKmd => { + generate_ts_client(&KMD_TS_CLIENT)?; + } Commands::GenerateTsAll => { generate_ts_client(&ALGOD_TS_CLIENT)?; generate_ts_client(&INDEXER_TS_CLIENT)?; + generate_ts_client(&KMD_TS_CLIENT)?; } Commands::ConvertOpenapi => { run("npm run convert-openapi", Some(Path::new("api")), None)?; @@ -298,6 +339,13 @@ fn execute_command(command: &Commands) -> Result<()> { None, )?; } + Commands::ConvertKmd => { + run( + "npm run convert-openapi -- --kmd-only", + Some(Path::new("api")), + None, + )?; + } } Ok(()) } From f651b85f4db2c18cf2aff7969a6919f82816e9db Mon Sep 17 00:00:00 2001 From: Altynbek Orumbayev Date: Fri, 26 Sep 2025 16:09:44 +0200 Subject: [PATCH 2/4] fix: Ensure GET request with empty schemas are excluded - Rust Clients (algod, indexer, kmd): - Removed Content-Type headers from all GET/HEAD/DELETE requests - Removed empty request body parameters from methods like list_wallets() - Now: client.list_wallets() instead of client.list_wallets(None) - TypeScript Clients (algod, indexer, kmd): - Removed body parameters from GET/HEAD/DELETE methods - Now: client.listWallets() instead of client.listWallets({ body: {} }) --- .../generator/template_engine.py | 29 ++ .../templates/apis/client.rs.j2 | 4 +- .../templates/apis/endpoint.rs.j2 | 23 +- .../generator/template_engine.py | 3 +- .../templates/apis/service.ts.j2 | 14 +- crates/algod_client/src/apis/abort_catchup.rs | 1 - .../apis/account_application_information.rs | 5 - .../src/apis/account_asset_information.rs | 5 - .../src/apis/account_assets_information.rs | 1 - .../src/apis/account_information.rs | 5 - .../apis/delete_participation_key_by_id.rs | 1 - .../src/apis/experimental_check.rs | 1 - .../src/apis/generate_participation_keys.rs | 1 - .../src/apis/get_application_box_by_name.rs | 1 - .../src/apis/get_application_boxes.rs | 1 - .../src/apis/get_application_by_id.rs | 1 - .../algod_client/src/apis/get_asset_by_id.rs | 1 - crates/algod_client/src/apis/get_block.rs | 5 - .../algod_client/src/apis/get_block_hash.rs | 1 - .../algod_client/src/apis/get_block_logs.rs | 1 - .../src/apis/get_block_time_stamp_offset.rs | 1 - .../algod_client/src/apis/get_block_txids.rs | 1 - crates/algod_client/src/apis/get_config.rs | 1 - .../src/apis/get_debug_settings_prof.rs | 1 - crates/algod_client/src/apis/get_genesis.rs | 1 - .../src/apis/get_ledger_state_delta.rs | 5 - ...edger_state_delta_for_transaction_group.rs | 5 - .../src/apis/get_light_block_header_proof.rs | 1 - .../src/apis/get_participation_key_by_id.rs | 1 - .../src/apis/get_participation_keys.rs | 1 - .../src/apis/get_pending_transactions.rs | 5 - .../get_pending_transactions_by_address.rs | 5 - crates/algod_client/src/apis/get_ready.rs | 1 - .../algod_client/src/apis/get_state_proof.rs | 1 - crates/algod_client/src/apis/get_status.rs | 1 - crates/algod_client/src/apis/get_supply.rs | 1 - .../algod_client/src/apis/get_sync_round.rs | 1 - ...ion_group_ledger_state_deltas_for_round.rs | 5 - .../src/apis/get_transaction_proof.rs | 1 - crates/algod_client/src/apis/get_version.rs | 1 - crates/algod_client/src/apis/health_check.rs | 1 - crates/algod_client/src/apis/metrics.rs | 1 - .../apis/pending_transaction_information.rs | 5 - .../src/apis/put_debug_settings_prof.rs | 1 - .../src/apis/set_block_time_stamp_offset.rs | 1 - .../algod_client/src/apis/set_sync_round.rs | 1 - crates/algod_client/src/apis/shutdown_node.rs | 1 - .../src/apis/simulate_transaction.rs | 5 +- crates/algod_client/src/apis/start_catchup.rs | 1 - crates/algod_client/src/apis/swagger_json.rs | 1 - .../src/apis/transaction_params.rs | 1 - .../algod_client/src/apis/unset_sync_round.rs | 1 - .../algod_client/src/apis/wait_for_block.rs | 1 - .../tests/common/local_net_dispenser.rs | 4 +- .../tests/kmd/wallet_lifecycle.rs | 2 +- .../apis/lookup_account_app_local_states.rs | 1 - .../src/apis/lookup_account_assets.rs | 1 - .../src/apis/lookup_account_by_id.rs | 1 - .../lookup_account_created_applications.rs | 1 - .../src/apis/lookup_account_created_assets.rs | 1 - .../src/apis/lookup_account_transactions.rs | 1 - .../lookup_application_box_by_id_and_name.rs | 1 - .../src/apis/lookup_application_by_id.rs | 1 - .../src/apis/lookup_application_logs_by_id.rs | 1 - .../src/apis/lookup_asset_balances.rs | 1 - .../src/apis/lookup_asset_by_id.rs | 1 - .../src/apis/lookup_asset_transactions.rs | 1 - .../indexer_client/src/apis/lookup_block.rs | 1 - .../src/apis/lookup_transaction.rs | 1 - .../src/apis/make_health_check.rs | 1 - .../src/apis/search_for_accounts.rs | 1 - .../src/apis/search_for_application_boxes.rs | 1 - .../src/apis/search_for_applications.rs | 1 - .../src/apis/search_for_assets.rs | 1 - .../src/apis/search_for_block_headers.rs | 1 - .../src/apis/search_for_transactions.rs | 1 - crates/kmd_client/src/apis/client.rs | 29 +- crates/kmd_client/src/apis/delete_key.rs | 12 +- crates/kmd_client/src/apis/delete_multisig.rs | 8 +- crates/kmd_client/src/apis/get_version.rs | 12 +- crates/kmd_client/src/apis/list_wallets.rs | 12 +- crates/kmd_client/src/apis/swagger_handler.rs | 1 - .../algod_client/src/apis/api.service.ts | 329 +++++------------- .../indexer_client/src/apis/api.service.ts | 147 +++----- .../kmd_client/src/apis/api.service.ts | 63 +--- 85 files changed, 229 insertions(+), 576 deletions(-) diff --git a/api/oas_generator/rust_oas_generator/generator/template_engine.py b/api/oas_generator/rust_oas_generator/generator/template_engine.py index 24d749edd..9fb2565dd 100644 --- a/api/oas_generator/rust_oas_generator/generator/template_engine.py +++ b/api/oas_generator/rust_oas_generator/generator/template_engine.py @@ -361,6 +361,7 @@ def _register_globals(self) -> None: "get_request_body_name": lambda op: "request" if op.request_body else None, "is_request_body_required": lambda op: bool(op.request_body and op.request_body.get("required", False)), "should_import_request_body_type": type_analyzer.should_import_request_body_type, + "is_empty_request_body": lambda op: self._is_empty_request_body(op), # Client type detection "get_client_type": lambda spec: self._detect_client_type_from_spec(spec), } @@ -398,6 +399,34 @@ def _rust_vec(rust_type: str) -> str: """Wrap Rust type in Vec.""" return f"Vec<{rust_type}>" + def _is_empty_request_body(self, operation: Operation) -> bool: + """Check if a request body has no meaningful content (empty object).""" + if not operation.request_body: + return True + + # Check the content schemas + content = operation.request_body.get("content", {}) + for _, media_obj in content.items(): + schema = media_obj.get("schema", {}) + + # If there's a $ref, we need to resolve it + if "$ref" in schema: + ref_name = schema["$ref"].split("/")[-1] + # Look up the schema in components + if hasattr(self, "spec") and self.spec: + components = self.spec.get("components", {}) + schemas = components.get("schemas", {}) + schema = schemas.get(ref_name, {}) + + # Check if schema has any properties + properties = schema.get("properties", {}) + required = schema.get("required", []) + + if properties or required: + return False + + return True + def _detect_client_type_from_spec(self, spec: ParsedSpec | dict[str, Any]) -> str: """Detect client type from the OpenAPI specification. diff --git a/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 b/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 index 34b9209aa..9140235ee 100644 --- a/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 +++ b/api/oas_generator/rust_oas_generator/templates/apis/client.rs.j2 @@ -116,7 +116,7 @@ impl {{ client_type }}Client { {% endif %} pub async fn {{ operation.rust_function_name }}( &self, - {% if has_request_body(operation) %} + {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} {% set request_body_name = get_request_body_name(operation) %} {% set request_body_type = get_request_body_type(operation) %} {% if is_request_body_required(operation) %}{{ request_body_name }}: {{ request_body_type }}, @@ -139,7 +139,7 @@ impl {{ client_type }}Client { get_success_response_type(operation) }}{% endif %}{% else %}(){% endif %}, Error> { let result = super::{{ operation.rust_function_name }}::{{ operation.rust_function_name }}( self.http_client.as_ref(), - {% if has_request_body(operation) %} + {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} {{ get_request_body_name(operation) }}, {% endif %} {% for param in operation.parameters %} diff --git a/api/oas_generator/rust_oas_generator/templates/apis/endpoint.rs.j2 b/api/oas_generator/rust_oas_generator/templates/apis/endpoint.rs.j2 index dc938e266..38e272ad8 100644 --- a/api/oas_generator/rust_oas_generator/templates/apis/endpoint.rs.j2 +++ b/api/oas_generator/rust_oas_generator/templates/apis/endpoint.rs.j2 @@ -58,7 +58,7 @@ pub enum {{ operation.rust_error_enum }} { {% endif %} pub async fn {{ operation.rust_function_name }}( http_client: &dyn HttpClient, -{% if has_request_body(operation) %} +{% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} {% set request_body_name = get_request_body_name(operation) %} {% set request_body_type = get_request_body_type(operation) %} {% if is_request_body_required(operation) %}{{ request_body_name }}: {{ request_body_type }}, @@ -81,7 +81,7 @@ pub async fn {{ operation.rust_function_name }}( {% for param in operation.parameters %} let p_{{ param.rust_name }} = {{ param.rust_name }}; {% endfor %} - {% if has_request_body(operation) %} + {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} let p_{{ get_request_body_name(operation) }} = {{ get_request_body_name(operation) }}; {% endif %} @@ -117,23 +117,27 @@ pub async fn {{ operation.rust_function_name }}( headers.insert("Content-Type".to_string(), "text/plain".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); - let body = {% if has_request_body(operation) %}Some(p_{{ get_request_body_name(operation) }}){% else %}None{% endif %}; + let body = {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %}Some(p_{{ get_request_body_name(operation) }}){% else %}None{% endif %}; {% elif not operation.supports_msgpack %} let mut headers: HashMap = HashMap::new(); + {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} headers.insert("Content-Type".to_string(), "application/json".to_string()); + {% endif %} headers.insert("Accept".to_string(), "application/json".to_string()); - let body = {% if has_request_body(operation) %} + let body = {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} Some(serde_json::to_vec(&p_{{ get_request_body_name(operation) }}).map_err(|e| Error::Serde { message: e.to_string() })?) {% else %} None {% endif %}; {% elif not has_format_parameter(operation) %} let mut headers: HashMap = HashMap::new(); + {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} headers.insert("Content-Type".to_string(), "application/msgpack".to_string()); + {% endif %} headers.insert("Accept".to_string(), "application/msgpack".to_string()); - let body = {% if has_request_body(operation) %} + let body = {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} {% if operation.request_body_supports_msgpack %} {% if request_body_type == "Vec" %} Some(p_{{ get_request_body_name(operation) }}) @@ -150,15 +154,20 @@ pub async fn {{ operation.rust_function_name }}( let use_msgpack = {% for param in operation.parameters if param.name == "format" %}{% if param.is_enum_parameter %}p_{{ param.rust_name }}.map(|f| f != Format::Json).unwrap_or(true){% else %}p_{{ param.rust_name }}.map(|f| f != "json").unwrap_or(true){% endif %}{% endfor %}; let mut headers: HashMap = HashMap::new(); + {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} if use_msgpack { headers.insert("Content-Type".to_string(), "application/msgpack".to_string()); - headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { headers.insert("Content-Type".to_string(), "application/json".to_string()); + } + {% endif %} + if use_msgpack { + headers.insert("Accept".to_string(), "application/msgpack".to_string()); + } else { headers.insert("Accept".to_string(), "application/json".to_string()); } - let body = {% if has_request_body(operation) %} + let body = {% if has_request_body(operation) and operation.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} {% if operation.request_body_supports_msgpack %} if use_msgpack { {% if request_body_type == "Vec" %} diff --git a/api/oas_generator/ts_oas_generator/generator/template_engine.py b/api/oas_generator/ts_oas_generator/generator/template_engine.py index 519c342d9..772fad338 100644 --- a/api/oas_generator/ts_oas_generator/generator/template_engine.py +++ b/api/oas_generator/ts_oas_generator/generator/template_engine.py @@ -518,7 +518,8 @@ def extract_types(type_str: str) -> set[str]: # Collect from all type references context.import_types = extract_types(context.response_type) - if context.request_body: + # Only include request body types if the method actually uses a body + if context.request_body and context.method.upper() not in ["GET", "HEAD", "DELETE"]: context.import_types |= extract_types(context.request_body.ts_type) for param in context.parameters: diff --git a/api/oas_generator/ts_oas_generator/templates/apis/service.ts.j2 b/api/oas_generator/ts_oas_generator/templates/apis/service.ts.j2 index a310c889c..bb75ce132 100644 --- a/api/oas_generator/ts_oas_generator/templates/apis/service.ts.j2 +++ b/api/oas_generator/ts_oas_generator/templates/apis/service.ts.j2 @@ -79,12 +79,12 @@ export class {{ service_class_name }} { {%- for p in op.pathParameters %} {{ p.varName }}: {{ p.tsType }}, {%- endfor %} -{%- if op.otherParameters|length > 0 or op.requestBody %} +{%- if op.otherParameters|length > 0 or (op.requestBody and op.method.upper() not in ['GET', 'HEAD', 'DELETE']) %} params?: { {%- for p in op.otherParameters %} {{ p.varName }}{% if not p.required %}?{% endif %}: {{ p.tsType }}; {%- endfor %} -{%- if op.requestBody %} +{%- if op.requestBody and op.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} body{% if not op.requestBody.required %}?{% endif %}: {{ op.requestBody.tsType }}; {%- endif %} }, @@ -96,7 +96,7 @@ export class {{ service_class_name }} { const responseFormat: 'json' | 'msgpack' = {% if supports_msgpack %}{% if op.hasFormatParam and op.formatVarName %}(params?.{{ op.formatVarName }} as 'json' | 'msgpack' | undefined) ?? 'msgpack'{% else %}'msgpack'{% endif %}{% else %}'json'{% endif %}; headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack'; - {% if op.requestBody %} + {% if op.requestBody and op.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} {% if is_raw_bytes_body %} const serializedBody = params?.body ?? undefined; const mediaType = 'application/msgpack'; @@ -109,9 +109,6 @@ export class {{ service_class_name }} { ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body; {% endif %} - {% else %} - const serializedBody = undefined; - const mediaType = undefined; {% endif %} {% set query_params = op.otherParameters | selectattr('in', 'equalto', 'query') | list %} @@ -136,8 +133,13 @@ export class {{ service_class_name }} { {%- endfor %} }, headers, + {% if op.requestBody and op.method.upper() not in ['GET', 'HEAD', 'DELETE'] %} body: serializedBody, mediaType: mediaType, + {% else %} + body: undefined, + mediaType: undefined, + {% endif %} ...(requestOptions ?? {}), }); diff --git a/crates/algod_client/src/apis/abort_catchup.rs b/crates/algod_client/src/apis/abort_catchup.rs index a8f6470ef..a1933b235 100644 --- a/crates/algod_client/src/apis/abort_catchup.rs +++ b/crates/algod_client/src/apis/abort_catchup.rs @@ -47,7 +47,6 @@ pub async fn abort_catchup( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/account_application_information.rs b/crates/algod_client/src/apis/account_application_information.rs index f69c55b34..b0ddea68a 100644 --- a/crates/algod_client/src/apis/account_application_information.rs +++ b/crates/algod_client/src/apis/account_application_information.rs @@ -60,13 +60,8 @@ pub async fn account_application_information( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/account_asset_information.rs b/crates/algod_client/src/apis/account_asset_information.rs index a0bc716ab..e2f5b6b2e 100644 --- a/crates/algod_client/src/apis/account_asset_information.rs +++ b/crates/algod_client/src/apis/account_asset_information.rs @@ -60,13 +60,8 @@ pub async fn account_asset_information( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/account_assets_information.rs b/crates/algod_client/src/apis/account_assets_information.rs index 7da59bbe2..3b8544cbc 100644 --- a/crates/algod_client/src/apis/account_assets_information.rs +++ b/crates/algod_client/src/apis/account_assets_information.rs @@ -57,7 +57,6 @@ pub async fn account_assets_information( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/account_information.rs b/crates/algod_client/src/apis/account_information.rs index 0206f13f4..db101b61c 100644 --- a/crates/algod_client/src/apis/account_information.rs +++ b/crates/algod_client/src/apis/account_information.rs @@ -62,13 +62,8 @@ pub async fn account_information( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/delete_participation_key_by_id.rs b/crates/algod_client/src/apis/delete_participation_key_by_id.rs index dd8162768..5f363e175 100644 --- a/crates/algod_client/src/apis/delete_participation_key_by_id.rs +++ b/crates/algod_client/src/apis/delete_participation_key_by_id.rs @@ -48,7 +48,6 @@ pub async fn delete_participation_key_by_id( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/experimental_check.rs b/crates/algod_client/src/apis/experimental_check.rs index db5256387..fd606a55e 100644 --- a/crates/algod_client/src/apis/experimental_check.rs +++ b/crates/algod_client/src/apis/experimental_check.rs @@ -36,7 +36,6 @@ pub async fn experimental_check(http_client: &dyn HttpClient) -> Result<(), Erro let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/generate_participation_keys.rs b/crates/algod_client/src/apis/generate_participation_keys.rs index 6ad8c13c6..315b23579 100644 --- a/crates/algod_client/src/apis/generate_participation_keys.rs +++ b/crates/algod_client/src/apis/generate_participation_keys.rs @@ -59,7 +59,6 @@ pub async fn generate_participation_keys( query_params.insert("last".to_string(), p_last.to_string()); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_application_box_by_name.rs b/crates/algod_client/src/apis/get_application_box_by_name.rs index 9c4d257b0..b33772550 100644 --- a/crates/algod_client/src/apis/get_application_box_by_name.rs +++ b/crates/algod_client/src/apis/get_application_box_by_name.rs @@ -51,7 +51,6 @@ pub async fn get_application_box_by_name( query_params.insert("name".to_string(), p_name.to_string()); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_application_boxes.rs b/crates/algod_client/src/apis/get_application_boxes.rs index be3fb825e..3360a499b 100644 --- a/crates/algod_client/src/apis/get_application_boxes.rs +++ b/crates/algod_client/src/apis/get_application_boxes.rs @@ -52,7 +52,6 @@ pub async fn get_application_boxes( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_application_by_id.rs b/crates/algod_client/src/apis/get_application_by_id.rs index e9d0eb93a..887ce7862 100644 --- a/crates/algod_client/src/apis/get_application_by_id.rs +++ b/crates/algod_client/src/apis/get_application_by_id.rs @@ -48,7 +48,6 @@ pub async fn get_application_by_id( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_asset_by_id.rs b/crates/algod_client/src/apis/get_asset_by_id.rs index cb8bc5333..09eb94a4d 100644 --- a/crates/algod_client/src/apis/get_asset_by_id.rs +++ b/crates/algod_client/src/apis/get_asset_by_id.rs @@ -42,7 +42,6 @@ pub async fn get_asset_by_id(http_client: &dyn HttpClient, asset_id: u64) -> Res let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_block.rs b/crates/algod_client/src/apis/get_block.rs index c7f43d7fc..e5c95c49e 100644 --- a/crates/algod_client/src/apis/get_block.rs +++ b/crates/algod_client/src/apis/get_block.rs @@ -60,13 +60,8 @@ pub async fn get_block( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/get_block_hash.rs b/crates/algod_client/src/apis/get_block_hash.rs index 77570efc1..d460be64e 100644 --- a/crates/algod_client/src/apis/get_block_hash.rs +++ b/crates/algod_client/src/apis/get_block_hash.rs @@ -45,7 +45,6 @@ pub async fn get_block_hash( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_block_logs.rs b/crates/algod_client/src/apis/get_block_logs.rs index b591f1ba8..ba7bd6053 100644 --- a/crates/algod_client/src/apis/get_block_logs.rs +++ b/crates/algod_client/src/apis/get_block_logs.rs @@ -44,7 +44,6 @@ pub async fn get_block_logs( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_block_time_stamp_offset.rs b/crates/algod_client/src/apis/get_block_time_stamp_offset.rs index 3682d3442..00e8d50ac 100644 --- a/crates/algod_client/src/apis/get_block_time_stamp_offset.rs +++ b/crates/algod_client/src/apis/get_block_time_stamp_offset.rs @@ -39,7 +39,6 @@ pub async fn get_block_time_stamp_offset( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_block_txids.rs b/crates/algod_client/src/apis/get_block_txids.rs index a626832f0..fa76e97ee 100644 --- a/crates/algod_client/src/apis/get_block_txids.rs +++ b/crates/algod_client/src/apis/get_block_txids.rs @@ -45,7 +45,6 @@ pub async fn get_block_txids( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_config.rs b/crates/algod_client/src/apis/get_config.rs index e647bb18b..0faf901e5 100644 --- a/crates/algod_client/src/apis/get_config.rs +++ b/crates/algod_client/src/apis/get_config.rs @@ -35,7 +35,6 @@ pub async fn get_config(http_client: &dyn HttpClient) -> Result { let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_debug_settings_prof.rs b/crates/algod_client/src/apis/get_debug_settings_prof.rs index fc2c5ddef..4472f5d6f 100644 --- a/crates/algod_client/src/apis/get_debug_settings_prof.rs +++ b/crates/algod_client/src/apis/get_debug_settings_prof.rs @@ -37,7 +37,6 @@ pub async fn get_debug_settings_prof( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_genesis.rs b/crates/algod_client/src/apis/get_genesis.rs index 155b25ffc..8806f71c0 100644 --- a/crates/algod_client/src/apis/get_genesis.rs +++ b/crates/algod_client/src/apis/get_genesis.rs @@ -36,7 +36,6 @@ pub async fn get_genesis(http_client: &dyn HttpClient) -> Result let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_ledger_state_delta.rs b/crates/algod_client/src/apis/get_ledger_state_delta.rs index a43735e8b..1859f5711 100644 --- a/crates/algod_client/src/apis/get_ledger_state_delta.rs +++ b/crates/algod_client/src/apis/get_ledger_state_delta.rs @@ -56,13 +56,8 @@ pub async fn get_ledger_state_delta( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/get_ledger_state_delta_for_transaction_group.rs b/crates/algod_client/src/apis/get_ledger_state_delta_for_transaction_group.rs index fa7a01004..e06a8d0ea 100644 --- a/crates/algod_client/src/apis/get_ledger_state_delta_for_transaction_group.rs +++ b/crates/algod_client/src/apis/get_ledger_state_delta_for_transaction_group.rs @@ -59,13 +59,8 @@ pub async fn get_ledger_state_delta_for_transaction_group( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/get_light_block_header_proof.rs b/crates/algod_client/src/apis/get_light_block_header_proof.rs index 993ce42b2..518464bb2 100644 --- a/crates/algod_client/src/apis/get_light_block_header_proof.rs +++ b/crates/algod_client/src/apis/get_light_block_header_proof.rs @@ -46,7 +46,6 @@ pub async fn get_light_block_header_proof( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_participation_key_by_id.rs b/crates/algod_client/src/apis/get_participation_key_by_id.rs index 44db174a2..6deb16caa 100644 --- a/crates/algod_client/src/apis/get_participation_key_by_id.rs +++ b/crates/algod_client/src/apis/get_participation_key_by_id.rs @@ -48,7 +48,6 @@ pub async fn get_participation_key_by_id( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_participation_keys.rs b/crates/algod_client/src/apis/get_participation_keys.rs index 9b3ff9732..07578a587 100644 --- a/crates/algod_client/src/apis/get_participation_keys.rs +++ b/crates/algod_client/src/apis/get_participation_keys.rs @@ -42,7 +42,6 @@ pub async fn get_participation_keys( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_pending_transactions.rs b/crates/algod_client/src/apis/get_pending_transactions.rs index a245ba879..825ae3148 100644 --- a/crates/algod_client/src/apis/get_pending_transactions.rs +++ b/crates/algod_client/src/apis/get_pending_transactions.rs @@ -57,13 +57,8 @@ pub async fn get_pending_transactions( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/get_pending_transactions_by_address.rs b/crates/algod_client/src/apis/get_pending_transactions_by_address.rs index 2b46c918d..27454f32f 100644 --- a/crates/algod_client/src/apis/get_pending_transactions_by_address.rs +++ b/crates/algod_client/src/apis/get_pending_transactions_by_address.rs @@ -63,13 +63,8 @@ pub async fn get_pending_transactions_by_address( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/get_ready.rs b/crates/algod_client/src/apis/get_ready.rs index c6d381b5e..cafa1cdea 100644 --- a/crates/algod_client/src/apis/get_ready.rs +++ b/crates/algod_client/src/apis/get_ready.rs @@ -37,7 +37,6 @@ pub async fn get_ready(http_client: &dyn HttpClient) -> Result<(), Error> { let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_state_proof.rs b/crates/algod_client/src/apis/get_state_proof.rs index 7abf61c9f..7c19ca433 100644 --- a/crates/algod_client/src/apis/get_state_proof.rs +++ b/crates/algod_client/src/apis/get_state_proof.rs @@ -46,7 +46,6 @@ pub async fn get_state_proof( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_status.rs b/crates/algod_client/src/apis/get_status.rs index 5cd3c5a05..5e2107486 100644 --- a/crates/algod_client/src/apis/get_status.rs +++ b/crates/algod_client/src/apis/get_status.rs @@ -38,7 +38,6 @@ pub async fn get_status(http_client: &dyn HttpClient) -> Result = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_supply.rs b/crates/algod_client/src/apis/get_supply.rs index 14219828e..5f046f9bd 100644 --- a/crates/algod_client/src/apis/get_supply.rs +++ b/crates/algod_client/src/apis/get_supply.rs @@ -37,7 +37,6 @@ pub async fn get_supply(http_client: &dyn HttpClient) -> Result = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_sync_round.rs b/crates/algod_client/src/apis/get_sync_round.rs index 724356a8f..ef55e11ab 100644 --- a/crates/algod_client/src/apis/get_sync_round.rs +++ b/crates/algod_client/src/apis/get_sync_round.rs @@ -40,7 +40,6 @@ pub async fn get_sync_round(http_client: &dyn HttpClient) -> Result = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_transaction_group_ledger_state_deltas_for_round.rs b/crates/algod_client/src/apis/get_transaction_group_ledger_state_deltas_for_round.rs index e0f1bdf10..76edb9a66 100644 --- a/crates/algod_client/src/apis/get_transaction_group_ledger_state_deltas_for_round.rs +++ b/crates/algod_client/src/apis/get_transaction_group_ledger_state_deltas_for_round.rs @@ -56,13 +56,8 @@ pub async fn get_transaction_group_ledger_state_deltas_for_round( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/get_transaction_proof.rs b/crates/algod_client/src/apis/get_transaction_proof.rs index 325aa93aa..9e7558e55 100644 --- a/crates/algod_client/src/apis/get_transaction_proof.rs +++ b/crates/algod_client/src/apis/get_transaction_proof.rs @@ -62,7 +62,6 @@ pub async fn get_transaction_proof( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/get_version.rs b/crates/algod_client/src/apis/get_version.rs index e787e06e1..5dcae6e3a 100644 --- a/crates/algod_client/src/apis/get_version.rs +++ b/crates/algod_client/src/apis/get_version.rs @@ -35,7 +35,6 @@ pub async fn get_version(http_client: &dyn HttpClient) -> Result let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/health_check.rs b/crates/algod_client/src/apis/health_check.rs index f7678f885..fb1b02986 100644 --- a/crates/algod_client/src/apis/health_check.rs +++ b/crates/algod_client/src/apis/health_check.rs @@ -35,7 +35,6 @@ pub async fn health_check(http_client: &dyn HttpClient) -> Result<(), Error> { let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/metrics.rs b/crates/algod_client/src/apis/metrics.rs index a1410b1d3..4753b03d0 100644 --- a/crates/algod_client/src/apis/metrics.rs +++ b/crates/algod_client/src/apis/metrics.rs @@ -35,7 +35,6 @@ pub async fn metrics(http_client: &dyn HttpClient) -> Result<(), Error> { let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/pending_transaction_information.rs b/crates/algod_client/src/apis/pending_transaction_information.rs index 74e00a326..69e7293dd 100644 --- a/crates/algod_client/src/apis/pending_transaction_information.rs +++ b/crates/algod_client/src/apis/pending_transaction_information.rs @@ -62,13 +62,8 @@ pub async fn pending_transaction_information( let mut headers: HashMap = HashMap::new(); if use_msgpack { - headers.insert( - "Content-Type".to_string(), - "application/msgpack".to_string(), - ); headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/put_debug_settings_prof.rs b/crates/algod_client/src/apis/put_debug_settings_prof.rs index e1f7a31ec..5865a137a 100644 --- a/crates/algod_client/src/apis/put_debug_settings_prof.rs +++ b/crates/algod_client/src/apis/put_debug_settings_prof.rs @@ -37,7 +37,6 @@ pub async fn put_debug_settings_prof( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/set_block_time_stamp_offset.rs b/crates/algod_client/src/apis/set_block_time_stamp_offset.rs index 57d112b34..b355db5cf 100644 --- a/crates/algod_client/src/apis/set_block_time_stamp_offset.rs +++ b/crates/algod_client/src/apis/set_block_time_stamp_offset.rs @@ -44,7 +44,6 @@ pub async fn set_block_time_stamp_offset( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/set_sync_round.rs b/crates/algod_client/src/apis/set_sync_round.rs index a1fd1139f..fe1107891 100644 --- a/crates/algod_client/src/apis/set_sync_round.rs +++ b/crates/algod_client/src/apis/set_sync_round.rs @@ -42,7 +42,6 @@ pub async fn set_sync_round(http_client: &dyn HttpClient, round: u64) -> Result< let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/shutdown_node.rs b/crates/algod_client/src/apis/shutdown_node.rs index ffcdac602..5daa64a2f 100644 --- a/crates/algod_client/src/apis/shutdown_node.rs +++ b/crates/algod_client/src/apis/shutdown_node.rs @@ -43,7 +43,6 @@ pub async fn shutdown_node( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/simulate_transaction.rs b/crates/algod_client/src/apis/simulate_transaction.rs index 1db494439..1098ee697 100644 --- a/crates/algod_client/src/apis/simulate_transaction.rs +++ b/crates/algod_client/src/apis/simulate_transaction.rs @@ -60,9 +60,12 @@ pub async fn simulate_transaction( "Content-Type".to_string(), "application/msgpack".to_string(), ); - headers.insert("Accept".to_string(), "application/msgpack".to_string()); } else { headers.insert("Content-Type".to_string(), "application/json".to_string()); + } + if use_msgpack { + headers.insert("Accept".to_string(), "application/msgpack".to_string()); + } else { headers.insert("Accept".to_string(), "application/json".to_string()); } diff --git a/crates/algod_client/src/apis/start_catchup.rs b/crates/algod_client/src/apis/start_catchup.rs index 37d51c39c..2e2410a75 100644 --- a/crates/algod_client/src/apis/start_catchup.rs +++ b/crates/algod_client/src/apis/start_catchup.rs @@ -53,7 +53,6 @@ pub async fn start_catchup( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/swagger_json.rs b/crates/algod_client/src/apis/swagger_json.rs index be2c1f9ba..0f3575ec7 100644 --- a/crates/algod_client/src/apis/swagger_json.rs +++ b/crates/algod_client/src/apis/swagger_json.rs @@ -35,7 +35,6 @@ pub async fn swagger_json(http_client: &dyn HttpClient) -> Result let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/transaction_params.rs b/crates/algod_client/src/apis/transaction_params.rs index 7722f1d5e..bac816555 100644 --- a/crates/algod_client/src/apis/transaction_params.rs +++ b/crates/algod_client/src/apis/transaction_params.rs @@ -39,7 +39,6 @@ pub async fn transaction_params(http_client: &dyn HttpClient) -> Result = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/unset_sync_round.rs b/crates/algod_client/src/apis/unset_sync_round.rs index 69635c4d7..a1a112c2d 100644 --- a/crates/algod_client/src/apis/unset_sync_round.rs +++ b/crates/algod_client/src/apis/unset_sync_round.rs @@ -40,7 +40,6 @@ pub async fn unset_sync_round(http_client: &dyn HttpClient) -> Result<(), Error> let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algod_client/src/apis/wait_for_block.rs b/crates/algod_client/src/apis/wait_for_block.rs index 34771c2e0..99a77a3bd 100644 --- a/crates/algod_client/src/apis/wait_for_block.rs +++ b/crates/algod_client/src/apis/wait_for_block.rs @@ -45,7 +45,6 @@ pub async fn wait_for_block( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/algokit_utils/tests/common/local_net_dispenser.rs b/crates/algokit_utils/tests/common/local_net_dispenser.rs index f71aeb7a9..d1d17acd3 100644 --- a/crates/algokit_utils/tests/common/local_net_dispenser.rs +++ b/crates/algokit_utils/tests/common/local_net_dispenser.rs @@ -8,7 +8,7 @@ use algokit_utils::TransactionSigner; use kmd_client::KmdClient; use kmd_client::models::{ ExportKeyRequest, GenerateKeyRequest, InitWalletHandleTokenRequest, ListKeysRequest, - ListWalletsRequest, ReleaseWalletHandleTokenRequest, + ReleaseWalletHandleTokenRequest, }; use crate::common::TestAccount; @@ -52,7 +52,7 @@ impl LocalNetDispenser { ) -> Result> { let wallets_response = self .kmd_client - .list_wallets(Some(ListWalletsRequest::new())) + .list_wallets() .await .map_err(|e| format!("Failed to list KMD wallets: {:?}", e))?; diff --git a/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs b/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs index 2cdce1677..980f14169 100644 --- a/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs +++ b/crates/algokit_utils/tests/kmd/wallet_lifecycle.rs @@ -45,7 +45,7 @@ async fn wallet_lifecycle() -> Result<(), Box = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_account_assets.rs b/crates/indexer_client/src/apis/lookup_account_assets.rs index 59a7fc0a5..29f6372b8 100644 --- a/crates/indexer_client/src/apis/lookup_account_assets.rs +++ b/crates/indexer_client/src/apis/lookup_account_assets.rs @@ -65,7 +65,6 @@ pub async fn lookup_account_assets( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_account_by_id.rs b/crates/indexer_client/src/apis/lookup_account_by_id.rs index 14ee532cf..a516345cb 100644 --- a/crates/indexer_client/src/apis/lookup_account_by_id.rs +++ b/crates/indexer_client/src/apis/lookup_account_by_id.rs @@ -60,7 +60,6 @@ pub async fn lookup_account_by_id( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_account_created_applications.rs b/crates/indexer_client/src/apis/lookup_account_created_applications.rs index 1e3a11c72..740351ec7 100644 --- a/crates/indexer_client/src/apis/lookup_account_created_applications.rs +++ b/crates/indexer_client/src/apis/lookup_account_created_applications.rs @@ -65,7 +65,6 @@ pub async fn lookup_account_created_applications( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_account_created_assets.rs b/crates/indexer_client/src/apis/lookup_account_created_assets.rs index d4175ce88..4ff954d08 100644 --- a/crates/indexer_client/src/apis/lookup_account_created_assets.rs +++ b/crates/indexer_client/src/apis/lookup_account_created_assets.rs @@ -65,7 +65,6 @@ pub async fn lookup_account_created_assets( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_account_transactions.rs b/crates/indexer_client/src/apis/lookup_account_transactions.rs index 980d164a0..27b699602 100644 --- a/crates/indexer_client/src/apis/lookup_account_transactions.rs +++ b/crates/indexer_client/src/apis/lookup_account_transactions.rs @@ -120,7 +120,6 @@ pub async fn lookup_account_transactions( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_application_box_by_id_and_name.rs b/crates/indexer_client/src/apis/lookup_application_box_by_id_and_name.rs index 3eaa6cb79..10f3ec345 100644 --- a/crates/indexer_client/src/apis/lookup_application_box_by_id_and_name.rs +++ b/crates/indexer_client/src/apis/lookup_application_box_by_id_and_name.rs @@ -48,7 +48,6 @@ pub async fn lookup_application_box_by_id_and_name( query_params.insert("name".to_string(), p_name.to_string()); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_application_by_id.rs b/crates/indexer_client/src/apis/lookup_application_by_id.rs index 5db3993cd..5f058e42a 100644 --- a/crates/indexer_client/src/apis/lookup_application_by_id.rs +++ b/crates/indexer_client/src/apis/lookup_application_by_id.rs @@ -49,7 +49,6 @@ pub async fn lookup_application_by_id( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_application_logs_by_id.rs b/crates/indexer_client/src/apis/lookup_application_logs_by_id.rs index cdd2a596d..0ac7eaed6 100644 --- a/crates/indexer_client/src/apis/lookup_application_logs_by_id.rs +++ b/crates/indexer_client/src/apis/lookup_application_logs_by_id.rs @@ -72,7 +72,6 @@ pub async fn lookup_application_logs_by_id( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_asset_balances.rs b/crates/indexer_client/src/apis/lookup_asset_balances.rs index 46bd11fe6..db5829485 100644 --- a/crates/indexer_client/src/apis/lookup_asset_balances.rs +++ b/crates/indexer_client/src/apis/lookup_asset_balances.rs @@ -66,7 +66,6 @@ pub async fn lookup_asset_balances( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_asset_by_id.rs b/crates/indexer_client/src/apis/lookup_asset_by_id.rs index 20ae81009..6f413d0ec 100644 --- a/crates/indexer_client/src/apis/lookup_asset_by_id.rs +++ b/crates/indexer_client/src/apis/lookup_asset_by_id.rs @@ -47,7 +47,6 @@ pub async fn lookup_asset_by_id( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_asset_transactions.rs b/crates/indexer_client/src/apis/lookup_asset_transactions.rs index c3eda0ffa..b6ca1d39d 100644 --- a/crates/indexer_client/src/apis/lookup_asset_transactions.rs +++ b/crates/indexer_client/src/apis/lookup_asset_transactions.rs @@ -127,7 +127,6 @@ pub async fn lookup_asset_transactions( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_block.rs b/crates/indexer_client/src/apis/lookup_block.rs index 1f0f806d5..da5649b6e 100644 --- a/crates/indexer_client/src/apis/lookup_block.rs +++ b/crates/indexer_client/src/apis/lookup_block.rs @@ -46,7 +46,6 @@ pub async fn lookup_block( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/lookup_transaction.rs b/crates/indexer_client/src/apis/lookup_transaction.rs index fb2d94a89..1125bb730 100644 --- a/crates/indexer_client/src/apis/lookup_transaction.rs +++ b/crates/indexer_client/src/apis/lookup_transaction.rs @@ -45,7 +45,6 @@ pub async fn lookup_transaction( let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/make_health_check.rs b/crates/indexer_client/src/apis/make_health_check.rs index 4ec9c3f5a..bb9c9a1dc 100644 --- a/crates/indexer_client/src/apis/make_health_check.rs +++ b/crates/indexer_client/src/apis/make_health_check.rs @@ -35,7 +35,6 @@ pub async fn make_health_check(http_client: &dyn HttpClient) -> Result = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/search_for_accounts.rs b/crates/indexer_client/src/apis/search_for_accounts.rs index 04e89d092..bc8bac436 100644 --- a/crates/indexer_client/src/apis/search_for_accounts.rs +++ b/crates/indexer_client/src/apis/search_for_accounts.rs @@ -94,7 +94,6 @@ pub async fn search_for_accounts( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/search_for_application_boxes.rs b/crates/indexer_client/src/apis/search_for_application_boxes.rs index a41db1921..f33cc740c 100644 --- a/crates/indexer_client/src/apis/search_for_application_boxes.rs +++ b/crates/indexer_client/src/apis/search_for_application_boxes.rs @@ -55,7 +55,6 @@ pub async fn search_for_application_boxes( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/search_for_applications.rs b/crates/indexer_client/src/apis/search_for_applications.rs index 4ae3e9876..23189913b 100644 --- a/crates/indexer_client/src/apis/search_for_applications.rs +++ b/crates/indexer_client/src/apis/search_for_applications.rs @@ -63,7 +63,6 @@ pub async fn search_for_applications( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/search_for_assets.rs b/crates/indexer_client/src/apis/search_for_assets.rs index daad7522a..e26ac5f3a 100644 --- a/crates/indexer_client/src/apis/search_for_assets.rs +++ b/crates/indexer_client/src/apis/search_for_assets.rs @@ -74,7 +74,6 @@ pub async fn search_for_assets( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/search_for_block_headers.rs b/crates/indexer_client/src/apis/search_for_block_headers.rs index 9899fb1f6..bf1bdc707 100644 --- a/crates/indexer_client/src/apis/search_for_block_headers.rs +++ b/crates/indexer_client/src/apis/search_for_block_headers.rs @@ -84,7 +84,6 @@ pub async fn search_for_block_headers( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/indexer_client/src/apis/search_for_transactions.rs b/crates/indexer_client/src/apis/search_for_transactions.rs index b8392bce0..655f5bbf5 100644 --- a/crates/indexer_client/src/apis/search_for_transactions.rs +++ b/crates/indexer_client/src/apis/search_for_transactions.rs @@ -140,7 +140,6 @@ pub async fn search_for_transactions( } let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/crates/kmd_client/src/apis/client.rs b/crates/kmd_client/src/apis/client.rs index 153d17d02..56c6121e0 100644 --- a/crates/kmd_client/src/apis/client.rs +++ b/crates/kmd_client/src/apis/client.rs @@ -97,11 +97,8 @@ impl KmdClient { } /// Delete a key - pub async fn delete_key( - &self, - request: DeleteKeyRequest, - ) -> Result { - let result = super::delete_key::delete_key(self.http_client.as_ref(), request).await; + pub async fn delete_key(&self) -> Result { + let result = super::delete_key::delete_key(self.http_client.as_ref()).await; result } @@ -150,12 +147,8 @@ impl KmdClient { } /// Delete a multisig - pub async fn delete_multisig( - &self, - request: DeleteMultisigRequest, - ) -> Result { - let result = - super::delete_multisig::delete_multisig(self.http_client.as_ref(), request).await; + pub async fn delete_multisig(&self) -> Result { + let result = super::delete_multisig::delete_multisig(self.http_client.as_ref()).await; result } @@ -313,21 +306,15 @@ impl KmdClient { } /// List wallets - pub async fn list_wallets( - &self, - request: Option, - ) -> Result { - let result = super::list_wallets::list_wallets(self.http_client.as_ref(), request).await; + pub async fn list_wallets(&self) -> Result { + let result = super::list_wallets::list_wallets(self.http_client.as_ref()).await; result } /// Retrieves the current version - pub async fn get_version( - &self, - request: Option, - ) -> Result { - let result = super::get_version::get_version(self.http_client.as_ref(), request).await; + pub async fn get_version(&self) -> Result { + let result = super::get_version::get_version(self.http_client.as_ref()).await; result } diff --git a/crates/kmd_client/src/apis/delete_key.rs b/crates/kmd_client/src/apis/delete_key.rs index e2c7710cb..29689c924 100644 --- a/crates/kmd_client/src/apis/delete_key.rs +++ b/crates/kmd_client/src/apis/delete_key.rs @@ -30,23 +30,15 @@ pub enum DeleteKeyError { } /// Deletes the key with the passed public key from the wallet. -pub async fn delete_key( - http_client: &dyn HttpClient, - request: DeleteKeyRequest, -) -> Result { - let p_request = request; - +pub async fn delete_key(http_client: &dyn HttpClient) -> Result { let path = "/v1/key".to_string(); let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); - let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { - message: e.to_string(), - })?); + let body = None; let response = http_client .request( diff --git a/crates/kmd_client/src/apis/delete_multisig.rs b/crates/kmd_client/src/apis/delete_multisig.rs index b7e2f5f05..c3bc65617 100644 --- a/crates/kmd_client/src/apis/delete_multisig.rs +++ b/crates/kmd_client/src/apis/delete_multisig.rs @@ -32,21 +32,15 @@ pub enum DeleteMultisigError { /// Deletes multisig preimage information for the passed address from the wallet. pub async fn delete_multisig( http_client: &dyn HttpClient, - request: DeleteMultisigRequest, ) -> Result { - let p_request = request; - let path = "/v1/multisig".to_string(); let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); - let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { - message: e.to_string(), - })?); + let body = None; let response = http_client .request( diff --git a/crates/kmd_client/src/apis/get_version.rs b/crates/kmd_client/src/apis/get_version.rs index b1c8b75ca..1eadf748f 100644 --- a/crates/kmd_client/src/apis/get_version.rs +++ b/crates/kmd_client/src/apis/get_version.rs @@ -30,23 +30,15 @@ pub enum GetVersionError { } /// Retrieves the current version -pub async fn get_version( - http_client: &dyn HttpClient, - request: Option, -) -> Result { - let p_request = request; - +pub async fn get_version(http_client: &dyn HttpClient) -> Result { let path = "/versions".to_string(); let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); - let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { - message: e.to_string(), - })?); + let body = None; let response = http_client .request( diff --git a/crates/kmd_client/src/apis/list_wallets.rs b/crates/kmd_client/src/apis/list_wallets.rs index 2002c8eb0..19a16952c 100644 --- a/crates/kmd_client/src/apis/list_wallets.rs +++ b/crates/kmd_client/src/apis/list_wallets.rs @@ -30,23 +30,15 @@ pub enum ListWalletsError { } /// Lists all of the wallets that kmd is aware of. -pub async fn list_wallets( - http_client: &dyn HttpClient, - request: Option, -) -> Result { - let p_request = request; - +pub async fn list_wallets(http_client: &dyn HttpClient) -> Result { let path = "/v1/wallets".to_string(); let query_params: HashMap = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); - let body = Some(serde_json::to_vec(&p_request).map_err(|e| Error::Serde { - message: e.to_string(), - })?); + let body = None; let response = http_client .request( diff --git a/crates/kmd_client/src/apis/swagger_handler.rs b/crates/kmd_client/src/apis/swagger_handler.rs index 650219993..46e258ab6 100644 --- a/crates/kmd_client/src/apis/swagger_handler.rs +++ b/crates/kmd_client/src/apis/swagger_handler.rs @@ -35,7 +35,6 @@ pub async fn swagger_handler(http_client: &dyn HttpClient) -> Result = HashMap::new(); let mut headers: HashMap = HashMap::new(); - headers.insert("Content-Type".to_string(), "application/json".to_string()); headers.insert("Accept".to_string(), "application/json".to_string()); let body = None; diff --git a/packages/typescript/algod_client/src/apis/api.service.ts b/packages/typescript/algod_client/src/apis/api.service.ts index d112bfae7..dded8da14 100644 --- a/packages/typescript/algod_client/src/apis/api.service.ts +++ b/packages/typescript/algod_client/src/apis/api.service.ts @@ -98,17 +98,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'DELETE', url: '/v2/catchup/{catchpoint}', path: { catchpoint: catchpoint }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -132,17 +129,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{address}/applications/{application-id}', path: { address: address, 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: { format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -166,17 +160,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{address}/assets/{asset-id}', path: { address: address, 'asset-id': typeof assetId === 'bigint' ? assetId.toString() : assetId }, query: { format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -199,17 +190,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{address}/assets', path: { address: address }, query: { limit: typeof params?.limit === 'bigint' ? (params!.limit as bigint).toString() : params?.limit, next: params?.next }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -232,17 +220,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{address}', path: { address: address }, query: { exclude: params?.exclude, format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -322,17 +307,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'DELETE', url: '/v2/participation/{participation-id}', path: { 'participation-id': participationId }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -348,17 +330,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/experimental', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -378,9 +357,6 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'POST', url: '/v2/participation/generate/{address}', @@ -391,8 +367,8 @@ export class AlgodApi { last: typeof params?.last === 'bigint' ? (params!.last as bigint).toString() : params?.last, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -415,17 +391,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}/box', path: { 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: { name: params?.name }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -448,17 +421,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}/boxes', path: { 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: { max: typeof params?.max === 'bigint' ? (params!.max as bigint).toString() : params?.max }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -477,17 +447,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}', path: { 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -506,17 +473,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/assets/{asset-id}', path: { 'asset-id': typeof assetId === 'bigint' ? assetId.toString() : assetId }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -536,17 +500,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round}', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: { 'header-only': params?.headerOnly, format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -562,17 +523,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round}/hash', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -591,17 +549,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round}/logs', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -620,17 +575,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/devmode/blocks/offset', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -646,17 +598,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round}/txids', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -675,17 +624,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/debug/settings/config', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -704,17 +650,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/debug/settings/pprof', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -733,17 +676,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/genesis', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -766,17 +706,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/deltas/{round}', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: { format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -799,17 +736,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/deltas/txn/group/{id}', path: { id: id }, query: { format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -825,17 +759,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round}/lightheader/proof', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -854,17 +785,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/participation/{participation-id}', path: { 'participation-id': participationId }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -883,17 +811,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/participation', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -915,17 +840,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/transactions/pending', path: {}, query: { max: typeof params?.max === 'bigint' ? (params!.max as bigint).toString() : params?.max, format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -948,17 +870,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{address}/transactions/pending', path: { address: address }, query: { max: typeof params?.max === 'bigint' ? (params!.max as bigint).toString() : params?.max, format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -974,17 +893,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/ready', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1000,17 +916,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/stateproofs/{round}', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1026,17 +939,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/status', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1052,17 +962,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/ledger/supply', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1081,17 +988,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/ledger/sync', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1114,17 +1018,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/deltas/{round}/txn/group', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: { format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1145,17 +1046,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round}/transactions/{txid}/proof', path: { round: typeof round === 'bigint' ? round.toString() : round, txid: txid }, query: { hashtype: params?.hashtype, format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1174,17 +1072,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/versions', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1200,17 +1095,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/health', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1226,17 +1118,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/metrics', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1263,17 +1152,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = (params?.format as 'json' | 'msgpack' | undefined) ?? 'msgpack' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/transactions/pending/{txid}', path: { txid: txid }, query: { format: params?.format }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1292,17 +1178,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'PUT', url: '/debug/settings/pprof', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1375,17 +1258,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'POST', url: '/v2/devmode/blocks/offset/{offset}', path: { offset: typeof offset === 'bigint' ? offset.toString() : offset }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1404,17 +1284,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'POST', url: '/v2/ledger/sync/{round}', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1433,17 +1310,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'POST', url: '/v2/shutdown', path: {}, query: { timeout: typeof params?.timeout === 'bigint' ? (params!.timeout as bigint).toString() : params?.timeout }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1494,17 +1368,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'POST', url: '/v2/catchup/{catchpoint}', path: { catchpoint: catchpoint }, query: { min: typeof params?.min === 'bigint' ? (params!.min as bigint).toString() : params?.min }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1523,17 +1394,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/swagger.json', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1643,17 +1511,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/transactions/params', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1672,17 +1537,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'DELETE', url: '/v2/ledger/sync', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -1701,17 +1563,14 @@ export class AlgodApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/status/wait-for-block-after/{round}', path: { round: typeof round === 'bigint' ? round.toString() : round }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) diff --git a/packages/typescript/indexer_client/src/apis/api.service.ts b/packages/typescript/indexer_client/src/apis/api.service.ts index f4b867900..f5e262d1c 100644 --- a/packages/typescript/indexer_client/src/apis/api.service.ts +++ b/packages/typescript/indexer_client/src/apis/api.service.ts @@ -62,9 +62,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{account-id}/apps-local-state', @@ -76,8 +73,8 @@ export class IndexerApi { next: params?.next, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -100,9 +97,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{account-id}/assets', @@ -114,8 +108,8 @@ export class IndexerApi { next: params?.next, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -142,9 +136,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{account-id}', @@ -155,8 +146,8 @@ export class IndexerApi { exclude: params?.exclude, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -179,9 +170,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{account-id}/created-applications', @@ -193,8 +181,8 @@ export class IndexerApi { next: params?.next, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -217,9 +205,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{account-id}/created-assets', @@ -231,8 +216,8 @@ export class IndexerApi { next: params?.next, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -271,9 +256,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts/{account-id}/transactions', @@ -300,8 +282,8 @@ export class IndexerApi { 'rekey-to': params?.rekeyTo, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -324,17 +306,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}/box', path: { 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: { name: params?.name }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -357,17 +336,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}', path: { 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: { 'include-all': params?.includeAll }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -397,9 +373,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}/logs', @@ -413,8 +386,8 @@ export class IndexerApi { 'sender-address': params?.senderAddress, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -443,9 +416,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/assets/{asset-id}/balances', @@ -462,8 +432,8 @@ export class IndexerApi { typeof params?.currencyLessThan === 'bigint' ? (params!.currencyLessThan as bigint).toString() : params?.currencyLessThan, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -486,17 +456,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/assets/{asset-id}', path: { 'asset-id': typeof assetId === 'bigint' ? assetId.toString() : assetId }, query: { 'include-all': params?.includeAll }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -537,9 +504,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/assets/{asset-id}/transactions', @@ -568,8 +532,8 @@ export class IndexerApi { 'rekey-to': params?.rekeyTo, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -588,17 +552,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/blocks/{round-number}', path: { 'round-number': typeof roundNumber === 'bigint' ? roundNumber.toString() : roundNumber }, query: { 'header-only': params?.headerOnly }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -617,17 +578,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/transactions/{txid}', path: { txid: txid }, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -643,17 +601,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/health', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -687,9 +642,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/accounts', @@ -712,8 +664,8 @@ export class IndexerApi { 'online-only': params?.onlineOnly, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -736,17 +688,14 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications/{application-id}/boxes', path: { 'application-id': typeof applicationId === 'bigint' ? applicationId.toString() : applicationId }, query: { limit: typeof params?.limit === 'bigint' ? (params!.limit as bigint).toString() : params?.limit, next: params?.next }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -768,9 +717,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/applications', @@ -783,8 +729,8 @@ export class IndexerApi { next: params?.next, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -814,9 +760,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/assets', @@ -831,8 +774,8 @@ export class IndexerApi { 'asset-id': typeof params?.assetId === 'bigint' ? (params!.assetId as bigint).toString() : params?.assetId, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -864,9 +807,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/block-headers', @@ -883,8 +823,8 @@ export class IndexerApi { absent: params?.absent, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -927,9 +867,6 @@ export class IndexerApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/v2/transactions', @@ -961,8 +898,8 @@ export class IndexerApi { 'application-id': typeof params?.applicationId === 'bigint' ? (params!.applicationId as bigint).toString() : params?.applicationId, }, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) diff --git a/packages/typescript/kmd_client/src/apis/api.service.ts b/packages/typescript/kmd_client/src/apis/api.service.ts index fe9bc61c2..bae7a63be 100644 --- a/packages/typescript/kmd_client/src/apis/api.service.ts +++ b/packages/typescript/kmd_client/src/apis/api.service.ts @@ -23,8 +23,6 @@ import type { Apiv1PostwalletRenewResponse, Apiv1PostwalletResponse, CreateWalletRequest, - DeleteKeyRequest, - DeleteMultisigRequest, ExportKeyRequest, ExportMasterKeyRequest, ExportMultisigRequest, @@ -34,7 +32,6 @@ import type { InitWalletHandleTokenRequest, ListKeysRequest, ListMultisigRequest, - ListWalletsRequest, ReleaseWalletHandleTokenRequest, RenameWalletRequest, RenewWalletHandleTokenRequest, @@ -42,7 +39,6 @@ import type { SignProgramMultisigRequest, SignProgramRequest, SignTransactionRequest, - VersionsRequest, VersionsResponse, WalletInfoRequest, } from '../models/index' @@ -69,8 +65,6 @@ import { Apiv1PostwalletRenewResponseMeta, Apiv1PostwalletResponseMeta, CreateWalletRequestMeta, - DeleteKeyRequestMeta, - DeleteMultisigRequestMeta, ExportKeyRequestMeta, ExportMasterKeyRequestMeta, ExportMultisigRequestMeta, @@ -80,7 +74,6 @@ import { InitWalletHandleTokenRequestMeta, ListKeysRequestMeta, ListMultisigRequestMeta, - ListWalletsRequestMeta, ReleaseWalletHandleTokenRequestMeta, RenameWalletRequestMeta, RenewWalletHandleTokenRequestMeta, @@ -88,7 +81,6 @@ import { SignProgramMultisigRequestMeta, SignProgramRequestMeta, SignTransactionRequestMeta, - VersionsRequestMeta, VersionsResponseMeta, WalletInfoRequestMeta, } from '../models/index' @@ -131,25 +123,19 @@ export class KmdApi { /** * Deletes the key with the passed public key from the wallet. */ - async deleteKey(params?: { body: DeleteKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async deleteKey(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const bodyMeta = DeleteKeyRequestMeta - const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined - if (mediaType) headers['Content-Type'] = mediaType - const serializedBody = - bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body - const payload = await this.httpRequest.request({ method: 'DELETE', url: '/v1/key', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -163,25 +149,19 @@ export class KmdApi { /** * Deletes multisig preimage information for the passed address from the wallet. */ - async deleteMultisig(params?: { body: DeleteMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { + async deleteMultisig(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const bodyMeta = DeleteMultisigRequestMeta - const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined - if (mediaType) headers['Content-Type'] = mediaType - const serializedBody = - bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body - const payload = await this.httpRequest.request({ method: 'DELETE', url: '/v1/multisig', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -326,25 +306,19 @@ export class KmdApi { return payload as Apiv1PostkeyResponse } - async getVersion(params?: { body?: VersionsRequest }, requestOptions?: ApiRequestOptions): Promise { + async getVersion(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const bodyMeta = VersionsRequestMeta - const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined - if (mediaType) headers['Content-Type'] = mediaType - const serializedBody = - bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body - const payload = await this.httpRequest.request({ method: 'GET', url: '/versions', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -556,25 +530,19 @@ export class KmdApi { /** * Lists all of the wallets that kmd is aware of. */ - async listWallets(params?: { body?: ListWalletsRequest }, requestOptions?: ApiRequestOptions): Promise { + async listWallets(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const bodyMeta = ListWalletsRequestMeta - const mediaType = bodyMeta ? (responseFormat === 'json' ? 'application/json' : 'application/msgpack') : undefined - if (mediaType) headers['Content-Type'] = mediaType - const serializedBody = - bodyMeta && params?.body !== undefined ? AlgorandSerializer.encode(params.body, bodyMeta, responseFormat) : params?.body - const payload = await this.httpRequest.request({ method: 'GET', url: '/v1/wallets', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) @@ -832,17 +800,14 @@ export class KmdApi { const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' - const serializedBody = undefined - const mediaType = undefined - const payload = await this.httpRequest.request({ method: 'GET', url: '/swagger.json', path: {}, query: {}, headers, - body: serializedBody, - mediaType: mediaType, + body: undefined, + mediaType: undefined, ...(requestOptions ?? {}), }) From 1d19f95989df50ec2a5ebcc81c94f00ba9ee3780 Mon Sep 17 00:00:00 2001 From: Altynbek Orumbayev Date: Mon, 29 Sep 2025 17:19:54 +0200 Subject: [PATCH 3/4] refactor: pr comments on aligning ts and rs autogenerated abstraction names --- .../ts_oas_generator/generator/filters.py | 24 +- .../src/models/application-initial-states.ts | 16 +- ...kvstorage.ts => application-kv-storage.ts} | 6 +- .../algod_client/src/models/index.ts | 4 +- .../indexer_client/src/apis/api.service.ts | 2 +- .../kmd_client/src/apis/api.service.ts | 210 +++++++++--------- ...sponse.ts => apiv1-delete-key-response.ts} | 6 +- ...e.ts => apiv1-delete-multisig-response.ts} | 6 +- ...ponse.ts => apiv1-get-wallets-response.ts} | 6 +- ...e.ts => apiv1-post-key-export-response.ts} | 6 +- ...e.ts => apiv1-post-key-import-response.ts} | 6 +- ...nse.ts => apiv1-post-key-list-response.ts} | 6 +- ...response.ts => apiv1-post-key-response.ts} | 6 +- ... apiv1-post-master-key-export-response.ts} | 6 +- ...=> apiv1-post-multisig-export-response.ts} | 6 +- ...=> apiv1-post-multisig-import-response.ts} | 6 +- ...s => apiv1-post-multisig-list-response.ts} | 6 +- ...v1-post-multisig-program-sign-response.ts} | 6 +- ...ost-multisig-transaction-sign-response.ts} | 6 +- ...ts => apiv1-post-program-sign-response.ts} | 6 +- ...> apiv1-post-transaction-sign-response.ts} | 6 +- ....ts => apiv1-post-wallet-info-response.ts} | 6 +- ....ts => apiv1-post-wallet-init-response.ts} | 6 +- ... => apiv1-post-wallet-release-response.ts} | 6 +- ...s => apiv1-post-wallet-rename-response.ts} | 6 +- ...ts => apiv1-post-wallet-renew-response.ts} | 6 +- ...ponse.ts => apiv1-post-wallet-response.ts} | 6 +- .../typescript/kmd_client/src/models/index.ts | 84 +++---- 28 files changed, 244 insertions(+), 228 deletions(-) rename packages/typescript/algod_client/src/models/{application-kvstorage.ts => application-kv-storage.ts} (85%) rename packages/typescript/kmd_client/src/models/{apiv1-deletekey-response.ts => apiv1-delete-key-response.ts} (79%) rename packages/typescript/kmd_client/src/models/{apiv1-deletemultisig-response.ts => apiv1-delete-multisig-response.ts} (78%) rename packages/typescript/kmd_client/src/models/{apiv1-getwallets-response.ts => apiv1-get-wallets-response.ts} (86%) rename packages/typescript/kmd_client/src/models/{apiv1-postkey-export-response.ts => apiv1-post-key-export-response.ts} (83%) rename packages/typescript/kmd_client/src/models/{apiv1-postkey-import-response.ts => apiv1-post-key-import-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-postkey-list-response.ts => apiv1-post-key-list-response.ts} (83%) rename packages/typescript/kmd_client/src/models/{apiv1-postkey-response.ts => apiv1-post-key-response.ts} (84%) rename packages/typescript/kmd_client/src/models/{apiv1-postmaster-key-export-response.ts => apiv1-post-master-key-export-response.ts} (85%) rename packages/typescript/kmd_client/src/models/{apiv1-postmultisig-export-response.ts => apiv1-post-multisig-export-response.ts} (88%) rename packages/typescript/kmd_client/src/models/{apiv1-postmultisig-import-response.ts => apiv1-post-multisig-import-response.ts} (81%) rename packages/typescript/kmd_client/src/models/{apiv1-postmultisig-list-response.ts => apiv1-post-multisig-list-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-postmultisig-program-sign-response.ts => apiv1-post-multisig-program-sign-response.ts} (81%) rename packages/typescript/kmd_client/src/models/{apiv1-postmultisig-transaction-sign-response.ts => apiv1-post-multisig-transaction-sign-response.ts} (80%) rename packages/typescript/kmd_client/src/models/{apiv1-postprogram-sign-response.ts => apiv1-post-program-sign-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-posttransaction-sign-response.ts => apiv1-post-transaction-sign-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-postwallet-info-response.ts => apiv1-post-wallet-info-response.ts} (85%) rename packages/typescript/kmd_client/src/models/{apiv1-postwallet-init-response.ts => apiv1-post-wallet-init-response.ts} (83%) rename packages/typescript/kmd_client/src/models/{apiv1-postwallet-release-response.ts => apiv1-post-wallet-release-response.ts} (78%) rename packages/typescript/kmd_client/src/models/{apiv1-postwallet-rename-response.ts => apiv1-post-wallet-rename-response.ts} (84%) rename packages/typescript/kmd_client/src/models/{apiv1-postwallet-renew-response.ts => apiv1-post-wallet-renew-response.ts} (85%) rename packages/typescript/kmd_client/src/models/{apiv1-postwallet-response.ts => apiv1-post-wallet-response.ts} (85%) diff --git a/api/oas_generator/ts_oas_generator/generator/filters.py b/api/oas_generator/ts_oas_generator/generator/filters.py index 50c1fcdfe..9745b56b4 100644 --- a/api/oas_generator/ts_oas_generator/generator/filters.py +++ b/api/oas_generator/ts_oas_generator/generator/filters.py @@ -46,6 +46,9 @@ def ts_array(type_str: str) -> str: _WORD_BOUNDARY_RE = re.compile(r"([a-z0-9])([A-Z])") _NON_ALNUM_RE = re.compile(r"[^A-Za-z0-9]+") +_SNAKE_CASE_DELIMITER_RE = re.compile(r"[\-\.\s]") +_ACRONYM_SPLIT_RE = re.compile(r"([A-Z])([A-Z][a-z])") +_LOWER_TO_UPPER_SPLIT_RE = re.compile(r"([a-z0-9])([A-Z])") _U32_MAX_VALUE = 4294967295 _SMALL_INTEGER_MAX = 100 @@ -69,9 +72,22 @@ def _split_words(name: str) -> tuple[str, ...]: return parts or (name,) +def _snake_case_like_rust(name: str) -> str: + """Convert a string to snake_case using the same rules as the Rust generator.""" + + # Replace common delimiters with underscore + s = _SNAKE_CASE_DELIMITER_RE.sub("_", name) + # Split acronym sequences before CamelCase words (e.g., "EMultisig" -> "E_Multisig") + s = _ACRONYM_SPLIT_RE.sub(r"\1_\2", s) + # Split lower/digit to upper transitions (e.g., "v1Delete" -> "v1_Delete") + s = _LOWER_TO_UPPER_SPLIT_RE.sub(r"\1_\2", s) + return s.lower() + + def ts_pascal_case(name: str) -> str: - """Convert name to PascalCase.""" - return "".join(part.capitalize() for part in _split_words(name)) + """Convert name to PascalCase (aligned with Rust pascalcase).""" + snake = _snake_case_like_rust(name) + return "".join(part.capitalize() for part in snake.split("_") if part) def ts_camel_case(name: str) -> str: @@ -81,8 +97,8 @@ def ts_camel_case(name: str) -> str: def ts_kebab_case(name: str) -> str: - """Convert name to kebab-case.""" - return "-".join(part.lower() for part in _split_words(name)) + """Convert name to kebab-case (aligned with Rust snakecase rules).""" + return _snake_case_like_rust(name).replace("_", "-") def ts_property_name(name: str) -> str: diff --git a/packages/typescript/algod_client/src/models/application-initial-states.ts b/packages/typescript/algod_client/src/models/application-initial-states.ts index 179f74e36..22acf411e 100644 --- a/packages/typescript/algod_client/src/models/application-initial-states.ts +++ b/packages/typescript/algod_client/src/models/application-initial-states.ts @@ -1,6 +1,6 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { ApplicationKvstorage } from './application-kvstorage' -import { ApplicationKvstorageMeta } from './application-kvstorage' +import type { ApplicationKvStorage } from './application-kv-storage' +import { ApplicationKvStorageMeta } from './application-kv-storage' /** * An application's initial global/local/box states that were accessed during simulation. @@ -14,9 +14,9 @@ export type ApplicationInitialStates = { /** * An application's initial local states tied to different accounts. */ - appLocals?: ApplicationKvstorage[] - appGlobals?: ApplicationKvstorage - appBoxes?: ApplicationKvstorage + appLocals?: ApplicationKvStorage[] + appGlobals?: ApplicationKvStorage + appBoxes?: ApplicationKvStorage } export const ApplicationInitialStatesMeta: ModelMetadata = { @@ -35,21 +35,21 @@ export const ApplicationInitialStatesMeta: ModelMetadata = { wireKey: 'app-locals', optional: true, nullable: false, - type: { kind: 'array', item: { kind: 'model', meta: () => ApplicationKvstorageMeta } }, + type: { kind: 'array', item: { kind: 'model', meta: () => ApplicationKvStorageMeta } }, }, { name: 'appGlobals', wireKey: 'app-globals', optional: true, nullable: false, - type: { kind: 'model', meta: () => ApplicationKvstorageMeta }, + type: { kind: 'model', meta: () => ApplicationKvStorageMeta }, }, { name: 'appBoxes', wireKey: 'app-boxes', optional: true, nullable: false, - type: { kind: 'model', meta: () => ApplicationKvstorageMeta }, + type: { kind: 'model', meta: () => ApplicationKvStorageMeta }, }, ], } diff --git a/packages/typescript/algod_client/src/models/application-kvstorage.ts b/packages/typescript/algod_client/src/models/application-kv-storage.ts similarity index 85% rename from packages/typescript/algod_client/src/models/application-kvstorage.ts rename to packages/typescript/algod_client/src/models/application-kv-storage.ts index 1cdc78f70..c69a95d55 100644 --- a/packages/typescript/algod_client/src/models/application-kvstorage.ts +++ b/packages/typescript/algod_client/src/models/application-kv-storage.ts @@ -5,7 +5,7 @@ import { AvmKeyValueMeta } from './avm-key-value' /** * An application's global/local/box state. */ -export type ApplicationKvstorage = { +export type ApplicationKvStorage = { /** * Key-Value pairs representing application states. */ @@ -17,8 +17,8 @@ export type ApplicationKvstorage = { account?: string } -export const ApplicationKvstorageMeta: ModelMetadata = { - name: 'ApplicationKvstorage', +export const ApplicationKvStorageMeta: ModelMetadata = { + name: 'ApplicationKvStorage', kind: 'object', fields: [ { diff --git a/packages/typescript/algod_client/src/models/index.ts b/packages/typescript/algod_client/src/models/index.ts index d0393371e..0900ce210 100644 --- a/packages/typescript/algod_client/src/models/index.ts +++ b/packages/typescript/algod_client/src/models/index.ts @@ -96,8 +96,8 @@ export type { ScratchChange } from './scratch-change' export { ScratchChangeMeta } from './scratch-change' export type { ApplicationStateOperation } from './application-state-operation' export { ApplicationStateOperationMeta } from './application-state-operation' -export type { ApplicationKvstorage } from './application-kvstorage' -export { ApplicationKvstorageMeta } from './application-kvstorage' +export type { ApplicationKvStorage } from './application-kv-storage' +export { ApplicationKvStorageMeta } from './application-kv-storage' export type { ApplicationInitialStates } from './application-initial-states' export { ApplicationInitialStatesMeta } from './application-initial-states' export type { SimulationOpcodeTraceUnit } from './simulation-opcode-trace-unit' diff --git a/packages/typescript/indexer_client/src/apis/api.service.ts b/packages/typescript/indexer_client/src/apis/api.service.ts index f5e262d1c..1f0f5cbcc 100644 --- a/packages/typescript/indexer_client/src/apis/api.service.ts +++ b/packages/typescript/indexer_client/src/apis/api.service.ts @@ -297,7 +297,7 @@ export class IndexerApi { /** * Given an application ID and box name, returns base64 encoded box name and value. Box names must be in the goal app call arg form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, encode base 64 and use 'b64' prefix as in 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. */ - async lookupApplicationBoxByIdandName( + async lookupApplicationBoxByIdAndName( applicationId: number | bigint, params?: { name: string }, requestOptions?: ApiRequestOptions, diff --git a/packages/typescript/kmd_client/src/apis/api.service.ts b/packages/typescript/kmd_client/src/apis/api.service.ts index bae7a63be..76b4b8ccd 100644 --- a/packages/typescript/kmd_client/src/apis/api.service.ts +++ b/packages/typescript/kmd_client/src/apis/api.service.ts @@ -1,27 +1,27 @@ import type { BaseHttpRequest, ApiRequestOptions } from '../core/base-http-request' import { AlgorandSerializer } from '../core/model-runtime' import type { - Apiv1DeletekeyResponse, - Apiv1DeletemultisigResponse, - Apiv1GetwalletsResponse, - Apiv1PostkeyExportResponse, - Apiv1PostkeyImportResponse, - Apiv1PostkeyListResponse, - Apiv1PostkeyResponse, - Apiv1PostmasterKeyExportResponse, - Apiv1PostmultisigExportResponse, - Apiv1PostmultisigImportResponse, - Apiv1PostmultisigListResponse, - Apiv1PostmultisigProgramSignResponse, - Apiv1PostmultisigTransactionSignResponse, - Apiv1PostprogramSignResponse, - Apiv1PosttransactionSignResponse, - Apiv1PostwalletInfoResponse, - Apiv1PostwalletInitResponse, - Apiv1PostwalletReleaseResponse, - Apiv1PostwalletRenameResponse, - Apiv1PostwalletRenewResponse, - Apiv1PostwalletResponse, + Apiv1DeleteKeyResponse, + Apiv1DeleteMultisigResponse, + Apiv1GetWalletsResponse, + Apiv1PostKeyExportResponse, + Apiv1PostKeyImportResponse, + Apiv1PostKeyListResponse, + Apiv1PostKeyResponse, + Apiv1PostMasterKeyExportResponse, + Apiv1PostMultisigExportResponse, + Apiv1PostMultisigImportResponse, + Apiv1PostMultisigListResponse, + Apiv1PostMultisigProgramSignResponse, + Apiv1PostMultisigTransactionSignResponse, + Apiv1PostProgramSignResponse, + Apiv1PostTransactionSignResponse, + Apiv1PostWalletInfoResponse, + Apiv1PostWalletInitResponse, + Apiv1PostWalletReleaseResponse, + Apiv1PostWalletRenameResponse, + Apiv1PostWalletRenewResponse, + Apiv1PostWalletResponse, CreateWalletRequest, ExportKeyRequest, ExportMasterKeyRequest, @@ -43,27 +43,27 @@ import type { WalletInfoRequest, } from '../models/index' import { - Apiv1DeletekeyResponseMeta, - Apiv1DeletemultisigResponseMeta, - Apiv1GetwalletsResponseMeta, - Apiv1PostkeyExportResponseMeta, - Apiv1PostkeyImportResponseMeta, - Apiv1PostkeyListResponseMeta, - Apiv1PostkeyResponseMeta, - Apiv1PostmasterKeyExportResponseMeta, - Apiv1PostmultisigExportResponseMeta, - Apiv1PostmultisigImportResponseMeta, - Apiv1PostmultisigListResponseMeta, - Apiv1PostmultisigProgramSignResponseMeta, - Apiv1PostmultisigTransactionSignResponseMeta, - Apiv1PostprogramSignResponseMeta, - Apiv1PosttransactionSignResponseMeta, - Apiv1PostwalletInfoResponseMeta, - Apiv1PostwalletInitResponseMeta, - Apiv1PostwalletReleaseResponseMeta, - Apiv1PostwalletRenameResponseMeta, - Apiv1PostwalletRenewResponseMeta, - Apiv1PostwalletResponseMeta, + Apiv1DeleteKeyResponseMeta, + Apiv1DeleteMultisigResponseMeta, + Apiv1GetWalletsResponseMeta, + Apiv1PostKeyExportResponseMeta, + Apiv1PostKeyImportResponseMeta, + Apiv1PostKeyListResponseMeta, + Apiv1PostKeyResponseMeta, + Apiv1PostMasterKeyExportResponseMeta, + Apiv1PostMultisigExportResponseMeta, + Apiv1PostMultisigImportResponseMeta, + Apiv1PostMultisigListResponseMeta, + Apiv1PostMultisigProgramSignResponseMeta, + Apiv1PostMultisigTransactionSignResponseMeta, + Apiv1PostProgramSignResponseMeta, + Apiv1PostTransactionSignResponseMeta, + Apiv1PostWalletInfoResponseMeta, + Apiv1PostWalletInitResponseMeta, + Apiv1PostWalletReleaseResponseMeta, + Apiv1PostWalletRenameResponseMeta, + Apiv1PostWalletRenewResponseMeta, + Apiv1PostWalletResponseMeta, CreateWalletRequestMeta, ExportKeyRequestMeta, ExportMasterKeyRequestMeta, @@ -91,7 +91,7 @@ export class KmdApi { /** * Create a new wallet (collection of keys) with the given parameters. */ - async createWallet(params?: { body: CreateWalletRequest }, requestOptions?: ApiRequestOptions): Promise { + async createWallet(params?: { body: CreateWalletRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -113,17 +113,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostwalletResponseMeta + const responseMeta = Apiv1PostWalletResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostwalletResponse + return payload as Apiv1PostWalletResponse } /** * Deletes the key with the passed public key from the wallet. */ - async deleteKey(requestOptions?: ApiRequestOptions): Promise { + async deleteKey(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -139,17 +139,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1DeletekeyResponseMeta + const responseMeta = Apiv1DeleteKeyResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1DeletekeyResponse + return payload as Apiv1DeleteKeyResponse } /** * Deletes multisig preimage information for the passed address from the wallet. */ - async deleteMultisig(requestOptions?: ApiRequestOptions): Promise { + async deleteMultisig(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -165,17 +165,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1DeletemultisigResponseMeta + const responseMeta = Apiv1DeleteMultisigResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1DeletemultisigResponse + return payload as Apiv1DeleteMultisigResponse } /** * Export the secret key associated with the passed public key. */ - async exportKey(params?: { body: ExportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async exportKey(params?: { body: ExportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -197,11 +197,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostkeyExportResponseMeta + const responseMeta = Apiv1PostKeyExportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostkeyExportResponse + return payload as Apiv1PostKeyExportResponse } /** @@ -210,7 +210,7 @@ export class KmdApi { async exportMasterKey( params?: { body: ExportMasterKeyRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -232,11 +232,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostmasterKeyExportResponseMeta + const responseMeta = Apiv1PostMasterKeyExportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostmasterKeyExportResponse + return payload as Apiv1PostMasterKeyExportResponse } /** @@ -245,7 +245,7 @@ export class KmdApi { async exportMultisig( params?: { body: ExportMultisigRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -267,17 +267,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostmultisigExportResponseMeta + const responseMeta = Apiv1PostMultisigExportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostmultisigExportResponse + return payload as Apiv1PostMultisigExportResponse } /** * Generates the next key in the deterministic key sequence (as determined by the master derivation key) and adds it to the wallet, returning the public key. */ - async generateKey(params?: { body: GenerateKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async generateKey(params?: { body: GenerateKeyRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -299,11 +299,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostkeyResponseMeta + const responseMeta = Apiv1PostKeyResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostkeyResponse + return payload as Apiv1PostKeyResponse } async getVersion(requestOptions?: ApiRequestOptions): Promise { @@ -332,7 +332,7 @@ export class KmdApi { /** * Returns information about the wallet associated with the passed wallet handle token. Additionally returns expiration information about the token itself. */ - async getWalletInfo(params?: { body: WalletInfoRequest }, requestOptions?: ApiRequestOptions): Promise { + async getWalletInfo(params?: { body: WalletInfoRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -354,17 +354,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostwalletInfoResponseMeta + const responseMeta = Apiv1PostWalletInfoResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostwalletInfoResponse + return payload as Apiv1PostWalletInfoResponse } /** * Import an externally generated key into the wallet. Note that if you wish to back up the imported key, you must do so by backing up the entire wallet database, because imported keys were not derived from the wallet's master derivation key. */ - async importKey(params?: { body: ImportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async importKey(params?: { body: ImportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -386,11 +386,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostkeyImportResponseMeta + const responseMeta = Apiv1PostKeyImportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostkeyImportResponse + return payload as Apiv1PostKeyImportResponse } /** @@ -399,7 +399,7 @@ export class KmdApi { async importMultisig( params?: { body: ImportMultisigRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -421,11 +421,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostmultisigImportResponseMeta + const responseMeta = Apiv1PostMultisigImportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostmultisigImportResponse + return payload as Apiv1PostMultisigImportResponse } /** @@ -434,7 +434,7 @@ export class KmdApi { async initWalletHandleToken( params?: { body: InitWalletHandleTokenRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -456,17 +456,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostwalletInitResponseMeta + const responseMeta = Apiv1PostWalletInitResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostwalletInitResponse + return payload as Apiv1PostWalletInitResponse } /** * Lists all of the public keys in this wallet. All of them have a stored private key. */ - async listKeysInWallet(params?: { body: ListKeysRequest }, requestOptions?: ApiRequestOptions): Promise { + async listKeysInWallet(params?: { body: ListKeysRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -488,17 +488,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostkeyListResponseMeta + const responseMeta = Apiv1PostKeyListResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostkeyListResponse + return payload as Apiv1PostKeyListResponse } /** * Lists all of the multisig accounts whose preimages this wallet stores */ - async listMultisg(params?: { body: ListMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { + async listMultisg(params?: { body: ListMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -520,17 +520,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostmultisigListResponseMeta + const responseMeta = Apiv1PostMultisigListResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostmultisigListResponse + return payload as Apiv1PostMultisigListResponse } /** * Lists all of the wallets that kmd is aware of. */ - async listWallets(requestOptions?: ApiRequestOptions): Promise { + async listWallets(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -546,11 +546,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1GetwalletsResponseMeta + const responseMeta = Apiv1GetWalletsResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1GetwalletsResponse + return payload as Apiv1GetWalletsResponse } /** @@ -559,7 +559,7 @@ export class KmdApi { async releaseWalletHandleToken( params?: { body: ReleaseWalletHandleTokenRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -581,17 +581,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostwalletReleaseResponseMeta + const responseMeta = Apiv1PostWalletReleaseResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostwalletReleaseResponse + return payload as Apiv1PostWalletReleaseResponse } /** * Rename the underlying wallet to something else */ - async renameWallet(params?: { body: RenameWalletRequest }, requestOptions?: ApiRequestOptions): Promise { + async renameWallet(params?: { body: RenameWalletRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -613,11 +613,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostwalletRenameResponseMeta + const responseMeta = Apiv1PostWalletRenameResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostwalletRenameResponse + return payload as Apiv1PostWalletRenameResponse } /** @@ -626,7 +626,7 @@ export class KmdApi { async renewWalletHandleToken( params?: { body: RenewWalletHandleTokenRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -648,11 +648,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostwalletRenewResponseMeta + const responseMeta = Apiv1PostWalletRenewResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostwalletRenewResponse + return payload as Apiv1PostWalletRenewResponse } /** @@ -661,7 +661,7 @@ export class KmdApi { async signMultisigProgram( params?: { body: SignProgramMultisigRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -683,11 +683,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostmultisigProgramSignResponseMeta + const responseMeta = Apiv1PostMultisigProgramSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostmultisigProgramSignResponse + return payload as Apiv1PostMultisigProgramSignResponse } /** @@ -696,7 +696,7 @@ export class KmdApi { async signMultisigTransaction( params?: { body: SignMultisigRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -718,17 +718,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostmultisigTransactionSignResponseMeta + const responseMeta = Apiv1PostMultisigTransactionSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostmultisigTransactionSignResponse + return payload as Apiv1PostMultisigTransactionSignResponse } /** * Signs the passed program with a key from the wallet, determined by the account named in the request. */ - async signProgram(params?: { body: SignProgramRequest }, requestOptions?: ApiRequestOptions): Promise { + async signProgram(params?: { body: SignProgramRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -750,11 +750,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostprogramSignResponseMeta + const responseMeta = Apiv1PostProgramSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostprogramSignResponse + return payload as Apiv1PostProgramSignResponse } /** @@ -763,7 +763,7 @@ export class KmdApi { async signTransaction( params?: { body: SignTransactionRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -785,11 +785,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PosttransactionSignResponseMeta + const responseMeta = Apiv1PostTransactionSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PosttransactionSignResponse + return payload as Apiv1PostTransactionSignResponse } /** diff --git a/packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts b/packages/typescript/kmd_client/src/models/apiv1-delete-key-response.ts similarity index 79% rename from packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-delete-key-response.ts index 726b80ed7..85e0c3096 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-deletekey-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-delete-key-response.ts @@ -4,13 +4,13 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1DELETEKeyResponse is the response to `DELETE /v1/key` * friendly:DeleteKeyResponse */ -export type Apiv1DeletekeyResponse = { +export type Apiv1DeleteKeyResponse = { error?: boolean message?: string } -export const Apiv1DeletekeyResponseMeta: ModelMetadata = { - name: 'Apiv1DeletekeyResponse', +export const Apiv1DeleteKeyResponseMeta: ModelMetadata = { + name: 'Apiv1DeleteKeyResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts b/packages/typescript/kmd_client/src/models/apiv1-delete-multisig-response.ts similarity index 78% rename from packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-delete-multisig-response.ts index d42d9e906..fdedf003c 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-deletemultisig-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-delete-multisig-response.ts @@ -4,13 +4,13 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` * friendly:DeleteMultisigResponse */ -export type Apiv1DeletemultisigResponse = { +export type Apiv1DeleteMultisigResponse = { error?: boolean message?: string } -export const Apiv1DeletemultisigResponseMeta: ModelMetadata = { - name: 'Apiv1DeletemultisigResponse', +export const Apiv1DeleteMultisigResponseMeta: ModelMetadata = { + name: 'Apiv1DeleteMultisigResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts b/packages/typescript/kmd_client/src/models/apiv1-get-wallets-response.ts similarity index 86% rename from packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-get-wallets-response.ts index 0991b0981..3bfaa03d9 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-getwallets-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-get-wallets-response.ts @@ -6,14 +6,14 @@ import { Apiv1WalletMeta } from './apiv1-wallet' * APIV1GETWalletsResponse is the response to `GET /v1/wallets` * friendly:ListWalletsResponse */ -export type Apiv1GetwalletsResponse = { +export type Apiv1GetWalletsResponse = { error?: boolean message?: string wallets?: Apiv1Wallet[] } -export const Apiv1GetwalletsResponseMeta: ModelMetadata = { - name: 'Apiv1GetwalletsResponse', +export const Apiv1GetWalletsResponseMeta: ModelMetadata = { + name: 'Apiv1GetWalletsResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-key-export-response.ts similarity index 83% rename from packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-key-export-response.ts index 108783a79..1e0106cc5 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postkey-export-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-key-export-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` * friendly:ExportKeyResponse */ -export type Apiv1PostkeyExportResponse = { +export type Apiv1PostKeyExportResponse = { error?: boolean message?: string privateKey?: Uint8Array } -export const Apiv1PostkeyExportResponseMeta: ModelMetadata = { - name: 'Apiv1PostkeyExportResponse', +export const Apiv1PostKeyExportResponseMeta: ModelMetadata = { + name: 'Apiv1PostKeyExportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-key-import-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-key-import-response.ts index c39745a2c..fc76defb4 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postkey-import-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-key-import-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` * friendly:ImportKeyResponse */ -export type Apiv1PostkeyImportResponse = { +export type Apiv1PostKeyImportResponse = { address?: string error?: boolean message?: string } -export const Apiv1PostkeyImportResponseMeta: ModelMetadata = { - name: 'Apiv1PostkeyImportResponse', +export const Apiv1PostKeyImportResponseMeta: ModelMetadata = { + name: 'Apiv1PostKeyImportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-key-list-response.ts similarity index 83% rename from packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-key-list-response.ts index c4ac3b3f0..b72547065 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postkey-list-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-key-list-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyListResponse is the response to `POST /v1/key/list` * friendly:ListKeysResponse */ -export type Apiv1PostkeyListResponse = { +export type Apiv1PostKeyListResponse = { addresses?: string[] error?: boolean message?: string } -export const Apiv1PostkeyListResponseMeta: ModelMetadata = { - name: 'Apiv1PostkeyListResponse', +export const Apiv1PostKeyListResponseMeta: ModelMetadata = { + name: 'Apiv1PostKeyListResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-key-response.ts similarity index 84% rename from packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-key-response.ts index 397e86612..1c8abcd45 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postkey-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-key-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyResponse is the response to `POST /v1/key` * friendly:GenerateKeyResponse */ -export type Apiv1PostkeyResponse = { +export type Apiv1PostKeyResponse = { address?: string error?: boolean message?: string } -export const Apiv1PostkeyResponseMeta: ModelMetadata = { - name: 'Apiv1PostkeyResponse', +export const Apiv1PostKeyResponseMeta: ModelMetadata = { + name: 'Apiv1PostKeyResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-master-key-export-response.ts similarity index 85% rename from packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-master-key-export-response.ts index 9ba2cf06c..98d70250d 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postmaster-key-export-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-master-key-export-response.ts @@ -6,14 +6,14 @@ import { MasterDerivationKeyMeta } from './master-derivation-key' * APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` * friendly:ExportMasterKeyResponse */ -export type Apiv1PostmasterKeyExportResponse = { +export type Apiv1PostMasterKeyExportResponse = { error?: boolean masterDerivationKey?: MasterDerivationKey message?: string } -export const Apiv1PostmasterKeyExportResponseMeta: ModelMetadata = { - name: 'Apiv1PostmasterKeyExportResponse', +export const Apiv1PostMasterKeyExportResponseMeta: ModelMetadata = { + name: 'Apiv1PostMasterKeyExportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-export-response.ts similarity index 88% rename from packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-multisig-export-response.ts index 101ae4b47..be52c8631 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-export-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-export-response.ts @@ -6,7 +6,7 @@ import { PublicKeyMeta } from './public-key' * APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` * friendly:ExportMultisigResponse */ -export type Apiv1PostmultisigExportResponse = { +export type Apiv1PostMultisigExportResponse = { error?: boolean message?: string multisigVersion?: bigint @@ -14,8 +14,8 @@ export type Apiv1PostmultisigExportResponse = { threshold?: bigint } -export const Apiv1PostmultisigExportResponseMeta: ModelMetadata = { - name: 'Apiv1PostmultisigExportResponse', +export const Apiv1PostMultisigExportResponseMeta: ModelMetadata = { + name: 'Apiv1PostMultisigExportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-import-response.ts similarity index 81% rename from packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-multisig-import-response.ts index fca833c02..06cb4a434 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-import-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-import-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` * friendly:ImportMultisigResponse */ -export type Apiv1PostmultisigImportResponse = { +export type Apiv1PostMultisigImportResponse = { address?: string error?: boolean message?: string } -export const Apiv1PostmultisigImportResponseMeta: ModelMetadata = { - name: 'Apiv1PostmultisigImportResponse', +export const Apiv1PostMultisigImportResponseMeta: ModelMetadata = { + name: 'Apiv1PostMultisigImportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-list-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-multisig-list-response.ts index 1f95eb37c..2d8a70a79 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-list-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-list-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` * friendly:ListMultisigResponse */ -export type Apiv1PostmultisigListResponse = { +export type Apiv1PostMultisigListResponse = { addresses?: string[] error?: boolean message?: string } -export const Apiv1PostmultisigListResponseMeta: ModelMetadata = { - name: 'Apiv1PostmultisigListResponse', +export const Apiv1PostMultisigListResponseMeta: ModelMetadata = { + name: 'Apiv1PostMultisigListResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-program-sign-response.ts similarity index 81% rename from packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-multisig-program-sign-response.ts index 26cc3998f..8043f9709 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-program-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-program-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` * friendly:SignProgramMultisigResponse */ -export type Apiv1PostmultisigProgramSignResponse = { +export type Apiv1PostMultisigProgramSignResponse = { error?: boolean message?: string multisig?: Uint8Array } -export const Apiv1PostmultisigProgramSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostmultisigProgramSignResponse', +export const Apiv1PostMultisigProgramSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostMultisigProgramSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-transaction-sign-response.ts similarity index 80% rename from packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-multisig-transaction-sign-response.ts index fd455e4ff..94fa9449c 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postmultisig-transaction-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-multisig-transaction-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` * friendly:SignMultisigResponse */ -export type Apiv1PostmultisigTransactionSignResponse = { +export type Apiv1PostMultisigTransactionSignResponse = { error?: boolean message?: string multisig?: Uint8Array } -export const Apiv1PostmultisigTransactionSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostmultisigTransactionSignResponse', +export const Apiv1PostMultisigTransactionSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostMultisigTransactionSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-program-sign-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-program-sign-response.ts index 3d62ab02a..c0bab5f8a 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postprogram-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-program-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` * friendly:SignProgramResponse */ -export type Apiv1PostprogramSignResponse = { +export type Apiv1PostProgramSignResponse = { error?: boolean message?: string sig?: Uint8Array } -export const Apiv1PostprogramSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostprogramSignResponse', +export const Apiv1PostProgramSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostProgramSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-transaction-sign-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-transaction-sign-response.ts index 0777957c4..6d192b89d 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-posttransaction-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-transaction-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` * friendly:SignTransactionResponse */ -export type Apiv1PosttransactionSignResponse = { +export type Apiv1PostTransactionSignResponse = { error?: boolean message?: string signedTransaction?: Uint8Array } -export const Apiv1PosttransactionSignResponseMeta: ModelMetadata = { - name: 'Apiv1PosttransactionSignResponse', +export const Apiv1PostTransactionSignResponseMeta: ModelMetadata = { + name: 'Apiv1PostTransactionSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-info-response.ts similarity index 85% rename from packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-wallet-info-response.ts index d39d85525..4cd23b996 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postwallet-info-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-info-response.ts @@ -6,14 +6,14 @@ import { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' * APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` * friendly:WalletInfoResponse */ -export type Apiv1PostwalletInfoResponse = { +export type Apiv1PostWalletInfoResponse = { error?: boolean message?: string walletHandle?: Apiv1WalletHandle } -export const Apiv1PostwalletInfoResponseMeta: ModelMetadata = { - name: 'Apiv1PostwalletInfoResponse', +export const Apiv1PostWalletInfoResponseMeta: ModelMetadata = { + name: 'Apiv1PostWalletInfoResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-init-response.ts similarity index 83% rename from packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-wallet-init-response.ts index 2a859e8b9..98360013f 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postwallet-init-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-init-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` * friendly:InitWalletHandleTokenResponse */ -export type Apiv1PostwalletInitResponse = { +export type Apiv1PostWalletInitResponse = { error?: boolean message?: string walletHandleToken?: string } -export const Apiv1PostwalletInitResponseMeta: ModelMetadata = { - name: 'Apiv1PostwalletInitResponse', +export const Apiv1PostWalletInitResponseMeta: ModelMetadata = { + name: 'Apiv1PostWalletInitResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-release-response.ts similarity index 78% rename from packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-wallet-release-response.ts index 25ea5a83f..4c911c982 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postwallet-release-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-release-response.ts @@ -4,13 +4,13 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` * friendly:ReleaseWalletHandleTokenResponse */ -export type Apiv1PostwalletReleaseResponse = { +export type Apiv1PostWalletReleaseResponse = { error?: boolean message?: string } -export const Apiv1PostwalletReleaseResponseMeta: ModelMetadata = { - name: 'Apiv1PostwalletReleaseResponse', +export const Apiv1PostWalletReleaseResponseMeta: ModelMetadata = { + name: 'Apiv1PostWalletReleaseResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-rename-response.ts similarity index 84% rename from packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-wallet-rename-response.ts index c094819ca..a2cdfd8b9 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postwallet-rename-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-rename-response.ts @@ -6,14 +6,14 @@ import { Apiv1WalletMeta } from './apiv1-wallet' * APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` * friendly:RenameWalletResponse */ -export type Apiv1PostwalletRenameResponse = { +export type Apiv1PostWalletRenameResponse = { error?: boolean message?: string wallet?: Apiv1Wallet } -export const Apiv1PostwalletRenameResponseMeta: ModelMetadata = { - name: 'Apiv1PostwalletRenameResponse', +export const Apiv1PostWalletRenameResponseMeta: ModelMetadata = { + name: 'Apiv1PostWalletRenameResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-renew-response.ts similarity index 85% rename from packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-wallet-renew-response.ts index 431a05791..0d9b35281 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postwallet-renew-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-renew-response.ts @@ -6,14 +6,14 @@ import { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' * APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` * friendly:RenewWalletHandleTokenResponse */ -export type Apiv1PostwalletRenewResponse = { +export type Apiv1PostWalletRenewResponse = { error?: boolean message?: string walletHandle?: Apiv1WalletHandle } -export const Apiv1PostwalletRenewResponseMeta: ModelMetadata = { - name: 'Apiv1PostwalletRenewResponse', +export const Apiv1PostWalletRenewResponseMeta: ModelMetadata = { + name: 'Apiv1PostWalletRenewResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-response.ts similarity index 85% rename from packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts rename to packages/typescript/kmd_client/src/models/apiv1-post-wallet-response.ts index d459d7026..1fdcf046e 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-postwallet-response.ts +++ b/packages/typescript/kmd_client/src/models/apiv1-post-wallet-response.ts @@ -6,14 +6,14 @@ import { Apiv1WalletMeta } from './apiv1-wallet' * APIV1POSTWalletResponse is the response to `POST /v1/wallet` * friendly:CreateWalletResponse */ -export type Apiv1PostwalletResponse = { +export type Apiv1PostWalletResponse = { error?: boolean message?: string wallet?: Apiv1Wallet } -export const Apiv1PostwalletResponseMeta: ModelMetadata = { - name: 'Apiv1PostwalletResponse', +export const Apiv1PostWalletResponseMeta: ModelMetadata = { + name: 'Apiv1PostWalletResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/index.ts b/packages/typescript/kmd_client/src/models/index.ts index 521e50f68..f0884c9d8 100644 --- a/packages/typescript/kmd_client/src/models/index.ts +++ b/packages/typescript/kmd_client/src/models/index.ts @@ -1,45 +1,45 @@ -export type { Apiv1DeletekeyResponse } from './apiv1-deletekey-response' -export { Apiv1DeletekeyResponseMeta } from './apiv1-deletekey-response' -export type { Apiv1DeletemultisigResponse } from './apiv1-deletemultisig-response' -export { Apiv1DeletemultisigResponseMeta } from './apiv1-deletemultisig-response' -export type { Apiv1GetwalletsResponse } from './apiv1-getwallets-response' -export { Apiv1GetwalletsResponseMeta } from './apiv1-getwallets-response' -export type { Apiv1PostkeyExportResponse } from './apiv1-postkey-export-response' -export { Apiv1PostkeyExportResponseMeta } from './apiv1-postkey-export-response' -export type { Apiv1PostkeyImportResponse } from './apiv1-postkey-import-response' -export { Apiv1PostkeyImportResponseMeta } from './apiv1-postkey-import-response' -export type { Apiv1PostkeyListResponse } from './apiv1-postkey-list-response' -export { Apiv1PostkeyListResponseMeta } from './apiv1-postkey-list-response' -export type { Apiv1PostkeyResponse } from './apiv1-postkey-response' -export { Apiv1PostkeyResponseMeta } from './apiv1-postkey-response' -export type { Apiv1PostmasterKeyExportResponse } from './apiv1-postmaster-key-export-response' -export { Apiv1PostmasterKeyExportResponseMeta } from './apiv1-postmaster-key-export-response' -export type { Apiv1PostmultisigExportResponse } from './apiv1-postmultisig-export-response' -export { Apiv1PostmultisigExportResponseMeta } from './apiv1-postmultisig-export-response' -export type { Apiv1PostmultisigImportResponse } from './apiv1-postmultisig-import-response' -export { Apiv1PostmultisigImportResponseMeta } from './apiv1-postmultisig-import-response' -export type { Apiv1PostmultisigListResponse } from './apiv1-postmultisig-list-response' -export { Apiv1PostmultisigListResponseMeta } from './apiv1-postmultisig-list-response' -export type { Apiv1PostmultisigProgramSignResponse } from './apiv1-postmultisig-program-sign-response' -export { Apiv1PostmultisigProgramSignResponseMeta } from './apiv1-postmultisig-program-sign-response' -export type { Apiv1PostmultisigTransactionSignResponse } from './apiv1-postmultisig-transaction-sign-response' -export { Apiv1PostmultisigTransactionSignResponseMeta } from './apiv1-postmultisig-transaction-sign-response' -export type { Apiv1PostprogramSignResponse } from './apiv1-postprogram-sign-response' -export { Apiv1PostprogramSignResponseMeta } from './apiv1-postprogram-sign-response' -export type { Apiv1PosttransactionSignResponse } from './apiv1-posttransaction-sign-response' -export { Apiv1PosttransactionSignResponseMeta } from './apiv1-posttransaction-sign-response' -export type { Apiv1PostwalletInfoResponse } from './apiv1-postwallet-info-response' -export { Apiv1PostwalletInfoResponseMeta } from './apiv1-postwallet-info-response' -export type { Apiv1PostwalletInitResponse } from './apiv1-postwallet-init-response' -export { Apiv1PostwalletInitResponseMeta } from './apiv1-postwallet-init-response' -export type { Apiv1PostwalletReleaseResponse } from './apiv1-postwallet-release-response' -export { Apiv1PostwalletReleaseResponseMeta } from './apiv1-postwallet-release-response' -export type { Apiv1PostwalletRenameResponse } from './apiv1-postwallet-rename-response' -export { Apiv1PostwalletRenameResponseMeta } from './apiv1-postwallet-rename-response' -export type { Apiv1PostwalletRenewResponse } from './apiv1-postwallet-renew-response' -export { Apiv1PostwalletRenewResponseMeta } from './apiv1-postwallet-renew-response' -export type { Apiv1PostwalletResponse } from './apiv1-postwallet-response' -export { Apiv1PostwalletResponseMeta } from './apiv1-postwallet-response' +export type { Apiv1DeleteKeyResponse } from './apiv1-delete-key-response' +export { Apiv1DeleteKeyResponseMeta } from './apiv1-delete-key-response' +export type { Apiv1DeleteMultisigResponse } from './apiv1-delete-multisig-response' +export { Apiv1DeleteMultisigResponseMeta } from './apiv1-delete-multisig-response' +export type { Apiv1GetWalletsResponse } from './apiv1-get-wallets-response' +export { Apiv1GetWalletsResponseMeta } from './apiv1-get-wallets-response' +export type { Apiv1PostKeyExportResponse } from './apiv1-post-key-export-response' +export { Apiv1PostKeyExportResponseMeta } from './apiv1-post-key-export-response' +export type { Apiv1PostKeyImportResponse } from './apiv1-post-key-import-response' +export { Apiv1PostKeyImportResponseMeta } from './apiv1-post-key-import-response' +export type { Apiv1PostKeyListResponse } from './apiv1-post-key-list-response' +export { Apiv1PostKeyListResponseMeta } from './apiv1-post-key-list-response' +export type { Apiv1PostKeyResponse } from './apiv1-post-key-response' +export { Apiv1PostKeyResponseMeta } from './apiv1-post-key-response' +export type { Apiv1PostMasterKeyExportResponse } from './apiv1-post-master-key-export-response' +export { Apiv1PostMasterKeyExportResponseMeta } from './apiv1-post-master-key-export-response' +export type { Apiv1PostMultisigExportResponse } from './apiv1-post-multisig-export-response' +export { Apiv1PostMultisigExportResponseMeta } from './apiv1-post-multisig-export-response' +export type { Apiv1PostMultisigImportResponse } from './apiv1-post-multisig-import-response' +export { Apiv1PostMultisigImportResponseMeta } from './apiv1-post-multisig-import-response' +export type { Apiv1PostMultisigListResponse } from './apiv1-post-multisig-list-response' +export { Apiv1PostMultisigListResponseMeta } from './apiv1-post-multisig-list-response' +export type { Apiv1PostMultisigProgramSignResponse } from './apiv1-post-multisig-program-sign-response' +export { Apiv1PostMultisigProgramSignResponseMeta } from './apiv1-post-multisig-program-sign-response' +export type { Apiv1PostMultisigTransactionSignResponse } from './apiv1-post-multisig-transaction-sign-response' +export { Apiv1PostMultisigTransactionSignResponseMeta } from './apiv1-post-multisig-transaction-sign-response' +export type { Apiv1PostProgramSignResponse } from './apiv1-post-program-sign-response' +export { Apiv1PostProgramSignResponseMeta } from './apiv1-post-program-sign-response' +export type { Apiv1PostTransactionSignResponse } from './apiv1-post-transaction-sign-response' +export { Apiv1PostTransactionSignResponseMeta } from './apiv1-post-transaction-sign-response' +export type { Apiv1PostWalletInfoResponse } from './apiv1-post-wallet-info-response' +export { Apiv1PostWalletInfoResponseMeta } from './apiv1-post-wallet-info-response' +export type { Apiv1PostWalletInitResponse } from './apiv1-post-wallet-init-response' +export { Apiv1PostWalletInitResponseMeta } from './apiv1-post-wallet-init-response' +export type { Apiv1PostWalletReleaseResponse } from './apiv1-post-wallet-release-response' +export { Apiv1PostWalletReleaseResponseMeta } from './apiv1-post-wallet-release-response' +export type { Apiv1PostWalletRenameResponse } from './apiv1-post-wallet-rename-response' +export { Apiv1PostWalletRenameResponseMeta } from './apiv1-post-wallet-rename-response' +export type { Apiv1PostWalletRenewResponse } from './apiv1-post-wallet-renew-response' +export { Apiv1PostWalletRenewResponseMeta } from './apiv1-post-wallet-renew-response' +export type { Apiv1PostWalletResponse } from './apiv1-post-wallet-response' +export { Apiv1PostWalletResponseMeta } from './apiv1-post-wallet-response' export type { Apiv1Wallet } from './apiv1-wallet' export { Apiv1WalletMeta } from './apiv1-wallet' export type { Apiv1WalletHandle } from './apiv1-wallet-handle' From fcd49cb3b962ac3b431b43747b7da80bc1a6f23f Mon Sep 17 00:00:00 2001 From: Altynbek Orumbayev Date: Mon, 29 Sep 2025 18:15:58 +0200 Subject: [PATCH 4/4] refactor: pr comments; dropping apiv1 prefix in kmd models --- api/scripts/convert-openapi.ts | 136 ++++++++-- api/specs/kmd.oas3.json | 234 +++++++++++------- crates/kmd_client/README.md | 46 ++-- crates/kmd_client/src/apis/client.rs | 63 +++-- crates/kmd_client/src/apis/create_wallet.rs | 4 +- crates/kmd_client/src/apis/delete_key.rs | 4 +- crates/kmd_client/src/apis/delete_multisig.rs | 4 +- crates/kmd_client/src/apis/export_key.rs | 4 +- .../kmd_client/src/apis/export_master_key.rs | 4 +- crates/kmd_client/src/apis/export_multisig.rs | 4 +- crates/kmd_client/src/apis/generate_key.rs | 4 +- crates/kmd_client/src/apis/get_wallet_info.rs | 4 +- crates/kmd_client/src/apis/import_key.rs | 4 +- crates/kmd_client/src/apis/import_multisig.rs | 4 +- .../src/apis/init_wallet_handle_token.rs | 4 +- .../src/apis/list_keys_in_wallet.rs | 4 +- crates/kmd_client/src/apis/list_multisg.rs | 4 +- crates/kmd_client/src/apis/list_wallets.rs | 4 +- .../src/apis/release_wallet_handle_token.rs | 4 +- crates/kmd_client/src/apis/rename_wallet.rs | 4 +- .../src/apis/renew_wallet_handle_token.rs | 4 +- .../src/apis/sign_multisig_program.rs | 4 +- .../src/apis/sign_multisig_transaction.rs | 4 +- crates/kmd_client/src/apis/sign_program.rs | 4 +- .../kmd_client/src/apis/sign_transaction.rs | 4 +- ...key_response.rs => delete_key_response.rs} | 10 +- ...esponse.rs => delete_multisig_response.rs} | 10 +- ...ts_response.rs => get_wallets_response.rs} | 14 +- crates/kmd_client/src/models/mod.rs | 92 +++---- ...esponse.rs => post_key_export_response.rs} | 10 +- ...esponse.rs => post_key_import_response.rs} | 10 +- ..._response.rs => post_key_list_response.rs} | 10 +- ...t_key_response.rs => post_key_response.rs} | 10 +- ....rs => post_master_key_export_response.rs} | 10 +- ...se.rs => post_multisig_export_response.rs} | 10 +- ...se.rs => post_multisig_import_response.rs} | 10 +- ...onse.rs => post_multisig_list_response.rs} | 10 +- ...=> post_multisig_program_sign_response.rs} | 10 +- ...ost_multisig_transaction_sign_response.rs} | 10 +- ...ponse.rs => post_program_sign_response.rs} | 10 +- ...e.rs => post_transaction_sign_response.rs} | 10 +- ...sponse.rs => post_wallet_info_response.rs} | 14 +- ...sponse.rs => post_wallet_init_response.rs} | 10 +- ...nse.rs => post_wallet_release_response.rs} | 10 +- ...onse.rs => post_wallet_rename_response.rs} | 14 +- ...ponse.rs => post_wallet_renew_response.rs} | 14 +- ...et_response.rs => post_wallet_response.rs} | 14 +- .../src/models/{apiv1_wallet.rs => wallet.rs} | 10 +- ...piv1_wallet_handle.rs => wallet_handle.rs} | 14 +- .../kmd_client/src/apis/api.service.ts | 216 ++++++++-------- ...key-response.ts => delete-key-response.ts} | 6 +- ...esponse.ts => delete-multisig-response.ts} | 6 +- ...ts-response.ts => get-wallets-response.ts} | 14 +- .../typescript/kmd_client/src/models/index.ts | 92 +++---- ...esponse.ts => post-key-export-response.ts} | 6 +- ...esponse.ts => post-key-import-response.ts} | 6 +- ...-response.ts => post-key-list-response.ts} | 6 +- ...t-key-response.ts => post-key-response.ts} | 6 +- ....ts => post-master-key-export-response.ts} | 6 +- ...se.ts => post-multisig-export-response.ts} | 6 +- ...se.ts => post-multisig-import-response.ts} | 6 +- ...onse.ts => post-multisig-list-response.ts} | 6 +- ...=> post-multisig-program-sign-response.ts} | 6 +- ...ost-multisig-transaction-sign-response.ts} | 6 +- ...ponse.ts => post-program-sign-response.ts} | 6 +- ...e.ts => post-transaction-sign-response.ts} | 6 +- ...sponse.ts => post-wallet-info-response.ts} | 14 +- ...sponse.ts => post-wallet-init-response.ts} | 6 +- ...nse.ts => post-wallet-release-response.ts} | 6 +- ...onse.ts => post-wallet-rename-response.ts} | 14 +- ...ponse.ts => post-wallet-renew-response.ts} | 14 +- ...et-response.ts => post-wallet-response.ts} | 14 +- ...piv1-wallet-handle.ts => wallet-handle.ts} | 14 +- .../src/models/{apiv1-wallet.ts => wallet.ts} | 6 +- 74 files changed, 767 insertions(+), 636 deletions(-) rename crates/kmd_client/src/models/{apiv1_delete_key_response.rs => delete_key_response.rs} (76%) rename crates/kmd_client/src/models/{apiv1_delete_multisig_response.rs => delete_multisig_response.rs} (75%) rename crates/kmd_client/src/models/{apiv1_get_wallets_response.rs => get_wallets_response.rs} (72%) rename crates/kmd_client/src/models/{apiv1_post_key_export_response.rs => post_key_export_response.rs} (80%) rename crates/kmd_client/src/models/{apiv1_post_key_import_response.rs => post_key_import_response.rs} (77%) rename crates/kmd_client/src/models/{apiv1_post_key_list_response.rs => post_key_list_response.rs} (78%) rename crates/kmd_client/src/models/{apiv1_post_key_response.rs => post_key_response.rs} (80%) rename crates/kmd_client/src/models/{apiv1_post_master_key_export_response.rs => post_master_key_export_response.rs} (78%) rename crates/kmd_client/src/models/{apiv1_post_multisig_export_response.rs => post_multisig_export_response.rs} (81%) rename crates/kmd_client/src/models/{apiv1_post_multisig_import_response.rs => post_multisig_import_response.rs} (76%) rename crates/kmd_client/src/models/{apiv1_post_multisig_list_response.rs => post_multisig_list_response.rs} (77%) rename crates/kmd_client/src/models/{apiv1_post_multisig_program_sign_response.rs => post_multisig_program_sign_response.rs} (77%) rename crates/kmd_client/src/models/{apiv1_post_multisig_transaction_sign_response.rs => post_multisig_transaction_sign_response.rs} (75%) rename crates/kmd_client/src/models/{apiv1_post_program_sign_response.rs => post_program_sign_response.rs} (79%) rename crates/kmd_client/src/models/{apiv1_post_transaction_sign_response.rs => post_transaction_sign_response.rs} (78%) rename crates/kmd_client/src/models/{apiv1_post_wallet_info_response.rs => post_wallet_info_response.rs} (70%) rename crates/kmd_client/src/models/{apiv1_post_wallet_init_response.rs => post_wallet_init_response.rs} (78%) rename crates/kmd_client/src/models/{apiv1_post_wallet_release_response.rs => post_wallet_release_response.rs} (74%) rename crates/kmd_client/src/models/{apiv1_post_wallet_rename_response.rs => post_wallet_rename_response.rs} (71%) rename crates/kmd_client/src/models/{apiv1_post_wallet_renew_response.rs => post_wallet_renew_response.rs} (70%) rename crates/kmd_client/src/models/{apiv1_post_wallet_response.rs => post_wallet_response.rs} (73%) rename crates/kmd_client/src/models/{apiv1_wallet.rs => wallet.rs} (88%) rename crates/kmd_client/src/models/{apiv1_wallet_handle.rs => wallet_handle.rs} (73%) rename packages/typescript/kmd_client/src/models/{apiv1-delete-key-response.ts => delete-key-response.ts} (79%) rename packages/typescript/kmd_client/src/models/{apiv1-delete-multisig-response.ts => delete-multisig-response.ts} (78%) rename packages/typescript/kmd_client/src/models/{apiv1-get-wallets-response.ts => get-wallets-response.ts} (70%) rename packages/typescript/kmd_client/src/models/{apiv1-post-key-export-response.ts => post-key-export-response.ts} (83%) rename packages/typescript/kmd_client/src/models/{apiv1-post-key-import-response.ts => post-key-import-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-post-key-list-response.ts => post-key-list-response.ts} (83%) rename packages/typescript/kmd_client/src/models/{apiv1-post-key-response.ts => post-key-response.ts} (84%) rename packages/typescript/kmd_client/src/models/{apiv1-post-master-key-export-response.ts => post-master-key-export-response.ts} (84%) rename packages/typescript/kmd_client/src/models/{apiv1-post-multisig-export-response.ts => post-multisig-export-response.ts} (88%) rename packages/typescript/kmd_client/src/models/{apiv1-post-multisig-import-response.ts => post-multisig-import-response.ts} (81%) rename packages/typescript/kmd_client/src/models/{apiv1-post-multisig-list-response.ts => post-multisig-list-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-post-multisig-program-sign-response.ts => post-multisig-program-sign-response.ts} (80%) rename packages/typescript/kmd_client/src/models/{apiv1-post-multisig-transaction-sign-response.ts => post-multisig-transaction-sign-response.ts} (79%) rename packages/typescript/kmd_client/src/models/{apiv1-post-program-sign-response.ts => post-program-sign-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-post-transaction-sign-response.ts => post-transaction-sign-response.ts} (82%) rename packages/typescript/kmd_client/src/models/{apiv1-post-wallet-info-response.ts => post-wallet-info-response.ts} (63%) rename packages/typescript/kmd_client/src/models/{apiv1-post-wallet-init-response.ts => post-wallet-init-response.ts} (83%) rename packages/typescript/kmd_client/src/models/{apiv1-post-wallet-release-response.ts => post-wallet-release-response.ts} (77%) rename packages/typescript/kmd_client/src/models/{apiv1-post-wallet-rename-response.ts => post-wallet-rename-response.ts} (65%) rename packages/typescript/kmd_client/src/models/{apiv1-post-wallet-renew-response.ts => post-wallet-renew-response.ts} (63%) rename packages/typescript/kmd_client/src/models/{apiv1-post-wallet-response.ts => post-wallet-response.ts} (66%) rename packages/typescript/kmd_client/src/models/{apiv1-wallet-handle.ts => wallet-handle.ts} (63%) rename packages/typescript/kmd_client/src/models/{apiv1-wallet.ts => wallet.ts} (92%) diff --git a/api/scripts/convert-openapi.ts b/api/scripts/convert-openapi.ts index 7f0dec824..19f49b566 100644 --- a/api/scripts/convert-openapi.ts +++ b/api/scripts/convert-openapi.ts @@ -55,6 +55,8 @@ interface ProcessingConfig { requiredFieldTransforms?: RequiredFieldTransform[]; fieldTransforms?: FieldTransform[]; msgpackOnlyEndpoints?: MsgpackOnlyEndpoint[]; + // If true, strip APIVn prefixes from component schemas and update refs (KMD) + stripKmdApiVersionPrefixes?: boolean; } // ===== TRANSFORMATIONS ===== @@ -584,6 +586,88 @@ function resolveRef(spec: OpenAPISpec, ref: string): any { return current; } +/** + * Strip APIVn prefix from component schema names and update all $ref usages (KMD-specific) + * Adds x-algokit-original-name and x-algokit-version metadata for traceability. + */ +function stripKmdApiVersionPrefixes(spec: OpenAPISpec): { renamed: number; collisions: number } { + let renamed = 0; + let collisions = 0; + + const components = spec.components; + if (!components || !components.schemas) { + return { renamed, collisions }; + } + + const schemas = components.schemas as Record; + const oldToNewName: Record = {}; + const newSchemas: Record = {}; + + const versionPrefix = /^APIV(\d+)(.+)$/; // e.g., APIV1DELETEMultisigResponse + + // 1) Build rename map and new schemas object + for (const [name, schema] of Object.entries(schemas)) { + const match = name.match(versionPrefix); + if (!match) { + if (newSchemas[name]) { + collisions++; + newSchemas[`${name}__DUP`] = schema; + } else { + newSchemas[name] = schema; + } + continue; + } + + const version = Number(match[1]); + const base = match[2]; // e.g., DELETEMultisigResponse + let target = base; + + // Avoid collisions: if target already exists, suffix with V + if (newSchemas[target] || Object.values(oldToNewName).includes(target)) { + target = `${base}V${version}`; + collisions++; + } + + // Record mapping and add metadata (in case in future new versions of the spec are added) + oldToNewName[name] = target; + const schemaCopy = { ...(schema as any) }; + schemaCopy["x-algokit-original-name"] = name; + schemaCopy["x-algokit-kmd-api-version"] = version; + newSchemas[target] = schemaCopy; + renamed++; + } + + // Apply renamed schemas + components.schemas = newSchemas as any; + + if (renamed === 0) { + return { renamed, collisions }; + } + + // 2) Update all $ref occurrences pointing to old schema names + const updateRefs = (obj: any): void => { + if (!obj || typeof obj !== "object") return; + if (Array.isArray(obj)) { + for (const item of obj) updateRefs(item); + return; + } + + if (typeof obj.$ref === "string" && obj.$ref.startsWith("#/components/schemas/")) { + const refName = obj.$ref.substring("#/components/schemas/".length); + const newName = oldToNewName[refName]; + if (newName) { + obj.$ref = `#/components/schemas/${newName}`; + } + } + + for (const value of Object.values(obj)) updateRefs(value); + }; + + updateRefs(spec); + + return { renamed, collisions }; +} + // ===== MAIN PROCESSOR ===== class OpenAPIProcessor { @@ -689,6 +773,13 @@ class OpenAPIProcessor { // Apply transformations console.log("ℹ️ Applying transformations..."); + // 0. KMD-only: strip APIVn prefixes before other transforms if requested + if (this.config.stripKmdApiVersionPrefixes) { + const { renamed, collisions } = stripKmdApiVersionPrefixes(spec); + if (renamed > 0) { + console.log(`ℹ️ Stripped APIVn prefix from ${renamed} schemas (collisions resolved: ${collisions})`); + } + } // 1. Fix missing descriptions const descriptionCount = fixMissingDescriptions(spec); @@ -834,32 +925,32 @@ async function processAlgodSpec() { fieldTransforms: [ { fieldName: "action", - removeItems: ["format"] + removeItems: ["format"], }, { fieldName: "num-uint", removeItems: ["format"], addItems: { - "minimum": 0, - "maximum": 64, - } + minimum: 0, + maximum: 64, + }, }, { fieldName: "num-byte-slice", removeItems: ["format"], addItems: { - "minimum": 0, - "maximum": 64, - } + minimum: 0, + maximum: 64, + }, }, { fieldName: "extra-program-pages", removeItems: ["format"], addItems: { - "minimum": 0, - "maximum": 3, - } - } + minimum: 0, + maximum: 3, + }, + }, ], vendorExtensionTransforms: [ { @@ -914,12 +1005,13 @@ async function processKmdSpec() { const config: ProcessingConfig = { sourceUrl: `https://raw.githubusercontent.com/algorand/go-algorand/${stableTag}/daemon/kmd/api/swagger.json`, outputPath: join(process.cwd(), "specs", "kmd.oas3.json"), + stripKmdApiVersionPrefixes: true, fieldTransforms: [ { fieldName: "private_key", removeItems: ["$ref"], addItems: { - "type": "string", + type: "string", "x-algokit-bytes-base64": true, }, }, @@ -955,25 +1047,25 @@ async function processIndexerSpec() { fieldName: "num-uint", removeItems: ["x-algorand-format"], addItems: { - "minimum": 0, - "maximum": 64, - } + minimum: 0, + maximum: 64, + }, }, { fieldName: "num-byte-slice", removeItems: ["x-algorand-format"], addItems: { - "minimum": 0, - "maximum": 64, - } + minimum: 0, + maximum: 64, + }, }, { fieldName: "extra-program-pages", addItems: { - "minimum": 0, - "maximum": 3, - } - } + minimum: 0, + maximum: 3, + }, + }, ], vendorExtensionTransforms: [ { diff --git a/api/specs/kmd.oas3.json b/api/specs/kmd.oas3.json index ebbd9c49d..029b87aa9 100644 --- a/api/specs/kmd.oas3.json +++ b/api/specs/kmd.oas3.json @@ -63,7 +63,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyResponse" + "$ref": "#/components/schemas/POSTKeyResponse" } } } @@ -91,7 +91,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1DELETEKeyResponse" + "$ref": "#/components/schemas/DELETEKeyResponse" } } } @@ -121,7 +121,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyExportResponse" + "$ref": "#/components/schemas/POSTKeyExportResponse" } } } @@ -151,7 +151,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyImportResponse" + "$ref": "#/components/schemas/POSTKeyImportResponse" } } } @@ -181,7 +181,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyListResponse" + "$ref": "#/components/schemas/POSTKeyListResponse" } } } @@ -211,7 +211,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMasterKeyExportResponse" + "$ref": "#/components/schemas/POSTMasterKeyExportResponse" } } } @@ -241,7 +241,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1DELETEMultisigResponse" + "$ref": "#/components/schemas/DELETEMultisigResponse" } } } @@ -271,7 +271,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigExportResponse" + "$ref": "#/components/schemas/POSTMultisigExportResponse" } } } @@ -301,7 +301,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigImportResponse" + "$ref": "#/components/schemas/POSTMultisigImportResponse" } } } @@ -331,7 +331,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigListResponse" + "$ref": "#/components/schemas/POSTMultisigListResponse" } } } @@ -361,7 +361,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigTransactionSignResponse" + "$ref": "#/components/schemas/POSTMultisigTransactionSignResponse" } } } @@ -391,7 +391,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigProgramSignResponse" + "$ref": "#/components/schemas/POSTMultisigProgramSignResponse" } } } @@ -421,7 +421,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTProgramSignResponse" + "$ref": "#/components/schemas/POSTProgramSignResponse" } } } @@ -451,7 +451,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTTransactionSignResponse" + "$ref": "#/components/schemas/POSTTransactionSignResponse" } } } @@ -481,7 +481,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletResponse" + "$ref": "#/components/schemas/POSTWalletResponse" } } } @@ -511,7 +511,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletInfoResponse" + "$ref": "#/components/schemas/POSTWalletInfoResponse" } } } @@ -541,7 +541,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletInitResponse" + "$ref": "#/components/schemas/POSTWalletInitResponse" } } } @@ -571,7 +571,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletReleaseResponse" + "$ref": "#/components/schemas/POSTWalletReleaseResponse" } } } @@ -601,7 +601,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletRenameResponse" + "$ref": "#/components/schemas/POSTWalletRenameResponse" } } } @@ -631,7 +631,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletRenewResponse" + "$ref": "#/components/schemas/POSTWalletRenewResponse" } } } @@ -661,7 +661,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1GETWalletsResponse" + "$ref": "#/components/schemas/GETWalletsResponse" } } } @@ -702,7 +702,7 @@ }, "components": { "schemas": { - "APIV1DELETEKeyResponse": { + "DELETEKeyResponse": { "type": "object", "properties": { "error": { @@ -715,9 +715,11 @@ } }, "description": "APIV1DELETEKeyResponse is the response to `DELETE /v1/key`\nfriendly:DeleteKeyResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1DELETEKeyResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1DELETEMultisigResponse": { + "DELETEMultisigResponse": { "type": "object", "properties": { "error": { @@ -730,9 +732,11 @@ } }, "description": "APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete`\nfriendly:DeleteMultisigResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1DELETEMultisigResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1GETWalletsResponse": { + "GETWalletsResponse": { "type": "object", "properties": { "error": { @@ -746,15 +750,17 @@ "wallets": { "type": "array", "items": { - "$ref": "#/components/schemas/APIV1Wallet" + "$ref": "#/components/schemas/Wallet" }, "x-go-name": "Wallets" } }, "description": "APIV1GETWalletsResponse is the response to `GET /v1/wallets`\nfriendly:ListWalletsResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1GETWalletsResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTKeyExportResponse": { + "POSTKeyExportResponse": { "type": "object", "properties": { "error": { @@ -771,9 +777,11 @@ } }, "description": "APIV1POSTKeyExportResponse is the response to `POST /v1/key/export`\nfriendly:ExportKeyResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTKeyExportResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTKeyImportResponse": { + "POSTKeyImportResponse": { "type": "object", "properties": { "address": { @@ -790,9 +798,11 @@ } }, "description": "APIV1POSTKeyImportResponse is the response to `POST /v1/key/import`\nfriendly:ImportKeyResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTKeyImportResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTKeyListResponse": { + "POSTKeyListResponse": { "type": "object", "properties": { "addresses": { @@ -812,9 +822,11 @@ } }, "description": "APIV1POSTKeyListResponse is the response to `POST /v1/key/list`\nfriendly:ListKeysResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTKeyListResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTKeyResponse": { + "POSTKeyResponse": { "type": "object", "properties": { "address": { @@ -831,9 +843,11 @@ } }, "description": "APIV1POSTKeyResponse is the response to `POST /v1/key`\nfriendly:GenerateKeyResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTKeyResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTMasterKeyExportResponse": { + "POSTMasterKeyExportResponse": { "type": "object", "properties": { "error": { @@ -849,9 +863,11 @@ } }, "description": "APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export`\nfriendly:ExportMasterKeyResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTMasterKeyExportResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTMultisigExportResponse": { + "POSTMultisigExportResponse": { "type": "object", "properties": { "error": { @@ -881,9 +897,11 @@ } }, "description": "APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export`\nfriendly:ExportMultisigResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTMultisigExportResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTMultisigImportResponse": { + "POSTMultisigImportResponse": { "type": "object", "properties": { "address": { @@ -900,9 +918,11 @@ } }, "description": "APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import`\nfriendly:ImportMultisigResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTMultisigImportResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTMultisigListResponse": { + "POSTMultisigListResponse": { "type": "object", "properties": { "addresses": { @@ -922,9 +942,11 @@ } }, "description": "APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list`\nfriendly:ListMultisigResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTMultisigListResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTMultisigProgramSignResponse": { + "POSTMultisigProgramSignResponse": { "type": "object", "properties": { "error": { @@ -943,9 +965,11 @@ } }, "description": "APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata`\nfriendly:SignProgramMultisigResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTMultisigProgramSignResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTMultisigTransactionSignResponse": { + "POSTMultisigTransactionSignResponse": { "type": "object", "properties": { "error": { @@ -964,9 +988,11 @@ } }, "description": "APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign`\nfriendly:SignMultisigResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTMultisigTransactionSignResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTProgramSignResponse": { + "POSTProgramSignResponse": { "type": "object", "properties": { "error": { @@ -985,9 +1011,11 @@ } }, "description": "APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign`\nfriendly:SignProgramResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTProgramSignResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTTransactionSignResponse": { + "POSTTransactionSignResponse": { "type": "object", "properties": { "error": { @@ -1006,9 +1034,11 @@ } }, "description": "APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign`\nfriendly:SignTransactionResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTTransactionSignResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTWalletInfoResponse": { + "POSTWalletInfoResponse": { "type": "object", "properties": { "error": { @@ -1020,13 +1050,15 @@ "x-go-name": "Message" }, "wallet_handle": { - "$ref": "#/components/schemas/APIV1WalletHandle" + "$ref": "#/components/schemas/WalletHandle" } }, "description": "APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info`\nfriendly:WalletInfoResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTWalletInfoResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTWalletInitResponse": { + "POSTWalletInitResponse": { "type": "object", "properties": { "error": { @@ -1043,9 +1075,11 @@ } }, "description": "APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init`\nfriendly:InitWalletHandleTokenResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTWalletInitResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTWalletReleaseResponse": { + "POSTWalletReleaseResponse": { "type": "object", "properties": { "error": { @@ -1058,9 +1092,11 @@ } }, "description": "APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release`\nfriendly:ReleaseWalletHandleTokenResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTWalletReleaseResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTWalletRenameResponse": { + "POSTWalletRenameResponse": { "type": "object", "properties": { "error": { @@ -1072,13 +1108,15 @@ "x-go-name": "Message" }, "wallet": { - "$ref": "#/components/schemas/APIV1Wallet" + "$ref": "#/components/schemas/Wallet" } }, "description": "APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename`\nfriendly:RenameWalletResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTWalletRenameResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTWalletRenewResponse": { + "POSTWalletRenewResponse": { "type": "object", "properties": { "error": { @@ -1090,13 +1128,15 @@ "x-go-name": "Message" }, "wallet_handle": { - "$ref": "#/components/schemas/APIV1WalletHandle" + "$ref": "#/components/schemas/WalletHandle" } }, "description": "APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew`\nfriendly:RenewWalletHandleTokenResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTWalletRenewResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1POSTWalletResponse": { + "POSTWalletResponse": { "type": "object", "properties": { "error": { @@ -1108,13 +1148,15 @@ "x-go-name": "Message" }, "wallet": { - "$ref": "#/components/schemas/APIV1Wallet" + "$ref": "#/components/schemas/Wallet" } }, "description": "APIV1POSTWalletResponse is the response to `POST /v1/wallet`\nfriendly:CreateWalletResponse", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1POSTWalletResponse", + "x-algokit-kmd-api-version": 1 }, - "APIV1Wallet": { + "Wallet": { "type": "object", "properties": { "driver_name": { @@ -1147,9 +1189,11 @@ } }, "description": "APIV1Wallet is the API's representation of a wallet", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1Wallet", + "x-algokit-kmd-api-version": 1 }, - "APIV1WalletHandle": { + "WalletHandle": { "type": "object", "properties": { "expires_seconds": { @@ -1158,11 +1202,13 @@ "x-go-name": "ExpiresSeconds" }, "wallet": { - "$ref": "#/components/schemas/APIV1Wallet" + "$ref": "#/components/schemas/Wallet" } }, "description": "APIV1WalletHandle includes the wallet the handle corresponds to\nand the number of number of seconds to expiration", - "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" + "x-go-package": "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi", + "x-algokit-original-name": "APIV1WalletHandle", + "x-algokit-kmd-api-version": 1 }, "CreateWalletRequest": { "type": "object", @@ -1678,7 +1724,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletResponse" + "$ref": "#/components/schemas/POSTWalletResponse" } } } @@ -1688,7 +1734,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1DELETEKeyResponse" + "$ref": "#/components/schemas/DELETEKeyResponse" } } } @@ -1698,7 +1744,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1DELETEMultisigResponse" + "$ref": "#/components/schemas/DELETEMultisigResponse" } } } @@ -1708,7 +1754,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyExportResponse" + "$ref": "#/components/schemas/POSTKeyExportResponse" } } } @@ -1718,7 +1764,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMasterKeyExportResponse" + "$ref": "#/components/schemas/POSTMasterKeyExportResponse" } } } @@ -1728,7 +1774,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigExportResponse" + "$ref": "#/components/schemas/POSTMultisigExportResponse" } } } @@ -1738,7 +1784,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyResponse" + "$ref": "#/components/schemas/POSTKeyResponse" } } } @@ -1748,7 +1794,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyImportResponse" + "$ref": "#/components/schemas/POSTKeyImportResponse" } } } @@ -1758,7 +1804,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigImportResponse" + "$ref": "#/components/schemas/POSTMultisigImportResponse" } } } @@ -1768,7 +1814,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletInitResponse" + "$ref": "#/components/schemas/POSTWalletInitResponse" } } } @@ -1778,7 +1824,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTKeyListResponse" + "$ref": "#/components/schemas/POSTKeyListResponse" } } } @@ -1788,7 +1834,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigListResponse" + "$ref": "#/components/schemas/POSTMultisigListResponse" } } } @@ -1798,7 +1844,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1GETWalletsResponse" + "$ref": "#/components/schemas/GETWalletsResponse" } } } @@ -1808,7 +1854,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletReleaseResponse" + "$ref": "#/components/schemas/POSTWalletReleaseResponse" } } } @@ -1818,7 +1864,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletRenameResponse" + "$ref": "#/components/schemas/POSTWalletRenameResponse" } } } @@ -1828,7 +1874,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletRenewResponse" + "$ref": "#/components/schemas/POSTWalletRenewResponse" } } } @@ -1838,7 +1884,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigTransactionSignResponse" + "$ref": "#/components/schemas/POSTMultisigTransactionSignResponse" } } } @@ -1848,7 +1894,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTMultisigProgramSignResponse" + "$ref": "#/components/schemas/POSTMultisigProgramSignResponse" } } } @@ -1858,7 +1904,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTProgramSignResponse" + "$ref": "#/components/schemas/POSTProgramSignResponse" } } } @@ -1868,7 +1914,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTTransactionSignResponse" + "$ref": "#/components/schemas/POSTTransactionSignResponse" } } } @@ -1888,7 +1934,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIV1POSTWalletInfoResponse" + "$ref": "#/components/schemas/POSTWalletInfoResponse" } } } diff --git a/crates/kmd_client/README.md b/crates/kmd_client/README.md index 965e5a665..9de316828 100644 --- a/crates/kmd_client/README.md +++ b/crates/kmd_client/README.md @@ -164,50 +164,50 @@ This client provides access to 23 API operations: The following data models are available: -- `Apiv1DeleteKeyResponse` - APIV1DELETEKeyResponse is the response to `DELETE /v1/key` +- `DeleteKeyResponse` - APIV1DELETEKeyResponse is the response to `DELETE /v1/key` friendly:DeleteKeyResponse -- `Apiv1DeleteMultisigResponse` - APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` +- `DeleteMultisigResponse` - APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` friendly:DeleteMultisigResponse -- `Apiv1GetWalletsResponse` - APIV1GETWalletsResponse is the response to `GET /v1/wallets` +- `GetWalletsResponse` - APIV1GETWalletsResponse is the response to `GET /v1/wallets` friendly:ListWalletsResponse -- `Apiv1PostKeyExportResponse` - APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` +- `PostKeyExportResponse` - APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` friendly:ExportKeyResponse -- `Apiv1PostKeyImportResponse` - APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` +- `PostKeyImportResponse` - APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` friendly:ImportKeyResponse -- `Apiv1PostKeyListResponse` - APIV1POSTKeyListResponse is the response to `POST /v1/key/list` +- `PostKeyListResponse` - APIV1POSTKeyListResponse is the response to `POST /v1/key/list` friendly:ListKeysResponse -- `Apiv1PostKeyResponse` - APIV1POSTKeyResponse is the response to `POST /v1/key` +- `PostKeyResponse` - APIV1POSTKeyResponse is the response to `POST /v1/key` friendly:GenerateKeyResponse -- `Apiv1PostMasterKeyExportResponse` - APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` +- `PostMasterKeyExportResponse` - APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` friendly:ExportMasterKeyResponse -- `Apiv1PostMultisigExportResponse` - APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` +- `PostMultisigExportResponse` - APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` friendly:ExportMultisigResponse -- `Apiv1PostMultisigImportResponse` - APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` +- `PostMultisigImportResponse` - APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` friendly:ImportMultisigResponse -- `Apiv1PostMultisigListResponse` - APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` +- `PostMultisigListResponse` - APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` friendly:ListMultisigResponse -- `Apiv1PostMultisigProgramSignResponse` - APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` +- `PostMultisigProgramSignResponse` - APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` friendly:SignProgramMultisigResponse -- `Apiv1PostMultisigTransactionSignResponse` - APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` +- `PostMultisigTransactionSignResponse` - APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` friendly:SignMultisigResponse -- `Apiv1PostProgramSignResponse` - APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` +- `PostProgramSignResponse` - APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` friendly:SignProgramResponse -- `Apiv1PostTransactionSignResponse` - APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` +- `PostTransactionSignResponse` - APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` friendly:SignTransactionResponse -- `Apiv1PostWalletInfoResponse` - APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` +- `PostWalletInfoResponse` - APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` friendly:WalletInfoResponse -- `Apiv1PostWalletInitResponse` - APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` +- `PostWalletInitResponse` - APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` friendly:InitWalletHandleTokenResponse -- `Apiv1PostWalletReleaseResponse` - APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` +- `PostWalletReleaseResponse` - APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` friendly:ReleaseWalletHandleTokenResponse -- `Apiv1PostWalletRenameResponse` - APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` +- `PostWalletRenameResponse` - APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` friendly:RenameWalletResponse -- `Apiv1PostWalletRenewResponse` - APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` +- `PostWalletRenewResponse` - APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` friendly:RenewWalletHandleTokenResponse -- `Apiv1PostWalletResponse` - APIV1POSTWalletResponse is the response to `POST /v1/wallet` +- `PostWalletResponse` - APIV1POSTWalletResponse is the response to `POST /v1/wallet` friendly:CreateWalletResponse -- `Apiv1Wallet` - APIV1Wallet is the API's representation of a wallet -- `Apiv1WalletHandle` - APIV1WalletHandle includes the wallet the handle corresponds to +- `Wallet` - APIV1Wallet is the API's representation of a wallet +- `WalletHandle` - APIV1WalletHandle includes the wallet the handle corresponds to and the number of number of seconds to expiration - `CreateWalletRequest` - APIV1POSTWalletRequest is the request for `POST /v1/wallet` - `DeleteKeyRequest` - APIV1DELETEKeyRequest is the request for `DELETE /v1/key` diff --git a/crates/kmd_client/src/apis/client.rs b/crates/kmd_client/src/apis/client.rs index 56c6121e0..6d6204a42 100644 --- a/crates/kmd_client/src/apis/client.rs +++ b/crates/kmd_client/src/apis/client.rs @@ -12,17 +12,16 @@ use super::Error; use crate::models::{ - Apiv1DeleteKeyResponse, Apiv1DeleteMultisigResponse, Apiv1GetWalletsResponse, - Apiv1PostKeyExportResponse, Apiv1PostKeyImportResponse, Apiv1PostKeyListResponse, - Apiv1PostKeyResponse, Apiv1PostMasterKeyExportResponse, Apiv1PostMultisigExportResponse, - Apiv1PostMultisigImportResponse, Apiv1PostMultisigListResponse, - Apiv1PostMultisigProgramSignResponse, Apiv1PostMultisigTransactionSignResponse, - Apiv1PostProgramSignResponse, Apiv1PostTransactionSignResponse, Apiv1PostWalletInfoResponse, - Apiv1PostWalletInitResponse, Apiv1PostWalletReleaseResponse, Apiv1PostWalletRenameResponse, - Apiv1PostWalletRenewResponse, Apiv1PostWalletResponse, CreateWalletRequest, DeleteKeyRequest, - DeleteMultisigRequest, ExportKeyRequest, ExportMasterKeyRequest, ExportMultisigRequest, - GenerateKeyRequest, ImportKeyRequest, ImportMultisigRequest, InitWalletHandleTokenRequest, - ListKeysRequest, ListMultisigRequest, ListWalletsRequest, ReleaseWalletHandleTokenRequest, + CreateWalletRequest, DeleteKeyRequest, DeleteKeyResponse, DeleteMultisigRequest, + DeleteMultisigResponse, ExportKeyRequest, ExportMasterKeyRequest, ExportMultisigRequest, + GenerateKeyRequest, GetWalletsResponse, ImportKeyRequest, ImportMultisigRequest, + InitWalletHandleTokenRequest, ListKeysRequest, ListMultisigRequest, ListWalletsRequest, + PostKeyExportResponse, PostKeyImportResponse, PostKeyListResponse, PostKeyResponse, + PostMasterKeyExportResponse, PostMultisigExportResponse, PostMultisigImportResponse, + PostMultisigListResponse, PostMultisigProgramSignResponse, PostMultisigTransactionSignResponse, + PostProgramSignResponse, PostTransactionSignResponse, PostWalletInfoResponse, + PostWalletInitResponse, PostWalletReleaseResponse, PostWalletRenameResponse, + PostWalletRenewResponse, PostWalletResponse, ReleaseWalletHandleTokenRequest, RenameWalletRequest, RenewWalletHandleTokenRequest, SignMultisigRequest, SignProgramMultisigRequest, SignProgramRequest, SignTransactionRequest, VersionsRequest, VersionsResponse, WalletInfoRequest, @@ -90,14 +89,14 @@ impl KmdClient { pub async fn generate_key( &self, request: GenerateKeyRequest, - ) -> Result { + ) -> Result { let result = super::generate_key::generate_key(self.http_client.as_ref(), request).await; result } /// Delete a key - pub async fn delete_key(&self) -> Result { + pub async fn delete_key(&self) -> Result { let result = super::delete_key::delete_key(self.http_client.as_ref()).await; result @@ -107,7 +106,7 @@ impl KmdClient { pub async fn export_key( &self, request: ExportKeyRequest, - ) -> Result { + ) -> Result { let result = super::export_key::export_key(self.http_client.as_ref(), request).await; result @@ -117,7 +116,7 @@ impl KmdClient { pub async fn import_key( &self, request: ImportKeyRequest, - ) -> Result { + ) -> Result { let result = super::import_key::import_key(self.http_client.as_ref(), request).await; result @@ -127,7 +126,7 @@ impl KmdClient { pub async fn list_keys_in_wallet( &self, request: ListKeysRequest, - ) -> Result { + ) -> Result { let result = super::list_keys_in_wallet::list_keys_in_wallet(self.http_client.as_ref(), request) .await; @@ -139,7 +138,7 @@ impl KmdClient { pub async fn export_master_key( &self, request: ExportMasterKeyRequest, - ) -> Result { + ) -> Result { let result = super::export_master_key::export_master_key(self.http_client.as_ref(), request).await; @@ -147,7 +146,7 @@ impl KmdClient { } /// Delete a multisig - pub async fn delete_multisig(&self) -> Result { + pub async fn delete_multisig(&self) -> Result { let result = super::delete_multisig::delete_multisig(self.http_client.as_ref()).await; result @@ -157,7 +156,7 @@ impl KmdClient { pub async fn export_multisig( &self, request: ExportMultisigRequest, - ) -> Result { + ) -> Result { let result = super::export_multisig::export_multisig(self.http_client.as_ref(), request).await; @@ -168,7 +167,7 @@ impl KmdClient { pub async fn import_multisig( &self, request: ImportMultisigRequest, - ) -> Result { + ) -> Result { let result = super::import_multisig::import_multisig(self.http_client.as_ref(), request).await; @@ -179,7 +178,7 @@ impl KmdClient { pub async fn list_multisg( &self, request: ListMultisigRequest, - ) -> Result { + ) -> Result { let result = super::list_multisg::list_multisg(self.http_client.as_ref(), request).await; result @@ -189,7 +188,7 @@ impl KmdClient { pub async fn sign_multisig_transaction( &self, request: SignMultisigRequest, - ) -> Result { + ) -> Result { let result = super::sign_multisig_transaction::sign_multisig_transaction( self.http_client.as_ref(), request, @@ -203,7 +202,7 @@ impl KmdClient { pub async fn sign_multisig_program( &self, request: SignProgramMultisigRequest, - ) -> Result { + ) -> Result { let result = super::sign_multisig_program::sign_multisig_program(self.http_client.as_ref(), request) .await; @@ -215,7 +214,7 @@ impl KmdClient { pub async fn sign_program( &self, request: SignProgramRequest, - ) -> Result { + ) -> Result { let result = super::sign_program::sign_program(self.http_client.as_ref(), request).await; result @@ -225,7 +224,7 @@ impl KmdClient { pub async fn sign_transaction( &self, request: SignTransactionRequest, - ) -> Result { + ) -> Result { let result = super::sign_transaction::sign_transaction(self.http_client.as_ref(), request).await; @@ -236,7 +235,7 @@ impl KmdClient { pub async fn create_wallet( &self, request: CreateWalletRequest, - ) -> Result { + ) -> Result { let result = super::create_wallet::create_wallet(self.http_client.as_ref(), request).await; result @@ -246,7 +245,7 @@ impl KmdClient { pub async fn get_wallet_info( &self, request: WalletInfoRequest, - ) -> Result { + ) -> Result { let result = super::get_wallet_info::get_wallet_info(self.http_client.as_ref(), request).await; @@ -257,7 +256,7 @@ impl KmdClient { pub async fn init_wallet_handle_token( &self, request: InitWalletHandleTokenRequest, - ) -> Result { + ) -> Result { let result = super::init_wallet_handle_token::init_wallet_handle_token( self.http_client.as_ref(), request, @@ -271,7 +270,7 @@ impl KmdClient { pub async fn release_wallet_handle_token( &self, request: ReleaseWalletHandleTokenRequest, - ) -> Result { + ) -> Result { let result = super::release_wallet_handle_token::release_wallet_handle_token( self.http_client.as_ref(), request, @@ -285,7 +284,7 @@ impl KmdClient { pub async fn rename_wallet( &self, request: RenameWalletRequest, - ) -> Result { + ) -> Result { let result = super::rename_wallet::rename_wallet(self.http_client.as_ref(), request).await; result @@ -295,7 +294,7 @@ impl KmdClient { pub async fn renew_wallet_handle_token( &self, request: RenewWalletHandleTokenRequest, - ) -> Result { + ) -> Result { let result = super::renew_wallet_handle_token::renew_wallet_handle_token( self.http_client.as_ref(), request, @@ -306,7 +305,7 @@ impl KmdClient { } /// List wallets - pub async fn list_wallets(&self) -> Result { + pub async fn list_wallets(&self) -> Result { let result = super::list_wallets::list_wallets(self.http_client.as_ref()).await; result diff --git a/crates/kmd_client/src/apis/create_wallet.rs b/crates/kmd_client/src/apis/create_wallet.rs index c410c13fd..2f9631f1c 100644 --- a/crates/kmd_client/src/apis/create_wallet.rs +++ b/crates/kmd_client/src/apis/create_wallet.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostWalletResponse; +use crate::models::PostWalletResponse; // Import request body type if needed use crate::models::CreateWalletRequest; @@ -33,7 +33,7 @@ pub enum CreateWalletError { pub async fn create_wallet( http_client: &dyn HttpClient, request: CreateWalletRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/wallet".to_string(); diff --git a/crates/kmd_client/src/apis/delete_key.rs b/crates/kmd_client/src/apis/delete_key.rs index 29689c924..d2018637d 100644 --- a/crates/kmd_client/src/apis/delete_key.rs +++ b/crates/kmd_client/src/apis/delete_key.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1DeleteKeyResponse; +use crate::models::DeleteKeyResponse; // Import request body type if needed use crate::models::DeleteKeyRequest; @@ -30,7 +30,7 @@ pub enum DeleteKeyError { } /// Deletes the key with the passed public key from the wallet. -pub async fn delete_key(http_client: &dyn HttpClient) -> Result { +pub async fn delete_key(http_client: &dyn HttpClient) -> Result { let path = "/v1/key".to_string(); let query_params: HashMap = HashMap::new(); diff --git a/crates/kmd_client/src/apis/delete_multisig.rs b/crates/kmd_client/src/apis/delete_multisig.rs index c3bc65617..4b2d99766 100644 --- a/crates/kmd_client/src/apis/delete_multisig.rs +++ b/crates/kmd_client/src/apis/delete_multisig.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1DeleteMultisigResponse; +use crate::models::DeleteMultisigResponse; // Import request body type if needed use crate::models::DeleteMultisigRequest; @@ -32,7 +32,7 @@ pub enum DeleteMultisigError { /// Deletes multisig preimage information for the passed address from the wallet. pub async fn delete_multisig( http_client: &dyn HttpClient, -) -> Result { +) -> Result { let path = "/v1/multisig".to_string(); let query_params: HashMap = HashMap::new(); diff --git a/crates/kmd_client/src/apis/export_key.rs b/crates/kmd_client/src/apis/export_key.rs index d23854392..c3deb52a5 100644 --- a/crates/kmd_client/src/apis/export_key.rs +++ b/crates/kmd_client/src/apis/export_key.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostKeyExportResponse; +use crate::models::PostKeyExportResponse; // Import request body type if needed use crate::models::ExportKeyRequest; @@ -33,7 +33,7 @@ pub enum ExportKeyError { pub async fn export_key( http_client: &dyn HttpClient, request: ExportKeyRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/key/export".to_string(); diff --git a/crates/kmd_client/src/apis/export_master_key.rs b/crates/kmd_client/src/apis/export_master_key.rs index fc3735a57..ccdf10647 100644 --- a/crates/kmd_client/src/apis/export_master_key.rs +++ b/crates/kmd_client/src/apis/export_master_key.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostMasterKeyExportResponse; +use crate::models::PostMasterKeyExportResponse; // Import request body type if needed use crate::models::ExportMasterKeyRequest; @@ -33,7 +33,7 @@ pub enum ExportMasterKeyError { pub async fn export_master_key( http_client: &dyn HttpClient, request: ExportMasterKeyRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/master-key/export".to_string(); diff --git a/crates/kmd_client/src/apis/export_multisig.rs b/crates/kmd_client/src/apis/export_multisig.rs index 75a6b8d5d..2e8a47d44 100644 --- a/crates/kmd_client/src/apis/export_multisig.rs +++ b/crates/kmd_client/src/apis/export_multisig.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostMultisigExportResponse; +use crate::models::PostMultisigExportResponse; // Import request body type if needed use crate::models::ExportMultisigRequest; @@ -33,7 +33,7 @@ pub enum ExportMultisigError { pub async fn export_multisig( http_client: &dyn HttpClient, request: ExportMultisigRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/multisig/export".to_string(); diff --git a/crates/kmd_client/src/apis/generate_key.rs b/crates/kmd_client/src/apis/generate_key.rs index 5f7abf9e6..58fcda832 100644 --- a/crates/kmd_client/src/apis/generate_key.rs +++ b/crates/kmd_client/src/apis/generate_key.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostKeyResponse; +use crate::models::PostKeyResponse; // Import request body type if needed use crate::models::GenerateKeyRequest; @@ -33,7 +33,7 @@ pub enum GenerateKeyError { pub async fn generate_key( http_client: &dyn HttpClient, request: GenerateKeyRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/key".to_string(); diff --git a/crates/kmd_client/src/apis/get_wallet_info.rs b/crates/kmd_client/src/apis/get_wallet_info.rs index 3967e0e96..340f60088 100644 --- a/crates/kmd_client/src/apis/get_wallet_info.rs +++ b/crates/kmd_client/src/apis/get_wallet_info.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostWalletInfoResponse; +use crate::models::PostWalletInfoResponse; // Import request body type if needed use crate::models::WalletInfoRequest; @@ -33,7 +33,7 @@ pub enum GetWalletInfoError { pub async fn get_wallet_info( http_client: &dyn HttpClient, request: WalletInfoRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/wallet/info".to_string(); diff --git a/crates/kmd_client/src/apis/import_key.rs b/crates/kmd_client/src/apis/import_key.rs index 9192622e2..0984383d6 100644 --- a/crates/kmd_client/src/apis/import_key.rs +++ b/crates/kmd_client/src/apis/import_key.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostKeyImportResponse; +use crate::models::PostKeyImportResponse; // Import request body type if needed use crate::models::ImportKeyRequest; @@ -33,7 +33,7 @@ pub enum ImportKeyError { pub async fn import_key( http_client: &dyn HttpClient, request: ImportKeyRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/key/import".to_string(); diff --git a/crates/kmd_client/src/apis/import_multisig.rs b/crates/kmd_client/src/apis/import_multisig.rs index 841c84d9f..7eb86a13c 100644 --- a/crates/kmd_client/src/apis/import_multisig.rs +++ b/crates/kmd_client/src/apis/import_multisig.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostMultisigImportResponse; +use crate::models::PostMultisigImportResponse; // Import request body type if needed use crate::models::ImportMultisigRequest; @@ -33,7 +33,7 @@ pub enum ImportMultisigError { pub async fn import_multisig( http_client: &dyn HttpClient, request: ImportMultisigRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/multisig/import".to_string(); diff --git a/crates/kmd_client/src/apis/init_wallet_handle_token.rs b/crates/kmd_client/src/apis/init_wallet_handle_token.rs index 216cec455..1588ac583 100644 --- a/crates/kmd_client/src/apis/init_wallet_handle_token.rs +++ b/crates/kmd_client/src/apis/init_wallet_handle_token.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostWalletInitResponse; +use crate::models::PostWalletInitResponse; // Import request body type if needed use crate::models::InitWalletHandleTokenRequest; @@ -33,7 +33,7 @@ pub enum InitWalletHandleTokenError { pub async fn init_wallet_handle_token( http_client: &dyn HttpClient, request: InitWalletHandleTokenRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/wallet/init".to_string(); diff --git a/crates/kmd_client/src/apis/list_keys_in_wallet.rs b/crates/kmd_client/src/apis/list_keys_in_wallet.rs index e8adcb9d2..cde78aaa0 100644 --- a/crates/kmd_client/src/apis/list_keys_in_wallet.rs +++ b/crates/kmd_client/src/apis/list_keys_in_wallet.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostKeyListResponse; +use crate::models::PostKeyListResponse; // Import request body type if needed use crate::models::ListKeysRequest; @@ -33,7 +33,7 @@ pub enum ListKeysInWalletError { pub async fn list_keys_in_wallet( http_client: &dyn HttpClient, request: ListKeysRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/key/list".to_string(); diff --git a/crates/kmd_client/src/apis/list_multisg.rs b/crates/kmd_client/src/apis/list_multisg.rs index 58bcbea37..a1cbce03b 100644 --- a/crates/kmd_client/src/apis/list_multisg.rs +++ b/crates/kmd_client/src/apis/list_multisg.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostMultisigListResponse; +use crate::models::PostMultisigListResponse; // Import request body type if needed use crate::models::ListMultisigRequest; @@ -33,7 +33,7 @@ pub enum ListMultisgError { pub async fn list_multisg( http_client: &dyn HttpClient, request: ListMultisigRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/multisig/list".to_string(); diff --git a/crates/kmd_client/src/apis/list_wallets.rs b/crates/kmd_client/src/apis/list_wallets.rs index 19a16952c..1203dc484 100644 --- a/crates/kmd_client/src/apis/list_wallets.rs +++ b/crates/kmd_client/src/apis/list_wallets.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1GetWalletsResponse; +use crate::models::GetWalletsResponse; // Import request body type if needed use crate::models::ListWalletsRequest; @@ -30,7 +30,7 @@ pub enum ListWalletsError { } /// Lists all of the wallets that kmd is aware of. -pub async fn list_wallets(http_client: &dyn HttpClient) -> Result { +pub async fn list_wallets(http_client: &dyn HttpClient) -> Result { let path = "/v1/wallets".to_string(); let query_params: HashMap = HashMap::new(); diff --git a/crates/kmd_client/src/apis/release_wallet_handle_token.rs b/crates/kmd_client/src/apis/release_wallet_handle_token.rs index 5ef65462e..e40a2bead 100644 --- a/crates/kmd_client/src/apis/release_wallet_handle_token.rs +++ b/crates/kmd_client/src/apis/release_wallet_handle_token.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostWalletReleaseResponse; +use crate::models::PostWalletReleaseResponse; // Import request body type if needed use crate::models::ReleaseWalletHandleTokenRequest; @@ -33,7 +33,7 @@ pub enum ReleaseWalletHandleTokenError { pub async fn release_wallet_handle_token( http_client: &dyn HttpClient, request: ReleaseWalletHandleTokenRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/wallet/release".to_string(); diff --git a/crates/kmd_client/src/apis/rename_wallet.rs b/crates/kmd_client/src/apis/rename_wallet.rs index bdf152222..eda7ec6f0 100644 --- a/crates/kmd_client/src/apis/rename_wallet.rs +++ b/crates/kmd_client/src/apis/rename_wallet.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostWalletRenameResponse; +use crate::models::PostWalletRenameResponse; // Import request body type if needed use crate::models::RenameWalletRequest; @@ -33,7 +33,7 @@ pub enum RenameWalletError { pub async fn rename_wallet( http_client: &dyn HttpClient, request: RenameWalletRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/wallet/rename".to_string(); diff --git a/crates/kmd_client/src/apis/renew_wallet_handle_token.rs b/crates/kmd_client/src/apis/renew_wallet_handle_token.rs index 0fc6ee4e8..2568967ab 100644 --- a/crates/kmd_client/src/apis/renew_wallet_handle_token.rs +++ b/crates/kmd_client/src/apis/renew_wallet_handle_token.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostWalletRenewResponse; +use crate::models::PostWalletRenewResponse; // Import request body type if needed use crate::models::RenewWalletHandleTokenRequest; @@ -33,7 +33,7 @@ pub enum RenewWalletHandleTokenError { pub async fn renew_wallet_handle_token( http_client: &dyn HttpClient, request: RenewWalletHandleTokenRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/wallet/renew".to_string(); diff --git a/crates/kmd_client/src/apis/sign_multisig_program.rs b/crates/kmd_client/src/apis/sign_multisig_program.rs index 652221381..8e19814d9 100644 --- a/crates/kmd_client/src/apis/sign_multisig_program.rs +++ b/crates/kmd_client/src/apis/sign_multisig_program.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostMultisigProgramSignResponse; +use crate::models::PostMultisigProgramSignResponse; // Import request body type if needed use crate::models::SignProgramMultisigRequest; @@ -33,7 +33,7 @@ pub enum SignMultisigProgramError { pub async fn sign_multisig_program( http_client: &dyn HttpClient, request: SignProgramMultisigRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/multisig/signprogram".to_string(); diff --git a/crates/kmd_client/src/apis/sign_multisig_transaction.rs b/crates/kmd_client/src/apis/sign_multisig_transaction.rs index ab2910414..f421e8ae3 100644 --- a/crates/kmd_client/src/apis/sign_multisig_transaction.rs +++ b/crates/kmd_client/src/apis/sign_multisig_transaction.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostMultisigTransactionSignResponse; +use crate::models::PostMultisigTransactionSignResponse; // Import request body type if needed use crate::models::SignMultisigRequest; @@ -33,7 +33,7 @@ pub enum SignMultisigTransactionError { pub async fn sign_multisig_transaction( http_client: &dyn HttpClient, request: SignMultisigRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/multisig/sign".to_string(); diff --git a/crates/kmd_client/src/apis/sign_program.rs b/crates/kmd_client/src/apis/sign_program.rs index 153310d3f..61eba6b8e 100644 --- a/crates/kmd_client/src/apis/sign_program.rs +++ b/crates/kmd_client/src/apis/sign_program.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostProgramSignResponse; +use crate::models::PostProgramSignResponse; // Import request body type if needed use crate::models::SignProgramRequest; @@ -33,7 +33,7 @@ pub enum SignProgramError { pub async fn sign_program( http_client: &dyn HttpClient, request: SignProgramRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/program/sign".to_string(); diff --git a/crates/kmd_client/src/apis/sign_transaction.rs b/crates/kmd_client/src/apis/sign_transaction.rs index e678fce5f..5c5cb0e2f 100644 --- a/crates/kmd_client/src/apis/sign_transaction.rs +++ b/crates/kmd_client/src/apis/sign_transaction.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; use super::{ContentType, Error, KmdApiError}; // Import all custom types used by this endpoint -use crate::models::Apiv1PostTransactionSignResponse; +use crate::models::PostTransactionSignResponse; // Import request body type if needed use crate::models::SignTransactionRequest; @@ -33,7 +33,7 @@ pub enum SignTransactionError { pub async fn sign_transaction( http_client: &dyn HttpClient, request: SignTransactionRequest, -) -> Result { +) -> Result { let p_request = request; let path = "/v1/transaction/sign".to_string(); diff --git a/crates/kmd_client/src/models/apiv1_delete_key_response.rs b/crates/kmd_client/src/models/delete_key_response.rs similarity index 76% rename from crates/kmd_client/src/models/apiv1_delete_key_response.rs rename to crates/kmd_client/src/models/delete_key_response.rs index 11d7e6d0b..5d8a97343 100644 --- a/crates/kmd_client/src/models/apiv1_delete_key_response.rs +++ b/crates/kmd_client/src/models/delete_key_response.rs @@ -15,16 +15,16 @@ use serde::{Deserialize, Serialize}; /// friendly:DeleteKeyResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1DeleteKeyResponse { +pub struct DeleteKeyResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, } -impl Apiv1DeleteKeyResponse { - /// Default constructor for Apiv1DeleteKeyResponse - pub fn new() -> Apiv1DeleteKeyResponse { - Apiv1DeleteKeyResponse::default() +impl DeleteKeyResponse { + /// Default constructor for DeleteKeyResponse + pub fn new() -> DeleteKeyResponse { + DeleteKeyResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_delete_multisig_response.rs b/crates/kmd_client/src/models/delete_multisig_response.rs similarity index 75% rename from crates/kmd_client/src/models/apiv1_delete_multisig_response.rs rename to crates/kmd_client/src/models/delete_multisig_response.rs index 05956dc11..a9e22f69b 100644 --- a/crates/kmd_client/src/models/apiv1_delete_multisig_response.rs +++ b/crates/kmd_client/src/models/delete_multisig_response.rs @@ -15,16 +15,16 @@ use serde::{Deserialize, Serialize}; /// friendly:DeleteMultisigResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1DeleteMultisigResponse { +pub struct DeleteMultisigResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, } -impl Apiv1DeleteMultisigResponse { - /// Default constructor for Apiv1DeleteMultisigResponse - pub fn new() -> Apiv1DeleteMultisigResponse { - Apiv1DeleteMultisigResponse::default() +impl DeleteMultisigResponse { + /// Default constructor for DeleteMultisigResponse + pub fn new() -> DeleteMultisigResponse { + DeleteMultisigResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_get_wallets_response.rs b/crates/kmd_client/src/models/get_wallets_response.rs similarity index 72% rename from crates/kmd_client/src/models/apiv1_get_wallets_response.rs rename to crates/kmd_client/src/models/get_wallets_response.rs index 3dbce058f..87d1c39e9 100644 --- a/crates/kmd_client/src/models/apiv1_get_wallets_response.rs +++ b/crates/kmd_client/src/models/get_wallets_response.rs @@ -11,24 +11,24 @@ use crate::models; use serde::{Deserialize, Serialize}; -use crate::models::Apiv1Wallet; +use crate::models::Wallet; /// APIV1GETWalletsResponse is the response to `GET /v1/wallets` /// friendly:ListWalletsResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1GetWalletsResponse { +pub struct GetWalletsResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "wallets", skip_serializing_if = "Option::is_none")] - pub wallets: Option>, + pub wallets: Option>, } -impl Apiv1GetWalletsResponse { - /// Default constructor for Apiv1GetWalletsResponse - pub fn new() -> Apiv1GetWalletsResponse { - Apiv1GetWalletsResponse::default() +impl GetWalletsResponse { + /// Default constructor for GetWalletsResponse + pub fn new() -> GetWalletsResponse { + GetWalletsResponse::default() } } diff --git a/crates/kmd_client/src/models/mod.rs b/crates/kmd_client/src/models/mod.rs index e5b879a96..a3dc7160c 100644 --- a/crates/kmd_client/src/models/mod.rs +++ b/crates/kmd_client/src/models/mod.rs @@ -14,52 +14,52 @@ pub type UnknownJsonValue = String; #[cfg(not(feature = "ffi_uniffi"))] pub type UnknownJsonValue = serde_json::Value; -pub mod apiv1_delete_key_response; -pub use self::apiv1_delete_key_response::Apiv1DeleteKeyResponse; -pub mod apiv1_delete_multisig_response; -pub use self::apiv1_delete_multisig_response::Apiv1DeleteMultisigResponse; -pub mod apiv1_get_wallets_response; -pub use self::apiv1_get_wallets_response::Apiv1GetWalletsResponse; -pub mod apiv1_post_key_export_response; -pub use self::apiv1_post_key_export_response::Apiv1PostKeyExportResponse; -pub mod apiv1_post_key_import_response; -pub use self::apiv1_post_key_import_response::Apiv1PostKeyImportResponse; -pub mod apiv1_post_key_list_response; -pub use self::apiv1_post_key_list_response::Apiv1PostKeyListResponse; -pub mod apiv1_post_key_response; -pub use self::apiv1_post_key_response::Apiv1PostKeyResponse; -pub mod apiv1_post_master_key_export_response; -pub use self::apiv1_post_master_key_export_response::Apiv1PostMasterKeyExportResponse; -pub mod apiv1_post_multisig_export_response; -pub use self::apiv1_post_multisig_export_response::Apiv1PostMultisigExportResponse; -pub mod apiv1_post_multisig_import_response; -pub use self::apiv1_post_multisig_import_response::Apiv1PostMultisigImportResponse; -pub mod apiv1_post_multisig_list_response; -pub use self::apiv1_post_multisig_list_response::Apiv1PostMultisigListResponse; -pub mod apiv1_post_multisig_program_sign_response; -pub use self::apiv1_post_multisig_program_sign_response::Apiv1PostMultisigProgramSignResponse; -pub mod apiv1_post_multisig_transaction_sign_response; -pub use self::apiv1_post_multisig_transaction_sign_response::Apiv1PostMultisigTransactionSignResponse; -pub mod apiv1_post_program_sign_response; -pub use self::apiv1_post_program_sign_response::Apiv1PostProgramSignResponse; -pub mod apiv1_post_transaction_sign_response; -pub use self::apiv1_post_transaction_sign_response::Apiv1PostTransactionSignResponse; -pub mod apiv1_post_wallet_info_response; -pub use self::apiv1_post_wallet_info_response::Apiv1PostWalletInfoResponse; -pub mod apiv1_post_wallet_init_response; -pub use self::apiv1_post_wallet_init_response::Apiv1PostWalletInitResponse; -pub mod apiv1_post_wallet_release_response; -pub use self::apiv1_post_wallet_release_response::Apiv1PostWalletReleaseResponse; -pub mod apiv1_post_wallet_rename_response; -pub use self::apiv1_post_wallet_rename_response::Apiv1PostWalletRenameResponse; -pub mod apiv1_post_wallet_renew_response; -pub use self::apiv1_post_wallet_renew_response::Apiv1PostWalletRenewResponse; -pub mod apiv1_post_wallet_response; -pub use self::apiv1_post_wallet_response::Apiv1PostWalletResponse; -pub mod apiv1_wallet; -pub use self::apiv1_wallet::Apiv1Wallet; -pub mod apiv1_wallet_handle; -pub use self::apiv1_wallet_handle::Apiv1WalletHandle; +pub mod delete_key_response; +pub use self::delete_key_response::DeleteKeyResponse; +pub mod delete_multisig_response; +pub use self::delete_multisig_response::DeleteMultisigResponse; +pub mod get_wallets_response; +pub use self::get_wallets_response::GetWalletsResponse; +pub mod post_key_export_response; +pub use self::post_key_export_response::PostKeyExportResponse; +pub mod post_key_import_response; +pub use self::post_key_import_response::PostKeyImportResponse; +pub mod post_key_list_response; +pub use self::post_key_list_response::PostKeyListResponse; +pub mod post_key_response; +pub use self::post_key_response::PostKeyResponse; +pub mod post_master_key_export_response; +pub use self::post_master_key_export_response::PostMasterKeyExportResponse; +pub mod post_multisig_export_response; +pub use self::post_multisig_export_response::PostMultisigExportResponse; +pub mod post_multisig_import_response; +pub use self::post_multisig_import_response::PostMultisigImportResponse; +pub mod post_multisig_list_response; +pub use self::post_multisig_list_response::PostMultisigListResponse; +pub mod post_multisig_program_sign_response; +pub use self::post_multisig_program_sign_response::PostMultisigProgramSignResponse; +pub mod post_multisig_transaction_sign_response; +pub use self::post_multisig_transaction_sign_response::PostMultisigTransactionSignResponse; +pub mod post_program_sign_response; +pub use self::post_program_sign_response::PostProgramSignResponse; +pub mod post_transaction_sign_response; +pub use self::post_transaction_sign_response::PostTransactionSignResponse; +pub mod post_wallet_info_response; +pub use self::post_wallet_info_response::PostWalletInfoResponse; +pub mod post_wallet_init_response; +pub use self::post_wallet_init_response::PostWalletInitResponse; +pub mod post_wallet_release_response; +pub use self::post_wallet_release_response::PostWalletReleaseResponse; +pub mod post_wallet_rename_response; +pub use self::post_wallet_rename_response::PostWalletRenameResponse; +pub mod post_wallet_renew_response; +pub use self::post_wallet_renew_response::PostWalletRenewResponse; +pub mod post_wallet_response; +pub use self::post_wallet_response::PostWalletResponse; +pub mod wallet; +pub use self::wallet::Wallet; +pub mod wallet_handle; +pub use self::wallet_handle::WalletHandle; pub mod create_wallet_request; pub use self::create_wallet_request::CreateWalletRequest; pub mod delete_key_request; diff --git a/crates/kmd_client/src/models/apiv1_post_key_export_response.rs b/crates/kmd_client/src/models/post_key_export_response.rs similarity index 80% rename from crates/kmd_client/src/models/apiv1_post_key_export_response.rs rename to crates/kmd_client/src/models/post_key_export_response.rs index ed2ccbd6f..54ca1ee04 100644 --- a/crates/kmd_client/src/models/apiv1_post_key_export_response.rs +++ b/crates/kmd_client/src/models/post_key_export_response.rs @@ -17,7 +17,7 @@ use serde_with::{Bytes, serde_as}; #[serde_as] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostKeyExportResponse { +pub struct PostKeyExportResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -27,9 +27,9 @@ pub struct Apiv1PostKeyExportResponse { pub private_key: Option>, } -impl Apiv1PostKeyExportResponse { - /// Default constructor for Apiv1PostKeyExportResponse - pub fn new() -> Apiv1PostKeyExportResponse { - Apiv1PostKeyExportResponse::default() +impl PostKeyExportResponse { + /// Default constructor for PostKeyExportResponse + pub fn new() -> PostKeyExportResponse { + PostKeyExportResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_key_import_response.rs b/crates/kmd_client/src/models/post_key_import_response.rs similarity index 77% rename from crates/kmd_client/src/models/apiv1_post_key_import_response.rs rename to crates/kmd_client/src/models/post_key_import_response.rs index c997074f0..3801f7046 100644 --- a/crates/kmd_client/src/models/apiv1_post_key_import_response.rs +++ b/crates/kmd_client/src/models/post_key_import_response.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// friendly:ImportKeyResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostKeyImportResponse { +pub struct PostKeyImportResponse { #[serde(rename = "address", skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(rename = "error", skip_serializing_if = "Option::is_none")] @@ -24,9 +24,9 @@ pub struct Apiv1PostKeyImportResponse { pub message: Option, } -impl Apiv1PostKeyImportResponse { - /// Default constructor for Apiv1PostKeyImportResponse - pub fn new() -> Apiv1PostKeyImportResponse { - Apiv1PostKeyImportResponse::default() +impl PostKeyImportResponse { + /// Default constructor for PostKeyImportResponse + pub fn new() -> PostKeyImportResponse { + PostKeyImportResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_key_list_response.rs b/crates/kmd_client/src/models/post_key_list_response.rs similarity index 78% rename from crates/kmd_client/src/models/apiv1_post_key_list_response.rs rename to crates/kmd_client/src/models/post_key_list_response.rs index 34c7e2bed..d58e96202 100644 --- a/crates/kmd_client/src/models/apiv1_post_key_list_response.rs +++ b/crates/kmd_client/src/models/post_key_list_response.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// friendly:ListKeysResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostKeyListResponse { +pub struct PostKeyListResponse { #[serde(rename = "addresses", skip_serializing_if = "Option::is_none")] pub addresses: Option>, #[serde(rename = "error", skip_serializing_if = "Option::is_none")] @@ -24,9 +24,9 @@ pub struct Apiv1PostKeyListResponse { pub message: Option, } -impl Apiv1PostKeyListResponse { - /// Default constructor for Apiv1PostKeyListResponse - pub fn new() -> Apiv1PostKeyListResponse { - Apiv1PostKeyListResponse::default() +impl PostKeyListResponse { + /// Default constructor for PostKeyListResponse + pub fn new() -> PostKeyListResponse { + PostKeyListResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_key_response.rs b/crates/kmd_client/src/models/post_key_response.rs similarity index 80% rename from crates/kmd_client/src/models/apiv1_post_key_response.rs rename to crates/kmd_client/src/models/post_key_response.rs index 399919dba..89c02af27 100644 --- a/crates/kmd_client/src/models/apiv1_post_key_response.rs +++ b/crates/kmd_client/src/models/post_key_response.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// friendly:GenerateKeyResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostKeyResponse { +pub struct PostKeyResponse { #[serde(rename = "address", skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(rename = "error", skip_serializing_if = "Option::is_none")] @@ -24,9 +24,9 @@ pub struct Apiv1PostKeyResponse { pub message: Option, } -impl Apiv1PostKeyResponse { - /// Default constructor for Apiv1PostKeyResponse - pub fn new() -> Apiv1PostKeyResponse { - Apiv1PostKeyResponse::default() +impl PostKeyResponse { + /// Default constructor for PostKeyResponse + pub fn new() -> PostKeyResponse { + PostKeyResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs b/crates/kmd_client/src/models/post_master_key_export_response.rs similarity index 78% rename from crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs rename to crates/kmd_client/src/models/post_master_key_export_response.rs index feb093ffc..57195e854 100644 --- a/crates/kmd_client/src/models/apiv1_post_master_key_export_response.rs +++ b/crates/kmd_client/src/models/post_master_key_export_response.rs @@ -17,7 +17,7 @@ use crate::models::MasterDerivationKey; /// friendly:ExportMasterKeyResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostMasterKeyExportResponse { +pub struct PostMasterKeyExportResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde( @@ -29,9 +29,9 @@ pub struct Apiv1PostMasterKeyExportResponse { pub message: Option, } -impl Apiv1PostMasterKeyExportResponse { - /// Default constructor for Apiv1PostMasterKeyExportResponse - pub fn new() -> Apiv1PostMasterKeyExportResponse { - Apiv1PostMasterKeyExportResponse::default() +impl PostMasterKeyExportResponse { + /// Default constructor for PostMasterKeyExportResponse + pub fn new() -> PostMasterKeyExportResponse { + PostMasterKeyExportResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs b/crates/kmd_client/src/models/post_multisig_export_response.rs similarity index 81% rename from crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs rename to crates/kmd_client/src/models/post_multisig_export_response.rs index 264aeb2ed..433a5ff64 100644 --- a/crates/kmd_client/src/models/apiv1_post_multisig_export_response.rs +++ b/crates/kmd_client/src/models/post_multisig_export_response.rs @@ -17,7 +17,7 @@ use crate::models::PublicKey; /// friendly:ExportMultisigResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostMultisigExportResponse { +pub struct PostMultisigExportResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -30,9 +30,9 @@ pub struct Apiv1PostMultisigExportResponse { pub threshold: Option, } -impl Apiv1PostMultisigExportResponse { - /// Default constructor for Apiv1PostMultisigExportResponse - pub fn new() -> Apiv1PostMultisigExportResponse { - Apiv1PostMultisigExportResponse::default() +impl PostMultisigExportResponse { + /// Default constructor for PostMultisigExportResponse + pub fn new() -> PostMultisigExportResponse { + PostMultisigExportResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs b/crates/kmd_client/src/models/post_multisig_import_response.rs similarity index 76% rename from crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs rename to crates/kmd_client/src/models/post_multisig_import_response.rs index 423fe976d..bed2ea2f1 100644 --- a/crates/kmd_client/src/models/apiv1_post_multisig_import_response.rs +++ b/crates/kmd_client/src/models/post_multisig_import_response.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// friendly:ImportMultisigResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostMultisigImportResponse { +pub struct PostMultisigImportResponse { #[serde(rename = "address", skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(rename = "error", skip_serializing_if = "Option::is_none")] @@ -24,9 +24,9 @@ pub struct Apiv1PostMultisigImportResponse { pub message: Option, } -impl Apiv1PostMultisigImportResponse { - /// Default constructor for Apiv1PostMultisigImportResponse - pub fn new() -> Apiv1PostMultisigImportResponse { - Apiv1PostMultisigImportResponse::default() +impl PostMultisigImportResponse { + /// Default constructor for PostMultisigImportResponse + pub fn new() -> PostMultisigImportResponse { + PostMultisigImportResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs b/crates/kmd_client/src/models/post_multisig_list_response.rs similarity index 77% rename from crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs rename to crates/kmd_client/src/models/post_multisig_list_response.rs index aaae916e2..6f4b1dbf0 100644 --- a/crates/kmd_client/src/models/apiv1_post_multisig_list_response.rs +++ b/crates/kmd_client/src/models/post_multisig_list_response.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// friendly:ListMultisigResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostMultisigListResponse { +pub struct PostMultisigListResponse { #[serde(rename = "addresses", skip_serializing_if = "Option::is_none")] pub addresses: Option>, #[serde(rename = "error", skip_serializing_if = "Option::is_none")] @@ -24,9 +24,9 @@ pub struct Apiv1PostMultisigListResponse { pub message: Option, } -impl Apiv1PostMultisigListResponse { - /// Default constructor for Apiv1PostMultisigListResponse - pub fn new() -> Apiv1PostMultisigListResponse { - Apiv1PostMultisigListResponse::default() +impl PostMultisigListResponse { + /// Default constructor for PostMultisigListResponse + pub fn new() -> PostMultisigListResponse { + PostMultisigListResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs b/crates/kmd_client/src/models/post_multisig_program_sign_response.rs similarity index 77% rename from crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs rename to crates/kmd_client/src/models/post_multisig_program_sign_response.rs index 810ef1d08..75c40813d 100644 --- a/crates/kmd_client/src/models/apiv1_post_multisig_program_sign_response.rs +++ b/crates/kmd_client/src/models/post_multisig_program_sign_response.rs @@ -17,7 +17,7 @@ use serde_with::{Bytes, serde_as}; #[serde_as] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostMultisigProgramSignResponse { +pub struct PostMultisigProgramSignResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -27,9 +27,9 @@ pub struct Apiv1PostMultisigProgramSignResponse { pub multisig: Option>, } -impl Apiv1PostMultisigProgramSignResponse { - /// Default constructor for Apiv1PostMultisigProgramSignResponse - pub fn new() -> Apiv1PostMultisigProgramSignResponse { - Apiv1PostMultisigProgramSignResponse::default() +impl PostMultisigProgramSignResponse { + /// Default constructor for PostMultisigProgramSignResponse + pub fn new() -> PostMultisigProgramSignResponse { + PostMultisigProgramSignResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs b/crates/kmd_client/src/models/post_multisig_transaction_sign_response.rs similarity index 75% rename from crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs rename to crates/kmd_client/src/models/post_multisig_transaction_sign_response.rs index dc261ce44..10e986bc9 100644 --- a/crates/kmd_client/src/models/apiv1_post_multisig_transaction_sign_response.rs +++ b/crates/kmd_client/src/models/post_multisig_transaction_sign_response.rs @@ -17,7 +17,7 @@ use serde_with::{Bytes, serde_as}; #[serde_as] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostMultisigTransactionSignResponse { +pub struct PostMultisigTransactionSignResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -27,9 +27,9 @@ pub struct Apiv1PostMultisigTransactionSignResponse { pub multisig: Option>, } -impl Apiv1PostMultisigTransactionSignResponse { - /// Default constructor for Apiv1PostMultisigTransactionSignResponse - pub fn new() -> Apiv1PostMultisigTransactionSignResponse { - Apiv1PostMultisigTransactionSignResponse::default() +impl PostMultisigTransactionSignResponse { + /// Default constructor for PostMultisigTransactionSignResponse + pub fn new() -> PostMultisigTransactionSignResponse { + PostMultisigTransactionSignResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_program_sign_response.rs b/crates/kmd_client/src/models/post_program_sign_response.rs similarity index 79% rename from crates/kmd_client/src/models/apiv1_post_program_sign_response.rs rename to crates/kmd_client/src/models/post_program_sign_response.rs index f4411003a..378111f0f 100644 --- a/crates/kmd_client/src/models/apiv1_post_program_sign_response.rs +++ b/crates/kmd_client/src/models/post_program_sign_response.rs @@ -17,7 +17,7 @@ use serde_with::{Bytes, serde_as}; #[serde_as] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostProgramSignResponse { +pub struct PostProgramSignResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -27,9 +27,9 @@ pub struct Apiv1PostProgramSignResponse { pub sig: Option>, } -impl Apiv1PostProgramSignResponse { - /// Default constructor for Apiv1PostProgramSignResponse - pub fn new() -> Apiv1PostProgramSignResponse { - Apiv1PostProgramSignResponse::default() +impl PostProgramSignResponse { + /// Default constructor for PostProgramSignResponse + pub fn new() -> PostProgramSignResponse { + PostProgramSignResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs b/crates/kmd_client/src/models/post_transaction_sign_response.rs similarity index 78% rename from crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs rename to crates/kmd_client/src/models/post_transaction_sign_response.rs index c459551d0..3c82583fe 100644 --- a/crates/kmd_client/src/models/apiv1_post_transaction_sign_response.rs +++ b/crates/kmd_client/src/models/post_transaction_sign_response.rs @@ -17,7 +17,7 @@ use serde_with::{Bytes, serde_as}; #[serde_as] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostTransactionSignResponse { +pub struct PostTransactionSignResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -27,9 +27,9 @@ pub struct Apiv1PostTransactionSignResponse { pub signed_transaction: Option>, } -impl Apiv1PostTransactionSignResponse { - /// Default constructor for Apiv1PostTransactionSignResponse - pub fn new() -> Apiv1PostTransactionSignResponse { - Apiv1PostTransactionSignResponse::default() +impl PostTransactionSignResponse { + /// Default constructor for PostTransactionSignResponse + pub fn new() -> PostTransactionSignResponse { + PostTransactionSignResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs b/crates/kmd_client/src/models/post_wallet_info_response.rs similarity index 70% rename from crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs rename to crates/kmd_client/src/models/post_wallet_info_response.rs index c782b4ec1..601eb7e7f 100644 --- a/crates/kmd_client/src/models/apiv1_post_wallet_info_response.rs +++ b/crates/kmd_client/src/models/post_wallet_info_response.rs @@ -11,24 +11,24 @@ use crate::models; use serde::{Deserialize, Serialize}; -use crate::models::Apiv1WalletHandle; +use crate::models::WalletHandle; /// APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` /// friendly:WalletInfoResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostWalletInfoResponse { +pub struct PostWalletInfoResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "wallet_handle", skip_serializing_if = "Option::is_none")] - pub wallet_handle: Option, + pub wallet_handle: Option, } -impl Apiv1PostWalletInfoResponse { - /// Default constructor for Apiv1PostWalletInfoResponse - pub fn new() -> Apiv1PostWalletInfoResponse { - Apiv1PostWalletInfoResponse::default() +impl PostWalletInfoResponse { + /// Default constructor for PostWalletInfoResponse + pub fn new() -> PostWalletInfoResponse { + PostWalletInfoResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs b/crates/kmd_client/src/models/post_wallet_init_response.rs similarity index 78% rename from crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs rename to crates/kmd_client/src/models/post_wallet_init_response.rs index 9121da280..f07526a2d 100644 --- a/crates/kmd_client/src/models/apiv1_post_wallet_init_response.rs +++ b/crates/kmd_client/src/models/post_wallet_init_response.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// friendly:InitWalletHandleTokenResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostWalletInitResponse { +pub struct PostWalletInitResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] @@ -27,9 +27,9 @@ pub struct Apiv1PostWalletInitResponse { pub wallet_handle_token: Option, } -impl Apiv1PostWalletInitResponse { - /// Default constructor for Apiv1PostWalletInitResponse - pub fn new() -> Apiv1PostWalletInitResponse { - Apiv1PostWalletInitResponse::default() +impl PostWalletInitResponse { + /// Default constructor for PostWalletInitResponse + pub fn new() -> PostWalletInitResponse { + PostWalletInitResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs b/crates/kmd_client/src/models/post_wallet_release_response.rs similarity index 74% rename from crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs rename to crates/kmd_client/src/models/post_wallet_release_response.rs index 96ec79980..38868f826 100644 --- a/crates/kmd_client/src/models/apiv1_post_wallet_release_response.rs +++ b/crates/kmd_client/src/models/post_wallet_release_response.rs @@ -15,16 +15,16 @@ use serde::{Deserialize, Serialize}; /// friendly:ReleaseWalletHandleTokenResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostWalletReleaseResponse { +pub struct PostWalletReleaseResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, } -impl Apiv1PostWalletReleaseResponse { - /// Default constructor for Apiv1PostWalletReleaseResponse - pub fn new() -> Apiv1PostWalletReleaseResponse { - Apiv1PostWalletReleaseResponse::default() +impl PostWalletReleaseResponse { + /// Default constructor for PostWalletReleaseResponse + pub fn new() -> PostWalletReleaseResponse { + PostWalletReleaseResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs b/crates/kmd_client/src/models/post_wallet_rename_response.rs similarity index 71% rename from crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs rename to crates/kmd_client/src/models/post_wallet_rename_response.rs index 96d757dc2..b8637949a 100644 --- a/crates/kmd_client/src/models/apiv1_post_wallet_rename_response.rs +++ b/crates/kmd_client/src/models/post_wallet_rename_response.rs @@ -11,24 +11,24 @@ use crate::models; use serde::{Deserialize, Serialize}; -use crate::models::Apiv1Wallet; +use crate::models::Wallet; /// APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` /// friendly:RenameWalletResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostWalletRenameResponse { +pub struct PostWalletRenameResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "wallet", skip_serializing_if = "Option::is_none")] - pub wallet: Option, + pub wallet: Option, } -impl Apiv1PostWalletRenameResponse { - /// Default constructor for Apiv1PostWalletRenameResponse - pub fn new() -> Apiv1PostWalletRenameResponse { - Apiv1PostWalletRenameResponse::default() +impl PostWalletRenameResponse { + /// Default constructor for PostWalletRenameResponse + pub fn new() -> PostWalletRenameResponse { + PostWalletRenameResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs b/crates/kmd_client/src/models/post_wallet_renew_response.rs similarity index 70% rename from crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs rename to crates/kmd_client/src/models/post_wallet_renew_response.rs index 75058eaf0..4129342ae 100644 --- a/crates/kmd_client/src/models/apiv1_post_wallet_renew_response.rs +++ b/crates/kmd_client/src/models/post_wallet_renew_response.rs @@ -11,24 +11,24 @@ use crate::models; use serde::{Deserialize, Serialize}; -use crate::models::Apiv1WalletHandle; +use crate::models::WalletHandle; /// APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` /// friendly:RenewWalletHandleTokenResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostWalletRenewResponse { +pub struct PostWalletRenewResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "wallet_handle", skip_serializing_if = "Option::is_none")] - pub wallet_handle: Option, + pub wallet_handle: Option, } -impl Apiv1PostWalletRenewResponse { - /// Default constructor for Apiv1PostWalletRenewResponse - pub fn new() -> Apiv1PostWalletRenewResponse { - Apiv1PostWalletRenewResponse::default() +impl PostWalletRenewResponse { + /// Default constructor for PostWalletRenewResponse + pub fn new() -> PostWalletRenewResponse { + PostWalletRenewResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_post_wallet_response.rs b/crates/kmd_client/src/models/post_wallet_response.rs similarity index 73% rename from crates/kmd_client/src/models/apiv1_post_wallet_response.rs rename to crates/kmd_client/src/models/post_wallet_response.rs index 7cf8fa7b9..56207344d 100644 --- a/crates/kmd_client/src/models/apiv1_post_wallet_response.rs +++ b/crates/kmd_client/src/models/post_wallet_response.rs @@ -11,24 +11,24 @@ use crate::models; use serde::{Deserialize, Serialize}; -use crate::models::Apiv1Wallet; +use crate::models::Wallet; /// APIV1POSTWalletResponse is the response to `POST /v1/wallet` /// friendly:CreateWalletResponse #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1PostWalletResponse { +pub struct PostWalletResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "wallet", skip_serializing_if = "Option::is_none")] - pub wallet: Option, + pub wallet: Option, } -impl Apiv1PostWalletResponse { - /// Default constructor for Apiv1PostWalletResponse - pub fn new() -> Apiv1PostWalletResponse { - Apiv1PostWalletResponse::default() +impl PostWalletResponse { + /// Default constructor for PostWalletResponse + pub fn new() -> PostWalletResponse { + PostWalletResponse::default() } } diff --git a/crates/kmd_client/src/models/apiv1_wallet.rs b/crates/kmd_client/src/models/wallet.rs similarity index 88% rename from crates/kmd_client/src/models/apiv1_wallet.rs rename to crates/kmd_client/src/models/wallet.rs index 8375ec4b4..098761d74 100644 --- a/crates/kmd_client/src/models/apiv1_wallet.rs +++ b/crates/kmd_client/src/models/wallet.rs @@ -16,7 +16,7 @@ use crate::models::TxType; /// APIV1Wallet is the API's representation of a wallet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1Wallet { +pub struct Wallet { #[serde(rename = "driver_name", skip_serializing_if = "Option::is_none")] pub driver_name: Option, #[serde(rename = "driver_version", skip_serializing_if = "Option::is_none")] @@ -31,9 +31,9 @@ pub struct Apiv1Wallet { pub supported_txs: Option>, } -impl Apiv1Wallet { - /// Default constructor for Apiv1Wallet - pub fn new() -> Apiv1Wallet { - Apiv1Wallet::default() +impl Wallet { + /// Default constructor for Wallet + pub fn new() -> Wallet { + Wallet::default() } } diff --git a/crates/kmd_client/src/models/apiv1_wallet_handle.rs b/crates/kmd_client/src/models/wallet_handle.rs similarity index 73% rename from crates/kmd_client/src/models/apiv1_wallet_handle.rs rename to crates/kmd_client/src/models/wallet_handle.rs index aac6a8336..eee2a664a 100644 --- a/crates/kmd_client/src/models/apiv1_wallet_handle.rs +++ b/crates/kmd_client/src/models/wallet_handle.rs @@ -11,22 +11,22 @@ use crate::models; use serde::{Deserialize, Serialize}; -use crate::models::Apiv1Wallet; +use crate::models::Wallet; /// APIV1WalletHandle includes the wallet the handle corresponds to /// and the number of number of seconds to expiration #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "ffi_uniffi", derive(uniffi::Record))] -pub struct Apiv1WalletHandle { +pub struct WalletHandle { #[serde(rename = "expires_seconds", skip_serializing_if = "Option::is_none")] pub expires_seconds: Option, #[serde(rename = "wallet", skip_serializing_if = "Option::is_none")] - pub wallet: Option, + pub wallet: Option, } -impl Apiv1WalletHandle { - /// Default constructor for Apiv1WalletHandle - pub fn new() -> Apiv1WalletHandle { - Apiv1WalletHandle::default() +impl WalletHandle { + /// Default constructor for WalletHandle + pub fn new() -> WalletHandle { + WalletHandle::default() } } diff --git a/packages/typescript/kmd_client/src/apis/api.service.ts b/packages/typescript/kmd_client/src/apis/api.service.ts index 76b4b8ccd..2ad036218 100644 --- a/packages/typescript/kmd_client/src/apis/api.service.ts +++ b/packages/typescript/kmd_client/src/apis/api.service.ts @@ -1,37 +1,37 @@ import type { BaseHttpRequest, ApiRequestOptions } from '../core/base-http-request' import { AlgorandSerializer } from '../core/model-runtime' import type { - Apiv1DeleteKeyResponse, - Apiv1DeleteMultisigResponse, - Apiv1GetWalletsResponse, - Apiv1PostKeyExportResponse, - Apiv1PostKeyImportResponse, - Apiv1PostKeyListResponse, - Apiv1PostKeyResponse, - Apiv1PostMasterKeyExportResponse, - Apiv1PostMultisigExportResponse, - Apiv1PostMultisigImportResponse, - Apiv1PostMultisigListResponse, - Apiv1PostMultisigProgramSignResponse, - Apiv1PostMultisigTransactionSignResponse, - Apiv1PostProgramSignResponse, - Apiv1PostTransactionSignResponse, - Apiv1PostWalletInfoResponse, - Apiv1PostWalletInitResponse, - Apiv1PostWalletReleaseResponse, - Apiv1PostWalletRenameResponse, - Apiv1PostWalletRenewResponse, - Apiv1PostWalletResponse, CreateWalletRequest, + DeleteKeyResponse, + DeleteMultisigResponse, ExportKeyRequest, ExportMasterKeyRequest, ExportMultisigRequest, GenerateKeyRequest, + GetWalletsResponse, ImportKeyRequest, ImportMultisigRequest, InitWalletHandleTokenRequest, ListKeysRequest, ListMultisigRequest, + PostKeyExportResponse, + PostKeyImportResponse, + PostKeyListResponse, + PostKeyResponse, + PostMasterKeyExportResponse, + PostMultisigExportResponse, + PostMultisigImportResponse, + PostMultisigListResponse, + PostMultisigProgramSignResponse, + PostMultisigTransactionSignResponse, + PostProgramSignResponse, + PostTransactionSignResponse, + PostWalletInfoResponse, + PostWalletInitResponse, + PostWalletReleaseResponse, + PostWalletRenameResponse, + PostWalletRenewResponse, + PostWalletResponse, ReleaseWalletHandleTokenRequest, RenameWalletRequest, RenewWalletHandleTokenRequest, @@ -43,37 +43,37 @@ import type { WalletInfoRequest, } from '../models/index' import { - Apiv1DeleteKeyResponseMeta, - Apiv1DeleteMultisigResponseMeta, - Apiv1GetWalletsResponseMeta, - Apiv1PostKeyExportResponseMeta, - Apiv1PostKeyImportResponseMeta, - Apiv1PostKeyListResponseMeta, - Apiv1PostKeyResponseMeta, - Apiv1PostMasterKeyExportResponseMeta, - Apiv1PostMultisigExportResponseMeta, - Apiv1PostMultisigImportResponseMeta, - Apiv1PostMultisigListResponseMeta, - Apiv1PostMultisigProgramSignResponseMeta, - Apiv1PostMultisigTransactionSignResponseMeta, - Apiv1PostProgramSignResponseMeta, - Apiv1PostTransactionSignResponseMeta, - Apiv1PostWalletInfoResponseMeta, - Apiv1PostWalletInitResponseMeta, - Apiv1PostWalletReleaseResponseMeta, - Apiv1PostWalletRenameResponseMeta, - Apiv1PostWalletRenewResponseMeta, - Apiv1PostWalletResponseMeta, CreateWalletRequestMeta, + DeleteKeyResponseMeta, + DeleteMultisigResponseMeta, ExportKeyRequestMeta, ExportMasterKeyRequestMeta, ExportMultisigRequestMeta, GenerateKeyRequestMeta, + GetWalletsResponseMeta, ImportKeyRequestMeta, ImportMultisigRequestMeta, InitWalletHandleTokenRequestMeta, ListKeysRequestMeta, ListMultisigRequestMeta, + PostKeyExportResponseMeta, + PostKeyImportResponseMeta, + PostKeyListResponseMeta, + PostKeyResponseMeta, + PostMasterKeyExportResponseMeta, + PostMultisigExportResponseMeta, + PostMultisigImportResponseMeta, + PostMultisigListResponseMeta, + PostMultisigProgramSignResponseMeta, + PostMultisigTransactionSignResponseMeta, + PostProgramSignResponseMeta, + PostTransactionSignResponseMeta, + PostWalletInfoResponseMeta, + PostWalletInitResponseMeta, + PostWalletReleaseResponseMeta, + PostWalletRenameResponseMeta, + PostWalletRenewResponseMeta, + PostWalletResponseMeta, ReleaseWalletHandleTokenRequestMeta, RenameWalletRequestMeta, RenewWalletHandleTokenRequestMeta, @@ -91,7 +91,7 @@ export class KmdApi { /** * Create a new wallet (collection of keys) with the given parameters. */ - async createWallet(params?: { body: CreateWalletRequest }, requestOptions?: ApiRequestOptions): Promise { + async createWallet(params?: { body: CreateWalletRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -113,17 +113,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostWalletResponseMeta + const responseMeta = PostWalletResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostWalletResponse + return payload as PostWalletResponse } /** * Deletes the key with the passed public key from the wallet. */ - async deleteKey(requestOptions?: ApiRequestOptions): Promise { + async deleteKey(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -139,17 +139,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1DeleteKeyResponseMeta + const responseMeta = DeleteKeyResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1DeleteKeyResponse + return payload as DeleteKeyResponse } /** * Deletes multisig preimage information for the passed address from the wallet. */ - async deleteMultisig(requestOptions?: ApiRequestOptions): Promise { + async deleteMultisig(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -165,17 +165,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1DeleteMultisigResponseMeta + const responseMeta = DeleteMultisigResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1DeleteMultisigResponse + return payload as DeleteMultisigResponse } /** * Export the secret key associated with the passed public key. */ - async exportKey(params?: { body: ExportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async exportKey(params?: { body: ExportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -197,11 +197,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostKeyExportResponseMeta + const responseMeta = PostKeyExportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostKeyExportResponse + return payload as PostKeyExportResponse } /** @@ -210,7 +210,7 @@ export class KmdApi { async exportMasterKey( params?: { body: ExportMasterKeyRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -232,20 +232,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostMasterKeyExportResponseMeta + const responseMeta = PostMasterKeyExportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostMasterKeyExportResponse + return payload as PostMasterKeyExportResponse } /** * Given a multisig address whose preimage this wallet stores, returns the information used to generate the address, including public keys, threshold, and multisig version. */ - async exportMultisig( - params?: { body: ExportMultisigRequest }, - requestOptions?: ApiRequestOptions, - ): Promise { + async exportMultisig(params?: { body: ExportMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -267,17 +264,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostMultisigExportResponseMeta + const responseMeta = PostMultisigExportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostMultisigExportResponse + return payload as PostMultisigExportResponse } /** * Generates the next key in the deterministic key sequence (as determined by the master derivation key) and adds it to the wallet, returning the public key. */ - async generateKey(params?: { body: GenerateKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async generateKey(params?: { body: GenerateKeyRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -299,11 +296,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostKeyResponseMeta + const responseMeta = PostKeyResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostKeyResponse + return payload as PostKeyResponse } async getVersion(requestOptions?: ApiRequestOptions): Promise { @@ -332,7 +329,7 @@ export class KmdApi { /** * Returns information about the wallet associated with the passed wallet handle token. Additionally returns expiration information about the token itself. */ - async getWalletInfo(params?: { body: WalletInfoRequest }, requestOptions?: ApiRequestOptions): Promise { + async getWalletInfo(params?: { body: WalletInfoRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -354,17 +351,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostWalletInfoResponseMeta + const responseMeta = PostWalletInfoResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostWalletInfoResponse + return payload as PostWalletInfoResponse } /** * Import an externally generated key into the wallet. Note that if you wish to back up the imported key, you must do so by backing up the entire wallet database, because imported keys were not derived from the wallet's master derivation key. */ - async importKey(params?: { body: ImportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { + async importKey(params?: { body: ImportKeyRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -386,20 +383,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostKeyImportResponseMeta + const responseMeta = PostKeyImportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostKeyImportResponse + return payload as PostKeyImportResponse } /** * Generates a multisig account from the passed public keys array and multisig metadata, and stores all of this in the wallet. */ - async importMultisig( - params?: { body: ImportMultisigRequest }, - requestOptions?: ApiRequestOptions, - ): Promise { + async importMultisig(params?: { body: ImportMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -421,11 +415,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostMultisigImportResponseMeta + const responseMeta = PostMultisigImportResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostMultisigImportResponse + return payload as PostMultisigImportResponse } /** @@ -434,7 +428,7 @@ export class KmdApi { async initWalletHandleToken( params?: { body: InitWalletHandleTokenRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -456,17 +450,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostWalletInitResponseMeta + const responseMeta = PostWalletInitResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostWalletInitResponse + return payload as PostWalletInitResponse } /** * Lists all of the public keys in this wallet. All of them have a stored private key. */ - async listKeysInWallet(params?: { body: ListKeysRequest }, requestOptions?: ApiRequestOptions): Promise { + async listKeysInWallet(params?: { body: ListKeysRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -488,17 +482,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostKeyListResponseMeta + const responseMeta = PostKeyListResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostKeyListResponse + return payload as PostKeyListResponse } /** * Lists all of the multisig accounts whose preimages this wallet stores */ - async listMultisg(params?: { body: ListMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { + async listMultisg(params?: { body: ListMultisigRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -520,17 +514,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostMultisigListResponseMeta + const responseMeta = PostMultisigListResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostMultisigListResponse + return payload as PostMultisigListResponse } /** * Lists all of the wallets that kmd is aware of. */ - async listWallets(requestOptions?: ApiRequestOptions): Promise { + async listWallets(requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -546,11 +540,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1GetWalletsResponseMeta + const responseMeta = GetWalletsResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1GetWalletsResponse + return payload as GetWalletsResponse } /** @@ -559,7 +553,7 @@ export class KmdApi { async releaseWalletHandleToken( params?: { body: ReleaseWalletHandleTokenRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -581,17 +575,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostWalletReleaseResponseMeta + const responseMeta = PostWalletReleaseResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostWalletReleaseResponse + return payload as PostWalletReleaseResponse } /** * Rename the underlying wallet to something else */ - async renameWallet(params?: { body: RenameWalletRequest }, requestOptions?: ApiRequestOptions): Promise { + async renameWallet(params?: { body: RenameWalletRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -613,11 +607,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostWalletRenameResponseMeta + const responseMeta = PostWalletRenameResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostWalletRenameResponse + return payload as PostWalletRenameResponse } /** @@ -626,7 +620,7 @@ export class KmdApi { async renewWalletHandleToken( params?: { body: RenewWalletHandleTokenRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -648,11 +642,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostWalletRenewResponseMeta + const responseMeta = PostWalletRenewResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostWalletRenewResponse + return payload as PostWalletRenewResponse } /** @@ -661,7 +655,7 @@ export class KmdApi { async signMultisigProgram( params?: { body: SignProgramMultisigRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -683,11 +677,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostMultisigProgramSignResponseMeta + const responseMeta = PostMultisigProgramSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostMultisigProgramSignResponse + return payload as PostMultisigProgramSignResponse } /** @@ -696,7 +690,7 @@ export class KmdApi { async signMultisigTransaction( params?: { body: SignMultisigRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -718,17 +712,17 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostMultisigTransactionSignResponseMeta + const responseMeta = PostMultisigTransactionSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostMultisigTransactionSignResponse + return payload as PostMultisigTransactionSignResponse } /** * Signs the passed program with a key from the wallet, determined by the account named in the request. */ - async signProgram(params?: { body: SignProgramRequest }, requestOptions?: ApiRequestOptions): Promise { + async signProgram(params?: { body: SignProgramRequest }, requestOptions?: ApiRequestOptions): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -750,11 +744,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostProgramSignResponseMeta + const responseMeta = PostProgramSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostProgramSignResponse + return payload as PostProgramSignResponse } /** @@ -763,7 +757,7 @@ export class KmdApi { async signTransaction( params?: { body: SignTransactionRequest }, requestOptions?: ApiRequestOptions, - ): Promise { + ): Promise { const headers: Record = {} const responseFormat: 'json' | 'msgpack' = 'json' headers['Accept'] = responseFormat === 'json' ? 'application/json' : 'application/msgpack' @@ -785,11 +779,11 @@ export class KmdApi { ...(requestOptions ?? {}), }) - const responseMeta = Apiv1PostTransactionSignResponseMeta + const responseMeta = PostTransactionSignResponseMeta if (responseMeta) { return AlgorandSerializer.decode(payload, responseMeta, responseFormat) } - return payload as Apiv1PostTransactionSignResponse + return payload as PostTransactionSignResponse } /** diff --git a/packages/typescript/kmd_client/src/models/apiv1-delete-key-response.ts b/packages/typescript/kmd_client/src/models/delete-key-response.ts similarity index 79% rename from packages/typescript/kmd_client/src/models/apiv1-delete-key-response.ts rename to packages/typescript/kmd_client/src/models/delete-key-response.ts index 85e0c3096..f9efc7841 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-delete-key-response.ts +++ b/packages/typescript/kmd_client/src/models/delete-key-response.ts @@ -4,13 +4,13 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1DELETEKeyResponse is the response to `DELETE /v1/key` * friendly:DeleteKeyResponse */ -export type Apiv1DeleteKeyResponse = { +export type DeleteKeyResponse = { error?: boolean message?: string } -export const Apiv1DeleteKeyResponseMeta: ModelMetadata = { - name: 'Apiv1DeleteKeyResponse', +export const DeleteKeyResponseMeta: ModelMetadata = { + name: 'DeleteKeyResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-delete-multisig-response.ts b/packages/typescript/kmd_client/src/models/delete-multisig-response.ts similarity index 78% rename from packages/typescript/kmd_client/src/models/apiv1-delete-multisig-response.ts rename to packages/typescript/kmd_client/src/models/delete-multisig-response.ts index fdedf003c..251964cda 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-delete-multisig-response.ts +++ b/packages/typescript/kmd_client/src/models/delete-multisig-response.ts @@ -4,13 +4,13 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1DELETEMultisigResponse is the response to POST /v1/multisig/delete` * friendly:DeleteMultisigResponse */ -export type Apiv1DeleteMultisigResponse = { +export type DeleteMultisigResponse = { error?: boolean message?: string } -export const Apiv1DeleteMultisigResponseMeta: ModelMetadata = { - name: 'Apiv1DeleteMultisigResponse', +export const DeleteMultisigResponseMeta: ModelMetadata = { + name: 'DeleteMultisigResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-get-wallets-response.ts b/packages/typescript/kmd_client/src/models/get-wallets-response.ts similarity index 70% rename from packages/typescript/kmd_client/src/models/apiv1-get-wallets-response.ts rename to packages/typescript/kmd_client/src/models/get-wallets-response.ts index 3bfaa03d9..b25dcb260 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-get-wallets-response.ts +++ b/packages/typescript/kmd_client/src/models/get-wallets-response.ts @@ -1,19 +1,19 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { Apiv1Wallet } from './apiv1-wallet' -import { Apiv1WalletMeta } from './apiv1-wallet' +import type { Wallet } from './wallet' +import { WalletMeta } from './wallet' /** * APIV1GETWalletsResponse is the response to `GET /v1/wallets` * friendly:ListWalletsResponse */ -export type Apiv1GetWalletsResponse = { +export type GetWalletsResponse = { error?: boolean message?: string - wallets?: Apiv1Wallet[] + wallets?: Wallet[] } -export const Apiv1GetWalletsResponseMeta: ModelMetadata = { - name: 'Apiv1GetWalletsResponse', +export const GetWalletsResponseMeta: ModelMetadata = { + name: 'GetWalletsResponse', kind: 'object', fields: [ { @@ -35,7 +35,7 @@ export const Apiv1GetWalletsResponseMeta: ModelMetadata = { wireKey: 'wallets', optional: true, nullable: false, - type: { kind: 'array', item: { kind: 'model', meta: () => Apiv1WalletMeta } }, + type: { kind: 'array', item: { kind: 'model', meta: () => WalletMeta } }, }, ], } diff --git a/packages/typescript/kmd_client/src/models/index.ts b/packages/typescript/kmd_client/src/models/index.ts index f0884c9d8..2fb35b4c0 100644 --- a/packages/typescript/kmd_client/src/models/index.ts +++ b/packages/typescript/kmd_client/src/models/index.ts @@ -1,49 +1,49 @@ -export type { Apiv1DeleteKeyResponse } from './apiv1-delete-key-response' -export { Apiv1DeleteKeyResponseMeta } from './apiv1-delete-key-response' -export type { Apiv1DeleteMultisigResponse } from './apiv1-delete-multisig-response' -export { Apiv1DeleteMultisigResponseMeta } from './apiv1-delete-multisig-response' -export type { Apiv1GetWalletsResponse } from './apiv1-get-wallets-response' -export { Apiv1GetWalletsResponseMeta } from './apiv1-get-wallets-response' -export type { Apiv1PostKeyExportResponse } from './apiv1-post-key-export-response' -export { Apiv1PostKeyExportResponseMeta } from './apiv1-post-key-export-response' -export type { Apiv1PostKeyImportResponse } from './apiv1-post-key-import-response' -export { Apiv1PostKeyImportResponseMeta } from './apiv1-post-key-import-response' -export type { Apiv1PostKeyListResponse } from './apiv1-post-key-list-response' -export { Apiv1PostKeyListResponseMeta } from './apiv1-post-key-list-response' -export type { Apiv1PostKeyResponse } from './apiv1-post-key-response' -export { Apiv1PostKeyResponseMeta } from './apiv1-post-key-response' -export type { Apiv1PostMasterKeyExportResponse } from './apiv1-post-master-key-export-response' -export { Apiv1PostMasterKeyExportResponseMeta } from './apiv1-post-master-key-export-response' -export type { Apiv1PostMultisigExportResponse } from './apiv1-post-multisig-export-response' -export { Apiv1PostMultisigExportResponseMeta } from './apiv1-post-multisig-export-response' -export type { Apiv1PostMultisigImportResponse } from './apiv1-post-multisig-import-response' -export { Apiv1PostMultisigImportResponseMeta } from './apiv1-post-multisig-import-response' -export type { Apiv1PostMultisigListResponse } from './apiv1-post-multisig-list-response' -export { Apiv1PostMultisigListResponseMeta } from './apiv1-post-multisig-list-response' -export type { Apiv1PostMultisigProgramSignResponse } from './apiv1-post-multisig-program-sign-response' -export { Apiv1PostMultisigProgramSignResponseMeta } from './apiv1-post-multisig-program-sign-response' -export type { Apiv1PostMultisigTransactionSignResponse } from './apiv1-post-multisig-transaction-sign-response' -export { Apiv1PostMultisigTransactionSignResponseMeta } from './apiv1-post-multisig-transaction-sign-response' -export type { Apiv1PostProgramSignResponse } from './apiv1-post-program-sign-response' -export { Apiv1PostProgramSignResponseMeta } from './apiv1-post-program-sign-response' -export type { Apiv1PostTransactionSignResponse } from './apiv1-post-transaction-sign-response' -export { Apiv1PostTransactionSignResponseMeta } from './apiv1-post-transaction-sign-response' -export type { Apiv1PostWalletInfoResponse } from './apiv1-post-wallet-info-response' -export { Apiv1PostWalletInfoResponseMeta } from './apiv1-post-wallet-info-response' -export type { Apiv1PostWalletInitResponse } from './apiv1-post-wallet-init-response' -export { Apiv1PostWalletInitResponseMeta } from './apiv1-post-wallet-init-response' -export type { Apiv1PostWalletReleaseResponse } from './apiv1-post-wallet-release-response' -export { Apiv1PostWalletReleaseResponseMeta } from './apiv1-post-wallet-release-response' -export type { Apiv1PostWalletRenameResponse } from './apiv1-post-wallet-rename-response' -export { Apiv1PostWalletRenameResponseMeta } from './apiv1-post-wallet-rename-response' -export type { Apiv1PostWalletRenewResponse } from './apiv1-post-wallet-renew-response' -export { Apiv1PostWalletRenewResponseMeta } from './apiv1-post-wallet-renew-response' -export type { Apiv1PostWalletResponse } from './apiv1-post-wallet-response' -export { Apiv1PostWalletResponseMeta } from './apiv1-post-wallet-response' -export type { Apiv1Wallet } from './apiv1-wallet' -export { Apiv1WalletMeta } from './apiv1-wallet' -export type { Apiv1WalletHandle } from './apiv1-wallet-handle' -export { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' +export type { DeleteKeyResponse } from './delete-key-response' +export { DeleteKeyResponseMeta } from './delete-key-response' +export type { DeleteMultisigResponse } from './delete-multisig-response' +export { DeleteMultisigResponseMeta } from './delete-multisig-response' +export type { GetWalletsResponse } from './get-wallets-response' +export { GetWalletsResponseMeta } from './get-wallets-response' +export type { PostKeyExportResponse } from './post-key-export-response' +export { PostKeyExportResponseMeta } from './post-key-export-response' +export type { PostKeyImportResponse } from './post-key-import-response' +export { PostKeyImportResponseMeta } from './post-key-import-response' +export type { PostKeyListResponse } from './post-key-list-response' +export { PostKeyListResponseMeta } from './post-key-list-response' +export type { PostKeyResponse } from './post-key-response' +export { PostKeyResponseMeta } from './post-key-response' +export type { PostMasterKeyExportResponse } from './post-master-key-export-response' +export { PostMasterKeyExportResponseMeta } from './post-master-key-export-response' +export type { PostMultisigExportResponse } from './post-multisig-export-response' +export { PostMultisigExportResponseMeta } from './post-multisig-export-response' +export type { PostMultisigImportResponse } from './post-multisig-import-response' +export { PostMultisigImportResponseMeta } from './post-multisig-import-response' +export type { PostMultisigListResponse } from './post-multisig-list-response' +export { PostMultisigListResponseMeta } from './post-multisig-list-response' +export type { PostMultisigProgramSignResponse } from './post-multisig-program-sign-response' +export { PostMultisigProgramSignResponseMeta } from './post-multisig-program-sign-response' +export type { PostMultisigTransactionSignResponse } from './post-multisig-transaction-sign-response' +export { PostMultisigTransactionSignResponseMeta } from './post-multisig-transaction-sign-response' +export type { PostProgramSignResponse } from './post-program-sign-response' +export { PostProgramSignResponseMeta } from './post-program-sign-response' +export type { PostTransactionSignResponse } from './post-transaction-sign-response' +export { PostTransactionSignResponseMeta } from './post-transaction-sign-response' +export type { PostWalletInfoResponse } from './post-wallet-info-response' +export { PostWalletInfoResponseMeta } from './post-wallet-info-response' +export type { PostWalletInitResponse } from './post-wallet-init-response' +export { PostWalletInitResponseMeta } from './post-wallet-init-response' +export type { PostWalletReleaseResponse } from './post-wallet-release-response' +export { PostWalletReleaseResponseMeta } from './post-wallet-release-response' +export type { PostWalletRenameResponse } from './post-wallet-rename-response' +export { PostWalletRenameResponseMeta } from './post-wallet-rename-response' +export type { PostWalletRenewResponse } from './post-wallet-renew-response' +export { PostWalletRenewResponseMeta } from './post-wallet-renew-response' +export type { PostWalletResponse } from './post-wallet-response' +export { PostWalletResponseMeta } from './post-wallet-response' +export type { Wallet } from './wallet' +export { WalletMeta } from './wallet' +export type { WalletHandle } from './wallet-handle' +export { WalletHandleMeta } from './wallet-handle' export type { CreateWalletRequest } from './create-wallet-request' export { CreateWalletRequestMeta } from './create-wallet-request' export type { DeleteKeyRequest } from './delete-key-request' diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-key-export-response.ts b/packages/typescript/kmd_client/src/models/post-key-export-response.ts similarity index 83% rename from packages/typescript/kmd_client/src/models/apiv1-post-key-export-response.ts rename to packages/typescript/kmd_client/src/models/post-key-export-response.ts index 1e0106cc5..92f5c0a50 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-key-export-response.ts +++ b/packages/typescript/kmd_client/src/models/post-key-export-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyExportResponse is the response to `POST /v1/key/export` * friendly:ExportKeyResponse */ -export type Apiv1PostKeyExportResponse = { +export type PostKeyExportResponse = { error?: boolean message?: string privateKey?: Uint8Array } -export const Apiv1PostKeyExportResponseMeta: ModelMetadata = { - name: 'Apiv1PostKeyExportResponse', +export const PostKeyExportResponseMeta: ModelMetadata = { + name: 'PostKeyExportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-key-import-response.ts b/packages/typescript/kmd_client/src/models/post-key-import-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-post-key-import-response.ts rename to packages/typescript/kmd_client/src/models/post-key-import-response.ts index fc76defb4..3f016d071 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-key-import-response.ts +++ b/packages/typescript/kmd_client/src/models/post-key-import-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyImportResponse is the response to `POST /v1/key/import` * friendly:ImportKeyResponse */ -export type Apiv1PostKeyImportResponse = { +export type PostKeyImportResponse = { address?: string error?: boolean message?: string } -export const Apiv1PostKeyImportResponseMeta: ModelMetadata = { - name: 'Apiv1PostKeyImportResponse', +export const PostKeyImportResponseMeta: ModelMetadata = { + name: 'PostKeyImportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-key-list-response.ts b/packages/typescript/kmd_client/src/models/post-key-list-response.ts similarity index 83% rename from packages/typescript/kmd_client/src/models/apiv1-post-key-list-response.ts rename to packages/typescript/kmd_client/src/models/post-key-list-response.ts index b72547065..5eff3cc88 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-key-list-response.ts +++ b/packages/typescript/kmd_client/src/models/post-key-list-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyListResponse is the response to `POST /v1/key/list` * friendly:ListKeysResponse */ -export type Apiv1PostKeyListResponse = { +export type PostKeyListResponse = { addresses?: string[] error?: boolean message?: string } -export const Apiv1PostKeyListResponseMeta: ModelMetadata = { - name: 'Apiv1PostKeyListResponse', +export const PostKeyListResponseMeta: ModelMetadata = { + name: 'PostKeyListResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-key-response.ts b/packages/typescript/kmd_client/src/models/post-key-response.ts similarity index 84% rename from packages/typescript/kmd_client/src/models/apiv1-post-key-response.ts rename to packages/typescript/kmd_client/src/models/post-key-response.ts index 1c8abcd45..fd15b9e0f 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-key-response.ts +++ b/packages/typescript/kmd_client/src/models/post-key-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTKeyResponse is the response to `POST /v1/key` * friendly:GenerateKeyResponse */ -export type Apiv1PostKeyResponse = { +export type PostKeyResponse = { address?: string error?: boolean message?: string } -export const Apiv1PostKeyResponseMeta: ModelMetadata = { - name: 'Apiv1PostKeyResponse', +export const PostKeyResponseMeta: ModelMetadata = { + name: 'PostKeyResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-master-key-export-response.ts b/packages/typescript/kmd_client/src/models/post-master-key-export-response.ts similarity index 84% rename from packages/typescript/kmd_client/src/models/apiv1-post-master-key-export-response.ts rename to packages/typescript/kmd_client/src/models/post-master-key-export-response.ts index 98d70250d..dbf367278 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-master-key-export-response.ts +++ b/packages/typescript/kmd_client/src/models/post-master-key-export-response.ts @@ -6,14 +6,14 @@ import { MasterDerivationKeyMeta } from './master-derivation-key' * APIV1POSTMasterKeyExportResponse is the response to `POST /v1/master-key/export` * friendly:ExportMasterKeyResponse */ -export type Apiv1PostMasterKeyExportResponse = { +export type PostMasterKeyExportResponse = { error?: boolean masterDerivationKey?: MasterDerivationKey message?: string } -export const Apiv1PostMasterKeyExportResponseMeta: ModelMetadata = { - name: 'Apiv1PostMasterKeyExportResponse', +export const PostMasterKeyExportResponseMeta: ModelMetadata = { + name: 'PostMasterKeyExportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-export-response.ts b/packages/typescript/kmd_client/src/models/post-multisig-export-response.ts similarity index 88% rename from packages/typescript/kmd_client/src/models/apiv1-post-multisig-export-response.ts rename to packages/typescript/kmd_client/src/models/post-multisig-export-response.ts index be52c8631..3410d2676 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-export-response.ts +++ b/packages/typescript/kmd_client/src/models/post-multisig-export-response.ts @@ -6,7 +6,7 @@ import { PublicKeyMeta } from './public-key' * APIV1POSTMultisigExportResponse is the response to `POST /v1/multisig/export` * friendly:ExportMultisigResponse */ -export type Apiv1PostMultisigExportResponse = { +export type PostMultisigExportResponse = { error?: boolean message?: string multisigVersion?: bigint @@ -14,8 +14,8 @@ export type Apiv1PostMultisigExportResponse = { threshold?: bigint } -export const Apiv1PostMultisigExportResponseMeta: ModelMetadata = { - name: 'Apiv1PostMultisigExportResponse', +export const PostMultisigExportResponseMeta: ModelMetadata = { + name: 'PostMultisigExportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-import-response.ts b/packages/typescript/kmd_client/src/models/post-multisig-import-response.ts similarity index 81% rename from packages/typescript/kmd_client/src/models/apiv1-post-multisig-import-response.ts rename to packages/typescript/kmd_client/src/models/post-multisig-import-response.ts index 06cb4a434..ccae67e35 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-import-response.ts +++ b/packages/typescript/kmd_client/src/models/post-multisig-import-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigImportResponse is the response to `POST /v1/multisig/import` * friendly:ImportMultisigResponse */ -export type Apiv1PostMultisigImportResponse = { +export type PostMultisigImportResponse = { address?: string error?: boolean message?: string } -export const Apiv1PostMultisigImportResponseMeta: ModelMetadata = { - name: 'Apiv1PostMultisigImportResponse', +export const PostMultisigImportResponseMeta: ModelMetadata = { + name: 'PostMultisigImportResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-list-response.ts b/packages/typescript/kmd_client/src/models/post-multisig-list-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-post-multisig-list-response.ts rename to packages/typescript/kmd_client/src/models/post-multisig-list-response.ts index 2d8a70a79..10fd45601 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-list-response.ts +++ b/packages/typescript/kmd_client/src/models/post-multisig-list-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigListResponse is the response to `POST /v1/multisig/list` * friendly:ListMultisigResponse */ -export type Apiv1PostMultisigListResponse = { +export type PostMultisigListResponse = { addresses?: string[] error?: boolean message?: string } -export const Apiv1PostMultisigListResponseMeta: ModelMetadata = { - name: 'Apiv1PostMultisigListResponse', +export const PostMultisigListResponseMeta: ModelMetadata = { + name: 'PostMultisigListResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-program-sign-response.ts b/packages/typescript/kmd_client/src/models/post-multisig-program-sign-response.ts similarity index 80% rename from packages/typescript/kmd_client/src/models/apiv1-post-multisig-program-sign-response.ts rename to packages/typescript/kmd_client/src/models/post-multisig-program-sign-response.ts index 8043f9709..e6820f008 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-program-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/post-multisig-program-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigProgramSignResponse is the response to `POST /v1/multisig/signdata` * friendly:SignProgramMultisigResponse */ -export type Apiv1PostMultisigProgramSignResponse = { +export type PostMultisigProgramSignResponse = { error?: boolean message?: string multisig?: Uint8Array } -export const Apiv1PostMultisigProgramSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostMultisigProgramSignResponse', +export const PostMultisigProgramSignResponseMeta: ModelMetadata = { + name: 'PostMultisigProgramSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-transaction-sign-response.ts b/packages/typescript/kmd_client/src/models/post-multisig-transaction-sign-response.ts similarity index 79% rename from packages/typescript/kmd_client/src/models/apiv1-post-multisig-transaction-sign-response.ts rename to packages/typescript/kmd_client/src/models/post-multisig-transaction-sign-response.ts index 94fa9449c..309d94a75 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-multisig-transaction-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/post-multisig-transaction-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTMultisigTransactionSignResponse is the response to `POST /v1/multisig/sign` * friendly:SignMultisigResponse */ -export type Apiv1PostMultisigTransactionSignResponse = { +export type PostMultisigTransactionSignResponse = { error?: boolean message?: string multisig?: Uint8Array } -export const Apiv1PostMultisigTransactionSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostMultisigTransactionSignResponse', +export const PostMultisigTransactionSignResponseMeta: ModelMetadata = { + name: 'PostMultisigTransactionSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-program-sign-response.ts b/packages/typescript/kmd_client/src/models/post-program-sign-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-post-program-sign-response.ts rename to packages/typescript/kmd_client/src/models/post-program-sign-response.ts index c0bab5f8a..d1dfac6b0 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-program-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/post-program-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTProgramSignResponse is the response to `POST /v1/data/sign` * friendly:SignProgramResponse */ -export type Apiv1PostProgramSignResponse = { +export type PostProgramSignResponse = { error?: boolean message?: string sig?: Uint8Array } -export const Apiv1PostProgramSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostProgramSignResponse', +export const PostProgramSignResponseMeta: ModelMetadata = { + name: 'PostProgramSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-transaction-sign-response.ts b/packages/typescript/kmd_client/src/models/post-transaction-sign-response.ts similarity index 82% rename from packages/typescript/kmd_client/src/models/apiv1-post-transaction-sign-response.ts rename to packages/typescript/kmd_client/src/models/post-transaction-sign-response.ts index 6d192b89d..6f698149a 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-transaction-sign-response.ts +++ b/packages/typescript/kmd_client/src/models/post-transaction-sign-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTTransactionSignResponse is the response to `POST /v1/transaction/sign` * friendly:SignTransactionResponse */ -export type Apiv1PostTransactionSignResponse = { +export type PostTransactionSignResponse = { error?: boolean message?: string signedTransaction?: Uint8Array } -export const Apiv1PostTransactionSignResponseMeta: ModelMetadata = { - name: 'Apiv1PostTransactionSignResponse', +export const PostTransactionSignResponseMeta: ModelMetadata = { + name: 'PostTransactionSignResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-info-response.ts b/packages/typescript/kmd_client/src/models/post-wallet-info-response.ts similarity index 63% rename from packages/typescript/kmd_client/src/models/apiv1-post-wallet-info-response.ts rename to packages/typescript/kmd_client/src/models/post-wallet-info-response.ts index 4cd23b996..6c30f05ab 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-info-response.ts +++ b/packages/typescript/kmd_client/src/models/post-wallet-info-response.ts @@ -1,19 +1,19 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { Apiv1WalletHandle } from './apiv1-wallet-handle' -import { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' +import type { WalletHandle } from './wallet-handle' +import { WalletHandleMeta } from './wallet-handle' /** * APIV1POSTWalletInfoResponse is the response to `POST /v1/wallet/info` * friendly:WalletInfoResponse */ -export type Apiv1PostWalletInfoResponse = { +export type PostWalletInfoResponse = { error?: boolean message?: string - walletHandle?: Apiv1WalletHandle + walletHandle?: WalletHandle } -export const Apiv1PostWalletInfoResponseMeta: ModelMetadata = { - name: 'Apiv1PostWalletInfoResponse', +export const PostWalletInfoResponseMeta: ModelMetadata = { + name: 'PostWalletInfoResponse', kind: 'object', fields: [ { @@ -35,7 +35,7 @@ export const Apiv1PostWalletInfoResponseMeta: ModelMetadata = { wireKey: 'wallet_handle', optional: true, nullable: false, - type: { kind: 'model', meta: () => Apiv1WalletHandleMeta }, + type: { kind: 'model', meta: () => WalletHandleMeta }, }, ], } diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-init-response.ts b/packages/typescript/kmd_client/src/models/post-wallet-init-response.ts similarity index 83% rename from packages/typescript/kmd_client/src/models/apiv1-post-wallet-init-response.ts rename to packages/typescript/kmd_client/src/models/post-wallet-init-response.ts index 98360013f..5b24fb77a 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-init-response.ts +++ b/packages/typescript/kmd_client/src/models/post-wallet-init-response.ts @@ -4,14 +4,14 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTWalletInitResponse is the response to `POST /v1/wallet/init` * friendly:InitWalletHandleTokenResponse */ -export type Apiv1PostWalletInitResponse = { +export type PostWalletInitResponse = { error?: boolean message?: string walletHandleToken?: string } -export const Apiv1PostWalletInitResponseMeta: ModelMetadata = { - name: 'Apiv1PostWalletInitResponse', +export const PostWalletInitResponseMeta: ModelMetadata = { + name: 'PostWalletInitResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-release-response.ts b/packages/typescript/kmd_client/src/models/post-wallet-release-response.ts similarity index 77% rename from packages/typescript/kmd_client/src/models/apiv1-post-wallet-release-response.ts rename to packages/typescript/kmd_client/src/models/post-wallet-release-response.ts index 4c911c982..f79795876 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-release-response.ts +++ b/packages/typescript/kmd_client/src/models/post-wallet-release-response.ts @@ -4,13 +4,13 @@ import type { ModelMetadata } from '../core/model-runtime' * APIV1POSTWalletReleaseResponse is the response to `POST /v1/wallet/release` * friendly:ReleaseWalletHandleTokenResponse */ -export type Apiv1PostWalletReleaseResponse = { +export type PostWalletReleaseResponse = { error?: boolean message?: string } -export const Apiv1PostWalletReleaseResponseMeta: ModelMetadata = { - name: 'Apiv1PostWalletReleaseResponse', +export const PostWalletReleaseResponseMeta: ModelMetadata = { + name: 'PostWalletReleaseResponse', kind: 'object', fields: [ { diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-rename-response.ts b/packages/typescript/kmd_client/src/models/post-wallet-rename-response.ts similarity index 65% rename from packages/typescript/kmd_client/src/models/apiv1-post-wallet-rename-response.ts rename to packages/typescript/kmd_client/src/models/post-wallet-rename-response.ts index a2cdfd8b9..43ab2bf73 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-rename-response.ts +++ b/packages/typescript/kmd_client/src/models/post-wallet-rename-response.ts @@ -1,19 +1,19 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { Apiv1Wallet } from './apiv1-wallet' -import { Apiv1WalletMeta } from './apiv1-wallet' +import type { Wallet } from './wallet' +import { WalletMeta } from './wallet' /** * APIV1POSTWalletRenameResponse is the response to `POST /v1/wallet/rename` * friendly:RenameWalletResponse */ -export type Apiv1PostWalletRenameResponse = { +export type PostWalletRenameResponse = { error?: boolean message?: string - wallet?: Apiv1Wallet + wallet?: Wallet } -export const Apiv1PostWalletRenameResponseMeta: ModelMetadata = { - name: 'Apiv1PostWalletRenameResponse', +export const PostWalletRenameResponseMeta: ModelMetadata = { + name: 'PostWalletRenameResponse', kind: 'object', fields: [ { @@ -35,7 +35,7 @@ export const Apiv1PostWalletRenameResponseMeta: ModelMetadata = { wireKey: 'wallet', optional: true, nullable: false, - type: { kind: 'model', meta: () => Apiv1WalletMeta }, + type: { kind: 'model', meta: () => WalletMeta }, }, ], } diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-renew-response.ts b/packages/typescript/kmd_client/src/models/post-wallet-renew-response.ts similarity index 63% rename from packages/typescript/kmd_client/src/models/apiv1-post-wallet-renew-response.ts rename to packages/typescript/kmd_client/src/models/post-wallet-renew-response.ts index 0d9b35281..078061e4f 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-renew-response.ts +++ b/packages/typescript/kmd_client/src/models/post-wallet-renew-response.ts @@ -1,19 +1,19 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { Apiv1WalletHandle } from './apiv1-wallet-handle' -import { Apiv1WalletHandleMeta } from './apiv1-wallet-handle' +import type { WalletHandle } from './wallet-handle' +import { WalletHandleMeta } from './wallet-handle' /** * APIV1POSTWalletRenewResponse is the response to `POST /v1/wallet/renew` * friendly:RenewWalletHandleTokenResponse */ -export type Apiv1PostWalletRenewResponse = { +export type PostWalletRenewResponse = { error?: boolean message?: string - walletHandle?: Apiv1WalletHandle + walletHandle?: WalletHandle } -export const Apiv1PostWalletRenewResponseMeta: ModelMetadata = { - name: 'Apiv1PostWalletRenewResponse', +export const PostWalletRenewResponseMeta: ModelMetadata = { + name: 'PostWalletRenewResponse', kind: 'object', fields: [ { @@ -35,7 +35,7 @@ export const Apiv1PostWalletRenewResponseMeta: ModelMetadata = { wireKey: 'wallet_handle', optional: true, nullable: false, - type: { kind: 'model', meta: () => Apiv1WalletHandleMeta }, + type: { kind: 'model', meta: () => WalletHandleMeta }, }, ], } diff --git a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-response.ts b/packages/typescript/kmd_client/src/models/post-wallet-response.ts similarity index 66% rename from packages/typescript/kmd_client/src/models/apiv1-post-wallet-response.ts rename to packages/typescript/kmd_client/src/models/post-wallet-response.ts index 1fdcf046e..cb91a8836 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-post-wallet-response.ts +++ b/packages/typescript/kmd_client/src/models/post-wallet-response.ts @@ -1,19 +1,19 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { Apiv1Wallet } from './apiv1-wallet' -import { Apiv1WalletMeta } from './apiv1-wallet' +import type { Wallet } from './wallet' +import { WalletMeta } from './wallet' /** * APIV1POSTWalletResponse is the response to `POST /v1/wallet` * friendly:CreateWalletResponse */ -export type Apiv1PostWalletResponse = { +export type PostWalletResponse = { error?: boolean message?: string - wallet?: Apiv1Wallet + wallet?: Wallet } -export const Apiv1PostWalletResponseMeta: ModelMetadata = { - name: 'Apiv1PostWalletResponse', +export const PostWalletResponseMeta: ModelMetadata = { + name: 'PostWalletResponse', kind: 'object', fields: [ { @@ -35,7 +35,7 @@ export const Apiv1PostWalletResponseMeta: ModelMetadata = { wireKey: 'wallet', optional: true, nullable: false, - type: { kind: 'model', meta: () => Apiv1WalletMeta }, + type: { kind: 'model', meta: () => WalletMeta }, }, ], } diff --git a/packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts b/packages/typescript/kmd_client/src/models/wallet-handle.ts similarity index 63% rename from packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts rename to packages/typescript/kmd_client/src/models/wallet-handle.ts index 7b77162ef..25474663f 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-wallet-handle.ts +++ b/packages/typescript/kmd_client/src/models/wallet-handle.ts @@ -1,18 +1,18 @@ import type { ModelMetadata } from '../core/model-runtime' -import type { Apiv1Wallet } from './apiv1-wallet' -import { Apiv1WalletMeta } from './apiv1-wallet' +import type { Wallet } from './wallet' +import { WalletMeta } from './wallet' /** * APIV1WalletHandle includes the wallet the handle corresponds to * and the number of number of seconds to expiration */ -export type Apiv1WalletHandle = { +export type WalletHandle = { expiresSeconds?: bigint - wallet?: Apiv1Wallet + wallet?: Wallet } -export const Apiv1WalletHandleMeta: ModelMetadata = { - name: 'Apiv1WalletHandle', +export const WalletHandleMeta: ModelMetadata = { + name: 'WalletHandle', kind: 'object', fields: [ { @@ -27,7 +27,7 @@ export const Apiv1WalletHandleMeta: ModelMetadata = { wireKey: 'wallet', optional: true, nullable: false, - type: { kind: 'model', meta: () => Apiv1WalletMeta }, + type: { kind: 'model', meta: () => WalletMeta }, }, ], } diff --git a/packages/typescript/kmd_client/src/models/apiv1-wallet.ts b/packages/typescript/kmd_client/src/models/wallet.ts similarity index 92% rename from packages/typescript/kmd_client/src/models/apiv1-wallet.ts rename to packages/typescript/kmd_client/src/models/wallet.ts index a674ca339..563163734 100644 --- a/packages/typescript/kmd_client/src/models/apiv1-wallet.ts +++ b/packages/typescript/kmd_client/src/models/wallet.ts @@ -5,7 +5,7 @@ import { TxTypeMeta } from './tx-type' /** * APIV1Wallet is the API's representation of a wallet */ -export type Apiv1Wallet = { +export type Wallet = { driverName?: string driverVersion?: bigint id?: string @@ -14,8 +14,8 @@ export type Apiv1Wallet = { supportedTxs?: TxType[] } -export const Apiv1WalletMeta: ModelMetadata = { - name: 'Apiv1Wallet', +export const WalletMeta: ModelMetadata = { + name: 'Wallet', kind: 'object', fields: [ {