Skip to content

Commit defedb6

Browse files
[Mantle]: Add Mantle EVM-compatible chain (#3417)
1 parent 573696f commit defedb6

File tree

8 files changed

+74
-3
lines changed

8 files changed

+74
-3
lines changed

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/CoinAddressDerivationTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CoinAddressDerivationTests {
4545
ETHEREUM, SMARTCHAIN, POLYGON, OPTIMISM, ZKSYNC, ARBITRUM, ARBITRUMNOVA, ECOCHAIN, AVALANCHECCHAIN, XDAI,
4646
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
4747
AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KLAYTN, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
48-
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
48+
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
4949
RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)
5050
ETHEREUMCLASSIC -> assertEquals("0x078bA3228F3E6C08bEEac9A005de0b7e7089aD1c", address)
5151
GOCHAIN -> assertEquals("0x5940ce4A14210d4Ccd0ac206CE92F21828016aC2", address)

docs/registry.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ This list is generated from [./registry.json](../registry.json)
8585
| 2301 | Qtum | QTUM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/qtum/info/logo.png" width="32" /> | <https://qtum.org> |
8686
| 2718 | Nebulas | NAS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nebulas/info/logo.png" width="32" /> | <https://nebulas.io> |
8787
| 3030 | Hedera | HBAR | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/hedera/info/logo.png" width="32" /> | <https://hedera.com/> |
88+
| 5000 | Mantle | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/mantle/info/logo.png" width="32" /> | <https://www.mantle.xyz> |
8889
| 5600 | BNB Greenfield | BNB | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/greenfield/info/logo.png" width="32" /> | <https://greenfield.bnbchain.org> |
8990
| 6060 | GoChain | GO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/gochain/info/logo.png" width="32" /> | <https://gochain.io> |
9091
| 8453 | Base | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png" width="32" /> | <https://base.mirror.xyz/> |

include/TrustWalletCore/TWCoinType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ enum TWCoinType {
175175
TWCoinTypeArbitrumNova = 10042170,
176176
TWCoinTypeLinea = 59144,
177177
TWCoinTypeGreenfield = 5600,
178+
TWCoinTypeMantle = 5000,
178179
};
179180

180181
/// Returns the blockchain for a coin type.

kotlin/wallet-core-kotlin/src/commonTest/kotlin/com/trustwallet/core/test/CoinAddressDerivationTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CoinAddressDerivationTests {
3939
Ethereum, SmartChain, Polygon, Optimism, Zksync, Arbitrum, ArbitrumNova, ECOChain, AvalancheCChain, XDai,
4040
Fantom, Celo, CronosChain, SmartBitcoinCash, KuCoinCommunityChain, Boba, Metis,
4141
Aurora, Evmos, Moonriver, Moonbeam, KavaEvm, Klaytn, Meter, OKXChain, PolygonzkEVM, Scroll,
42-
ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield,
42+
ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle,
4343
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
4444

4545
Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"

registry.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,36 @@
410410
"documentation": "https://docs.linea.build"
411411
}
412412
},
413+
{
414+
"id": "mantle",
415+
"name": "Mantle",
416+
"coinId": 5000,
417+
"symbol": "MNT",
418+
"decimals": 18,
419+
"blockchain": "Ethereum",
420+
"derivation": [
421+
{
422+
"path": "m/44'/60'/0'/0/0"
423+
}
424+
],
425+
"curve": "secp256k1",
426+
"publicKeyType": "secp256k1Extended",
427+
"chainId": "5000",
428+
"addressHasher": "keccak256",
429+
"explorer": {
430+
"url": "https://explorer.mantle.xyz",
431+
"txPath": "/tx/",
432+
"accountPath": "/address/",
433+
"sampleTx": "0xfae996ea23f1ff9909ac04d26ae6e52ab600a84163fab9e0e893483c685629dd",
434+
"sampleAccount": "0xA295EEFd401C8BE1457F266d3e73cdD015e5CFbb"
435+
},
436+
"info": {
437+
"url": "https://www.mantle.xyz",
438+
"source": "https://github.com/mantlenetworkio",
439+
"rpc": "https://rpc.mantle.xyz",
440+
"documentation": "https://docs.mantle.xyz/network/introduction/overview"
441+
}
442+
},
413443
{
414444
"id": "ethereum",
415445
"name": "Ethereum",

swift/Tests/CoinAddressDerivationTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ class CoinAddressDerivationTests: XCTestCase {
112112
.neon,
113113
.base,
114114
.linea,
115-
.greenfield:
115+
.greenfield,
116+
.mantle:
116117
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
117118
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
118119
case .ronin:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright © 2017-2023 Trust Wallet.
2+
//
3+
// This file is part of Trust. The full Trust copyright notice, including
4+
// terms governing use, modification, and redistribution, is contained in the
5+
// file LICENSE at the root of the source code distribution tree.
6+
//
7+
// This is a GENERATED FILE, changes made here MAY BE LOST.
8+
// Generated one-time (codegen/bin/cointests)
9+
//
10+
11+
#include "TestUtilities.h"
12+
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
13+
#include <gtest/gtest.h>
14+
15+
16+
TEST(TWMantleCoinType, TWCoinType) {
17+
const auto coin = TWCoinTypeMantle;
18+
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
19+
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
20+
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
21+
const auto chainId = WRAPS(TWCoinTypeChainId(coin));
22+
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0xfae996ea23f1ff9909ac04d26ae6e52ab600a84163fab9e0e893483c685629dd"));
23+
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
24+
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0xA295EEFd401C8BE1457F266d3e73cdD015e5CFbb"));
25+
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
26+
27+
assertStringsEqual(id, "mantle");
28+
assertStringsEqual(name, "Mantle");
29+
assertStringsEqual(symbol, "MNT");
30+
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
31+
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
32+
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x0);
33+
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x0);
34+
assertStringsEqual(chainId, "5000");
35+
assertStringsEqual(txUrl, "https://explorer.mantle.xyz/tx/0xfae996ea23f1ff9909ac04d26ae6e52ab600a84163fab9e0e893483c685629dd");
36+
assertStringsEqual(accUrl, "https://explorer.mantle.xyz/address/0xA295EEFd401C8BE1457F266d3e73cdD015e5CFbb");
37+
}

tests/common/CoinAddressDerivationTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ TEST(Coin, DeriveAddress) {
8282
case TWCoinTypeBase:
8383
case TWCoinTypeLinea:
8484
case TWCoinTypeGreenfield:
85+
case TWCoinTypeMantle:
8586
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
8687
break;
8788

0 commit comments

Comments
 (0)