From 8313d32336b2476e77cb378cee60305d2b996919 Mon Sep 17 00:00:00 2001 From: maayan Date: Fri, 4 Aug 2023 00:32:20 -0400 Subject: [PATCH] clean up, leave only structure --- ecosystem/typescript/sdk_v2/LICENSE | 201 --------------- ecosystem/typescript/sdk_v2/SPEC.md | 223 ---------------- .../sdk_v2/src/account/account_address.ts | 103 -------- .../sdk_v2/src/account/aptos_account.ts | 191 -------------- .../typescript/sdk_v2/src/account/index.ts | 2 - .../typescript/sdk_v2/src/api/account.ts | 129 ---------- ecosystem/typescript/sdk_v2/src/api/aptos.ts | 9 - .../typescript/sdk_v2/src/api/aptos_config.ts | 7 - .../typescript/sdk_v2/src/api/general.ts | 82 ------ ecosystem/typescript/sdk_v2/src/api/index.ts | 2 - ecosystem/typescript/sdk_v2/src/bcs/consts.ts | 12 - .../typescript/sdk_v2/src/bcs/deserializer.ts | 188 -------------- ecosystem/typescript/sdk_v2/src/bcs/helper.ts | 112 -------- .../typescript/sdk_v2/src/bcs/identifier.ts | 18 -- ecosystem/typescript/sdk_v2/src/bcs/index.ts | 8 - .../typescript/sdk_v2/src/bcs/serializer.ts | 240 ------------------ ecosystem/typescript/sdk_v2/src/bcs/types.ts | 13 - .../typescript/sdk_v2/src/client/types.ts | 6 +- .../sdk_v2/src/crypto/authentication_key.ts | 73 ------ .../sdk_v2/src/crypto/authenticator.ts | 153 ----------- .../typescript/sdk_v2/src/crypto/ed25519.ts | 49 ---- .../typescript/sdk_v2/src/crypto/index.ts | 4 - .../sdk_v2/src/crypto/multi_ed25519.ts | 158 ------------ ecosystem/typescript/sdk_v2/src/index.ts | 4 - .../typescript/sdk_v2/src/internal/account.ts | 106 -------- .../typescript/sdk_v2/src/internal/general.ts | 68 ----- .../sdk_v2/src/internal/transaction.ts | 13 - .../sdk_v2/src/types/generated/index.ts | 101 -------- .../src/types/generated/models/AccountData.ts | 17 -- .../generated/models/AccountSignature.ts | 17 -- .../AccountSignature_Ed25519Signature.ts | 10 - .../AccountSignature_MultiEd25519Signature.ts | 10 - .../src/types/generated/models/Address.ts | 14 - .../src/types/generated/models/AptosError.ts | 22 -- .../types/generated/models/AptosErrorCode.ts | 31 --- .../src/types/generated/models/Block.ts | 26 -- .../models/BlockMetadataTransaction.ts | 55 ---- .../generated/models/DecodedTableData.ts | 26 -- .../types/generated/models/DeleteModule.ts | 19 -- .../types/generated/models/DeleteResource.ts | 19 -- .../types/generated/models/DeleteTableItem.ts | 17 -- .../generated/models/DeletedTableData.ts | 18 -- .../types/generated/models/DirectWriteSet.ts | 12 - .../generated/models/Ed25519Signature.ts | 13 - .../models/EncodeSubmissionRequest.ts | 24 -- .../types/generated/models/EntryFunctionId.ts | 13 - .../generated/models/EntryFunctionPayload.ts | 22 -- .../src/types/generated/models/Event.ts | 21 -- .../src/types/generated/models/EventGuid.ts | 12 - .../types/generated/models/GasEstimation.ts | 22 -- .../types/generated/models/GenesisPayload.ts | 11 - .../models/GenesisPayload_WriteSetPayload.ts | 10 - .../generated/models/GenesisTransaction.ts | 42 --- .../src/types/generated/models/HashValue.ts | 5 - .../generated/models/HealthCheckSuccess.ts | 11 - .../types/generated/models/HexEncodedBytes.ts | 12 - .../generated/models/IdentifierWrapper.ts | 5 - .../types/generated/models/IndexResponse.ts | 30 --- .../generated/models/ModuleBundlePayload.ts | 10 - .../src/types/generated/models/MoveAbility.ts | 5 - .../types/generated/models/MoveFunction.ts | 37 --- .../models/MoveFunctionGenericTypeParam.ts | 16 -- .../models/MoveFunctionVisibility.ts | 12 - .../src/types/generated/models/MoveModule.ts | 30 --- .../generated/models/MoveModuleBytecode.ts | 15 -- .../types/generated/models/MoveModuleId.ts | 15 -- .../types/generated/models/MoveResource.ts | 15 -- .../generated/models/MoveScriptBytecode.ts | 15 -- .../src/types/generated/models/MoveStruct.ts | 32 --- .../types/generated/models/MoveStructField.ts | 15 -- .../models/MoveStructGenericTypeParam.ts | 16 -- .../types/generated/models/MoveStructTag.ts | 24 -- .../types/generated/models/MoveStructValue.ts | 49 ---- .../src/types/generated/models/MoveType.ts | 34 --- .../src/types/generated/models/MoveValue.ts | 16 -- .../generated/models/MultiAgentSignature.ts | 24 -- .../generated/models/MultiEd25519Signature.ts | 27 -- .../types/generated/models/MultisigPayload.ts | 16 -- .../models/MultisigTransactionPayload.ts | 8 - .../generated/models/PendingTransaction.ts | 24 -- .../generated/models/RawTableItemRequest.ts | 13 - .../src/types/generated/models/RoleType.ts | 8 - .../types/generated/models/ScriptPayload.ts | 22 -- .../types/generated/models/ScriptWriteSet.ts | 12 - .../models/StateCheckpointTransaction.ts | 34 --- .../types/generated/models/StateKeyWrapper.ts | 9 - .../models/SubmitTransactionRequest.ts | 24 -- .../generated/models/TableItemRequest.ts | 18 -- .../src/types/generated/models/Transaction.ts | 15 -- .../generated/models/TransactionPayload.ts | 14 - ...TransactionPayload_EntryFunctionPayload.ts | 10 - .../TransactionPayload_ModuleBundlePayload.ts | 10 - .../TransactionPayload_MultisigPayload.ts | 10 - .../TransactionPayload_ScriptPayload.ts | 10 - .../generated/models/TransactionSignature.ts | 13 - .../TransactionSignature_Ed25519Signature.ts | 10 - ...ransactionSignature_MultiAgentSignature.ts | 10 - ...nsactionSignature_MultiEd25519Signature.ts | 10 - .../Transaction_BlockMetadataTransaction.ts | 10 - .../models/Transaction_GenesisTransaction.ts | 10 - .../models/Transaction_PendingTransaction.ts | 10 - .../Transaction_StateCheckpointTransaction.ts | 10 - .../models/Transaction_UserTransaction.ts | 10 - ...ransactionsBatchSingleSubmissionFailure.ts | 17 -- .../TransactionsBatchSubmissionResult.ts | 18 -- .../sdk_v2/src/types/generated/models/U128.ts | 12 - .../sdk_v2/src/types/generated/models/U256.ts | 12 - .../sdk_v2/src/types/generated/models/U64.ts | 12 - .../types/generated/models/UserTransaction.ts | 49 ---- .../types/generated/models/VersionedEvent.ts | 22 -- .../src/types/generated/models/ViewRequest.ts | 22 -- .../src/types/generated/models/WriteModule.ts | 19 -- .../types/generated/models/WriteResource.ts | 19 -- .../src/types/generated/models/WriteSet.ts | 12 - .../types/generated/models/WriteSetChange.ts | 16 -- .../models/WriteSetChange_DeleteModule.ts | 10 - .../models/WriteSetChange_DeleteResource.ts | 10 - .../models/WriteSetChange_DeleteTableItem.ts | 10 - .../models/WriteSetChange_WriteModule.ts | 10 - .../models/WriteSetChange_WriteResource.ts | 10 - .../models/WriteSetChange_WriteTableItem.ts | 10 - .../types/generated/models/WriteSetPayload.ts | 13 - .../models/WriteSet_DirectWriteSet.ts | 10 - .../models/WriteSet_ScriptWriteSet.ts | 10 - .../types/generated/models/WriteTableItem.ts | 18 -- .../typescript/sdk_v2/src/types/index.ts | 1 - .../sdk_v2/src/utils/api-endpoints.ts | 28 -- .../typescript/sdk_v2/src/utils/const.ts | 13 - .../typescript/sdk_v2/src/utils/hd-key.ts | 79 ------ .../typescript/sdk_v2/src/utils/helpers.ts | 43 ---- .../typescript/sdk_v2/src/utils/hex_string.ts | 122 --------- .../typescript/sdk_v2/src/utils/index.ts | 7 - .../sdk_v2/src/utils/memoize-decorator.ts | 151 ----------- .../sdk_v2/src/utils/pagination_helpers.ts | 44 ---- ecosystem/typescript/sdk_v2/tsconfig.json | 12 - 135 files changed, 2 insertions(+), 4437 deletions(-) delete mode 100644 ecosystem/typescript/sdk_v2/LICENSE delete mode 100644 ecosystem/typescript/sdk_v2/SPEC.md delete mode 100644 ecosystem/typescript/sdk_v2/src/account/account_address.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/account/aptos_account.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/account/index.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/api/account.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/api/general.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/consts.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/deserializer.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/helper.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/identifier.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/index.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/serializer.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/bcs/types.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/crypto/authentication_key.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/crypto/authenticator.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/crypto/ed25519.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/crypto/index.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/crypto/multi_ed25519.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/internal/account.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/internal/general.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/internal/transaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/index.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/AccountData.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_Ed25519Signature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_MultiEd25519Signature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Address.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/AptosError.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/AptosErrorCode.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Block.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/BlockMetadataTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/DecodedTableData.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteModule.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteResource.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteTableItem.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/DeletedTableData.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/DirectWriteSet.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Ed25519Signature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/EncodeSubmissionRequest.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionId.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Event.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/EventGuid.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/GasEstimation.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload_WriteSetPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/HashValue.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/HealthCheckSuccess.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/HexEncodedBytes.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/IdentifierWrapper.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/IndexResponse.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/ModuleBundlePayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveAbility.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionGenericTypeParam.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionVisibility.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModule.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleBytecode.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleId.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveResource.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveScriptBytecode.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStruct.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructField.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructGenericTypeParam.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructTag.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructValue.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveType.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MoveValue.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MultiAgentSignature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MultiEd25519Signature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigTransactionPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/PendingTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/RawTableItemRequest.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/RoleType.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptWriteSet.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/StateCheckpointTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/StateKeyWrapper.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/SubmitTransactionRequest.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TableItemRequest.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_EntryFunctionPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ModuleBundlePayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_MultisigPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ScriptPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_Ed25519Signature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiAgentSignature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiEd25519Signature.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_BlockMetadataTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_GenesisTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_PendingTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_StateCheckpointTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_UserTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSingleSubmissionFailure.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSubmissionResult.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/U128.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/U256.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/U64.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/UserTransaction.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/VersionedEvent.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/ViewRequest.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteModule.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteResource.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteModule.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteResource.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteTableItem.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteModule.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteResource.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteTableItem.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetPayload.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_DirectWriteSet.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_ScriptWriteSet.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/generated/models/WriteTableItem.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/types/index.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/api-endpoints.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/const.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/hd-key.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/helpers.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/hex_string.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/index.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/memoize-decorator.ts delete mode 100644 ecosystem/typescript/sdk_v2/src/utils/pagination_helpers.ts diff --git a/ecosystem/typescript/sdk_v2/LICENSE b/ecosystem/typescript/sdk_v2/LICENSE deleted file mode 100644 index c61b66391a3c1..0000000000000 --- a/ecosystem/typescript/sdk_v2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/ecosystem/typescript/sdk_v2/SPEC.md b/ecosystem/typescript/sdk_v2/SPEC.md deleted file mode 100644 index 1c3adf31c3b9b..0000000000000 --- a/ecosystem/typescript/sdk_v2/SPEC.md +++ /dev/null @@ -1,223 +0,0 @@ -# Aptos SDK Specification Document - -[Table of Content](#table-of-content) - -![Status](https://img.shields.io/badge/version-1.0-brightgreen.svg) - -## Overview - -The goal of this document is to set a shared standard for implementation and development of all Aptos SDKs. - -This is a living document, and should be changed and updated as changes are made when developer needs are discovered. - -### Requirement Prioritization - -The following document follows the [MoSCoW](https://en.wikipedia.org/wiki/MoSCoW_method) method of prioritising rules. Please follow the following guidelines when evaluating rules. - -- `MUST` - Rules labeled as **must** are requirements that should not be deviated from at any cost -- `SHOULD` - Rules labeled as **should** are requirements that could be deviated from if needed, though this will have to be documented and cleared with all stakeholders before it can be disregarded. -- `COULD` - Rules labeled as **could** are requirements that are desirable but not necessary and therefore would be nice to have where time and resources permit. - -We do not use the fourth **`won't`** level in this specification. - -## Table of Contents - -- Base Requirements - - [1. BCS Encoding & Decoding](#1-BCS-Encoding--Decoding) - - [2. API servers](#2-API-servers) - - [3. Account Management](#3-Account-Management) - - [4. Transaction](#4-Transaction) - - [5. Coin Management](#5-Coin-Management) -- Maintenance Requirements - - [6. Source Control](#6-source-control) - - [7. Releases & Versioning](#7-releases--versioning) - - [8. CI Server](#8-ci-server) -- Additional Content Requirements - - [9. Documentation](#9-documentation) -- Dependencies & Infrastructure Requirements - - [10. Testing](#10-testing) - - [11. Dependencies](#11-dependencies) - - [12. HTTP Client](#12-http-client) - - [13. Logging](#13-reporting) - - [14. Reporting](#14-reporting) -- Initialization & Interaction Requirements - - [15. Initialization](#15-initalization) - - [16. Error Handling](#16-error-handling) - -## Base Requirements - -### 1. BCS Encoding & Decoding - -- [ ] **1.1** The SDK **must** support BCS encoding & decoding for. - - [ ] **1.1.1** Unsigned integers u8, u32, u64, u128, u256. - - [ ] **1.1.2** Optional arguments. - - [ ] **1.1.3** Tuples. - - [ ] **1.1.4** Enums. - - [ ] **1.1.5** UTF-8 Strings as vector of u8. - - [ ] **1.1.6** Structs. - - [ ] **1.1.7** Vectors using uleb128. - - [ ] **1.1.8** Addresses as a fixed 32 byte type. - - [ ] **1.1.9** Generics. - - [ ] **1.1.10** bool. - - [ ] **1.1.11** Object encodings as an address. -- [ ] **1.2** The encoding & decoding details **should** be hidden from the end user and done by the SDK. - - [ ] **1.2.1** The SDK **must** encode each piece in order. - - [ ] **1.2.2** The SDK **should** encode based on a given struct. - -### 2. API servers - -- [ ] **2.1** The SDK **must** interact directly with the Aptos REST API. - - [ ] **2.1.1** The SDK **must** support pagination with optional `start` and `limit` parameters to the REST API request. - - [ ] **2.1.2** The SDK **should** implement a client that adheres to the OpenAPI spec https://fullnode.mainnet.aptoslabs.com/v1/spec#/. -- [ ] **2.2** The SDK **should** interact directly with the Aptos Indexer API. - - [ ] **2.2.1** The SDK **must** support pagination with optional `offset` and `limit` parameters to Indexer API request. - - [ ] **2.2.2** The SDK **must** validate the account address when interacting with the Indexer API. - - [ ] **2.2.2.1** The SDK **must** validate an account address is a 64 character hex string with a leading `0x`. - - [ ] **2.2.3** The SDK **must** handle premade GraphQL queries https://cloud.hasura.io/public/graphiql?endpoint=https://indexer.mainnet.aptoslabs.com/v1/graphql. - - [ ] **2.2.3** The SDK **should** allow the user to pass in a custom GraphQL query. -- [ ] **2.3** The SDK **should** support interactions with Aptos devnet, testnet and mainnet networks. -- [ ] **2.4** The SDK **should** support interactions with a custom URL. - -### 3. Account Management - -- [ ] **3.1** The SDK **must** support account creation. -- [ ] **3.2** The SDK **must** support account APT coin balance read. -- [ ] **3.3** The SDK **must** support key management for Ed25519 keys. - - [ ] **3.3.1** The SDK **must** support Key generation - - [ ] **3.3.2** The SDK **must** support Key loading from a file - - [ ] **3.3.3** The SDK **must** support Key loading from a byte array - - [ ] **3.3.4** The SDK **should** support Key rotation - - [ ] **3.3.5** The SDK **could** Key management via local storage - - [ ] **3.3.6** The SDK **could** Key management via hardware wallet (e.g. Ledger, Keystone, etc.) -- [ ] **3.4** The SDK **must** support local single-threaded sequence number management. - - [ ] **3.4.1** The SDK **should** support multi-account sequence number management - - [ ] **3.4.2** The SDK **should** support single threaded sequence number high throughput smart queuing -- [ ] **3.5** The SDK **must** provide multi-agent signer support. -- [ ] **3.6** The SDK **should** support account any coin balance read. -- [ ] **3.7** The SDK **should** provide multi-Ed25519 signer support. -- [ ] **3.8** The SDK **should** provide mnemonic support. -- [ ] **3.9** The SDK **should** provide onchain multi-sig support. -- [ ] **3.10** The SDK **should** provide resource account support. -- [ ] **3.10** The SDK **should** provide Object support for deriving known objects and object ownership. - -### 4. Transaction - -- [ ] **4.1** The SDK **must** support entry function payload transaction submission. -- [ ] **4.2** The SDK **must** support script payload transaction submission. -- [ ] **4.3** The SDK **must** support simulation of transactions. -- [ ] **4.4** The SDK **must** support view function payload. -- [ ] **4.5** The SDK **should** use the gas estimation API to determine the gas price when building transaction payloads. - - [ ] **4.5.1** The SDK **must** cache the response from the gas estimation API for a set period of time (e.g. 1 minute). - -### 5. Coin Management - -- [ ] **5.1** The SDK **must** support APT coin transfer. -- [ ] **5.1** The SDK **should** support other coin transfer. - -## Maintenance Requirements - -### 6. Source Control - -- [ ] **6.1** The source code for the SDK **must** be maintained within Git version control. -- [ ] **6.2** The source code **must** be hosted publicly. -- [ ] **6.3** Development of new features **should** happen on feature branches. -- [ ] **6.4** Feature branches **should** pass all tests and linting before they can be merged into the `main` branch. -- [ ] **6.5** Source control **should** contain tags for each release of the SDK. -- [ ] **6.6** The `main` branch **should** be kept in a condition that allows for direct use through checkout. -- [ ] **6.7** The source code **should** use GitHub for public hosting. - -### 7. Releases & Versioning - -- [ ] **7.1** The SDK **must** use [Semantic Versioning](http://semver.org/) to increment the version number as changes are made. -- [ ] **7.2** For every new release the `CHANGELOG` file **must** to be updated with the `Major`, `Minor` and `Patch` changes. -- [ ] **7.3** A release package **must** include the documentation `README` file. -- [ ] **7.4** A release package **must** include the `LICENSE` file. -- [ ] **7.5** A release package **must** include the `CHANGELOG` file. - -- [ ] **7.6** A release package **should** not include unnecessary source code files or intermediary files for the SDK. - -- [ ] **7.7** The name of the SDK **should** follow language best practices, and be one of `aptos` or `Aptos`. -- [ ] **7.8** If the preferred name of the SDK is not available, it **could** be one of `aptos-sdk`, `AptosSDK`, or `aptosdev`. -- [ ] **7.9** As soon as the first public version of the library has been signed off, the version **should** be bumped to `1.0.0`. -- [ ] **7.10** New releases **could** be deployed automatically to the package manager using the CI server. - -### 8. CI Server - -- [ ] **8.1** A Continuous Integration (CI) server **must** be used to automatically test any branch of the Git repository. -- [ ] **8.2** The CI server **could** test on different platforms, including Windows, Linux, and macOS. -- [ ] **8.3** The CI server **could** test new Git tags, and build and push the package to the package manager. - -## Content Requirements - -### 9. Documentation - -- [ ] **9.1** The SDK **must** include a `README` file. - - - [ ] **9.1.1** The `README` file **must** have instructions on how to install the SDK using a package manager. - - [ ] **9.1.2** The `README` file **must** link to the `LICENSE` file. - - [ ] **9.1.3** The `README` file **must** document any installation requirements and prerequisites. - - [ ] **9.1.4** The `README` file **should** be written in Markdown. - - [ ] **9.1.5** The `README` file **should** include a version badge. - - [ ] **9.1.6** The `README` file **should** include a test status badge. - - [ ] **9.1.7** The `README` file **should** document all the different ways the SDK can be initialized. - - [ ] **9.1.8** The `README` file **should** include official support channels. - - [ ] **9.1.9** The `README` file **could** have instructions on how to install the SDK from version control. - -- [ ] **9.2** The SDK **must** include a `CHANGELOG` file. -- [ ] **9.3** The SDK **must** include a `CODE_OF_CONDUCT` file. -- [ ] **9.4** The SDK **must** include a `CONTRIBUTING` file. - - [ ] **9.4.1** The Contribution Guidelines **should** include instructions on how to run the SDK in development/testing mode. -- [ ] **9.5** The SDK **should** include a `ISSUE_TEMPLATE` file. -- [ ] **9.6** The SDK **should** include a `PULL_REQUEST_TEMPLATE` file. -- [ ] **9.7** The SDK **should** include a `SUPPORT` file. -- [ ] **9.8** The GitHub repository **should** have a title in the format, e.g. "Typescript library for the Aptos network" -- [ ] **9.9** The GitHub repository **should** have the following tags: `aptos`, `blockchain`, `web3`, `sdk`, `library`. - -## Dependencies & Infrastructure Requirements - -### 10. Testing - -- [ ] **10.1** The SDK **must** be thoroughly tested. -- [ ] **10.2** For any real API calls, the tests **must** use the Aptos testnet or devnet network. -- [ ] **10.3** The tests **should** have integration tests to make the network calls. -- [ ] **10.4** The tests **should** test responses. - -### 11. Dependencies - -- [ ] **11.1** The SDK **must** limit its runtime dependencies. -- [ ] **11.2** The SDK **should** have no runtime dependencies. -- [ ] **11.3** The SDK **could** use any amount of development and test dependencies. - -### 12. HTTP Client - -- [ ] **12.1** The SDK **must** use a well supported HTTP client. -- [ ] **12.2** The SDK **should** use a HTTP2 supported client. -- [ ] **12.3** A HTTP client from the standard libraries **should** be used. -- [ ] **12.4** The SDK **could** allow a developer to provide an alternative HTTP client. - -### 13. Logging - -- [ ] **13.1** The SDK **must** be able to log activities to a logger. -- [ ] **13.2** The logger **must** allow enabling/disabling of debug mode. -- [ ] **13.3** The logger **should** use the default runtime log. -- [ ] **13.4** The logger **should** allow a developer to provide an alternative logger. -- [ ] **13.5** When debugging is enabled, the logger **should** log (and only log) the request object, response object, and optionally any raw HTTP response object of no response object could be formed. - -### 14. Reporting - -- [ ] **14.1** The SDK **should** pass a custom header `x-aptos-client` with the format `/`. - - Example with known sdk version: `aptos-ts-sdk/1.8.4` - -## Initialization & Interaction Requirements - -### 15. Initialization - -- [ ] **15.1** The SDK client **must** allow selection of the base URL by name (`devnet` , `tesnet` , `mainnet`). -- [ ] **15.2** The SDK client **must** allow for setting a custom base URL directly (e.g `http://localhost:8080`). - -### 16. Error Handling - -- [ ] **16.1** The SDK **should** raise a `ApiError` for any request that did not result a HTTP 200 or 201 response code. -- [ ] **16.4** The response error object **should** contain a `message` attribute containing the message of the error, e.g. `account_not_found`. -- [ ] **16.5** The response error object **should** contain a `error_code` attribute containing the error code, e.g. `404`. -- [ ] **16.5** The response error object **should** contain a `vm_error_code` attribute containing the vm error code, e.g. `0`. diff --git a/ecosystem/typescript/sdk_v2/src/account/account_address.ts b/ecosystem/typescript/sdk_v2/src/account/account_address.ts deleted file mode 100644 index 5c7899ae17985..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/account/account_address.ts +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { MaybeHexString, HexString } from "../utils"; -import { Serializer, Deserializer, Bytes } from "../bcs"; - -export class AccountAddress { - static readonly LENGTH: number = 32; - - readonly address: Bytes; - - static CORE_CODE_ADDRESS: AccountAddress = AccountAddress.fromHex("0x1"); - - constructor(address: Bytes) { - if (address.length !== AccountAddress.LENGTH) { - throw new Error("Expected address of length 32"); - } - this.address = address; - } - - /** - * Creates AccountAddress from a hex string. - * @param addr Hex string can be with a prefix or without a prefix, - * e.g. '0x1aa' or '1aa'. Hex string will be left padded with 0s if too short. - */ - static fromHex(addr: MaybeHexString): AccountAddress { - let address = HexString.ensure(addr); - - // If an address hex has odd number of digits, padd the hex string with 0 - // e.g. '1aa' would become '01aa'. - if (address.noPrefix().length % 2 !== 0) { - address = new HexString(`0${address.noPrefix()}`); - } - - const addressBytes = address.toUint8Array(); - - if (addressBytes.length > AccountAddress.LENGTH) { - // eslint-disable-next-line quotes - throw new Error("Hex string is too long. Address's length is 32 bytes."); - } else if (addressBytes.length === AccountAddress.LENGTH) { - return new AccountAddress(addressBytes); - } - - const res: Bytes = new Uint8Array(AccountAddress.LENGTH); - res.set(addressBytes, AccountAddress.LENGTH - addressBytes.length); - - return new AccountAddress(res); - } - - /** - * Checks if the string is a valid AccountAddress - * @param addr Hex string can be with a prefix or without a prefix, - * e.g. '0x1aa' or '1aa'. Hex string will be left padded with 0s if too short. - */ - static isValid(addr: MaybeHexString): boolean { - // At least one zero is required - if (addr === "") { - return false; - } - - let address = HexString.ensure(addr); - - // If an address hex has odd number of digits, padd the hex string with 0 - // e.g. '1aa' would become '01aa'. - if (address.noPrefix().length % 2 !== 0) { - address = new HexString(`0${address.noPrefix()}`); - } - - const addressBytes = address.toUint8Array(); - - return addressBytes.length <= AccountAddress.LENGTH; - } - - /** - * Return a hex string from account Address. - */ - toHexString(): MaybeHexString { - return HexString.fromUint8Array(this.address).hex(); - } - - serialize(serializer: Serializer): void { - serializer.serializeFixedBytes(this.address); - } - - static deserialize(deserializer: Deserializer): AccountAddress { - return new AccountAddress(deserializer.deserializeFixedBytes(AccountAddress.LENGTH)); - } - - /** - * Standardizes an address to the format "0x" followed by 64 lowercase hexadecimal digits. - */ - static standardizeAddress(address: string): string { - // Convert the address to lowercase - const lowercaseAddress = address.toLowerCase(); - // Remove the "0x" prefix if present - const addressWithoutPrefix = lowercaseAddress.startsWith("0x") ? lowercaseAddress.slice(2) : lowercaseAddress; - // Pad the address with leading zeros if necessary - // to ensure it has exactly 64 characters (excluding the "0x" prefix) - const addressWithPadding = addressWithoutPrefix.padStart(64, "0"); - // Return the standardized address with the "0x" prefix - return `0x${addressWithPadding}`; - } -} diff --git a/ecosystem/typescript/sdk_v2/src/account/aptos_account.ts b/ecosystem/typescript/sdk_v2/src/account/aptos_account.ts deleted file mode 100644 index addb8788f458a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/account/aptos_account.ts +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import nacl from "tweetnacl"; -import * as bip39 from "@scure/bip39"; -import { bytesToHex } from "@noble/hashes/utils"; -import { sha3_256 as sha3Hash } from "@noble/hashes/sha3"; -import { derivePath } from "../utils/hd-key"; -import { HexString, MaybeHexString, Memoize } from "../utils"; -import { bcsToBytes } from "../bcs"; -import { AuthenticationKey, Ed25519PublicKey } from "../crypto"; -import { AccountAddress } from "./account_address"; - -export interface AptosAccountObject { - address?: MaybeHexString; - publicKeyHex?: MaybeHexString; - privateKeyHex: MaybeHexString; -} - -/** - * Class for creating and managing Aptos account - */ -export class AptosAccount { - /** - * A private key and public key, associated with the given account - */ - readonly signingKey: nacl.SignKeyPair; - - /** - * Address associated with the given account - */ - private readonly accountAddress: HexString; - - static fromAptosAccountObject(obj: AptosAccountObject): AptosAccount { - return new AptosAccount(HexString.ensure(obj.privateKeyHex).toUint8Array(), obj.address); - } - - /** - * Test derive path - */ - static isValidPath(path: string): boolean { - return /^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'+$/.test(path); - } - - /** - * Creates new account with bip44 path and mnemonics, - * @param path. (e.g. m/44'/637'/0'/0'/0') - * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} - * @param mnemonics. - * @returns AptosAccount - */ - static fromDerivePath(path: string, mnemonics: string): AptosAccount { - if (!AptosAccount.isValidPath(path)) { - throw new Error("Invalid derivation path"); - } - - const normalizeMnemonics = mnemonics - .trim() - .split(/\s+/) - .map((part) => part.toLowerCase()) - .join(" "); - - const { key } = derivePath(path, bytesToHex(bip39.mnemonicToSeedSync(normalizeMnemonics))); - - return new AptosAccount(key); - } - - /** - * Creates new account instance. Constructor allows passing in an address, - * to handle account key rotation, where auth_key != public_key - * @param privateKeyBytes Private key from which account key pair will be generated. - * If not specified, new key pair is going to be created. - * @param address Account address (e.g. 0xe8012714cd17606cee7188a2a365eef3fe760be598750678c8c5954eb548a591). - * If not specified, a new one will be generated from public key - */ - constructor(privateKeyBytes?: Uint8Array | undefined, address?: MaybeHexString) { - if (privateKeyBytes) { - this.signingKey = nacl.sign.keyPair.fromSeed(privateKeyBytes.slice(0, 32)); - } else { - this.signingKey = nacl.sign.keyPair(); - } - this.accountAddress = HexString.ensure(address || this.authKey().hex()); - } - - /** - * This is the key by which Aptos account is referenced. - * It is the 32-byte of the SHA-3 256 cryptographic hash - * of the public key(s) concatenated with a signature scheme identifier byte - * @returns Address associated with the given account - */ - address(): HexString { - return this.accountAddress; - } - - /** - * This key enables account owners to rotate their private key(s) - * associated with the account without changing the address that hosts their account. - * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication} - * @returns Authentication key for the associated account - */ - @Memoize() - authKey(): HexString { - const pubKey = new Ed25519PublicKey(this.signingKey.publicKey); - const authKey = AuthenticationKey.fromEd25519PublicKey(pubKey); - return authKey.derivedAddress(); - } - - /** - * Takes source address and seeds and returns the resource account address - * @param sourceAddress Address used to derive the resource account - * @param seed The seed bytes - * @returns The resource account address - */ - - static getResourceAccountAddress(sourceAddress: MaybeHexString, seed: Uint8Array): HexString { - const source = bcsToBytes(AccountAddress.fromHex(sourceAddress)); - - const bytes = new Uint8Array([...source, ...seed, AuthenticationKey.DERIVE_RESOURCE_ACCOUNT_SCHEME]); - - const hash = sha3Hash.create(); - hash.update(bytes); - - return HexString.fromUint8Array(hash.digest()); - } - - /** - * This key is generated with Ed25519 scheme. - * Public key is used to check a signature of transaction, signed by given account - * @returns The public key for the associated account - */ - pubKey(): HexString { - return HexString.fromUint8Array(this.signingKey.publicKey); - } - - /** - * Signs specified `buffer` with account's private key - * @param buffer A buffer to sign - * @returns A signature HexString - */ - signBuffer(buffer: Uint8Array): HexString { - const signature = nacl.sign.detached(buffer, this.signingKey.secretKey); - return HexString.fromUint8Array(signature); - } - - /** - * Signs specified `hexString` with account's private key - * @param hexString A regular string or HexString to sign - * @returns A signature HexString - */ - signHexString(hexString: MaybeHexString): HexString { - const toSign = HexString.ensure(hexString).toUint8Array(); - return this.signBuffer(toSign); - } - - /** - * Verifies the signature of the message with the public key of the account - * @param message a signed message - * @param signature the signature of the message - */ - verifySignature(message: MaybeHexString, signature: MaybeHexString): boolean { - const rawMessage = HexString.ensure(message).toUint8Array(); - const rawSignature = HexString.ensure(signature).toUint8Array(); - return nacl.sign.detached.verify(rawMessage, rawSignature, this.signingKey.publicKey); - } - - /** - * Derives account address, public key and private key - * @returns AptosAccountObject instance. - * @example An example of the returned AptosAccountObject object - * ``` - * { - * address: "0xe8012714cd17606cee7188a2a365eef3fe760be598750678c8c5954eb548a591", - * publicKeyHex: "0xf56d8524faf79fbc0f48c13aeed3b0ce5dd376b4db93b8130a107c0a5e04ba04", - * privateKeyHex: `0x009c9f7c992a06cfafe916f125d8adb7a395fca243e264a8e56a4b3e6accf940 - * d2b11e9ece3049ce60e3c7b4a1c58aebfa9298e29a30a58a67f1998646135204` - * } - * ``` - */ - toPrivateKeyObject(): AptosAccountObject { - return { - address: this.address().hex(), - publicKeyHex: this.pubKey().hex(), - privateKeyHex: HexString.fromUint8Array(this.signingKey.secretKey.slice(0, 32)).hex(), - }; - } -} - -// Returns an account address as a HexString given either an AptosAccount or a MaybeHexString. -export function getAddressFromAccountOrAddress(accountOrAddress: AptosAccount | MaybeHexString): HexString { - return accountOrAddress instanceof AptosAccount ? accountOrAddress.address() : HexString.ensure(accountOrAddress); -} diff --git a/ecosystem/typescript/sdk_v2/src/account/index.ts b/ecosystem/typescript/sdk_v2/src/account/index.ts deleted file mode 100644 index eb8036f9d8c83..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/account/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./aptos_account"; -export * from "./account_address"; diff --git a/ecosystem/typescript/sdk_v2/src/api/account.ts b/ecosystem/typescript/sdk_v2/src/api/account.ts deleted file mode 100644 index 72e22bd0b48e8..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/api/account.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { AptosConfig } from "./aptos_config"; -import { Gen } from "../types"; -import { parseApiError, MaybeHexString } from "../utils"; -import { AnyNumber } from "../bcs"; -import { getData, getModule, getModules, getResource, getResources, getTransactions } from "../internal/account"; -import { PaginationArgs } from "../client/types"; - -export class Account { - readonly config: AptosConfig; - - constructor(config: AptosConfig) { - this.config = config; - } - - /** - * Queries an Aptos account by address - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @returns Core account resource, used for identifying account and transaction execution - * @example An example of the returned account - * ``` - * { - * sequence_number: "1", - * authentication_key: "0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69" - * } - * ``` - */ - @parseApiError - async getData(accountAddress: MaybeHexString): Promise { - const data = await getData(this.config, accountAddress); - return data; - } - - /** - * Queries modules associated with given account - * - * Note: In order to get all account modules, this function may call the API - * multiple times as it paginates. - * - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @param query.ledgerVersion Specifies ledger version of transactions. By default latest version will be used - * @returns Account modules array for a specific ledger version. - * Module is represented by MoveModule interface. It contains module `bytecode` and `abi`, - * which is JSON representation of a module - */ - @parseApiError - async getModules( - accountAddress: MaybeHexString, - query?: { ledgerVersion?: AnyNumber }, - ): Promise { - const modules = await getModules(this.config, accountAddress, query); - return modules; - } - - /** - * Queries module associated with given account by module name - * - * Note: In order to get all account resources, this function may call the API - * multiple times as it paginates. - * - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @param moduleName The name of the module - * @param query.ledgerVersion Specifies ledger version of transactions. By default latest version will be used - * @returns Specified module. - * Module is represented by MoveModule interface. It contains module `bytecode` and `abi`, - * which JSON representation of a module - */ - @parseApiError - async getModule( - accountAddress: MaybeHexString, - moduleName: string, - query?: { ledgerVersion?: AnyNumber }, - ): Promise { - const module = await getModule(this.config, accountAddress, moduleName, query); - return module; - } - - /** - * Queries transactions sent by given account - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @param query Optional pagination object - * @param query.start The sequence number of the start transaction of the page. Default is 0. - * @param query.limit The max number of transactions should be returned for the page. Default is 25. - * @returns An array of on-chain transactions, sent by account - */ - @parseApiError - async getTransactions(accountAddress: MaybeHexString, query?: PaginationArgs): Promise { - const transactions = await getTransactions(this.config, accountAddress, query); - return transactions; - } - - /** - * Queries all resources associated with given account - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @param query.ledgerVersion Specifies ledger version of transactions. By default latest version will be used - * @returns Account resources for a specific ledger version - */ - @parseApiError - async getResources( - accountAddress: MaybeHexString, - query?: { ledgerVersion?: AnyNumber }, - ): Promise { - const resources = await getResources(this.config, accountAddress, query); - return resources; - } - - /** - * Queries resource associated with given account by resource type - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @param resourceType String representation of an on-chain Move struct type - * @param query.ledgerVersion Specifies ledger version of transactions. By default latest version will be used - * @returns Account resource of specified type and ledger version - * @example An example of an account resource - * ``` - * { - * type: "0x1::aptos_coin::AptosCoin", - * data: { value: 6 } - * } - * ``` - */ - @parseApiError - async getResource( - accountAddress: MaybeHexString, - resourceType: Gen.MoveStructTag, - query?: { ledgerVersion?: AnyNumber }, - ): Promise { - const resource = await getResource(this.config, accountAddress, resourceType, query); - return resource; - } -} diff --git a/ecosystem/typescript/sdk_v2/src/api/aptos.ts b/ecosystem/typescript/sdk_v2/src/api/aptos.ts index d51b59a1b9cee..20939ddb80791 100644 --- a/ecosystem/typescript/sdk_v2/src/api/aptos.ts +++ b/ecosystem/typescript/sdk_v2/src/api/aptos.ts @@ -1,14 +1,8 @@ -import { Account } from "./account"; import { AptosConfig } from "./aptos_config"; -import { General } from "./general"; export class Aptos { readonly config: AptosConfig; - readonly account: Account; - - readonly general: General; - /** * This class is the main entry point into Aptos's * APIs and separates functionality into different namespaces. @@ -27,8 +21,5 @@ export class Aptos { */ constructor(settings?: AptosConfig) { this.config = new AptosConfig(settings); - - this.account = new Account(this.config); - this.general = new General(this.config); } } diff --git a/ecosystem/typescript/sdk_v2/src/api/aptos_config.ts b/ecosystem/typescript/sdk_v2/src/api/aptos_config.ts index 3c1f97fae26e5..cd2c26a9e857c 100644 --- a/ecosystem/typescript/sdk_v2/src/api/aptos_config.ts +++ b/ecosystem/typescript/sdk_v2/src/api/aptos_config.ts @@ -1,16 +1,9 @@ import { ClientConfig } from "../client/types"; -import { DEFAULT_NETWORK, DEFAULT_FAUCET } from "../utils"; export class AptosConfig { - readonly network: string; - - readonly faucet: string; - readonly clientConfig?: ClientConfig; constructor(config?: AptosConfig) { - this.network = config?.network ?? DEFAULT_NETWORK; - this.faucet = config?.faucet ?? DEFAULT_FAUCET; this.clientConfig = config?.clientConfig ?? {}; } } diff --git a/ecosystem/typescript/sdk_v2/src/api/general.ts b/ecosystem/typescript/sdk_v2/src/api/general.ts deleted file mode 100644 index 0d44d66f13b89..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/api/general.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { AptosConfig } from "./aptos_config"; -import { Gen } from "../types"; -import { Memoize, parseApiError } from "../utils"; -import { getBlockByHeight, getBlockByVersion, getChainId, getLedgerInfo, view } from "../internal/general"; - -export class General { - readonly config: AptosConfig; - - constructor(config: AptosConfig) { - this.config = config; - } - - /** - * Queries the latest ledger information - * @returns Latest ledger information - * @example Example of returned data - * ``` - * { - * chain_id: 15, - * epoch: 6, - * ledgerVersion: "2235883", - * ledger_timestamp:"1654580922321826" - * } - * ``` - */ - @parseApiError - async getLedgerInfo(): Promise { - const info = await getLedgerInfo(this.config); - return info; - } - - /** - * @returns Current chain id - */ - @Memoize() - async getChainId(): Promise { - const chainId = await getChainId(this.config); - return chainId; - } - - /** - * Call for a move view function - * - * @param payload Transaction payload - * @param version (optional) Ledger version to lookup block information for - * - * @returns MoveValue[] - */ - @parseApiError - async view(payload: Gen.ViewRequest, ledger_version?: string): Promise { - const data = await view(this.config, payload, ledger_version); - return data; - } - - /** - * Get block by height - * - * @param blockHeight Block height to lookup. Starts at 0 - * @param withTransactions If set to true, include all transactions in the block - * - * @returns Block - */ - @parseApiError - async getBlockByHeight(blockHeight: number, withTransactions?: boolean): Promise { - const block = await getBlockByHeight(this.config, blockHeight, withTransactions); - return block; - } - - /** - * Get block by block transaction version - * - * @param version Ledger version to lookup block information for - * @param withTransactions If set to true, include all transactions in the block - * - * @returns Block - */ - @parseApiError - async getBlockByVersion(version: number, withTransactions?: boolean): Promise { - const block = await getBlockByVersion(this.config, version, withTransactions); - return block; - } -} diff --git a/ecosystem/typescript/sdk_v2/src/api/index.ts b/ecosystem/typescript/sdk_v2/src/api/index.ts index 0d6db433f556f..0a0c159a637f9 100644 --- a/ecosystem/typescript/sdk_v2/src/api/index.ts +++ b/ecosystem/typescript/sdk_v2/src/api/index.ts @@ -1,4 +1,2 @@ -export * from "./account"; export * from "./aptos"; export * from "./aptos_config"; -export * from "./general"; diff --git a/ecosystem/typescript/sdk_v2/src/bcs/consts.ts b/ecosystem/typescript/sdk_v2/src/bcs/consts.ts deleted file mode 100644 index ac57ec28fa919..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/consts.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from "./types"; - -// Upper bound values for uint8, uint16, uint64 and uint128 -export const MAX_U8_NUMBER: Uint8 = 2 ** 8 - 1; -export const MAX_U16_NUMBER: Uint16 = 2 ** 16 - 1; -export const MAX_U32_NUMBER: Uint32 = 2 ** 32 - 1; -export const MAX_U64_BIG_INT: Uint64 = BigInt(2 ** 64) - BigInt(1); -export const MAX_U128_BIG_INT: Uint128 = BigInt(2 ** 128) - BigInt(1); -export const MAX_U256_BIG_INT: Uint256 = BigInt(2 ** 256) - BigInt(1); diff --git a/ecosystem/typescript/sdk_v2/src/bcs/deserializer.ts b/ecosystem/typescript/sdk_v2/src/bcs/deserializer.ts deleted file mode 100644 index 337011a6327fa..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/deserializer.ts +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -/* eslint-disable no-bitwise */ -import { MAX_U32_NUMBER } from "./consts"; -import { Bytes, Uint128, Uint16, Uint256, Uint32, Uint64, Uint8 } from "./types"; - -export class Deserializer { - private buffer: ArrayBuffer; - - private offset: number; - - constructor(data: Bytes) { - // copies data to prevent outside mutation of buffer. - this.buffer = new ArrayBuffer(data.length); - new Uint8Array(this.buffer).set(data, 0); - this.offset = 0; - } - - private read(length: number): ArrayBuffer { - if (this.offset + length > this.buffer.byteLength) { - throw new Error("Reached to the end of buffer"); - } - - const bytes = this.buffer.slice(this.offset, this.offset + length); - this.offset += length; - return bytes; - } - - /** - * Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first, - * and then reads "l" bytes of content. Decodes the byte array into a string. - * - * BCS layout for "string": string_length | string_content. string_length is the bytes length of - * the string that is uleb128 encoded. string_length is a u32 integer. - * - * @example - * ```ts - * const deserializer = new Deserializer(new Uint8Array([24, 0xc3, 0xa7, 0xc3, 0xa5, 0xe2, 0x88, 0x9e, - * 0xe2, 0x89, 0xa0, 0xc2, 0xa2, 0xc3, 0xb5, 0xc3, 0x9f, 0xe2, 0x88, 0x82, 0xc6, 0x92, 0xe2, 0x88, 0xab])); - * assert(deserializer.deserializeStr() === "çå∞≠¢õß∂ƒ∫"); - * ``` - */ - deserializeStr(): string { - const value = this.deserializeBytes(); - const textDecoder = new TextDecoder(); - return textDecoder.decode(value); - } - - /** - * Deserializes an array of bytes. - * - * BCS layout for "bytes": bytes_length | bytes. bytes_length is the length of the bytes array that is - * uleb128 encoded. bytes_length is a u32 integer. - */ - deserializeBytes(): Bytes { - const len = this.deserializeUleb128AsU32(); - return new Uint8Array(this.read(len)); - } - - /** - * Deserializes an array of bytes. The number of bytes to read is already known. - * - */ - deserializeFixedBytes(len: number): Bytes { - return new Uint8Array(this.read(len)); - } - - /** - * Deserializes a boolean value. - * - * BCS layout for "boolean": One byte. "0x01" for True and "0x00" for False. - */ - deserializeBool(): boolean { - const bool = new Uint8Array(this.read(1))[0]; - if (bool !== 1 && bool !== 0) { - throw new Error("Invalid boolean value"); - } - return bool === 1; - } - - /** - * Deserializes a uint8 number. - * - * BCS layout for "uint8": One byte. Binary format in little-endian representation. - */ - deserializeU8(): Uint8 { - return new DataView(this.read(1)).getUint8(0); - } - - /** - * Deserializes a uint16 number. - * - * BCS layout for "uint16": Two bytes. Binary format in little-endian representation. - * @example - * ```ts - * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12])); - * assert(deserializer.deserializeU16() === 4660); - * ``` - */ - deserializeU16(): Uint16 { - return new DataView(this.read(2)).getUint16(0, true); - } - - /** - * Deserializes a uint32 number. - * - * BCS layout for "uint32": Four bytes. Binary format in little-endian representation. - * @example - * ```ts - * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12])); - * assert(deserializer.deserializeU32() === 305419896); - * ``` - */ - deserializeU32(): Uint32 { - return new DataView(this.read(4)).getUint32(0, true); - } - - /** - * Deserializes a uint64 number. - * - * BCS layout for "uint64": Eight bytes. Binary format in little-endian representation. - * @example - * ```ts - * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12])); - * assert(deserializer.deserializeU64() === 1311768467750121216); - * ``` - */ - deserializeU64(): Uint64 { - const low = this.deserializeU32(); - const high = this.deserializeU32(); - - // combine the two 32-bit values and return (little endian) - return BigInt((BigInt(high) << BigInt(32)) | BigInt(low)); - } - - /** - * Deserializes a uint128 number. - * - * BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation. - */ - deserializeU128(): Uint128 { - const low = this.deserializeU64(); - const high = this.deserializeU64(); - - // combine the two 64-bit values and return (little endian) - return BigInt((high << BigInt(64)) | low); - } - - /** - * Deserializes a uint256 number. - * - * BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation. - */ - deserializeU256(): Uint256 { - const low = this.deserializeU128(); - const high = this.deserializeU128(); - - // combine the two 128-bit values and return (little endian) - return BigInt((high << BigInt(128)) | low); - } - - /** - * Deserializes a uleb128 encoded uint32 number. - * - * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values - */ - deserializeUleb128AsU32(): Uint32 { - let value: bigint = BigInt(0); - let shift = 0; - - while (value < MAX_U32_NUMBER) { - const byte = this.deserializeU8(); - value |= BigInt(byte & 0x7f) << BigInt(shift); - - if ((byte & 0x80) === 0) { - break; - } - shift += 7; - } - - if (value > MAX_U32_NUMBER) { - throw new Error("Overflow while parsing uleb128-encoded uint32 value"); - } - - return Number(value); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/bcs/helper.ts b/ecosystem/typescript/sdk_v2/src/bcs/helper.ts deleted file mode 100644 index 37f774e76f42c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/helper.ts +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { Deserializer } from "./deserializer"; -import { Serializer } from "./serializer"; -import { Bytes, AnyNumber, Uint8, Uint16, Uint32 } from "./types"; - -interface Serializable { - serialize(serializer: Serializer): void; -} - -/** - * Serializes a vector values that are "Serializable". - */ -export function serializeVector(value: Array, serializer: Serializer): void { - serializer.serializeU32AsUleb128(value.length); - value.forEach((item: T) => { - item.serialize(serializer); - }); -} - -/** - * Serializes a vector with specified item serialization function. - * Very dynamic function and bypasses static typechecking. - */ -export function serializeVectorWithFunc(value: any[], func: string): Bytes { - const serializer = new Serializer(); - serializer.serializeU32AsUleb128(value.length); - const f = (serializer as any)[func]; - value.forEach((item) => { - f.call(serializer, item); - }); - return serializer.getBytes(); -} - -/** - * Deserializes a vector of values. - */ -export function deserializeVector(deserializer: Deserializer, cls: any): any[] { - const length = deserializer.deserializeUleb128AsU32(); - const list: Array = []; - for (let i = 0; i < length; i += 1) { - list.push(cls.deserialize(deserializer)); - } - return list; -} - -export function bcsToBytes(value: T): Bytes { - const serializer = new Serializer(); - value.serialize(serializer); - return serializer.getBytes(); -} - -export function bcsSerializeUint64(value: AnyNumber): Bytes { - const serializer = new Serializer(); - serializer.serializeU64(value); - return serializer.getBytes(); -} - -export function bcsSerializeU8(value: Uint8): Bytes { - const serializer = new Serializer(); - serializer.serializeU8(value); - return serializer.getBytes(); -} - -export function bcsSerializeU16(value: Uint16): Bytes { - const serializer = new Serializer(); - serializer.serializeU16(value); - return serializer.getBytes(); -} - -export function bcsSerializeU32(value: Uint32): Bytes { - const serializer = new Serializer(); - serializer.serializeU32(value); - return serializer.getBytes(); -} - -export function bcsSerializeU128(value: AnyNumber): Bytes { - const serializer = new Serializer(); - serializer.serializeU128(value); - return serializer.getBytes(); -} - -export function bcsSerializeU256(value: AnyNumber): Bytes { - const serializer = new Serializer(); - serializer.serializeU256(value); - return serializer.getBytes(); -} - -export function bcsSerializeBool(value: boolean): Bytes { - const serializer = new Serializer(); - serializer.serializeBool(value); - return serializer.getBytes(); -} - -export function bcsSerializeStr(value: string): Bytes { - const serializer = new Serializer(); - serializer.serializeStr(value); - return serializer.getBytes(); -} - -export function bcsSerializeBytes(value: Bytes): Bytes { - const serializer = new Serializer(); - serializer.serializeBytes(value); - return serializer.getBytes(); -} - -export function bcsSerializeFixedBytes(value: Bytes): Bytes { - const serializer = new Serializer(); - serializer.serializeFixedBytes(value); - return serializer.getBytes(); -} diff --git a/ecosystem/typescript/sdk_v2/src/bcs/identifier.ts b/ecosystem/typescript/sdk_v2/src/bcs/identifier.ts deleted file mode 100644 index 3ffc18b75b21c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/identifier.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { Deserializer } from "./deserializer"; -import { Serializer } from "./serializer"; - -export class Identifier { - constructor(public value: string) {} - - public serialize(serializer: Serializer): void { - serializer.serializeStr(this.value); - } - - static deserialize(deserializer: Deserializer): Identifier { - const value = deserializer.deserializeStr(); - return new Identifier(value); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/bcs/index.ts b/ecosystem/typescript/sdk_v2/src/bcs/index.ts deleted file mode 100644 index 18327efe923c9..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -export * from "./serializer"; -export * from "./deserializer"; -export * from "./identifier"; -export * from "./helper"; -export * from "./types"; diff --git a/ecosystem/typescript/sdk_v2/src/bcs/serializer.ts b/ecosystem/typescript/sdk_v2/src/bcs/serializer.ts deleted file mode 100644 index 7183e95b7d132..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/serializer.ts +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -/* eslint-disable no-bitwise */ -import { - MAX_U128_BIG_INT, - MAX_U16_NUMBER, - MAX_U32_NUMBER, - MAX_U64_BIG_INT, - MAX_U8_NUMBER, - MAX_U256_BIG_INT, -} from "./consts"; -import { Bytes, Uint8, Uint16, Uint32, AnyNumber } from "./types"; - -export class Serializer { - private buffer: ArrayBuffer; - - private offset: number; - - constructor() { - this.buffer = new ArrayBuffer(64); - this.offset = 0; - } - - private ensureBufferWillHandleSize(bytes: number) { - while (this.buffer.byteLength < this.offset + bytes) { - const newBuffer = new ArrayBuffer(this.buffer.byteLength * 2); - new Uint8Array(newBuffer).set(new Uint8Array(this.buffer)); - this.buffer = newBuffer; - } - } - - protected serialize(values: Bytes) { - this.ensureBufferWillHandleSize(values.length); - new Uint8Array(this.buffer, this.offset).set(values); - this.offset += values.length; - } - - private serializeWithFunction( - fn: (byteOffset: number, value: number, littleEndian?: boolean) => void, - bytesLength: number, - value: number, - ) { - this.ensureBufferWillHandleSize(bytesLength); - const dv = new DataView(this.buffer, this.offset); - fn.apply(dv, [0, value, true]); - this.offset += bytesLength; - } - - /** - * Serializes a string. UTF8 string is supported. Serializes the string's bytes length "l" first, - * and then serializes "l" bytes of the string content. - * - * BCS layout for "string": string_length | string_content. string_length is the bytes length of - * the string that is uleb128 encoded. string_length is a u32 integer. - * - * @example - * ```ts - * const serializer = new Serializer(); - * serializer.serializeStr("çå∞≠¢õß∂ƒ∫"); - * assert(serializer.getBytes() === new Uint8Array([24, 0xc3, 0xa7, 0xc3, 0xa5, 0xe2, 0x88, 0x9e, - * 0xe2, 0x89, 0xa0, 0xc2, 0xa2, 0xc3, 0xb5, 0xc3, 0x9f, 0xe2, 0x88, 0x82, 0xc6, 0x92, 0xe2, 0x88, 0xab])); - * ``` - */ - serializeStr(value: string): void { - const textEncoder = new TextEncoder(); - this.serializeBytes(textEncoder.encode(value)); - } - - /** - * Serializes an array of bytes. - * - * BCS layout for "bytes": bytes_length | bytes. bytes_length is the length of the bytes array that is - * uleb128 encoded. bytes_length is a u32 integer. - */ - serializeBytes(value: Bytes): void { - this.serializeU32AsUleb128(value.length); - this.serialize(value); - } - - /** - * Serializes an array of bytes with known length. Therefore length doesn't need to be - * serialized to help deserialization. When deserializing, the number of - * bytes to deserialize needs to be passed in. - */ - serializeFixedBytes(value: Bytes): void { - this.serialize(value); - } - - /** - * Serializes a boolean value. - * - * BCS layout for "boolean": One byte. "0x01" for True and "0x00" for False. - */ - serializeBool(value: boolean): void { - if (typeof value !== "boolean") { - throw new Error("Value needs to be a boolean"); - } - const byteValue = value ? 1 : 0; - this.serialize(new Uint8Array([byteValue])); - } - - /** - * Serializes a uint8 number. - * - * BCS layout for "uint8": One byte. Binary format in little-endian representation. - */ - @checkNumberRange(0, MAX_U8_NUMBER) - serializeU8(value: Uint8): void { - this.serialize(new Uint8Array([value])); - } - - /** - * Serializes a uint16 number. - * - * BCS layout for "uint16": Two bytes. Binary format in little-endian representation. - * @example - * ```ts - * const serializer = new Serializer(); - * serializer.serializeU16(4660); - * assert(serializer.getBytes() === new Uint8Array([0x34, 0x12])); - * ``` - */ - @checkNumberRange(0, MAX_U16_NUMBER) - serializeU16(value: Uint16): void { - this.serializeWithFunction(DataView.prototype.setUint16, 2, value); - } - - /** - * Serializes a uint32 number. - * - * BCS layout for "uint32": Four bytes. Binary format in little-endian representation. - * @example - * ```ts - * const serializer = new Serializer(); - * serializer.serializeU32(305419896); - * assert(serializer.getBytes() === new Uint8Array([0x78, 0x56, 0x34, 0x12])); - * ``` - */ - @checkNumberRange(0, MAX_U32_NUMBER) - serializeU32(value: Uint32): void { - this.serializeWithFunction(DataView.prototype.setUint32, 4, value); - } - - /** - * Serializes a uint64 number. - * - * BCS layout for "uint64": Eight bytes. Binary format in little-endian representation. - * @example - * ```ts - * const serializer = new Serializer(); - * serializer.serializeU64(1311768467750121216); - * assert(serializer.getBytes() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12])); - * ``` - */ - @checkNumberRange(BigInt(0), MAX_U64_BIG_INT) - serializeU64(value: AnyNumber): void { - const low = BigInt(value.toString()) & BigInt(MAX_U32_NUMBER); - const high = BigInt(value.toString()) >> BigInt(32); - - // write little endian number - this.serializeU32(Number(low)); - this.serializeU32(Number(high)); - } - - /** - * Serializes a uint128 number. - * - * BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation. - */ - @checkNumberRange(BigInt(0), MAX_U128_BIG_INT) - serializeU128(value: AnyNumber): void { - const low = BigInt(value.toString()) & MAX_U64_BIG_INT; - const high = BigInt(value.toString()) >> BigInt(64); - - // write little endian number - this.serializeU64(low); - this.serializeU64(high); - } - - /** - * Serializes a uint256 number. - * - * BCS layout for "uint256": Sixteen bytes. Binary format in little-endian representation. - */ - @checkNumberRange(BigInt(0), MAX_U256_BIG_INT) - serializeU256(value: AnyNumber): void { - const low = BigInt(value.toString()) & MAX_U128_BIG_INT; - const high = BigInt(value.toString()) >> BigInt(128); - - // write little endian number - this.serializeU128(low); - this.serializeU128(high); - } - - /** - * Serializes a uint32 number with uleb128. - * - * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values - */ - @checkNumberRange(0, MAX_U32_NUMBER) - serializeU32AsUleb128(val: Uint32): void { - let value = val; - const valueArray = []; - while (value >>> 7 !== 0) { - valueArray.push((value & 0x7f) | 0x80); - value >>>= 7; - } - valueArray.push(value); - this.serialize(new Uint8Array(valueArray)); - } - - /** - * Returns the buffered bytes - */ - getBytes(): Bytes { - return new Uint8Array(this.buffer).slice(0, this.offset); - } -} - -/** - * Creates a decorator to make sure the arg value of the decorated function is within a range. - * @param minValue The arg value of decorated function must >= minValue - * @param maxValue The arg value of decorated function must <= maxValue - * @param message Error message - */ -function checkNumberRange(minValue: T, maxValue: T, message?: string) { - return (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => { - const childFunction = descriptor.value; - // eslint-disable-next-line no-param-reassign - descriptor.value = function deco(value: AnyNumber) { - const valueBigInt = BigInt(value.toString()); - if (valueBigInt > BigInt(maxValue.toString()) || valueBigInt < BigInt(minValue.toString())) { - throw new Error(message || "Value is out of range"); - } - childFunction.apply(this, [value]); - }; - return descriptor; - }; -} diff --git a/ecosystem/typescript/sdk_v2/src/bcs/types.ts b/ecosystem/typescript/sdk_v2/src/bcs/types.ts deleted file mode 100644 index f834aa9762d6b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/bcs/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -export type Seq = T[]; - -export type Uint8 = number; -export type Uint16 = number; -export type Uint32 = number; -export type Uint64 = bigint; -export type Uint128 = bigint; -export type Uint256 = bigint; -export type AnyNumber = bigint | number; -export type Bytes = Uint8Array; diff --git a/ecosystem/typescript/sdk_v2/src/client/types.ts b/ecosystem/typescript/sdk_v2/src/client/types.ts index 9886e5e1fc89f..6ffad79dfe9f5 100644 --- a/ecosystem/typescript/sdk_v2/src/client/types.ts +++ b/ecosystem/typescript/sdk_v2/src/client/types.ts @@ -1,5 +1,3 @@ -import { AnyNumber } from "../bcs"; - /** * A configuration object we can pass with the request to the server. * @@ -32,7 +30,7 @@ export type AptosRequest = { endpoint?: string; body?: any; contentType?: string; - params?: Record; + params?: Record; originMethod?: string; overrides?: ClientConfig; }; @@ -92,6 +90,6 @@ export class AptosApiError extends Error { } export interface PaginationArgs { - start?: AnyNumber; + start?: bigint | number; limit?: number; } diff --git a/ecosystem/typescript/sdk_v2/src/crypto/authentication_key.ts b/ecosystem/typescript/sdk_v2/src/crypto/authentication_key.ts deleted file mode 100644 index fe0ed95004f4c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/crypto/authentication_key.ts +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { sha3_256 as sha3Hash } from "@noble/hashes/sha3"; -import { Ed25519PublicKey } from "./ed25519"; -import { Bytes } from "../bcs"; -import { HexString } from "../utils"; -import { MultiEd25519PublicKey } from "./multi_ed25519"; - -/** - * Each account stores an authentication key. Authentication key enables account owners to rotate - * their private key(s) associated with the account without changing the address that hosts their account. - * @see {@link * https://aptos.dev/concepts/accounts | Account Basics} - * - * Account addresses can be derived from AuthenticationKey - */ -export class AuthenticationKey { - static readonly LENGTH: number = 32; - - static readonly MULTI_ED25519_SCHEME: number = 1; - - static readonly ED25519_SCHEME: number = 0; - - static readonly DERIVE_RESOURCE_ACCOUNT_SCHEME: number = 255; - - readonly bytes: Bytes; - - constructor(bytes: Bytes) { - if (bytes.length !== AuthenticationKey.LENGTH) { - throw new Error("Expected a byte array of length 32"); - } - this.bytes = bytes; - } - - /** - * Converts a K-of-N MultiEd25519PublicKey to AuthenticationKey with: - * `auth_key = sha3-256(p_1 | … | p_n | K | 0x01)`. `K` represents the K-of-N required for - * authenticating the transaction. `0x01` is the 1-byte scheme for multisig. - */ - static fromMultiEd25519PublicKey(publicKey: MultiEd25519PublicKey): AuthenticationKey { - const pubKeyBytes = publicKey.toBytes(); - - const bytes = new Uint8Array(pubKeyBytes.length + 1); - bytes.set(pubKeyBytes); - bytes.set([AuthenticationKey.MULTI_ED25519_SCHEME], pubKeyBytes.length); - - const hash = sha3Hash.create(); - hash.update(bytes); - - return new AuthenticationKey(hash.digest()); - } - - static fromEd25519PublicKey(publicKey: Ed25519PublicKey): AuthenticationKey { - const pubKeyBytes = publicKey.value; - - const bytes = new Uint8Array(pubKeyBytes.length + 1); - bytes.set(pubKeyBytes); - bytes.set([AuthenticationKey.ED25519_SCHEME], pubKeyBytes.length); - - const hash = sha3Hash.create(); - hash.update(bytes); - - return new AuthenticationKey(hash.digest()); - } - - /** - * Derives an account address from AuthenticationKey. Since current AccountAddress is 32 bytes, - * AuthenticationKey bytes are directly translated to AccountAddress. - */ - derivedAddress(): HexString { - return HexString.fromUint8Array(this.bytes); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/crypto/authenticator.ts b/ecosystem/typescript/sdk_v2/src/crypto/authenticator.ts deleted file mode 100644 index 3792097ab4593..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/crypto/authenticator.ts +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -/* eslint-disable @typescript-eslint/naming-convention */ -import { AccountAddress } from "../account/account_address"; -import { Serializer, Deserializer, deserializeVector, serializeVector } from "../bcs"; -import { Ed25519PublicKey, Ed25519Signature } from "./ed25519"; -import { MultiEd25519PublicKey, MultiEd25519Signature } from "./multi_ed25519"; - -export abstract class TransactionAuthenticator { - abstract serialize(serializer: Serializer): void; - - static deserialize(deserializer: Deserializer): TransactionAuthenticator { - const index = deserializer.deserializeUleb128AsU32(); - switch (index) { - case 0: - return TransactionAuthenticatorEd25519.load(deserializer); - case 1: - return TransactionAuthenticatorMultiEd25519.load(deserializer); - case 2: - return TransactionAuthenticatorMultiAgent.load(deserializer); - default: - throw new Error(`Unknown variant index for TransactionAuthenticator: ${index}`); - } - } -} - -export class TransactionAuthenticatorEd25519 extends TransactionAuthenticator { - /** - * An authenticator for single signature. - * - * @param public_key Client's public key. - * @param signature Signature of a raw transaction. - * @see {@link https://aptos.dev/guides/creating-a-signed-transaction/ | Creating a Signed Transaction} - * for details about generating a signature. - */ - constructor(public readonly public_key: Ed25519PublicKey, public readonly signature: Ed25519Signature) { - super(); - } - - serialize(serializer: Serializer): void { - serializer.serializeU32AsUleb128(0); - this.public_key.serialize(serializer); - this.signature.serialize(serializer); - } - - static load(deserializer: Deserializer): TransactionAuthenticatorEd25519 { - const public_key = Ed25519PublicKey.deserialize(deserializer); - const signature = Ed25519Signature.deserialize(deserializer); - return new TransactionAuthenticatorEd25519(public_key, signature); - } -} - -export class TransactionAuthenticatorMultiEd25519 extends TransactionAuthenticator { - /** - * An authenticator for multiple signatures. - * - * @param public_key - * @param signature - * - */ - constructor(public readonly public_key: MultiEd25519PublicKey, public readonly signature: MultiEd25519Signature) { - super(); - } - - serialize(serializer: Serializer): void { - serializer.serializeU32AsUleb128(1); - this.public_key.serialize(serializer); - this.signature.serialize(serializer); - } - - static load(deserializer: Deserializer): TransactionAuthenticatorMultiEd25519 { - const public_key = MultiEd25519PublicKey.deserialize(deserializer); - const signature = MultiEd25519Signature.deserialize(deserializer); - return new TransactionAuthenticatorMultiEd25519(public_key, signature); - } -} - -export class TransactionAuthenticatorMultiAgent extends TransactionAuthenticator { - constructor( - public readonly sender: AccountAuthenticator, - public readonly secondary_signer_addresses: Array, - public readonly secondary_signers: Array, - ) { - super(); - } - - serialize(serializer: Serializer): void { - serializer.serializeU32AsUleb128(2); - this.sender.serialize(serializer); - serializeVector(this.secondary_signer_addresses, serializer); - serializeVector(this.secondary_signers, serializer); - } - - static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent { - const sender = AccountAuthenticator.deserialize(deserializer); - const secondary_signer_addresses = deserializeVector(deserializer, AccountAddress); - const secondary_signers = deserializeVector(deserializer, AccountAuthenticator); - return new TransactionAuthenticatorMultiAgent(sender, secondary_signer_addresses, secondary_signers); - } -} - -export abstract class AccountAuthenticator { - abstract serialize(serializer: Serializer): void; - - static deserialize(deserializer: Deserializer): AccountAuthenticator { - const index = deserializer.deserializeUleb128AsU32(); - switch (index) { - case 0: - return AccountAuthenticatorEd25519.load(deserializer); - case 1: - return AccountAuthenticatorMultiEd25519.load(deserializer); - default: - throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`); - } - } -} - -export class AccountAuthenticatorEd25519 extends AccountAuthenticator { - constructor(public readonly public_key: Ed25519PublicKey, public readonly signature: Ed25519Signature) { - super(); - } - - serialize(serializer: Serializer): void { - serializer.serializeU32AsUleb128(0); - this.public_key.serialize(serializer); - this.signature.serialize(serializer); - } - - static load(deserializer: Deserializer): AccountAuthenticatorEd25519 { - const public_key = Ed25519PublicKey.deserialize(deserializer); - const signature = Ed25519Signature.deserialize(deserializer); - return new AccountAuthenticatorEd25519(public_key, signature); - } -} - -export class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator { - constructor(public readonly public_key: MultiEd25519PublicKey, public readonly signature: MultiEd25519Signature) { - super(); - } - - serialize(serializer: Serializer): void { - serializer.serializeU32AsUleb128(1); - this.public_key.serialize(serializer); - this.signature.serialize(serializer); - } - - static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519 { - const public_key = MultiEd25519PublicKey.deserialize(deserializer); - const signature = MultiEd25519Signature.deserialize(deserializer); - return new AccountAuthenticatorMultiEd25519(public_key, signature); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/crypto/ed25519.ts b/ecosystem/typescript/sdk_v2/src/crypto/ed25519.ts deleted file mode 100644 index 1385e289efc1a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/crypto/ed25519.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { Bytes, Deserializer, Serializer } from "../bcs"; - -export class Ed25519PublicKey { - static readonly LENGTH: number = 32; - - readonly value: Bytes; - - constructor(value: Bytes) { - if (value.length !== Ed25519PublicKey.LENGTH) { - throw new Error(`Ed25519PublicKey length should be ${Ed25519PublicKey.LENGTH}`); - } - this.value = value; - } - - toBytes(): Bytes { - return this.value; - } - - serialize(serializer: Serializer): void { - serializer.serializeBytes(this.value); - } - - static deserialize(deserializer: Deserializer): Ed25519PublicKey { - const value = deserializer.deserializeBytes(); - return new Ed25519PublicKey(value); - } -} - -export class Ed25519Signature { - static readonly LENGTH = 64; - - constructor(public readonly value: Bytes) { - if (value.length !== Ed25519Signature.LENGTH) { - throw new Error(`Ed25519Signature length should be ${Ed25519Signature.LENGTH}`); - } - } - - serialize(serializer: Serializer): void { - serializer.serializeBytes(this.value); - } - - static deserialize(deserializer: Deserializer): Ed25519Signature { - const value = deserializer.deserializeBytes(); - return new Ed25519Signature(value); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/crypto/index.ts b/ecosystem/typescript/sdk_v2/src/crypto/index.ts deleted file mode 100644 index 707d04a8fe2ed..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/crypto/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./ed25519"; -export * from "./multi_ed25519"; -export * from "./authentication_key"; -export * from "./authenticator"; diff --git a/ecosystem/typescript/sdk_v2/src/crypto/multi_ed25519.ts b/ecosystem/typescript/sdk_v2/src/crypto/multi_ed25519.ts deleted file mode 100644 index 0fa0bf2a6ba63..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/crypto/multi_ed25519.ts +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -/* eslint-disable no-bitwise */ -import { Bytes, Deserializer, Serializer, Uint8 } from "../bcs"; -import { Ed25519PublicKey, Ed25519Signature } from "./ed25519"; - -/** - * MultiEd25519 currently supports at most 32 signatures. - */ -const MAX_SIGNATURES_SUPPORTED = 32; - -export class MultiEd25519PublicKey { - /** - * Public key for a K-of-N multisig transaction. A K-of-N multisig transaction means that for such a - * transaction to be executed, at least K out of the N authorized signers have signed the transaction - * and passed the check conducted by the chain. - * - * @see {@link - * https://aptos.dev/guides/creating-a-signed-transaction#multisignature-transactions | Creating a Signed Transaction} - * - * @param public_keys A list of public keys - * @param threshold At least "threshold" signatures must be valid - */ - constructor(public readonly public_keys: Array, public readonly threshold: Uint8) { - if (threshold > MAX_SIGNATURES_SUPPORTED) { - throw new Error(`"threshold" cannot be larger than ${MAX_SIGNATURES_SUPPORTED}`); - } - } - - /** - * Converts a MultiEd25519PublicKey into bytes with: bytes = p1_bytes | ... | pn_bytes | threshold - */ - toBytes(): Bytes { - const bytes = new Uint8Array(this.public_keys.length * Ed25519PublicKey.LENGTH + 1); - this.public_keys.forEach((k: Ed25519PublicKey, i: number) => { - bytes.set(k.value, i * Ed25519PublicKey.LENGTH); - }); - - bytes[this.public_keys.length * Ed25519PublicKey.LENGTH] = this.threshold; - - return bytes; - } - - serialize(serializer: Serializer): void { - serializer.serializeBytes(this.toBytes()); - } - - static deserialize(deserializer: Deserializer): MultiEd25519PublicKey { - const bytes = deserializer.deserializeBytes(); - const threshold = bytes[bytes.length - 1]; - - const keys: Array = []; - - for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) { - const begin = i; - keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH))); - } - return new MultiEd25519PublicKey(keys, threshold); - } -} - -export class MultiEd25519Signature { - static BITMAP_LEN: Uint8 = 4; - - /** - * Signature for a K-of-N multisig transaction. - * - * @see {@link - * https://aptos.dev/guides/creating-a-signed-transaction#multisignature-transactions | Creating a Signed Transaction} - * - * @param signatures A list of ed25519 signatures - * @param bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth - * signature should be provided in `signatures`. Bits are read from left to right - */ - constructor(public readonly signatures: Array, public readonly bitmap: Uint8Array) { - if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) { - throw new Error(`"bitmap" length should be ${MultiEd25519Signature.BITMAP_LEN}`); - } - } - - /** - * Converts a MultiEd25519Signature into bytes with `bytes = s1_bytes | ... | sn_bytes | bitmap` - */ - toBytes(): Bytes { - const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN); - this.signatures.forEach((k: Ed25519Signature, i: number) => { - bytes.set(k.value, i * Ed25519Signature.LENGTH); - }); - - bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH); - - return bytes; - } - - /** - * Helper method to create a bitmap out of the specified bit positions - * @param bits The bitmap positions that should be set. A position starts at index 0. - * Valid position should range between 0 and 31. - * @example - * Here's an example of valid `bits` - * ``` - * [0, 2, 31] - * ``` - * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap. - * The result bitmap should be 0b1010000000000000000000000000001 - * - * @returns bitmap that is 32bit long - */ - static createBitmap(bits: Array): Uint8Array { - // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte. - // The decimal value of 0b10000000 is 128. - const firstBitInByte = 128; - const bitmap = new Uint8Array([0, 0, 0, 0]); - - // Check if duplicates exist in bits - const dupCheckSet = new Set(); - - bits.forEach((bit: number) => { - if (bit >= MAX_SIGNATURES_SUPPORTED) { - throw new Error(`Invalid bit value ${bit}.`); - } - - if (dupCheckSet.has(bit)) { - throw new Error("Duplicated bits detected."); - } - - dupCheckSet.add(bit); - - const byteOffset = Math.floor(bit / 8); - - let byte = bitmap[byteOffset]; - - byte |= firstBitInByte >> bit % 8; - - bitmap[byteOffset] = byte; - }); - - return bitmap; - } - - serialize(serializer: Serializer): void { - serializer.serializeBytes(this.toBytes()); - } - - static deserialize(deserializer: Deserializer): MultiEd25519Signature { - const bytes = deserializer.deserializeBytes(); - const bitmap = bytes.subarray(bytes.length - 4); - - const sigs: Array = []; - - for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) { - const begin = i; - sigs.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH))); - } - return new MultiEd25519Signature(sigs, bitmap); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/index.ts b/ecosystem/typescript/sdk_v2/src/index.ts index 02085c3678f84..fd1a71add0df2 100644 --- a/ecosystem/typescript/sdk_v2/src/index.ts +++ b/ecosystem/typescript/sdk_v2/src/index.ts @@ -1,9 +1,5 @@ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 -export * from "./account"; export * from "./api"; -export * from "./bcs"; export * from "./client"; -export * from "./crypto"; -export * from "./utils"; diff --git a/ecosystem/typescript/sdk_v2/src/internal/account.ts b/ecosystem/typescript/sdk_v2/src/internal/account.ts deleted file mode 100644 index 4b38d61dd6785..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/internal/account.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { AptosConfig } from "../api/aptos_config"; -import { AnyNumber } from "../bcs"; -import { get } from "../client"; -import { PaginationArgs } from "../client/types"; -import { Gen } from "../types"; -import { MaybeHexString, HexString, paginateWithCursor } from "../utils"; - -export async function getData(aptosConfig: AptosConfig, accountAddress: MaybeHexString): Promise { - const { data } = await get<{}, Gen.AccountData>({ - url: aptosConfig.network, - endpoint: `accounts/${HexString.ensure(accountAddress).hex()}`, - originMethod: "getData", - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} - -export async function getModules( - aptosConfig: AptosConfig, - accountAddress: MaybeHexString, - query?: { ledgerVersion?: AnyNumber }, -): Promise { - const response = await paginateWithCursor<{}, Gen.MoveModuleBytecode[]>({ - url: aptosConfig.network, - endpoint: `accounts/${HexString.ensure(accountAddress).hex()}/modules`, - params: { ledger_version: query?.ledgerVersion, limit: 1000 }, - originMethod: "getModules", - overrides: { ...aptosConfig.clientConfig }, - }); - return response; -} - -/** - * Queries module associated with given account by module name - * - * Note: In order to get all account resources, this function may call the API - * multiple times as it paginates. - * - * @param accountAddress Hex-encoded 32 byte Aptos account address - * @param moduleName The name of the module - * @param query.ledgerVersion Specifies ledger version of transactions. By default latest version will be used - * @returns Specified module. - * Module is represented by MoveModule interface. It contains module `bytecode` and `abi`, - * which JSON representation of a module - */ -export async function getModule( - aptosConfig: AptosConfig, - accountAddress: MaybeHexString, - moduleName: string, - query?: { ledgerVersion?: AnyNumber }, -): Promise { - const { data } = await get<{}, Gen.MoveModuleBytecode>({ - url: aptosConfig.network, - endpoint: `accounts/${HexString.ensure(accountAddress).hex()}/module/${moduleName}`, - originMethod: "getModule", - params: { ledger_version: query?.ledgerVersion }, - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} - -export async function getTransactions( - aptosConfig: AptosConfig, - accountAddress: MaybeHexString, - query?: PaginationArgs, -): Promise { - const { data } = await get<{}, Gen.Transaction[]>({ - url: aptosConfig.network, - endpoint: `accounts/${HexString.ensure(accountAddress).hex()}/transactions`, - originMethod: "getTransactions", - params: { start: query?.start, limit: query?.limit }, - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} - -export async function getResources( - aptosConfig: AptosConfig, - accountAddress: MaybeHexString, - query?: { ledgerVersion?: AnyNumber }, -): Promise { - const out = await paginateWithCursor<{}, Gen.MoveResource[]>({ - url: aptosConfig.network, - endpoint: `accounts/${accountAddress}/resources`, - params: { ledger_version: query?.ledgerVersion, limit: 9999 }, - originMethod: "getResources", - overrides: { ...aptosConfig.clientConfig }, - }); - return out; -} - -export async function getResource( - aptosConfig: AptosConfig, - accountAddress: MaybeHexString, - resourceType: Gen.MoveStructTag, - query?: { ledgerVersion?: AnyNumber }, -): Promise { - const { data } = await get<{}, Gen.MoveResource>({ - url: aptosConfig.network, - endpoint: `accounts/${HexString.ensure(accountAddress).hex()}/resource/${resourceType}`, - originMethod: "getResource", - params: { ledger_version: query?.ledgerVersion }, - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} diff --git a/ecosystem/typescript/sdk_v2/src/internal/general.ts b/ecosystem/typescript/sdk_v2/src/internal/general.ts deleted file mode 100644 index 4da9fb41a5ad3..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/internal/general.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { AptosConfig } from "../api/aptos_config"; -import { get, post } from "../client"; -import { Gen } from "../types"; - -// TODO memoize -export async function getChainId(aptosConfig: AptosConfig): Promise { - const { data } = await get<{}, Gen.IndexResponse>({ - url: aptosConfig.network, - originMethod: "getChainId", - overrides: { ...aptosConfig.clientConfig }, - }); - return data.chain_id; -} - -export async function getLedgerInfo(aptosConfig: AptosConfig): Promise { - const { data } = await get<{}, Gen.IndexResponse>({ - url: aptosConfig.network, - originMethod: "getLedgerInfo", - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} - -export async function view( - aptosConfig: AptosConfig, - payload: Gen.ViewRequest, - ledger_version?: string, -): Promise { - const { data } = await post({ - url: aptosConfig.network, - body: payload, - endpoint: "view", - originMethod: "view", - params: { ledger_version }, - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} - -export async function getBlockByHeight( - aptosConfig: AptosConfig, - blockHeight: number, - withTransactions?: boolean, -): Promise { - const { data } = await get<{}, Gen.Block>({ - url: aptosConfig.network, - endpoint: `blocks/by_height/${blockHeight}`, - originMethod: "getBlockByHeight", - params: { with_transactions: withTransactions }, - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} - -export async function getBlockByVersion( - aptosConfig: AptosConfig, - version: number, - withTransactions?: boolean, -): Promise { - const { data } = await get<{}, Gen.Block>({ - url: aptosConfig.network, - endpoint: `blocks/by_version/${version}`, - originMethod: "getBlockByVersion", - params: { with_transactions: withTransactions }, - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} diff --git a/ecosystem/typescript/sdk_v2/src/internal/transaction.ts b/ecosystem/typescript/sdk_v2/src/internal/transaction.ts deleted file mode 100644 index 24bd76210432d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/internal/transaction.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { AptosConfig } from "../api/aptos_config"; -import { get } from "../client"; -import { Gen } from "../types"; - -export async function estimateGasPrice(aptosConfig: AptosConfig): Promise { - const { data } = await get<{}, Gen.GasEstimation>({ - url: aptosConfig.network, - endpoint: "estimate_gas_price", - originMethod: "estimateGasPrice", - overrides: { ...aptosConfig.clientConfig }, - }); - return data; -} diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/index.ts b/ecosystem/typescript/sdk_v2/src/types/generated/index.ts deleted file mode 100644 index e7311c673a7c9..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/index.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export type { AccountData } from './models/AccountData'; -export type { AccountSignature } from './models/AccountSignature'; -export type { AccountSignature_Ed25519Signature } from './models/AccountSignature_Ed25519Signature'; -export type { AccountSignature_MultiEd25519Signature } from './models/AccountSignature_MultiEd25519Signature'; -export type { Address } from './models/Address'; -export type { AptosError } from './models/AptosError'; -export { AptosErrorCode } from './models/AptosErrorCode'; -export type { Block } from './models/Block'; -export type { BlockMetadataTransaction } from './models/BlockMetadataTransaction'; -export type { DecodedTableData } from './models/DecodedTableData'; -export type { DeletedTableData } from './models/DeletedTableData'; -export type { DeleteModule } from './models/DeleteModule'; -export type { DeleteResource } from './models/DeleteResource'; -export type { DeleteTableItem } from './models/DeleteTableItem'; -export type { DirectWriteSet } from './models/DirectWriteSet'; -export type { Ed25519Signature } from './models/Ed25519Signature'; -export type { EncodeSubmissionRequest } from './models/EncodeSubmissionRequest'; -export type { EntryFunctionId } from './models/EntryFunctionId'; -export type { EntryFunctionPayload } from './models/EntryFunctionPayload'; -export type { Event } from './models/Event'; -export type { EventGuid } from './models/EventGuid'; -export type { GasEstimation } from './models/GasEstimation'; -export type { GenesisPayload } from './models/GenesisPayload'; -export type { GenesisPayload_WriteSetPayload } from './models/GenesisPayload_WriteSetPayload'; -export type { GenesisTransaction } from './models/GenesisTransaction'; -export type { HashValue } from './models/HashValue'; -export type { HealthCheckSuccess } from './models/HealthCheckSuccess'; -export type { HexEncodedBytes } from './models/HexEncodedBytes'; -export type { IdentifierWrapper } from './models/IdentifierWrapper'; -export type { IndexResponse } from './models/IndexResponse'; -export type { ModuleBundlePayload } from './models/ModuleBundlePayload'; -export type { MoveAbility } from './models/MoveAbility'; -export type { MoveFunction } from './models/MoveFunction'; -export type { MoveFunctionGenericTypeParam } from './models/MoveFunctionGenericTypeParam'; -export { MoveFunctionVisibility } from './models/MoveFunctionVisibility'; -export type { MoveModule } from './models/MoveModule'; -export type { MoveModuleBytecode } from './models/MoveModuleBytecode'; -export type { MoveModuleId } from './models/MoveModuleId'; -export type { MoveResource } from './models/MoveResource'; -export type { MoveScriptBytecode } from './models/MoveScriptBytecode'; -export type { MoveStruct } from './models/MoveStruct'; -export type { MoveStructField } from './models/MoveStructField'; -export type { MoveStructGenericTypeParam } from './models/MoveStructGenericTypeParam'; -export type { MoveStructTag } from './models/MoveStructTag'; -export type { MoveStructValue } from './models/MoveStructValue'; -export type { MoveType } from './models/MoveType'; -export type { MoveValue } from './models/MoveValue'; -export type { MultiAgentSignature } from './models/MultiAgentSignature'; -export type { MultiEd25519Signature } from './models/MultiEd25519Signature'; -export type { MultisigPayload } from './models/MultisigPayload'; -export type { MultisigTransactionPayload } from './models/MultisigTransactionPayload'; -export type { PendingTransaction } from './models/PendingTransaction'; -export type { RawTableItemRequest } from './models/RawTableItemRequest'; -export { RoleType } from './models/RoleType'; -export type { ScriptPayload } from './models/ScriptPayload'; -export type { ScriptWriteSet } from './models/ScriptWriteSet'; -export type { StateCheckpointTransaction } from './models/StateCheckpointTransaction'; -export type { StateKeyWrapper } from './models/StateKeyWrapper'; -export type { SubmitTransactionRequest } from './models/SubmitTransactionRequest'; -export type { TableItemRequest } from './models/TableItemRequest'; -export type { Transaction } from './models/Transaction'; -export type { Transaction_BlockMetadataTransaction } from './models/Transaction_BlockMetadataTransaction'; -export type { Transaction_GenesisTransaction } from './models/Transaction_GenesisTransaction'; -export type { Transaction_PendingTransaction } from './models/Transaction_PendingTransaction'; -export type { Transaction_StateCheckpointTransaction } from './models/Transaction_StateCheckpointTransaction'; -export type { Transaction_UserTransaction } from './models/Transaction_UserTransaction'; -export type { TransactionPayload } from './models/TransactionPayload'; -export type { TransactionPayload_EntryFunctionPayload } from './models/TransactionPayload_EntryFunctionPayload'; -export type { TransactionPayload_ModuleBundlePayload } from './models/TransactionPayload_ModuleBundlePayload'; -export type { TransactionPayload_MultisigPayload } from './models/TransactionPayload_MultisigPayload'; -export type { TransactionPayload_ScriptPayload } from './models/TransactionPayload_ScriptPayload'; -export type { TransactionsBatchSingleSubmissionFailure } from './models/TransactionsBatchSingleSubmissionFailure'; -export type { TransactionsBatchSubmissionResult } from './models/TransactionsBatchSubmissionResult'; -export type { TransactionSignature } from './models/TransactionSignature'; -export type { TransactionSignature_Ed25519Signature } from './models/TransactionSignature_Ed25519Signature'; -export type { TransactionSignature_MultiAgentSignature } from './models/TransactionSignature_MultiAgentSignature'; -export type { TransactionSignature_MultiEd25519Signature } from './models/TransactionSignature_MultiEd25519Signature'; -export type { U128 } from './models/U128'; -export type { U256 } from './models/U256'; -export type { U64 } from './models/U64'; -export type { UserTransaction } from './models/UserTransaction'; -export type { VersionedEvent } from './models/VersionedEvent'; -export type { ViewRequest } from './models/ViewRequest'; -export type { WriteModule } from './models/WriteModule'; -export type { WriteResource } from './models/WriteResource'; -export type { WriteSet } from './models/WriteSet'; -export type { WriteSet_DirectWriteSet } from './models/WriteSet_DirectWriteSet'; -export type { WriteSet_ScriptWriteSet } from './models/WriteSet_ScriptWriteSet'; -export type { WriteSetChange } from './models/WriteSetChange'; -export type { WriteSetChange_DeleteModule } from './models/WriteSetChange_DeleteModule'; -export type { WriteSetChange_DeleteResource } from './models/WriteSetChange_DeleteResource'; -export type { WriteSetChange_DeleteTableItem } from './models/WriteSetChange_DeleteTableItem'; -export type { WriteSetChange_WriteModule } from './models/WriteSetChange_WriteModule'; -export type { WriteSetChange_WriteResource } from './models/WriteSetChange_WriteResource'; -export type { WriteSetChange_WriteTableItem } from './models/WriteSetChange_WriteTableItem'; -export type { WriteSetPayload } from './models/WriteSetPayload'; -export type { WriteTableItem } from './models/WriteTableItem'; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountData.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountData.ts deleted file mode 100644 index 8df40aa857e6d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountData.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HexEncodedBytes } from './HexEncodedBytes'; -import type { U64 } from './U64'; - -/** - * Account data - * - * A simplified version of the onchain Account resource - */ -export type AccountData = { - sequence_number: U64; - authentication_key: HexEncodedBytes; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature.ts deleted file mode 100644 index 576d1507de68d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { AccountSignature_Ed25519Signature } from './AccountSignature_Ed25519Signature'; -import type { AccountSignature_MultiEd25519Signature } from './AccountSignature_MultiEd25519Signature'; - -/** - * Account signature scheme - * - * The account signature scheme allows you to have two types of accounts: - * - * 1. A single Ed25519 key account, one private key - * 2. A k-of-n multi-Ed25519 key account, multiple private keys, such that k-of-n must sign a transaction. - */ -export type AccountSignature = (AccountSignature_Ed25519Signature | AccountSignature_MultiEd25519Signature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_Ed25519Signature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_Ed25519Signature.ts deleted file mode 100644 index 3d91da519364e..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_Ed25519Signature.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Ed25519Signature } from './Ed25519Signature'; - -export type AccountSignature_Ed25519Signature = ({ - type: string; -} & Ed25519Signature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_MultiEd25519Signature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_MultiEd25519Signature.ts deleted file mode 100644 index 11acab2ebd410..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/AccountSignature_MultiEd25519Signature.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MultiEd25519Signature } from './MultiEd25519Signature'; - -export type AccountSignature_MultiEd25519Signature = ({ - type: string; -} & MultiEd25519Signature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Address.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Address.ts deleted file mode 100644 index 03c32f6b45d1e..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Address.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * A hex encoded 32 byte Aptos account address. - * - * This is represented in a string as a 64 character hex string, sometimes - * shortened by stripping leading 0s, and adding a 0x. - * - * For example, address 0x0000000000000000000000000000000000000000000000000000000000000001 is represented as 0x1. - * - */ -export type Address = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/AptosError.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/AptosError.ts deleted file mode 100644 index ed24d55242bef..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/AptosError.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { AptosErrorCode } from './AptosErrorCode'; - -/** - * This is the generic struct we use for all API errors, it contains a string - * message and an Aptos API specific error code. - */ -export type AptosError = { - /** - * A message describing the error - */ - message: string; - error_code: AptosErrorCode; - /** - * A code providing VM error details when submitting transactions to the VM - */ - vm_error_code?: number; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/AptosErrorCode.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/AptosErrorCode.ts deleted file mode 100644 index a20bac5d55260..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/AptosErrorCode.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * These codes provide more granular error information beyond just the HTTP - * status code of the response. - */ -export enum AptosErrorCode { - ACCOUNT_NOT_FOUND = 'account_not_found', - RESOURCE_NOT_FOUND = 'resource_not_found', - MODULE_NOT_FOUND = 'module_not_found', - STRUCT_FIELD_NOT_FOUND = 'struct_field_not_found', - VERSION_NOT_FOUND = 'version_not_found', - TRANSACTION_NOT_FOUND = 'transaction_not_found', - TABLE_ITEM_NOT_FOUND = 'table_item_not_found', - BLOCK_NOT_FOUND = 'block_not_found', - STATE_VALUE_NOT_FOUND = 'state_value_not_found', - VERSION_PRUNED = 'version_pruned', - BLOCK_PRUNED = 'block_pruned', - INVALID_INPUT = 'invalid_input', - INVALID_TRANSACTION_UPDATE = 'invalid_transaction_update', - SEQUENCE_NUMBER_TOO_OLD = 'sequence_number_too_old', - VM_ERROR = 'vm_error', - HEALTH_CHECK_FAILED = 'health_check_failed', - MEMPOOL_IS_FULL = 'mempool_is_full', - INTERNAL_ERROR = 'internal_error', - WEB_FRAMEWORK_ERROR = 'web_framework_error', - BCS_NOT_SUPPORTED = 'bcs_not_supported', - API_DISABLED = 'api_disabled', -} diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Block.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Block.ts deleted file mode 100644 index e6c2a57e31af2..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Block.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HashValue } from './HashValue'; -import type { Transaction } from './Transaction'; -import type { U64 } from './U64'; - -/** - * A Block with or without transactions - * - * This contains the information about a transactions along with - * associated transactions if requested - */ -export type Block = { - block_height: U64; - block_hash: HashValue; - block_timestamp: U64; - first_version: U64; - last_version: U64; - /** - * The transactions in the block in sequential order - */ - transactions?: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/BlockMetadataTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/BlockMetadataTransaction.ts deleted file mode 100644 index 9ec5828deedd9..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/BlockMetadataTransaction.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { Event } from './Event'; -import type { HashValue } from './HashValue'; -import type { U64 } from './U64'; -import type { WriteSetChange } from './WriteSetChange'; - -/** - * A block metadata transaction - * - * This signifies the beginning of a block, and contains information - * about the specific block - */ -export type BlockMetadataTransaction = { - version: U64; - hash: HashValue; - state_change_hash: HashValue; - event_root_hash: HashValue; - state_checkpoint_hash?: HashValue; - gas_used: U64; - /** - * Whether the transaction was successful - */ - success: boolean; - /** - * The VM status of the transaction, can tell useful information in a failure - */ - vm_status: string; - accumulator_root_hash: HashValue; - /** - * Final state of resources changed by the transaction - */ - changes: Array; - id: HashValue; - epoch: U64; - round: U64; - /** - * The events emitted at the block creation - */ - events: Array; - /** - * Previous block votes - */ - previous_block_votes_bitvec: Array; - proposer: Address; - /** - * The indices of the proposers who failed to propose - */ - failed_proposer_indices: Array; - timestamp: U64; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/DecodedTableData.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/DecodedTableData.ts deleted file mode 100644 index 83571f4fe5287..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/DecodedTableData.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Decoded table data - */ -export type DecodedTableData = { - /** - * Key of table in JSON - */ - key: any; - /** - * Type of key - */ - key_type: string; - /** - * Value of table in JSON - */ - value: any; - /** - * Type of value - */ - value_type: string; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteModule.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteModule.ts deleted file mode 100644 index 44d49ce0ca66a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteModule.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { MoveModuleId } from './MoveModuleId'; - -/** - * Delete a module - */ -export type DeleteModule = { - address: Address; - /** - * State key hash - */ - state_key_hash: string; - module: MoveModuleId; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteResource.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteResource.ts deleted file mode 100644 index ff863a9491086..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteResource.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { MoveStructTag } from './MoveStructTag'; - -/** - * Delete a resource - */ -export type DeleteResource = { - address: Address; - /** - * State key hash - */ - state_key_hash: string; - resource: MoveStructTag; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteTableItem.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteTableItem.ts deleted file mode 100644 index c2655d4f5be06..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeleteTableItem.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DeletedTableData } from './DeletedTableData'; -import type { HexEncodedBytes } from './HexEncodedBytes'; - -/** - * Delete a table item - */ -export type DeleteTableItem = { - state_key_hash: string; - handle: HexEncodedBytes; - key: HexEncodedBytes; - data?: DeletedTableData; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeletedTableData.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/DeletedTableData.ts deleted file mode 100644 index ccf4fd6e9b3cb..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/DeletedTableData.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Deleted table data - */ -export type DeletedTableData = { - /** - * Deleted key - */ - key: any; - /** - * Deleted key type - */ - key_type: string; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/DirectWriteSet.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/DirectWriteSet.ts deleted file mode 100644 index 1c09731f04fe6..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/DirectWriteSet.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Event } from './Event'; -import type { WriteSetChange } from './WriteSetChange'; - -export type DirectWriteSet = { - changes: Array; - events: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Ed25519Signature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Ed25519Signature.ts deleted file mode 100644 index 9d277a9e89052..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Ed25519Signature.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HexEncodedBytes } from "./HexEncodedBytes"; - -/** - * A single Ed25519 signature - */ -export type Ed25519Signature = { - public_key: HexEncodedBytes; - signature: HexEncodedBytes; -}; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/EncodeSubmissionRequest.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/EncodeSubmissionRequest.ts deleted file mode 100644 index 52e6f903e6f00..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/EncodeSubmissionRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { TransactionPayload } from './TransactionPayload'; -import type { U64 } from './U64'; - -/** - * Request to encode a submission - */ -export type EncodeSubmissionRequest = { - sender: Address; - sequence_number: U64; - max_gas_amount: U64; - gas_unit_price: U64; - expiration_timestamp_secs: U64; - payload: TransactionPayload; - /** - * Secondary signer accounts of the request for Multi-agent - */ - secondary_signers?: Array
; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionId.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionId.ts deleted file mode 100644 index f38310d0c2a1c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionId.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Entry function id is string representation of a entry function defined on-chain. - * - * Format: `{address}::{module name}::{function name}` - * - * Both `module name` and `function name` are case-sensitive. - * - */ -export type EntryFunctionId = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionPayload.ts deleted file mode 100644 index 78a3ee67d866d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/EntryFunctionPayload.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { EntryFunctionId } from './EntryFunctionId'; -import type { MoveType } from './MoveType'; - -/** - * Payload which runs a single entry function - */ -export type EntryFunctionPayload = { - function: EntryFunctionId; - /** - * Type arguments of the function - */ - type_arguments: Array; - /** - * Arguments of the function - */ - arguments: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Event.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Event.ts deleted file mode 100644 index a160a00cc0dde..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Event.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { EventGuid } from './EventGuid'; -import type { MoveType } from './MoveType'; -import type { U64 } from './U64'; - -/** - * An event from a transaction - */ -export type Event = { - guid: EventGuid; - sequence_number: U64; - type: MoveType; - /** - * The JSON representation of the event - */ - data: any; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/EventGuid.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/EventGuid.ts deleted file mode 100644 index 928ad847f5797..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/EventGuid.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { U64 } from './U64'; - -export type EventGuid = { - creation_number: U64; - account_address: Address; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/GasEstimation.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/GasEstimation.ts deleted file mode 100644 index f8ebd699311c9..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/GasEstimation.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Struct holding the outputs of the estimate gas API - */ -export type GasEstimation = { - /** - * The deprioritized estimate for the gas unit price - */ - deprioritized_gas_estimate?: number; - /** - * The current estimate for the gas unit price - */ - gas_estimate: number; - /** - * The prioritized estimate for the gas unit price - */ - prioritized_gas_estimate?: number; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload.ts deleted file mode 100644 index 66d653a68f279..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { GenesisPayload_WriteSetPayload } from './GenesisPayload_WriteSetPayload'; - -/** - * The writeset payload of the Genesis transaction - */ -export type GenesisPayload = GenesisPayload_WriteSetPayload; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload_WriteSetPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload_WriteSetPayload.ts deleted file mode 100644 index a61275063a40a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisPayload_WriteSetPayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteSetPayload } from './WriteSetPayload'; - -export type GenesisPayload_WriteSetPayload = ({ - type: string; -} & WriteSetPayload); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisTransaction.ts deleted file mode 100644 index 563a8be8fce78..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/GenesisTransaction.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Event } from './Event'; -import type { GenesisPayload } from './GenesisPayload'; -import type { HashValue } from './HashValue'; -import type { U64 } from './U64'; -import type { WriteSetChange } from './WriteSetChange'; - -/** - * The genesis transaction - * - * This only occurs at the genesis transaction (version 0) - */ -export type GenesisTransaction = { - version: U64; - hash: HashValue; - state_change_hash: HashValue; - event_root_hash: HashValue; - state_checkpoint_hash?: HashValue; - gas_used: U64; - /** - * Whether the transaction was successful - */ - success: boolean; - /** - * The VM status of the transaction, can tell useful information in a failure - */ - vm_status: string; - accumulator_root_hash: HashValue; - /** - * Final state of resources changed by the transaction - */ - changes: Array; - payload: GenesisPayload; - /** - * Events emitted during genesis - */ - events: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/HashValue.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/HashValue.ts deleted file mode 100644 index a296dd84c2a4b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/HashValue.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export type HashValue = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/HealthCheckSuccess.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/HealthCheckSuccess.ts deleted file mode 100644 index ff98f0ed77d30..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/HealthCheckSuccess.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Representation of a successful healthcheck - */ -export type HealthCheckSuccess = { - message: string; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/HexEncodedBytes.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/HexEncodedBytes.ts deleted file mode 100644 index d4a21baf0ce47..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/HexEncodedBytes.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * All bytes (Vec) data is represented as hex-encoded string prefixed with `0x` and fulfilled with - * two hex digits per byte. - * - * Unlike the `Address` type, HexEncodedBytes will not trim any zeros. - * - */ -export type HexEncodedBytes = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/IdentifierWrapper.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/IdentifierWrapper.ts deleted file mode 100644 index 8bf5d9a71895a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/IdentifierWrapper.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export type IdentifierWrapper = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/IndexResponse.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/IndexResponse.ts deleted file mode 100644 index 1ca2519b1a62d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/IndexResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { RoleType } from './RoleType'; -import type { U64 } from './U64'; - -/** - * The struct holding all data returned to the client by the - * index endpoint (i.e., GET "/"). Only for responding in JSON - */ -export type IndexResponse = { - /** - * Chain ID of the current chain - */ - chain_id: number; - epoch: U64; - ledger_version: U64; - oldest_ledger_version: U64; - ledger_timestamp: U64; - node_role: RoleType; - oldest_block_height: U64; - block_height: U64; - /** - * Git hash of the build of the API endpoint. Can be used to determine the exact - * software version used by the API endpoint. - */ - git_hash?: string; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/ModuleBundlePayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/ModuleBundlePayload.ts deleted file mode 100644 index be34a1f42ecbd..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/ModuleBundlePayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MoveModuleBytecode } from './MoveModuleBytecode'; - -export type ModuleBundlePayload = { - modules: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveAbility.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveAbility.ts deleted file mode 100644 index 311c5db9003a8..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveAbility.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export type MoveAbility = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunction.ts deleted file mode 100644 index 4ce3ad729c26c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunction.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { IdentifierWrapper } from './IdentifierWrapper'; -import type { MoveFunctionGenericTypeParam } from './MoveFunctionGenericTypeParam'; -import type { MoveFunctionVisibility } from './MoveFunctionVisibility'; -import type { MoveType } from './MoveType'; - -/** - * Move function - */ -export type MoveFunction = { - name: IdentifierWrapper; - visibility: MoveFunctionVisibility; - /** - * Whether the function can be called as an entry function directly in a transaction - */ - is_entry: boolean; - /** - * Whether the function is a view function or not - */ - is_view: boolean; - /** - * Generic type params associated with the Move function - */ - generic_type_params: Array; - /** - * Parameters associated with the move function - */ - params: Array; - /** - * Return type of the function - */ - return: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionGenericTypeParam.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionGenericTypeParam.ts deleted file mode 100644 index c0776fe5cab0c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionGenericTypeParam.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MoveAbility } from './MoveAbility'; - -/** - * Move function generic type param - */ -export type MoveFunctionGenericTypeParam = { - /** - * Move abilities tied to the generic type param and associated with the function that uses it - */ - constraints: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionVisibility.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionVisibility.ts deleted file mode 100644 index a1684d5c84713..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveFunctionVisibility.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Move function visibility - */ -export enum MoveFunctionVisibility { - PRIVATE = 'private', - PUBLIC = 'public', - FRIEND = 'friend', -} diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModule.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModule.ts deleted file mode 100644 index f2d127ff28614..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModule.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { IdentifierWrapper } from './IdentifierWrapper'; -import type { MoveFunction } from './MoveFunction'; -import type { MoveModuleId } from './MoveModuleId'; -import type { MoveStruct } from './MoveStruct'; - -/** - * A Move module - */ -export type MoveModule = { - address: Address; - name: IdentifierWrapper; - /** - * Friends of the module - */ - friends: Array; - /** - * Public functions of the module - */ - exposed_functions: Array; - /** - * Structs of the module - */ - structs: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleBytecode.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleBytecode.ts deleted file mode 100644 index 9348d105310a5..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleBytecode.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HexEncodedBytes } from './HexEncodedBytes'; -import type { MoveModule } from './MoveModule'; - -/** - * Move module bytecode along with it's ABI - */ -export type MoveModuleBytecode = { - bytecode: HexEncodedBytes; - abi?: MoveModule; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleId.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleId.ts deleted file mode 100644 index 5ad74349b690b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveModuleId.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Move module id is a string representation of Move module. - * - * Format: `{address}::{module name}` - * - * `address` should be hex-encoded 32 byte account address that is prefixed with `0x`. - * - * Module name is case-sensitive. - * - */ -export type MoveModuleId = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveResource.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveResource.ts deleted file mode 100644 index 544bfa47be053..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveResource.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MoveStructTag } from './MoveStructTag'; -import type { MoveStructValue } from './MoveStructValue'; - -/** - * A parsed Move resource - */ -export type MoveResource = { - type: MoveStructTag; - data: MoveStructValue; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveScriptBytecode.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveScriptBytecode.ts deleted file mode 100644 index 109a6cf6bfcf0..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveScriptBytecode.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HexEncodedBytes } from './HexEncodedBytes'; -import type { MoveFunction } from './MoveFunction'; - -/** - * Move script bytecode - */ -export type MoveScriptBytecode = { - bytecode: HexEncodedBytes; - abi?: MoveFunction; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStruct.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStruct.ts deleted file mode 100644 index 74dd1d8766e6f..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStruct.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { IdentifierWrapper } from './IdentifierWrapper'; -import type { MoveAbility } from './MoveAbility'; -import type { MoveStructField } from './MoveStructField'; -import type { MoveStructGenericTypeParam } from './MoveStructGenericTypeParam'; - -/** - * A move struct - */ -export type MoveStruct = { - name: IdentifierWrapper; - /** - * Whether the struct is a native struct of Move - */ - is_native: boolean; - /** - * Abilities associated with the struct - */ - abilities: Array; - /** - * Generic types associated with the struct - */ - generic_type_params: Array; - /** - * Fields associated with the struct - */ - fields: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructField.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructField.ts deleted file mode 100644 index 3f20b0bfbb72b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructField.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { IdentifierWrapper } from './IdentifierWrapper'; -import type { MoveType } from './MoveType'; - -/** - * Move struct field - */ -export type MoveStructField = { - name: IdentifierWrapper; - type: MoveType; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructGenericTypeParam.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructGenericTypeParam.ts deleted file mode 100644 index 5ff3317db916d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructGenericTypeParam.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MoveAbility } from './MoveAbility'; - -/** - * Move generic type param - */ -export type MoveStructGenericTypeParam = { - /** - * Move abilities tied to the generic type param and associated with the type that uses it - */ - constraints: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructTag.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructTag.ts deleted file mode 100644 index 254235ddd4b0a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructTag.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * String representation of a MoveStructTag (on-chain Move struct type). This exists so you - * can specify MoveStructTags as path / query parameters, e.g. for get_events_by_event_handle. - * - * It is a combination of: - * 1. `move_module_address`, `module_name` and `struct_name`, all joined by `::` - * 2. `struct generic type parameters` joined by `, ` - * - * Examples: - * * `0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>` - * * `0x1::account::Account` - * - * Note: - * 1. Empty chars should be ignored when comparing 2 struct tag ids. - * 2. When used in an URL path, should be encoded by url-encoding (AKA percent-encoding). - * - * See [doc](https://aptos.dev/concepts/accounts) for more details. - * - */ -export type MoveStructTag = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructValue.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructValue.ts deleted file mode 100644 index 11d4da45739bc..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveStructValue.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * This is a JSON representation of some data within an account resource. More specifically, - * it is a map of strings to arbitrary JSON values / objects, where the keys are top level - * fields within the given resource. - * - * To clarify, you might query for 0x1::account::Account and see the example data. - * - * Move `bool` type value is serialized into `boolean`. - * - * Move `u8`, `u16` and `u32` type value is serialized into `integer`. - * - * Move `u64`, `u128` and `u256` type value is serialized into `string`. - * - * Move `address` type value (32 byte Aptos account address) is serialized into a HexEncodedBytes string. - * For example: - * - `0x1` - * - `0x1668f6be25668c1a17cd8caf6b8d2f25` - * - * Move `vector` type value is serialized into `array`, except `vector` which is serialized into a - * HexEncodedBytes string with `0x` prefix. - * For example: - * - `vector{255, 255}` => `["255", "255"]` - * - `vector{255, 255}` => `0xffff` - * - * Move `struct` type value is serialized into `object` that looks like this (except some Move stdlib types, see the following section): - * ```json - * { - * field1_name: field1_value, - * field2_name: field2_value, - * ...... - * } - * ``` - * - * For example: - * `{ "created": "0xa550c18", "role_id": "0" }` - * - * **Special serialization for Move stdlib types**: - * - [0x1::string::String](https://github.com/aptos-labs/aptos-core/blob/main/language/move-stdlib/docs/ascii.md) - * is serialized into `string`. For example, struct value `0x1::string::String{bytes: b"Hello World!"}` - * is serialized as `"Hello World!"` in JSON. - * - */ - export type MoveStructValue = { - }; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveType.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveType.ts deleted file mode 100644 index 226183770b27c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveType.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * String representation of an on-chain Move type tag that is exposed in transaction payload. - * Values: - * - bool - * - u8 - * - u16 - * - u32 - * - u64 - * - u128 - * - u256 - * - address - * - signer - * - vector: `vector<{non-reference MoveTypeId}>` - * - struct: `{address}::{module_name}::{struct_name}::<{generic types}>` - * - * Vector type value examples: - * - `vector` - * - `vector>` - * - `vector<0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>>` - * - * Struct type value examples: - * - `0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin> - * - `0x1::account::Account` - * - * Note: - * 1. Empty chars should be ignored when comparing 2 struct tag ids. - * 2. When used in an URL path, should be encoded by url-encoding (AKA percent-encoding). - * - */ -export type MoveType = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveValue.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveValue.ts deleted file mode 100644 index 899490be8b4da..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MoveValue.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { HexEncodedBytes } from './HexEncodedBytes'; -import type { MoveStructValue } from './MoveStructValue'; -import type { U128 } from './U128'; -import type { U256 } from './U256'; -import type { U64 } from './U64'; - -/** - * An enum of the possible Move value types - */ -export type MoveValue = (number | U64 | U128 | U256 | boolean | Address | Array | HexEncodedBytes | MoveStructValue | string); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultiAgentSignature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MultiAgentSignature.ts deleted file mode 100644 index f07b81734f79e..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultiAgentSignature.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { AccountSignature } from './AccountSignature'; -import type { Address } from './Address'; - -/** - * Multi agent signature for multi agent transactions - * - * This allows you to have transactions across multiple accounts - */ -export type MultiAgentSignature = { - sender: AccountSignature; - /** - * The other involved parties' addresses - */ - secondary_signer_addresses: Array
; - /** - * The associated signatures, in the same order as the secondary addresses - */ - secondary_signers: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultiEd25519Signature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MultiEd25519Signature.ts deleted file mode 100644 index 29809a29c6c05..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultiEd25519Signature.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HexEncodedBytes } from './HexEncodedBytes'; - -/** - * A Ed25519 multi-sig signature - * - * This allows k-of-n signing for a transaction - */ -export type MultiEd25519Signature = { - /** - * The public keys for the Ed25519 signature - */ - public_keys: Array; - /** - * Signature associated with the public keys in the same order - */ - signatures: Array; - /** - * The number of signatures required for a successful transaction - */ - threshold: number; - bitmap: HexEncodedBytes; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigPayload.ts deleted file mode 100644 index 9100a74b3359f..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigPayload.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { MultisigTransactionPayload } from './MultisigTransactionPayload'; - -/** - * A multisig transaction that allows an owner of a multisig account to execute a pre-approved - * transaction as the multisig account. - */ -export type MultisigPayload = { - multisig_address: Address; - transaction_payload?: MultisigTransactionPayload; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigTransactionPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigTransactionPayload.ts deleted file mode 100644 index d3191b538308b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/MultisigTransactionPayload.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { EntryFunctionPayload } from './EntryFunctionPayload'; - -export type MultisigTransactionPayload = EntryFunctionPayload; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/PendingTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/PendingTransaction.ts deleted file mode 100644 index 2b4ad87fd6b8d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/PendingTransaction.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { HashValue } from './HashValue'; -import type { TransactionPayload } from './TransactionPayload'; -import type { TransactionSignature } from './TransactionSignature'; -import type { U64 } from './U64'; - -/** - * A transaction waiting in mempool - */ -export type PendingTransaction = { - hash: HashValue; - sender: Address; - sequence_number: U64; - max_gas_amount: U64; - gas_unit_price: U64; - expiration_timestamp_secs: U64; - payload: TransactionPayload; - signature?: TransactionSignature; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/RawTableItemRequest.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/RawTableItemRequest.ts deleted file mode 100644 index e8fc0f8eccd1d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/RawTableItemRequest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HexEncodedBytes } from './HexEncodedBytes'; - -/** - * Table Item request for the GetTableItemRaw API - */ -export type RawTableItemRequest = { - key: HexEncodedBytes; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/RoleType.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/RoleType.ts deleted file mode 100644 index f0b5c207d63bf..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/RoleType.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export enum RoleType { - VALIDATOR = 'validator', - FULL_NODE = 'full_node', -} diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptPayload.ts deleted file mode 100644 index 52cb0a0574352..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptPayload.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MoveScriptBytecode } from './MoveScriptBytecode'; -import type { MoveType } from './MoveType'; - -/** - * Payload which runs a script that can run multiple functions - */ -export type ScriptPayload = { - code: MoveScriptBytecode; - /** - * Type arguments of the function - */ - type_arguments: Array; - /** - * Arguments of the function - */ - arguments: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptWriteSet.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptWriteSet.ts deleted file mode 100644 index 469b780799c7a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/ScriptWriteSet.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { ScriptPayload } from './ScriptPayload'; - -export type ScriptWriteSet = { - execute_as: Address; - script: ScriptPayload; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/StateCheckpointTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/StateCheckpointTransaction.ts deleted file mode 100644 index bfe5b5dbcd246..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/StateCheckpointTransaction.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { HashValue } from './HashValue'; -import type { U64 } from './U64'; -import type { WriteSetChange } from './WriteSetChange'; - -/** - * A state checkpoint transaction - */ -export type StateCheckpointTransaction = { - version: U64; - hash: HashValue; - state_change_hash: HashValue; - event_root_hash: HashValue; - state_checkpoint_hash?: HashValue; - gas_used: U64; - /** - * Whether the transaction was successful - */ - success: boolean; - /** - * The VM status of the transaction, can tell useful information in a failure - */ - vm_status: string; - accumulator_root_hash: HashValue; - /** - * Final state of resources changed by the transaction - */ - changes: Array; - timestamp: U64; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/StateKeyWrapper.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/StateKeyWrapper.ts deleted file mode 100644 index d3939a43e6a77..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/StateKeyWrapper.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * Representation of a StateKey as a hex string. This is used for cursor based pagination. - * - */ -export type StateKeyWrapper = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/SubmitTransactionRequest.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/SubmitTransactionRequest.ts deleted file mode 100644 index b850d3f548e2d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/SubmitTransactionRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { TransactionPayload } from './TransactionPayload'; -import type { TransactionSignature } from './TransactionSignature'; -import type { U64 } from './U64'; - -/** - * A request to submit a transaction - * - * This requires a transaction and a signature of it - */ -export type SubmitTransactionRequest = { - sender: Address; - sequence_number: U64; - max_gas_amount: U64; - gas_unit_price: U64; - expiration_timestamp_secs: U64; - payload: TransactionPayload; - signature: TransactionSignature; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TableItemRequest.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TableItemRequest.ts deleted file mode 100644 index 18b44286d5165..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TableItemRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MoveType } from './MoveType'; - -/** - * Table Item request for the GetTableItem API - */ -export type TableItemRequest = { - key_type: MoveType; - value_type: MoveType; - /** - * The value of the table item's key - */ - key: any; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction.ts deleted file mode 100644 index 0d6bd99e8daa9..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Transaction_BlockMetadataTransaction } from './Transaction_BlockMetadataTransaction'; -import type { Transaction_GenesisTransaction } from './Transaction_GenesisTransaction'; -import type { Transaction_PendingTransaction } from './Transaction_PendingTransaction'; -import type { Transaction_StateCheckpointTransaction } from './Transaction_StateCheckpointTransaction'; -import type { Transaction_UserTransaction } from './Transaction_UserTransaction'; - -/** - * Enum of the different types of transactions in Aptos - */ -export type Transaction = (Transaction_PendingTransaction | Transaction_UserTransaction | Transaction_GenesisTransaction | Transaction_BlockMetadataTransaction | Transaction_StateCheckpointTransaction); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload.ts deleted file mode 100644 index 0115a29749beb..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { TransactionPayload_EntryFunctionPayload } from './TransactionPayload_EntryFunctionPayload'; -import type { TransactionPayload_ModuleBundlePayload } from './TransactionPayload_ModuleBundlePayload'; -import type { TransactionPayload_MultisigPayload } from './TransactionPayload_MultisigPayload'; -import type { TransactionPayload_ScriptPayload } from './TransactionPayload_ScriptPayload'; - -/** - * An enum of the possible transaction payloads - */ -export type TransactionPayload = (TransactionPayload_EntryFunctionPayload | TransactionPayload_ScriptPayload | TransactionPayload_ModuleBundlePayload | TransactionPayload_MultisigPayload); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_EntryFunctionPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_EntryFunctionPayload.ts deleted file mode 100644 index d44e5d89a654a..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_EntryFunctionPayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { EntryFunctionPayload } from './EntryFunctionPayload'; - -export type TransactionPayload_EntryFunctionPayload = ({ - type: string; -} & EntryFunctionPayload); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ModuleBundlePayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ModuleBundlePayload.ts deleted file mode 100644 index 0193cb9d97dc5..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ModuleBundlePayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModuleBundlePayload } from './ModuleBundlePayload'; - -export type TransactionPayload_ModuleBundlePayload = ({ - type: string; -} & ModuleBundlePayload); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_MultisigPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_MultisigPayload.ts deleted file mode 100644 index 01023dd71e6e9..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_MultisigPayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MultisigPayload } from './MultisigPayload'; - -export type TransactionPayload_MultisigPayload = ({ - type: string; -} & MultisigPayload); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ScriptPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ScriptPayload.ts deleted file mode 100644 index 9e7feb973092b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionPayload_ScriptPayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ScriptPayload } from './ScriptPayload'; - -export type TransactionPayload_ScriptPayload = ({ - type: string; -} & ScriptPayload); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature.ts deleted file mode 100644 index b3861fbdb2ba8..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { TransactionSignature_Ed25519Signature } from './TransactionSignature_Ed25519Signature'; -import type { TransactionSignature_MultiAgentSignature } from './TransactionSignature_MultiAgentSignature'; -import type { TransactionSignature_MultiEd25519Signature } from './TransactionSignature_MultiEd25519Signature'; - -/** - * An enum representing the different transaction signatures available - */ -export type TransactionSignature = (TransactionSignature_Ed25519Signature | TransactionSignature_MultiEd25519Signature | TransactionSignature_MultiAgentSignature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_Ed25519Signature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_Ed25519Signature.ts deleted file mode 100644 index 0667d1e8bb140..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_Ed25519Signature.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Ed25519Signature } from './Ed25519Signature'; - -export type TransactionSignature_Ed25519Signature = ({ - type: string; -} & Ed25519Signature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiAgentSignature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiAgentSignature.ts deleted file mode 100644 index e74d911d9fb63..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiAgentSignature.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MultiAgentSignature } from './MultiAgentSignature'; - -export type TransactionSignature_MultiAgentSignature = ({ - type: string; -} & MultiAgentSignature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiEd25519Signature.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiEd25519Signature.ts deleted file mode 100644 index 1f6dc58ada495..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionSignature_MultiEd25519Signature.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { MultiEd25519Signature } from './MultiEd25519Signature'; - -export type TransactionSignature_MultiEd25519Signature = ({ - type: string; -} & MultiEd25519Signature); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_BlockMetadataTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_BlockMetadataTransaction.ts deleted file mode 100644 index 82067d7479ccf..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_BlockMetadataTransaction.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { BlockMetadataTransaction } from './BlockMetadataTransaction'; - -export type Transaction_BlockMetadataTransaction = ({ - type: string; -} & BlockMetadataTransaction); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_GenesisTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_GenesisTransaction.ts deleted file mode 100644 index 3bb44fd02883b..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_GenesisTransaction.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { GenesisTransaction } from './GenesisTransaction'; - -export type Transaction_GenesisTransaction = ({ - type: string; -} & GenesisTransaction); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_PendingTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_PendingTransaction.ts deleted file mode 100644 index c593c76424f81..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_PendingTransaction.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { PendingTransaction } from './PendingTransaction'; - -export type Transaction_PendingTransaction = ({ - type: string; -} & PendingTransaction); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_StateCheckpointTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_StateCheckpointTransaction.ts deleted file mode 100644 index 90eeda7001b0f..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_StateCheckpointTransaction.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { StateCheckpointTransaction } from './StateCheckpointTransaction'; - -export type Transaction_StateCheckpointTransaction = ({ - type: string; -} & StateCheckpointTransaction); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_UserTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_UserTransaction.ts deleted file mode 100644 index 8feeed7c2233c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/Transaction_UserTransaction.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { UserTransaction } from './UserTransaction'; - -export type Transaction_UserTransaction = ({ - type: string; -} & UserTransaction); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSingleSubmissionFailure.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSingleSubmissionFailure.ts deleted file mode 100644 index 98f81af611b51..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSingleSubmissionFailure.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { AptosError } from './AptosError'; - -/** - * Information telling which batch submission transactions failed - */ -export type TransactionsBatchSingleSubmissionFailure = { - error: AptosError; - /** - * The index of which transaction failed, same as submission order - */ - transaction_index: number; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSubmissionResult.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSubmissionResult.ts deleted file mode 100644 index 43c5d62f8dfba..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/TransactionsBatchSubmissionResult.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { TransactionsBatchSingleSubmissionFailure } from './TransactionsBatchSingleSubmissionFailure'; - -/** - * Batch transaction submission result - * - * Tells which transactions failed - */ -export type TransactionsBatchSubmissionResult = { - /** - * Summary of the failed transactions - */ - transaction_failures: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/U128.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/U128.ts deleted file mode 100644 index d391d4afb9c24..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/U128.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * A string containing a 128-bit unsigned integer. - * - * We represent u128 values as a string to ensure compatibility with languages such - * as JavaScript that do not parse u128s in JSON natively. - * - */ -export type U128 = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/U256.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/U256.ts deleted file mode 100644 index 092d56d8eb4be..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/U256.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * A string containing a 256-bit unsigned integer. - * - * We represent u256 values as a string to ensure compatibility with languages such - * as JavaScript that do not parse u256s in JSON natively. - * - */ -export type U256 = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/U64.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/U64.ts deleted file mode 100644 index f8f542c609edb..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/U64.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * A string containing a 64-bit unsigned integer. - * - * We represent u64 values as a string to ensure compatibility with languages such - * as JavaScript that do not parse u64s in JSON natively. - * - */ -export type U64 = string; diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/UserTransaction.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/UserTransaction.ts deleted file mode 100644 index 4aa4e67a37ce3..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/UserTransaction.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { Event } from './Event'; -import type { HashValue } from './HashValue'; -import type { TransactionPayload } from './TransactionPayload'; -import type { TransactionSignature } from './TransactionSignature'; -import type { U64 } from './U64'; -import type { WriteSetChange } from './WriteSetChange'; - -/** - * A transaction submitted by a user to change the state of the blockchain - */ -export type UserTransaction = { - version: U64; - hash: HashValue; - state_change_hash: HashValue; - event_root_hash: HashValue; - state_checkpoint_hash?: HashValue; - gas_used: U64; - /** - * Whether the transaction was successful - */ - success: boolean; - /** - * The VM status of the transaction, can tell useful information in a failure - */ - vm_status: string; - accumulator_root_hash: HashValue; - /** - * Final state of resources changed by the transaction - */ - changes: Array; - sender: Address; - sequence_number: U64; - max_gas_amount: U64; - gas_unit_price: U64; - expiration_timestamp_secs: U64; - payload: TransactionPayload; - signature?: TransactionSignature; - /** - * Events generated by the transaction - */ - events: Array; - timestamp: U64; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/VersionedEvent.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/VersionedEvent.ts deleted file mode 100644 index c9934c820268f..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/VersionedEvent.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { EventGuid } from './EventGuid'; -import type { MoveType } from './MoveType'; -import type { U64 } from './U64'; - -/** - * An event from a transaction with a version - */ -export type VersionedEvent = { - version: U64; - guid: EventGuid; - sequence_number: U64; - type: MoveType; - /** - * The JSON representation of the event - */ - data: any; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/ViewRequest.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/ViewRequest.ts deleted file mode 100644 index 5fa124b8ef5fa..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/ViewRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { EntryFunctionId } from './EntryFunctionId'; -import type { MoveType } from './MoveType'; - -/** - * View request for the Move View Function API - */ -export type ViewRequest = { - function: EntryFunctionId; - /** - * Type arguments of the function - */ - type_arguments: Array; - /** - * Arguments of the function - */ - arguments: Array; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteModule.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteModule.ts deleted file mode 100644 index b032cc9136124..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteModule.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { MoveModuleBytecode } from './MoveModuleBytecode'; - -/** - * Write a new module or update an existing one - */ -export type WriteModule = { - address: Address; - /** - * State key hash - */ - state_key_hash: string; - data: MoveModuleBytecode; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteResource.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteResource.ts deleted file mode 100644 index 2bccf200e8ff8..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteResource.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { Address } from './Address'; -import type { MoveResource } from './MoveResource'; - -/** - * Write a resource or update an existing one - */ -export type WriteResource = { - address: Address; - /** - * State key hash - */ - state_key_hash: string; - data: MoveResource; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet.ts deleted file mode 100644 index ea06d3e6355aa..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteSet_DirectWriteSet } from './WriteSet_DirectWriteSet'; -import type { WriteSet_ScriptWriteSet } from './WriteSet_ScriptWriteSet'; - -/** - * The associated writeset with a payload - */ -export type WriteSet = (WriteSet_ScriptWriteSet | WriteSet_DirectWriteSet); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange.ts deleted file mode 100644 index dfcc2cb630beb..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteSetChange_DeleteModule } from './WriteSetChange_DeleteModule'; -import type { WriteSetChange_DeleteResource } from './WriteSetChange_DeleteResource'; -import type { WriteSetChange_DeleteTableItem } from './WriteSetChange_DeleteTableItem'; -import type { WriteSetChange_WriteModule } from './WriteSetChange_WriteModule'; -import type { WriteSetChange_WriteResource } from './WriteSetChange_WriteResource'; -import type { WriteSetChange_WriteTableItem } from './WriteSetChange_WriteTableItem'; - -/** - * A final state change of a transaction on a resource or module - */ -export type WriteSetChange = (WriteSetChange_DeleteModule | WriteSetChange_DeleteResource | WriteSetChange_DeleteTableItem | WriteSetChange_WriteModule | WriteSetChange_WriteResource | WriteSetChange_WriteTableItem); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteModule.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteModule.ts deleted file mode 100644 index 3c4252969f572..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteModule.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DeleteModule } from './DeleteModule'; - -export type WriteSetChange_DeleteModule = ({ - type: string; -} & DeleteModule); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteResource.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteResource.ts deleted file mode 100644 index bfb9924b661a3..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteResource.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DeleteResource } from './DeleteResource'; - -export type WriteSetChange_DeleteResource = ({ - type: string; -} & DeleteResource); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteTableItem.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteTableItem.ts deleted file mode 100644 index d82340222522d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_DeleteTableItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DeleteTableItem } from './DeleteTableItem'; - -export type WriteSetChange_DeleteTableItem = ({ - type: string; -} & DeleteTableItem); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteModule.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteModule.ts deleted file mode 100644 index 924d279b8c26f..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteModule.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteModule } from './WriteModule'; - -export type WriteSetChange_WriteModule = ({ - type: string; -} & WriteModule); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteResource.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteResource.ts deleted file mode 100644 index e7d4f6be56188..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteResource.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteResource } from './WriteResource'; - -export type WriteSetChange_WriteResource = ({ - type: string; -} & WriteResource); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteTableItem.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteTableItem.ts deleted file mode 100644 index 087c9765a7e62..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetChange_WriteTableItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteTableItem } from './WriteTableItem'; - -export type WriteSetChange_WriteTableItem = ({ - type: string; -} & WriteTableItem); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetPayload.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetPayload.ts deleted file mode 100644 index c15ea62f22d9c..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSetPayload.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { WriteSet } from './WriteSet'; - -/** - * A writeset payload, used only for genesis - */ -export type WriteSetPayload = { - write_set: WriteSet; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_DirectWriteSet.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_DirectWriteSet.ts deleted file mode 100644 index 552e98d4833a5..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_DirectWriteSet.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DirectWriteSet } from './DirectWriteSet'; - -export type WriteSet_DirectWriteSet = ({ - type: string; -} & DirectWriteSet); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_ScriptWriteSet.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_ScriptWriteSet.ts deleted file mode 100644 index e7304a8a8431d..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteSet_ScriptWriteSet.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ScriptWriteSet } from './ScriptWriteSet'; - -export type WriteSet_ScriptWriteSet = ({ - type: string; -} & ScriptWriteSet); - diff --git a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteTableItem.ts b/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteTableItem.ts deleted file mode 100644 index 6fbaa2b02a3b2..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/generated/models/WriteTableItem.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { DecodedTableData } from './DecodedTableData'; -import type { HexEncodedBytes } from './HexEncodedBytes'; - -/** - * Change set to write a table item - */ -export type WriteTableItem = { - state_key_hash: string; - handle: HexEncodedBytes; - key: HexEncodedBytes; - value: HexEncodedBytes; - data?: DecodedTableData; -}; - diff --git a/ecosystem/typescript/sdk_v2/src/types/index.ts b/ecosystem/typescript/sdk_v2/src/types/index.ts deleted file mode 100644 index 6f6e111967820..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * as Gen from "./generated"; diff --git a/ecosystem/typescript/sdk_v2/src/utils/api-endpoints.ts b/ecosystem/typescript/sdk_v2/src/utils/api-endpoints.ts deleted file mode 100644 index 3b317b3c98fb5..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/api-endpoints.ts +++ /dev/null @@ -1,28 +0,0 @@ -export const NetworkToIndexerAPI: Record = { - mainnet: "https://indexer.mainnet.aptoslabs.com/v1/graphql", - testnet: "https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql", - devnet: "https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql", -}; - -export const NetworkToNodeAPI: Record = { - mainnet: "https://fullnode.mainnet.aptoslabs.com/v1", - testnet: "https://fullnode.testnet.aptoslabs.com/v1", - devnet: "https://fullnode.devnet.aptoslabs.com/v1", -}; - -export const NodeAPIToNetwork: Record = { - "https://fullnode.mainnet.aptoslabs.com/v1": "mainnet", - "https://fullnode.testnet.aptoslabs.com/v1": "testnet", - "https://fullnode.devnet.aptoslabs.com/v1": "devnet", -}; - -export enum Network { - MAINNET = "mainnet", - TESTNET = "testnet", - DEVNET = "devnet", -} - -export interface CustomEndpoints { - fullnodeUrl: string; - indexerUrl?: string; -} diff --git a/ecosystem/typescript/sdk_v2/src/utils/const.ts b/ecosystem/typescript/sdk_v2/src/utils/const.ts deleted file mode 100644 index e6dfc747a9cf7..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/const.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Network } from "./api-endpoints"; - -export const NODE_URL = process.env.APTOS_NODE_URL!; -export const APTOS_FAUCET_URL = process.env.APTOS_FAUCET_URL!; - -export const DEFAULT_NETWORK = Network.TESTNET; -export const DEFAULT_FAUCET = Network.TESTNET; - -export const DEFAULT_MAX_GAS_AMOUNT = 200000; -// Transaction expire timestamp -export const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20; -// How long does SDK wait for txhn to finish -export const DEFAULT_TXN_TIMEOUT_SEC = 20; diff --git a/ecosystem/typescript/sdk_v2/src/utils/hd-key.ts b/ecosystem/typescript/sdk_v2/src/utils/hd-key.ts deleted file mode 100644 index 32ffd932472a0..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/hd-key.ts +++ /dev/null @@ -1,79 +0,0 @@ -import nacl from "tweetnacl"; -import { hmac } from "@noble/hashes/hmac"; -import { sha512 } from "@noble/hashes/sha512"; -import { hexToBytes } from "@noble/hashes/utils"; - -type Hex = string; -type Path = string; - -type Keys = { - key: Uint8Array; - chainCode: Uint8Array; -}; - -const pathRegex = /^m(\/[0-9]+')+$/; - -const replaceDerive = (val: string): string => val.replace("'", ""); - -const HMAC_KEY = "ed25519 seed"; -const HARDENED_OFFSET = 0x80000000; - -export const getMasterKeyFromSeed = (seed: Hex): Keys => { - const h = hmac.create(sha512, HMAC_KEY); - const I = h.update(hexToBytes(seed)).digest(); - const IL = I.slice(0, 32); - const IR = I.slice(32); - return { - key: IL, - chainCode: IR, - }; -}; - -export const CKDPriv = ({ key, chainCode }: Keys, index: number): Keys => { - const buffer = new ArrayBuffer(4); - new DataView(buffer).setUint32(0, index); - const indexBytes = new Uint8Array(buffer); - const zero = new Uint8Array([0]); - const data = new Uint8Array([...zero, ...key, ...indexBytes]); - - const I = hmac.create(sha512, chainCode).update(data).digest(); - const IL = I.slice(0, 32); - const IR = I.slice(32); - return { - key: IL, - chainCode: IR, - }; -}; - -export const getPublicKey = (privateKey: Uint8Array, withZeroByte = true): Uint8Array => { - const keyPair = nacl.sign.keyPair.fromSeed(privateKey); - const signPk = keyPair.secretKey.subarray(32); - const zero = new Uint8Array([0]); - return withZeroByte ? new Uint8Array([...zero, ...signPk]) : signPk; -}; - -export const isValidPath = (path: string): boolean => { - if (!pathRegex.test(path)) { - return false; - } - return !path - .split("/") - .slice(1) - .map(replaceDerive) - .some(Number.isNaN as any); -}; - -export const derivePath = (path: Path, seed: Hex, offset = HARDENED_OFFSET): Keys => { - if (!isValidPath(path)) { - throw new Error("Invalid derivation path"); - } - - const { key, chainCode } = getMasterKeyFromSeed(seed); - const segments = path - .split("/") - .slice(1) - .map(replaceDerive) - .map((el) => parseInt(el, 10)); - - return segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), { key, chainCode }); -}; diff --git a/ecosystem/typescript/sdk_v2/src/utils/helpers.ts b/ecosystem/typescript/sdk_v2/src/utils/helpers.ts deleted file mode 100644 index 351b6e1aaf2d6..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/helpers.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { AptosApiError } from "../client/types"; - -export async function sleep(timeMs: number): Promise { - return new Promise((resolve) => { - setTimeout(resolve, timeMs); - }); -} - -export class ApiError extends Error { - constructor( - public readonly status: number, - public readonly message: string, - public readonly errorCode?: string, - public readonly vmErrorCode?: string, - ) { - super(message); - } -} - -export function parseApiError(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) { - const childFunction = descriptor.value; - // eslint-disable-next-line no-param-reassign - descriptor.value = async function wrapper(...args: any[]) { - try { - // We need to explicitly await here so that the function is called and - // potentially throws an error. If we just return without awaiting, the - // promise is returned directly and the catch block cannot trigger. - const res = await childFunction.apply(this, [...args]); - return res; - } catch (e) { - if (e instanceof AptosApiError) { - throw new ApiError( - e.status, - JSON.stringify({ message: e.message, ...e.data }), - e.data?.error_code, - e.data?.vm_error_code, - ); - } - throw e; - } - }; - return descriptor; -} diff --git a/ecosystem/typescript/sdk_v2/src/utils/hex_string.ts b/ecosystem/typescript/sdk_v2/src/utils/hex_string.ts deleted file mode 100644 index f44eda9cd3bb8..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/hex_string.ts +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -import { bytesToHex, hexToBytes } from "@noble/hashes/utils"; -import { HexEncodedBytes } from "../types/generated"; - -// eslint-disable-next-line no-use-before-define -export type MaybeHexString = HexString | string | HexEncodedBytes; - -/** - * A util class for working with hex strings. - * Hex strings are strings that are prefixed with `0x` - */ -export class HexString { - /// We want to make sure this hexString has the `0x` hex prefix - private readonly hexString: string; - - /** - * Creates new hex string from Buffer - * @param buffer A buffer to convert - * @returns New HexString - */ - static fromBuffer(buffer: Uint8Array): HexString { - return HexString.fromUint8Array(buffer); - } - - /** - * Creates new hex string from Uint8Array - * @param arr Uint8Array to convert - * @returns New HexString - */ - static fromUint8Array(arr: Uint8Array): HexString { - return new HexString(bytesToHex(arr)); - } - - /** - * Ensures `hexString` is instance of `HexString` class - * @param hexString String to check - * @returns New HexString if `hexString` is regular string or `hexString` if it is HexString instance - * @example - * ``` - * const regularString = "string"; - * const hexString = new HexString("string"); // "0xstring" - * HexString.ensure(regularString); // "0xstring" - * HexString.ensure(hexString); // "0xstring" - * ``` - */ - static ensure(hexString: MaybeHexString): HexString { - if (typeof hexString === "string") { - return new HexString(hexString); - } - return hexString; - } - - /** - * Creates new HexString instance from regular string. If specified string already starts with "0x" prefix, - * it will not add another one - * @param hexString String to convert - * @example - * ``` - * const string = "string"; - * new HexString(string); // "0xstring" - * ``` - */ - constructor(hexString: string | HexEncodedBytes) { - if (hexString.startsWith("0x")) { - this.hexString = hexString; - } else { - this.hexString = `0x${hexString}`; - } - } - - /** - * Getter for inner hexString - * @returns Inner hex string - */ - hex(): string { - return this.hexString; - } - - /** - * Getter for inner hexString without prefix - * @returns Inner hex string without prefix - * @example - * ``` - * const hexString = new HexString("string"); // "0xstring" - * hexString.noPrefix(); // "string" - * ``` - */ - noPrefix(): string { - return this.hexString.slice(2); - } - - /** - * Overrides default `toString` method - * @returns Inner hex string - */ - toString(): string { - return this.hex(); - } - - /** - * Trimmes extra zeroes in the begining of a string - * @returns Inner hexString without leading zeroes - * @example - * ``` - * new HexString("0x000000string").toShortString(); // result = "0xstring" - * ``` - */ - toShortString(): string { - const trimmed = this.hexString.replace(/^0x0*/, ""); - return `0x${trimmed}`; - } - - /** - * Converts hex string to a Uint8Array - * @returns Uint8Array from inner hexString without prefix - */ - toUint8Array(): Uint8Array { - return Uint8Array.from(hexToBytes(this.noPrefix())); - } -} diff --git a/ecosystem/typescript/sdk_v2/src/utils/index.ts b/ecosystem/typescript/sdk_v2/src/utils/index.ts deleted file mode 100644 index 4551c622b3305..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./api-endpoints"; -export * from "./const"; -export * from "./memoize-decorator"; -export * from "./hd-key"; -export * from "./helpers"; -export * from "./pagination_helpers"; -export * from "./hex_string"; diff --git a/ecosystem/typescript/sdk_v2/src/utils/memoize-decorator.ts b/ecosystem/typescript/sdk_v2/src/utils/memoize-decorator.ts deleted file mode 100644 index 291c87819b772..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/memoize-decorator.ts +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Credits to https://github.com/darrylhodgins/typescript-memoize - */ - -/* eslint-disable no-param-reassign */ -/* eslint-disable no-restricted-syntax */ - -interface MemoizeArgs { - // ttl in milliseconds for cached items. After `ttlMs`, cached items are evicted automatically. If no `ttlMs` - // is provided, cached items won't get auto-evicted. - ttlMs?: number; - // produces the cache key based on `args`. - hashFunction?: boolean | ((...args: any[]) => any); - // cached items can be taged with `tags`. `tags` can be used to evict cached items - tags?: string[]; -} - -export function Memoize(args?: MemoizeArgs | MemoizeArgs["hashFunction"]) { - let hashFunction: MemoizeArgs["hashFunction"]; - let ttlMs: MemoizeArgs["ttlMs"]; - let tags: MemoizeArgs["tags"]; - - if (typeof args === "object") { - hashFunction = args.hashFunction; - ttlMs = args.ttlMs; - tags = args.tags; - } else { - hashFunction = args; - } - - return (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor) => { - if (descriptor.value != null) { - descriptor.value = getNewFunction(descriptor.value, hashFunction, ttlMs, tags); - } else if (descriptor.get != null) { - descriptor.get = getNewFunction(descriptor.get, hashFunction, ttlMs, tags); - } else { - throw new Error("Only put a Memoize() decorator on a method or get accessor."); - } - }; -} - -export function MemoizeExpiring(ttlMs: number, hashFunction?: MemoizeArgs["hashFunction"]) { - return Memoize({ - ttlMs, - hashFunction, - }); -} - -const clearCacheTagsMap: Map[]> = new Map(); - -export function clear(tags: string[]): number { - const cleared: Set> = new Set(); - for (const tag of tags) { - const maps = clearCacheTagsMap.get(tag); - if (maps) { - for (const mp of maps) { - if (!cleared.has(mp)) { - mp.clear(); - cleared.add(mp); - } - } - } - } - return cleared.size; -} - -function getNewFunction( - originalMethod: () => void, - hashFunction?: MemoizeArgs["hashFunction"], - ttlMs: number = 0, - tags?: MemoizeArgs["tags"], -) { - const propMapName = Symbol("__memoized_map__"); - - // The function returned here gets called instead of originalMethod. - // eslint-disable-next-line func-names - return function (...args: any[]) { - let returnedValue: any; - - // @ts-ignore - const that: any = this; - - // Get or create map - // eslint-disable-next-line no-prototype-builtins - if (!that.hasOwnProperty(propMapName)) { - Object.defineProperty(that, propMapName, { - configurable: false, - enumerable: false, - writable: false, - value: new Map(), - }); - } - const myMap: Map = that[propMapName]; - - if (Array.isArray(tags)) { - for (const tag of tags) { - if (clearCacheTagsMap.has(tag)) { - clearCacheTagsMap.get(tag)!.push(myMap); - } else { - clearCacheTagsMap.set(tag, [myMap]); - } - } - } - - if (hashFunction || args.length > 0 || ttlMs > 0) { - let hashKey: any; - - // If true is passed as first parameter, will automatically use every argument, passed to string - if (hashFunction === true) { - hashKey = args.map((a) => a.toString()).join("!"); - } else if (hashFunction) { - hashKey = hashFunction.apply(that, args); - } else { - // eslint-disable-next-line prefer-destructuring - hashKey = args[0]; - } - - const timestampKey = `${hashKey}__timestamp`; - let isExpired: boolean = false; - if (ttlMs > 0) { - if (!myMap.has(timestampKey)) { - // "Expired" since it was never called before - isExpired = true; - } else { - const timestamp = myMap.get(timestampKey); - isExpired = Date.now() - timestamp > ttlMs; - } - } - - if (myMap.has(hashKey) && !isExpired) { - returnedValue = myMap.get(hashKey); - } else { - returnedValue = originalMethod.apply(that, args as any); - myMap.set(hashKey, returnedValue); - if (ttlMs > 0) { - myMap.set(timestampKey, Date.now()); - } - } - } else { - const hashKey = that; - if (myMap.has(hashKey)) { - returnedValue = myMap.get(hashKey); - } else { - returnedValue = originalMethod.apply(that, args as any); - myMap.set(hashKey, returnedValue); - } - } - - return returnedValue; - }; -} diff --git a/ecosystem/typescript/sdk_v2/src/utils/pagination_helpers.ts b/ecosystem/typescript/sdk_v2/src/utils/pagination_helpers.ts deleted file mode 100644 index af795556d834f..0000000000000 --- a/ecosystem/typescript/sdk_v2/src/utils/pagination_helpers.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { get } from "../client"; -import { ClientConfig } from "../client/types"; - -/// This function is a helper for paginating using a function wrapping an API -export async function paginateWithCursor, Res extends any[]>(options: { - url: string; - endpoint?: string; - body?: any; - params?: Req; - originMethod?: string; - overrides?: ClientConfig; -}): Promise { - const out = []; - let cursor: string | undefined; - const requestParams = options.params as Req & { start?: string }; - // eslint-disable-next-line no-constant-condition - while (true) { - requestParams.start = cursor; - // eslint-disable-next-line no-await-in-loop - const response = await get({ - url: options.url, - endpoint: options.endpoint, - params: requestParams, - originMethod: options.originMethod, - overrides: options.overrides, - }); - // eslint-disable-next-line no-underscore-dangle - /** - * the cursor is a "state key" from the API prespective. Client - * should not need to "care" what it represents but just use it - * to query the next chunck of data. - */ - cursor = response.headers["x-aptos-cursor"]; - // Now that we have the cursor (if any), we remove the headers before - // adding these to the output of this function. - // eslint-disable-next-line no-underscore-dangle - delete (response as any).headers; - out.push(...response.data); - if (cursor === null || cursor === undefined) { - break; - } - } - return out as any; -} diff --git a/ecosystem/typescript/sdk_v2/tsconfig.json b/ecosystem/typescript/sdk_v2/tsconfig.json index 25461ead9d21a..2c3bfc1f7ca36 100644 --- a/ecosystem/typescript/sdk_v2/tsconfig.json +++ b/ecosystem/typescript/sdk_v2/tsconfig.json @@ -18,15 +18,3 @@ }, "include": ["src", "tests"] } - -/** - "forceConsistentCasingInFileNames": true, - "downlevelIteration": true, - "importHelpers": true, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "stripInternal": true, - "typeRoots": ["node_modules/@types"] -**/