Skip to content

Commit 6110d9c

Browse files
feat(monad): Add Monad testnet (#4543)
1 parent 4adde2a commit 6110d9c

File tree

9 files changed

+67
-3
lines changed

9 files changed

+67
-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
@@ -47,7 +47,7 @@ class CoinAddressDerivationTests {
4747
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
4848
AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KAIA, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
4949
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON, MANTAPACIFIC,
50-
ZETAEVM, MERLIN, LIGHTLINK, BLAST, BOUNCEBIT, ZKLINKNOVA, SONIC, PLASMA,
50+
ZETAEVM, MERLIN, LIGHTLINK, BLAST, BOUNCEBIT, ZKLINKNOVA, SONIC, PLASMA, MONAD,
5151
-> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
5252

5353
RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)

docs/registry.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ This list is generated from [./registry.json](../registry.json)
9898
| 8453 | Base | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png" width="32" /> | <https://base.mirror.xyz/> |
9999
| 8964 | NULS | NULS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nuls/info/logo.png" width="32" /> | <https://nuls.io> |
100100
| 9745 | Plasma Mainnet | XPL | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/plasma/info/logo.png" width="32" /> | <https://plasma.to> |
101+
| 10143 | Monad Testnet | MON | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/monad/info/logo.png" width="32" /> | <https://www.monad.xyz> |
101102
| 14001 | WAX | WAXP | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/wax/info/logo.png" width="32" /> | <http://wax.io> |
102103
| 18000 | Meter | MTR | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/meter/info/logo.png" width="32" /> | <https://meter.io/> |
103104
| 19167 | Flux | FLUX | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zelcash/info/logo.png" width="32" /> | <https://runonflux.io> |

include/TrustWalletCore/TWCoinType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ enum TWCoinType {
190190
TWCoinTypeSonic = 10000146,
191191
TWCoinTypePolymesh = 595,
192192
TWCoinTypePlasma = 9745,
193+
TWCoinTypeMonad = 10143,
193194
// end_of_tw_coin_type_marker_do_not_modify
194195
};
195196

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
@@ -40,7 +40,7 @@ class CoinAddressDerivationTests {
4040
Fantom, Celo, CronosChain, SmartBitcoinCash, KuCoinCommunityChain, Boba, Metis,
4141
Aurora, Evmos, Moonriver, Moonbeam, KavaEvm, Kaia, Meter, OKXChain, PolygonzkEVM, Scroll,
4242
ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle, ZenEON, MantaPacific,
43-
ZetaEVM, Merlin, Lightlink, Blast, BounceBit, ZkLinkNova, Sonic, Plasma,
43+
ZetaEVM, Merlin, Lightlink, Blast, BounceBit, ZkLinkNova, Sonic, Plasma, Monad,
4444
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
4545

4646
Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"

registry.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4910,5 +4910,35 @@
49104910
"rpc": "https://rpc.plasma.to",
49114911
"documentation": "https://plasmascan.to/documentation"
49124912
}
4913+
},
4914+
{
4915+
"id": "monad",
4916+
"name": "Monad",
4917+
"displayName": "Monad Testnet",
4918+
"coinId": 10143,
4919+
"symbol": "MON",
4920+
"decimals": 18,
4921+
"blockchain": "Ethereum",
4922+
"derivation": [
4923+
{
4924+
"path": "m/44'/60'/0'/0/0"
4925+
}
4926+
],
4927+
"curve": "secp256k1",
4928+
"publicKeyType": "secp256k1Extended",
4929+
"chainId": "10143",
4930+
"addressHasher": "keccak256",
4931+
"explorer": {
4932+
"url": "https://testnet.monadexplorer.com",
4933+
"txPath": "/tx/",
4934+
"accountPath": "/address/",
4935+
"sampleTx": "0xfffe6b1c1238be8d5f4779f97af8fffc89530e2634c61be7a5241dc08f41f07f",
4936+
"sampleAccount": "0xa161C1d86b26ac692604E0cDbc5EcB2D1d85759c"
4937+
},
4938+
"info": {
4939+
"url": "https://www.monad.xyz",
4940+
"rpc": "https://testnet-rpc.monad.xyz",
4941+
"documentation": "https://docs.monad.xyz"
4942+
}
49134943
}
49144944
]

rust/tw_tests/tests/coin_address_derivation_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fn test_coin_address_derivation() {
9393
| CoinType::ZkLinkNova
9494
| CoinType::Sonic
9595
| CoinType::Plasma
96+
| CoinType::Monad
9697
// end_of_evm_address_derivation_tests_marker_do_not_modify
9798
=> "0xAc1ec44E4f0ca7D172B7803f6836De87Fb72b309",
9899
CoinType::Bitcoin => "bc1qten42eesehw0ktddcp0fws7d3ycsqez3f7d5yt",

swift/Tests/CoinAddressDerivationTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ class CoinAddressDerivationTests: XCTestCase {
121121
.bounceBit,
122122
.zkLinkNova,
123123
.sonic,
124-
.plasma:
124+
.plasma,
125+
.monad:
125126
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
126127
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
127128
case .ronin:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
//
3+
// Copyright © 2017 Trust Wallet.
4+
5+
#include "TestUtilities.h"
6+
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
7+
#include <gtest/gtest.h>
8+
9+
TEST(TWMonadCoinType, TWCoinType) {
10+
const auto coin = TWCoinTypeMonad;
11+
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
12+
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
13+
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
14+
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0xfffe6b1c1238be8d5f4779f97af8fffc89530e2634c61be7a5241dc08f41f07f"));
15+
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
16+
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0xa161C1d86b26ac692604E0cDbc5EcB2D1d85759c"));
17+
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
18+
19+
assertStringsEqual(id, "monad");
20+
assertStringsEqual(name, "Monad Testnet");
21+
assertStringsEqual(symbol, "MON");
22+
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
23+
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
24+
ASSERT_EQ(TWCoinTypeP2pkhPrefix(coin), 0);
25+
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0);
26+
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0);
27+
assertStringsEqual(txUrl, "https://testnet.monadexplorer.com/tx/0xfffe6b1c1238be8d5f4779f97af8fffc89530e2634c61be7a5241dc08f41f07f");
28+
assertStringsEqual(accUrl, "https://testnet.monadexplorer.com/address/0xa161C1d86b26ac692604E0cDbc5EcB2D1d85759c");
29+
}

tests/common/CoinAddressDerivationTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ TEST(Coin, DeriveAddress) {
9191
case TWCoinTypeZkLinkNova:
9292
case TWCoinTypeSonic:
9393
case TWCoinTypePlasma:
94+
case TWCoinTypeMonad:
9495
// end_of_evm_address_derivation_tests_marker_do_not_modify
9596
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
9697
break;

0 commit comments

Comments
 (0)