Skip to content

Commit 949b0c3

Browse files
feat(Manta): Add support for Manta Pacific Mainnet (#3617)
* feat(manta): Add support for Manta Pacific Mainnet * feat(manta): Fix iOS, Android, Kotlin tests * feat(manta): Fix some tests, codegen-v2
1 parent 374da80 commit 949b0c3

File tree

11 files changed

+74
-4
lines changed

11 files changed

+74
-4
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ class CoinAddressDerivationTests {
4242
CALLISTO -> assertEquals("0x3E6FFC80745E6669135a76F4A7ce6BCF02436e04", address)
4343
DASH -> assertEquals("XqHiz8EXYbTAtBEYs4pWTHh7ipEDQcNQeT", address)
4444
DIGIBYTE -> assertEquals("dgb1qtjgmerfqwdffyf8ghcrkgy52cghsqptynmyswu", address)
45+
4546
ETHEREUM, SMARTCHAIN, POLYGON, OPTIMISM, ZKSYNC, ARBITRUM, ARBITRUMNOVA, ECOCHAIN, AVALANCHECCHAIN, XDAI,
4647
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
4748
AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KLAYTN, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
48-
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
49+
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON, MANTAPACIFIC,
50+
-> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
51+
4952
RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)
5053
ETHEREUMCLASSIC -> assertEquals("0x078bA3228F3E6C08bEEac9A005de0b7e7089aD1c", address)
5154
GOCHAIN -> assertEquals("0x5940ce4A14210d4Ccd0ac206CE92F21828016aC2", address)

codegen-v2/src/codegen/cpp/templates/TWCoinTypeTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST(TW{COIN_TYPE}CoinType, TWCoinType) {
1919
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
2020

2121
assertStringsEqual(id, "{COIN_ID}");
22-
assertStringsEqual(name, "{COIN_TYPE}");
22+
assertStringsEqual(name, "{COIN_NAME}");
2323
assertStringsEqual(symbol, "{SYMBOL}");
2424
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), {DECIMALS});
2525
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchain{BLOCKCHAIN});

codegen-v2/src/codegen/template_generator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl TemplateGenerator {
4040
.add_pattern("{TW_CRATE_NAME}", coin.id.to_tw_crate_name())
4141
.add_pattern("{COIN_ID}", coin.id.as_str())
4242
.add_pattern("{COIN_TYPE}", coin.coin_type())
43+
.add_pattern("{COIN_NAME}", &coin.name)
4344
.add_pattern("{SYMBOL}", &coin.symbol)
4445
.add_pattern("{DECIMALS}", coin.decimals)
4546
.add_pattern("{P2PKH_PREFIX}", coin.p2pkh_prefix)

docs/registry.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ This list is generated from [./registry.json](../registry.json)
3131
| 148 | Stellar | XLM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png" width="32" /> | <https://stellar.org> |
3232
| 156 | Bitcoin Gold | BTG | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoingold/info/logo.png" width="32" /> | <https://bitcoingold.org> |
3333
| 165 | Nano | XNO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nano/info/logo.png" width="32" /> | <https://nano.org> |
34+
| 169 | Manta Pacific | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/manta/info/logo.png" width="32" /> | <https://pacific.manta.network> |
3435
| 175 | Ravencoin | RVN | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ravencoin/info/logo.png" width="32" /> | <https://ravencoin.org> |
3536
| 178 | POA Network | POA | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/poa/info/logo.png" width="32" /> | <https://poa.network> |
3637
| 194 | EOS | EOS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/eos/info/logo.png" width="32" /> | <http://eos.io> |

include/TrustWalletCore/TWCoinType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ enum TWCoinType {
179179
TWCoinTypeZenEON = 7332,
180180
TWCoinTypeInternetComputer = 223,
181181
TWCoinTypeTia = 21000118,
182+
TWCoinTypeMantaPacific = 169,
182183
// end_of_tw_coin_type_marker_do_not_modify
183184
};
184185

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, Mantle, ZenEON,
42+
ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle, ZenEON, MantaPacific,
4343
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
4444

4545
Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"

registry.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,5 +4508,35 @@
45084508
"rpc": "",
45094509
"documentation": "https://internetcomputer.org/docs"
45104510
}
4511+
},
4512+
{
4513+
"id": "manta",
4514+
"name": "Manta Pacific",
4515+
"coinId": 169,
4516+
"symbol": "ETH",
4517+
"decimals": 18,
4518+
"blockchain": "Ethereum",
4519+
"derivation": [
4520+
{
4521+
"path": "m/44'/60'/0'/0/0"
4522+
}
4523+
],
4524+
"curve": "secp256k1",
4525+
"publicKeyType": "secp256k1Extended",
4526+
"chainId": "169",
4527+
"addressHasher": "keccak256",
4528+
"explorer": {
4529+
"url": "https://pacific-explorer.manta.network",
4530+
"txPath": "/tx/",
4531+
"accountPath": "/address/",
4532+
"sampleTx": "0x2bbd5d85b0ed05d1416e30ce1197a6f0c27d10ce02593a2719e2baf486d2e8c2",
4533+
"sampleAccount": "0xF122a1aC569a36a5Cf6d0F828A22254c8A9afF84"
4534+
},
4535+
"info": {
4536+
"url": "https://pacific.manta.network",
4537+
"source": "https://github.com/manta-network",
4538+
"rpc": "https://pacific-rpc.manta.network/http",
4539+
"documentation": "https://docs.manta.network/docs/Introduction"
4540+
}
45114541
}
45124542
]

rust/tw_any_coin/tests/coin_address_derivation_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ fn test_coin_address_derivation() {
8686
| CoinType::Greenfield
8787
| CoinType::Mantle
8888
| CoinType::ZenEON
89+
| CoinType::MantaPacific
8990
// end_of_evm_address_derivation_tests_marker_do_not_modify
9091
=> "0xAc1ec44E4f0ca7D172B7803f6836De87Fb72b309",
9192
CoinType::Bitcoin

swift/Tests/CoinAddressDerivationTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ class CoinAddressDerivationTests: XCTestCase {
114114
.linea,
115115
.greenfield,
116116
.mantle,
117-
.zenEON:
117+
.zenEON,
118+
.mantaPacific:
118119
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
119120
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
120121
case .ronin:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
#include "TestUtilities.h"
8+
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
9+
#include <gtest/gtest.h>
10+
11+
TEST(TWMantaPacificCoinType, TWCoinType) {
12+
const auto coin = TWCoinTypeMantaPacific;
13+
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
14+
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
15+
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
16+
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0x2bbd5d85b0ed05d1416e30ce1197a6f0c27d10ce02593a2719e2baf486d2e8c2"));
17+
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
18+
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0xF122a1aC569a36a5Cf6d0F828A22254c8A9afF84"));
19+
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
20+
21+
assertStringsEqual(id, "manta");
22+
assertStringsEqual(name, "Manta Pacific");
23+
assertStringsEqual(symbol, "ETH");
24+
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
25+
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
26+
ASSERT_EQ(TWCoinTypeP2pkhPrefix(coin), 0);
27+
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0);
28+
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0);
29+
assertStringsEqual(txUrl, "https://pacific-explorer.manta.network/tx/0x2bbd5d85b0ed05d1416e30ce1197a6f0c27d10ce02593a2719e2baf486d2e8c2");
30+
assertStringsEqual(accUrl, "https://pacific-explorer.manta.network/address/0xF122a1aC569a36a5Cf6d0F828A22254c8A9afF84");
31+
}

0 commit comments

Comments
 (0)