From 87c4c99fe60729505e91d5f578b7d7c0aaaed662 Mon Sep 17 00:00:00 2001 From: Joeh Date: Wed, 26 Jul 2023 12:13:42 +0100 Subject: [PATCH] Feat: Add Neon Mainnet Network --- docs/registry.md | 1 + include/TrustWalletCore/TWCoinType.h | 1 + registry.json | 30 +++++++++++++++++ tests/chains/Neon/TWCoinTypeTests.cpp | 37 +++++++++++++++++++++ tests/common/CoinAddressDerivationTests.cpp | 1 + 5 files changed, 70 insertions(+) create mode 100644 tests/chains/Neon/TWCoinTypeTests.cpp diff --git a/docs/registry.md b/docs/registry.md index a3905803c70..ca6fb7f6afc 100644 --- a/docs/registry.md +++ b/docs/registry.md @@ -140,4 +140,5 @@ This list is generated from [./registry.json](../registry.json) | 70000118 | Kujira | KUJI | | | | 80000118 | Comdex | CMDX | | | | 90000118 | Neutron | NTRN | | | +| 255022934 | Neon | NEON | | | | 1323161554 | Aurora | ETH | | | diff --git a/include/TrustWalletCore/TWCoinType.h b/include/TrustWalletCore/TWCoinType.h index c6de3d4e5dd..5ccaf3af7f2 100644 --- a/include/TrustWalletCore/TWCoinType.h +++ b/include/TrustWalletCore/TWCoinType.h @@ -169,6 +169,7 @@ enum TWCoinType { TWCoinTypeAcala = 787, TWCoinTypeAcalaEVM = 10000787, TWCoinTypeOpBNBtestnet = 5611, + TWCoinTypeNeon = 255022934, }; /// Returns the blockchain for a coin type. diff --git a/registry.json b/registry.json index 6cd872676f9..809e2ae14f9 100644 --- a/registry.json +++ b/registry.json @@ -4204,5 +4204,35 @@ "rpc": "https://toncenter.com/api/v2/jsonRPC", "documentation": "https://ton.org/docs" } + }, + { + "id": "neon", + "name": "Neon", + "coinId": 255022934, + "symbol": "NEON", + "decimals": 18, + "blockchain": "Ethereum", + "derivation": [ + { + "path": "m/44'/60'/0'/0/0" + } + ], + "curve": "secp256k1", + "publicKeyType": "secp256k1Extended", + "chainId": "245022934", + "addressHasher": "keccak256", + "explorer": { + "url": "https://neonscan.org", + "txPath": "/tx/", + "accountPath": "/address/", + "sampleTx": "0x77d86af2c6f02f14ef13ca52bf54864d92fcc4b32d8e884e225061c006738ed6", + "sampleAccount": "0xfa4a8650e7bebb918859c280a86f9661bed29877" + }, + "info": { + "url": "https://neonevm.org", + "source": "https://github.com/neonevm/neon-evm", + "rpc": "https://neon-proxy-mainnet.solana.p2p.org/", + "documentation": "https://docs.neonfoundation.io/docs/quick_start" + } } ] diff --git a/tests/chains/Neon/TWCoinTypeTests.cpp b/tests/chains/Neon/TWCoinTypeTests.cpp new file mode 100644 index 00000000000..9335530a0fc --- /dev/null +++ b/tests/chains/Neon/TWCoinTypeTests.cpp @@ -0,0 +1,37 @@ +// Copyright © 2017-2023 Trust Wallet. +// +// This file is part of Trust. The full Trust copyright notice, including +// terms governing use, modification, and redistribution, is contained in the +// file LICENSE at the root of the source code distribution tree. +// +// This is a GENERATED FILE, changes made here MAY BE LOST. +// Generated one-time (codegen/bin/cointests) +// + +#include "TestUtilities.h" +#include +#include + + +TEST(TWNeonCoinType, TWCoinType) { + const auto coin = TWCoinTypeNeon; + const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin)); + const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin)); + const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin)); + const auto chainId = WRAPS(TWCoinTypeChainId(coin)); + const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0x77d86af2c6f02f14ef13ca52bf54864d92fcc4b32d8e884e225061c006738ed6")); + const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get())); + const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0xfa4a8650e7bebb918859c280a86f9661bed29877")); + const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get())); + + assertStringsEqual(id, "neon"); + assertStringsEqual(name, "Neon"); + assertStringsEqual(symbol, "NEON"); + ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18); + ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum); + ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x0); + ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x0); + assertStringsEqual(chainId, "245022934"); + assertStringsEqual(txUrl, "https://neonscan.org/tx/0x77d86af2c6f02f14ef13ca52bf54864d92fcc4b32d8e884e225061c006738ed6"); + assertStringsEqual(accUrl, "https://neonscan.org/address/0xfa4a8650e7bebb918859c280a86f9661bed29877"); +} diff --git a/tests/common/CoinAddressDerivationTests.cpp b/tests/common/CoinAddressDerivationTests.cpp index e461945a2eb..ac948f7aa11 100644 --- a/tests/common/CoinAddressDerivationTests.cpp +++ b/tests/common/CoinAddressDerivationTests.cpp @@ -77,6 +77,7 @@ TEST(Coin, DeriveAddress) { case TWCoinTypeIoTeXEVM: case TWCoinTypeScroll: case TWCoinTypeOpBNBtestnet: + case TWCoinTypeNeon: EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F"); break;