Skip to content

Commit

Permalink
[Lightlink]: Add Lightlink Phoenix EVM chain (#3784)
Browse files Browse the repository at this point in the history
* feat(lightlink): Add Lightlink Phoenix EVM chain

* feat(lightlink): Fix iOS test
  • Loading branch information
satoshiotomakan authored Apr 11, 2024
1 parent 7d03d04 commit 8daa8f9
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,
ZETAEVM, MERLIN, LIGHTLINK,
-> 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 @@ -84,6 +84,7 @@ This list is generated from [./registry.json](../registry.json)
| 1030 | Conflux eSpace | CFX | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cfxevm/info/logo.png" width="32" /> | <https://confluxnetwork.org> |
| 1729 | Tezos | XTZ | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tezos/info/logo.png" width="32" /> | <https://tezos.com> |
| 1815 | Cardano | ADA | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cardano/info/logo.png" width="32" /> | <https://www.cardano.org> |
| 1890 | Lightlink Phoenix | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/lightlink/info/logo.png" width="32" /> | <https://lightlink.io> |
| 2301 | Qtum | QTUM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/qtum/info/logo.png" width="32" /> | <https://qtum.org> |
| 2718 | Nebulas | NAS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nebulas/info/logo.png" width="32" /> | <https://nebulas.io> |
| 3030 | Hedera | HBAR | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/hedera/info/logo.png" width="32" /> | <https://hedera.com/> |
Expand Down
1 change: 1 addition & 0 deletions include/TrustWalletCore/TWCoinType.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ enum TWCoinType {
TWCoinTypeZetaEVM = 20007000,
TWCoinTypeDydx = 22000118,
TWCoinTypeMerlin = 4200,
TWCoinTypeLightlink = 1890,
// 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,
ZetaEVM, Merlin, Lightlink,
-> "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 @@ -4658,5 +4658,36 @@
"rpc": "https://rpc.merlinchain.io",
"documentation": "https://docs.merlinchain.io/merlin-docs"
}
},
{
"id": "lightlink",
"name": "Lightlink",
"displayName": "Lightlink Phoenix",
"coinId": 1890,
"symbol": "ETH",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
{
"path": "m/44'/60'/0'/0/0"
}
],
"curve": "secp256k1",
"publicKeyType": "secp256k1Extended",
"chainId": "1890",
"addressHasher": "keccak256",
"explorer": {
"url": "https://phoenix.lightlink.io",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0xc65f82445aefc883fd4ffe09149c8ce48f61b670c0734528a49d4a8bd8309bb0",
"sampleAccount": "0x4566ED6c7a7fFc90E2C7cfF7eB9156262afD2fDe"
},
"info": {
"url": "https://lightlink.io",
"source": "https://github.com/lightlink-network",
"rpc": "https://endpoints.omniatech.io/v1/lightlink/phoenix/public",
"documentation": "https://docs.lightlink.io/lightlink-protocol"
}
}
]
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 @@ -87,6 +87,7 @@ fn test_coin_address_derivation() {
| CoinType::MantaPacific
| CoinType::ZetaEVM
| CoinType::Merlin
| CoinType::Lightlink
// 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 @@ -115,7 +115,8 @@ class CoinAddressDerivationTests: XCTestCase {
.zenEON,
.mantaPacific,
.zetaEVM,
.merlin:
.merlin,
.lightlink:
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
case .ronin:
Expand Down
29 changes: 29 additions & 0 deletions tests/chains/Lightlink/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(TWLightlinkCoinType, TWCoinType) {
const auto coin = TWCoinTypeLightlink;
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0xc65f82445aefc883fd4ffe09149c8ce48f61b670c0734528a49d4a8bd8309bb0"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0x4566ED6c7a7fFc90E2C7cfF7eB9156262afD2fDe"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));

assertStringsEqual(id, "lightlink");
assertStringsEqual(name, "Lightlink Phoenix");
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://phoenix.lightlink.io/tx/0xc65f82445aefc883fd4ffe09149c8ce48f61b670c0734528a49d4a8bd8309bb0");
assertStringsEqual(accUrl, "https://phoenix.lightlink.io/address/0x4566ED6c7a7fFc90E2C7cfF7eB9156262afD2fDe");
}
1 change: 1 addition & 0 deletions tests/common/CoinAddressDerivationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ TEST(Coin, DeriveAddress) {
case TWCoinTypeMantaPacific:
case TWCoinTypeZetaEVM:
case TWCoinTypeMerlin:
case TWCoinTypeLightlink:
// end_of_evm_address_derivation_tests_marker_do_not_modify
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
break;
Expand Down

0 comments on commit 8daa8f9

Please sign in to comment.