Skip to content

Commit

Permalink
feat(zkLink): Add zkLink Nova Mainnet EVM chain (#3881)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshiotomakan authored Jun 5, 2024
1 parent 55ca3e5 commit a85c7d4
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CoinAddressDerivationTests {
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KLAYTN, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON, MANTAPACIFIC,
ZETAEVM, MERLIN, LIGHTLINK, BLAST, BOUNCEBIT,
ZETAEVM, MERLIN, LIGHTLINK, BLAST, BOUNCEBIT, ZKLINKNOVA,
-> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)

RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)
Expand Down
1 change: 1 addition & 0 deletions docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ This list is generated from [./registry.json](../registry.json)
| 81457 | Blast | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/blast/info/logo.png" width="32" /> | <https://blast.io> |
| 105105 | Stratis | STRAX | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stratis/info/logo.png" width="32" /> | <https://www.stratisplatform.com/> |
| 534352 | Scroll | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png" width="32" /> | <https://scroll.io> |
| 810180 | zkLink Nova Mainnet | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zklinknova/info/logo.png" width="32" /> | <https://zklink.io> |
| 5718350 | Wanchain | WAN | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/wanchain/info/logo.png" width="32" /> | <https://wanchain.org> |
| 5741564 | Waves | WAVES | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/waves/info/logo.png" width="32" /> | <https://wavesplatform.com> |
| 10000025 | Cronos Chain | CRO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cronos/info/logo.png" width="32" /> | <https://cronos.org> |
Expand Down
1 change: 1 addition & 0 deletions include/TrustWalletCore/TWCoinType.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ enum TWCoinType {
TWCoinTypeLightlink = 1890,
TWCoinTypeBlast = 81457,
TWCoinTypeBounceBit = 6001,
TWCoinTypeZkLinkNova = 810180,
// end_of_tw_coin_type_marker_do_not_modify
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CoinAddressDerivationTests {
Fantom, Celo, CronosChain, SmartBitcoinCash, KuCoinCommunityChain, Boba, Metis,
Aurora, Evmos, Moonriver, Moonbeam, KavaEvm, Klaytn, Meter, OKXChain, PolygonzkEVM, Scroll,
ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle, ZenEON, MantaPacific,
ZetaEVM, Merlin, Lightlink, Blast, BounceBit,
ZetaEVM, Merlin, Lightlink, Blast, BounceBit, ZkLinkNova,
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"

Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"
Expand Down
31 changes: 31 additions & 0 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -4749,5 +4749,36 @@
"rpc": "https://fullnode-mainnet.bouncebitapi.com",
"documentation": "https://docs.bouncebit.io"
}
},
{
"id": "zklinknova",
"name": "ZkLinkNova",
"displayName": "zkLink Nova Mainnet",
"coinId": 810180,
"symbol": "ETH",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
{
"path": "m/44'/60'/0'/0/0"
}
],
"curve": "secp256k1",
"publicKeyType": "secp256k1Extended",
"chainId": "810180",
"addressHasher": "keccak256",
"explorer": {
"url": "https://explorer.zklink.io",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0xeb5eb8710369c89115a83f3e744c15c9d388030cfce2fd3a653dbd18f2947400",
"sampleAccount": "0xF95115BaD9a4585B3C5e2bfB50579f17163A45aA"
},
"info": {
"url": "https://zklink.io",
"source": "https://github.com/zkLinkProtocol",
"rpc": "https://rpc.zklink.io",
"documentation": "https://docs.zklink.io"
}
}
]
1 change: 1 addition & 0 deletions rust/tw_any_coin/tests/coin_address_derivation_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ fn test_coin_address_derivation() {
| CoinType::Lightlink
| CoinType::Blast
| CoinType::BounceBit
| CoinType::ZkLinkNova
// end_of_evm_address_derivation_tests_marker_do_not_modify
=> "0xAc1ec44E4f0ca7D172B7803f6836De87Fb72b309",
CoinType::Bitcoin
Expand Down
3 changes: 2 additions & 1 deletion swift/Tests/CoinAddressDerivationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class CoinAddressDerivationTests: XCTestCase {
.merlin,
.lightlink,
.blast,
.bounceBit:
.bounceBit,
.zkLinkNova:
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
case .ronin:
Expand Down
29 changes: 29 additions & 0 deletions tests/chains/ZkLinkNova/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.

#include "TestUtilities.h"
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
#include <gtest/gtest.h>

TEST(TWZkLinkNovaCoinType, TWCoinType) {
const auto coin = TWCoinTypeZkLinkNova;
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0xeb5eb8710369c89115a83f3e744c15c9d388030cfce2fd3a653dbd18f2947400"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0xF95115BaD9a4585B3C5e2bfB50579f17163A45aA"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));

assertStringsEqual(id, "zklinknova");
assertStringsEqual(name, "zkLink Nova Mainnet");
assertStringsEqual(symbol, "ETH");
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
ASSERT_EQ(TWCoinTypeP2pkhPrefix(coin), 0);
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0);
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0);
assertStringsEqual(txUrl, "https://explorer.zklink.io/tx/0xeb5eb8710369c89115a83f3e744c15c9d388030cfce2fd3a653dbd18f2947400");
assertStringsEqual(accUrl, "https://explorer.zklink.io/address/0xF95115BaD9a4585B3C5e2bfB50579f17163A45aA");
}
1 change: 1 addition & 0 deletions tests/common/CoinAddressDerivationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ TEST(Coin, DeriveAddress) {
case TWCoinTypeLightlink:
case TWCoinTypeBlast:
case TWCoinTypeBounceBit:
case TWCoinTypeZkLinkNova:
// end_of_evm_address_derivation_tests_marker_do_not_modify
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
break;
Expand Down

1 comment on commit a85c7d4

@Safay99
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a85c7d401f0d814eabbc72577a4b24b9ff2dda41

Please sign in to comment.