Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ swift/Sources/Generated
swift/wallet-core/
codegen-v2/bindings/

src/Generated/*.h
# src/Generated/*.h
src/Generated/*.cpp
include/TrustWalletCore/TWHRP.h
include/TrustWalletCore/TW*Proto.h
include/TrustWalletCore/TWEthereumChainID.h
# include/TrustWalletCore/TWHRP.h
# include/TrustWalletCore/TW*Proto.h
# include/TrustWalletCore/TWEthereumChainID.h

# Generated
include/TrustWalletCore/TWTONAddressConverter.h
include/TrustWalletCore/TWFFITest.h
include/TrustWalletCore/TWTONWallet.h
include/TrustWalletCore/TWTONMessageSigner.h
include/TrustWalletCore/TWMessageSigner.h
include/TrustWalletCore/TWWalletConnectRequest.h
include/TrustWalletCore/TWSolanaTransaction.h
include/TrustWalletCore/TWCryptoBoxPublicKey.h
include/TrustWalletCore/TWCryptoBoxSecretKey.h
# include/TrustWalletCore/TWTONAddressConverter.h
# include/TrustWalletCore/TWFFITest.h
# include/TrustWalletCore/TWTONWallet.h
# include/TrustWalletCore/TWTONMessageSigner.h
# include/TrustWalletCore/TWMessageSigner.h
# include/TrustWalletCore/TWWalletConnectRequest.h
# include/TrustWalletCore/TWSolanaTransaction.h
# include/TrustWalletCore/TWCryptoBoxPublicKey.h
# include/TrustWalletCore/TWCryptoBoxSecretKey.h

# Wasm
emsdk/
Expand Down Expand Up @@ -80,3 +80,5 @@ samples/cpp/sample

# Rust target build
**/target/

main
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/Cramiumlabs/wallet-core

go 1.22.5

require google.golang.org/protobuf v1.36.6
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
12 changes: 12 additions & 0 deletions include/TrustWalletCore/TWAeternityProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Aeternity_Proto_SigningInput;
typedef TWData *_Nonnull TW_Aeternity_Proto_SigningOutput;
12 changes: 12 additions & 0 deletions include/TrustWalletCore/TWAionProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Aion_Proto_SigningInput;
typedef TWData *_Nonnull TW_Aion_Proto_SigningOutput;
15 changes: 15 additions & 0 deletions include/TrustWalletCore/TWAlgorandProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Algorand_Proto_Transfer;
typedef TWData *_Nonnull TW_Algorand_Proto_AssetTransfer;
typedef TWData *_Nonnull TW_Algorand_Proto_AssetOptIn;
typedef TWData *_Nonnull TW_Algorand_Proto_SigningInput;
typedef TWData *_Nonnull TW_Algorand_Proto_SigningOutput;
28 changes: 28 additions & 0 deletions include/TrustWalletCore/TWAptosProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Aptos_Proto_TransferMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_StructTag;
typedef TWData *_Nonnull TW_Aptos_Proto_TokenTransferMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_TokenTransferCoinsMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_FungibleAssetTransferMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_ManagedTokensRegisterMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_CreateAccountMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_OfferNftMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_CancelOfferNftMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_ClaimNftMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_TortugaClaim;
typedef TWData *_Nonnull TW_Aptos_Proto_TortugaStake;
typedef TWData *_Nonnull TW_Aptos_Proto_TortugaUnstake;
typedef TWData *_Nonnull TW_Aptos_Proto_LiquidStaking;
typedef TWData *_Nonnull TW_Aptos_Proto_NftMessage;
typedef TWData *_Nonnull TW_Aptos_Proto_SigningInput;
typedef TWData *_Nonnull TW_Aptos_Proto_TransactionAuthenticator;
typedef TWData *_Nonnull TW_Aptos_Proto_SigningOutput;
14 changes: 14 additions & 0 deletions include/TrustWalletCore/TWBabylonStakingProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_BabylonStaking_Proto_PublicKeySignature;
typedef TWData *_Nonnull TW_BabylonStaking_Proto_StakingInfo;
typedef TWData *_Nonnull TW_BabylonStaking_Proto_InputBuilder;
typedef TWData *_Nonnull TW_BabylonStaking_Proto_OutputBuilder;
13 changes: 13 additions & 0 deletions include/TrustWalletCore/TWBarzProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Barz_Proto_ContractAddressInput;
typedef TWData *_Nonnull TW_Barz_Proto_FacetCut;
typedef TWData *_Nonnull TW_Barz_Proto_DiamondCutInput;
34 changes: 34 additions & 0 deletions include/TrustWalletCore/TWBinanceProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Binance_Proto_Transaction;
typedef TWData *_Nonnull TW_Binance_Proto_Signature;
typedef TWData *_Nonnull TW_Binance_Proto_TradeOrder;
typedef TWData *_Nonnull TW_Binance_Proto_CancelTradeOrder;
typedef TWData *_Nonnull TW_Binance_Proto_SendOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TokenIssueOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TokenMintOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TokenBurnOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TokenFreezeOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TokenUnfreezeOrder;
typedef TWData *_Nonnull TW_Binance_Proto_HTLTOrder;
typedef TWData *_Nonnull TW_Binance_Proto_DepositHTLTOrder;
typedef TWData *_Nonnull TW_Binance_Proto_ClaimHTLOrder;
typedef TWData *_Nonnull TW_Binance_Proto_RefundHTLTOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TransferOut;
typedef TWData *_Nonnull TW_Binance_Proto_SideChainDelegate;
typedef TWData *_Nonnull TW_Binance_Proto_SideChainRedelegate;
typedef TWData *_Nonnull TW_Binance_Proto_SideChainUndelegate;
typedef TWData *_Nonnull TW_Binance_Proto_SideChainStakeMigration;
typedef TWData *_Nonnull TW_Binance_Proto_TimeLockOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TimeRelockOrder;
typedef TWData *_Nonnull TW_Binance_Proto_TimeUnlockOrder;
typedef TWData *_Nonnull TW_Binance_Proto_SigningInput;
typedef TWData *_Nonnull TW_Binance_Proto_SigningOutput;
22 changes: 22 additions & 0 deletions include/TrustWalletCore/TWBitcoinProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Bitcoin_Proto_Transaction;
typedef TWData *_Nonnull TW_Bitcoin_Proto_TransactionInput;
typedef TWData *_Nonnull TW_Bitcoin_Proto_OutPoint;
typedef TWData *_Nonnull TW_Bitcoin_Proto_TransactionOutput;
typedef TWData *_Nonnull TW_Bitcoin_Proto_UnspentTransaction;
typedef TWData *_Nonnull TW_Bitcoin_Proto_OutputAddress;
typedef TWData *_Nonnull TW_Bitcoin_Proto_OutputIndex;
typedef TWData *_Nonnull TW_Bitcoin_Proto_SigningInput;
typedef TWData *_Nonnull TW_Bitcoin_Proto_TransactionPlan;
typedef TWData *_Nonnull TW_Bitcoin_Proto_SigningOutput;
typedef TWData *_Nonnull TW_Bitcoin_Proto_HashPublicKey;
typedef TWData *_Nonnull TW_Bitcoin_Proto_PreSigningOutput;
21 changes: 21 additions & 0 deletions include/TrustWalletCore/TWBitcoinV2Proto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_BitcoinV2_Proto_PublicKeyOrHash;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_PublicKeySignature;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_Input;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_Output;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_ChainInfo;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_TransactionBuilder;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_Psbt;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_SigningInput;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_TransactionPlan;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_PreSigningOutput;
typedef TWData *_Nonnull TW_BitcoinV2_Proto_SigningOutput;
24 changes: 24 additions & 0 deletions include/TrustWalletCore/TWCardanoProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Cardano_Proto_OutPoint;
typedef TWData *_Nonnull TW_Cardano_Proto_TokenAmount;
typedef TWData *_Nonnull TW_Cardano_Proto_TxInput;
typedef TWData *_Nonnull TW_Cardano_Proto_TxOutput;
typedef TWData *_Nonnull TW_Cardano_Proto_TokenBundle;
typedef TWData *_Nonnull TW_Cardano_Proto_Transfer;
typedef TWData *_Nonnull TW_Cardano_Proto_RegisterStakingKey;
typedef TWData *_Nonnull TW_Cardano_Proto_DeregisterStakingKey;
typedef TWData *_Nonnull TW_Cardano_Proto_VoteDelegation;
typedef TWData *_Nonnull TW_Cardano_Proto_Delegate;
typedef TWData *_Nonnull TW_Cardano_Proto_Withdraw;
typedef TWData *_Nonnull TW_Cardano_Proto_TransactionPlan;
typedef TWData *_Nonnull TW_Cardano_Proto_SigningInput;
typedef TWData *_Nonnull TW_Cardano_Proto_SigningOutput;
10 changes: 10 additions & 0 deletions include/TrustWalletCore/TWCommonProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

19 changes: 19 additions & 0 deletions include/TrustWalletCore/TWCosmosProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Cosmos_Proto_Amount;
typedef TWData *_Nonnull TW_Cosmos_Proto_Fee;
typedef TWData *_Nonnull TW_Cosmos_Proto_Height;
typedef TWData *_Nonnull TW_Cosmos_Proto_THORChainAsset;
typedef TWData *_Nonnull TW_Cosmos_Proto_THORChainCoin;
typedef TWData *_Nonnull TW_Cosmos_Proto_Message;
typedef TWData *_Nonnull TW_Cosmos_Proto_SignerInfo;
typedef TWData *_Nonnull TW_Cosmos_Proto_SigningInput;
typedef TWData *_Nonnull TW_Cosmos_Proto_SigningOutput;
39 changes: 39 additions & 0 deletions include/TrustWalletCore/TWCryptoBoxPublicKey.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.

#pragma once

#include "TWBase.h"
#include "TWData.h"

TW_EXTERN_C_BEGIN

TW_EXPORT_CLASS
struct TWCryptoBoxPublicKey;

/// Determines if the given public key is valid or not.
///
/// \param data *non-null* byte array.
/// \return true if the public key is valid, false otherwise.
TW_EXPORT_STATIC_METHOD bool TWCryptoBoxPublicKeyIsValid(TWData *_Nonnull data);

/// Create a `crypto_box` public key with the given block of data.
///
/// \param data *non-null* byte array. Expected to have 32 bytes.
/// \note Should be deleted with \tw_crypto_box_public_key_delete.
/// \return Nullable pointer to Public Key.
TW_EXPORT_STATIC_METHOD struct TWCryptoBoxPublicKey *_Nullable TWCryptoBoxPublicKeyCreateWithData(TWData *_Nonnull data);

/// Returns the raw data of a given public-key.
///
/// \param public_key *non-null* pointer to a public key.
/// \return C-compatible result with a C-compatible byte array.
TW_EXPORT_PROPERTY TWData *_Nonnull TWCryptoBoxPublicKeyData(struct TWCryptoBoxPublicKey *_Nonnull publicKey);

/// Delete the given public key.
///
/// \param public_key *non-null* pointer to public key.
TW_EXPORT_METHOD void TWCryptoBoxPublicKeyDelete(struct TWCryptoBoxPublicKey *_Nonnull publicKey);

TW_EXTERN_C_END
52 changes: 52 additions & 0 deletions include/TrustWalletCore/TWCryptoBoxSecretKey.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.

#pragma once

#include "TWBase.h"
#include "TWData.h"
#include "TWCryptoBoxPublicKey.h"

TW_EXTERN_C_BEGIN

TW_EXPORT_CLASS
struct TWCryptoBoxSecretKey;

/// Determines if the given secret key is valid or not.
///
/// \param data *non-null* byte array.
/// \return true if the secret key is valid, false otherwise.
TW_EXPORT_STATIC_METHOD bool TWCryptoBoxSecretKeyIsValid(TWData *_Nonnull data);

/// Create a random secret key.
///
/// \note Should be deleted with \tw_crypto_box_secret_key_delete.
/// \return Nullable pointer to Private Key.
TW_EXPORT_STATIC_METHOD struct TWCryptoBoxSecretKey *_Nonnull TWCryptoBoxSecretKeyCreate();

/// Create a `crypto_box` secret key with the given block of data.
///
/// \param data *non-null* byte array. Expected to have 32 bytes.
/// \note Should be deleted with \tw_crypto_box_secret_key_delete.
/// \return Nullable pointer to Secret Key.
TW_EXPORT_STATIC_METHOD struct TWCryptoBoxSecretKey *_Nullable TWCryptoBoxSecretKeyCreateWithData(TWData *_Nonnull data);

/// Returns the public key associated with the given `key`.
///
/// \param key *non-null* pointer to the private key.
/// \return *non-null* pointer to the corresponding public key.
TW_EXPORT_METHOD struct TWCryptoBoxPublicKey *_Nonnull TWCryptoBoxSecretKeyGetPublicKey(struct TWCryptoBoxSecretKey *_Nonnull key);

/// Returns the raw data of a given secret-key.
///
/// \param secret_key *non-null* pointer to a secret key.
/// \return C-compatible result with a C-compatible byte array.
TW_EXPORT_PROPERTY TWData *_Nonnull TWCryptoBoxSecretKeyData(struct TWCryptoBoxSecretKey *_Nonnull secretKey);

/// Delete the given secret `key`.
///
/// \param key *non-null* pointer to secret key.
TW_EXPORT_METHOD void TWCryptoBoxSecretKeyDelete(struct TWCryptoBoxSecretKey *_Nonnull key);

TW_EXTERN_C_END
14 changes: 14 additions & 0 deletions include/TrustWalletCore/TWDecredProto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.

#pragma once

#include "TWData.h"

typedef TWData *_Nonnull TW_Decred_Proto_Transaction;
typedef TWData *_Nonnull TW_Decred_Proto_TransactionInput;
typedef TWData *_Nonnull TW_Decred_Proto_TransactionOutput;
typedef TWData *_Nonnull TW_Decred_Proto_SigningOutput;
Loading
Loading