Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rootstock chain #3205

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@ class CoinAddressDerivationTests {
PERSISTENCE -> assertEquals("persistence142j9u5eaduzd7faumygud6ruhdwme98q7gv2ch", address)
AKASH -> assertEquals("akash142j9u5eaduzd7faumygud6ruhdwme98qal870f", address)
NOBLE -> assertEquals("noble142j9u5eaduzd7faumygud6ruhdwme98qc8l3wa", address)
ROOTSTOCK -> assertEquals("0xA2D7065F94F838a3aB9C04D67B312056846424Df", address)
}
}
1 change: 1 addition & 0 deletions docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This list is generated from [./registry.json](../registry.json)
| 118 | Cosmos Hub | ATOM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cosmos/info/logo.png" width="32" /> | <https://cosmos.network> |
| 133 | Zcash | ZEC | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png" width="32" /> | <https://z.cash> |
| 136 | Firo | FIRO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/firo/info/logo.png" width="32" /> | <https://firo.org/> |
| 137 | Rootstock | RBTC | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/rootstock/info/logo.png" width="32" /> | <https://rootstock.io> |
| 144 | XRP | XRP | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png" width="32" /> | <https://ripple.com/xrp> |
| 145 | Bitcoin Cash | BCH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png" width="32" /> | <https://bitcoincash.org> |
| 148 | Stellar | XLM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png" width="32" /> | <https://stellar.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 @@ -152,6 +152,7 @@ enum TWCoinType {
TWCoinTypeAkash = 17000118,
TWCoinTypeNoble = 18000118,
TWCoinTypeScroll = 534353,
TWCoinTypeRootstock = 137,
};

/// Returns the blockchain for a coin type.
Expand Down
30 changes: 30 additions & 0 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,36 @@
"documentation": "https://eth.wiki/json-rpc/API"
}
},
{
"id": "rootstock",
"name": "Rootstock",
"coinId": 137,
Milerius marked this conversation as resolved.
Show resolved Hide resolved
"symbol": "RBTC",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
{
"path": "m/44'/137'/0'/0/0"
}
],
"curve": "secp256k1",
"publicKeyType": "secp256k1Extended",
"chainId": "30",
"addressHasher": "keccak256",
"explorer": {
"url": "https://explorer.rsk.co",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0xeb8fa0488a655f8dc975153bffd066800bcaae5f21cf372356365b2a1d6d2288",
"sampleAccount": "0x4e5dabc28e4a0f5e5b19fcb56b28c5a1989352c1"
},
"info": {
"url": "https://rootstock.io",
"source": "https://github.com/rsksmart/rskj",
"rpc": "https://public-node.rsk.co",
"documentation": "https://dev.rootstock.io"
}
},
{
"id": "thorchain",
"name": "THORChain",
Expand Down
3 changes: 3 additions & 0 deletions swift/Tests/CoinAddressDerivationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ class CoinAddressDerivationTests: XCTestCase {
case .ethereumClassic:
let expectedResult = "0x078bA3228F3E6C08bEEac9A005de0b7e7089aD1c"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
case .rootstock:
let expectedResult = "0xA2D7065F94F838a3aB9C04D67B312056846424Df"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
case .filecoin:
let expectedResult = "f1zzykebxldfcakj5wdb5n3n7priul522fnmjzori"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
Expand Down
37 changes: 37 additions & 0 deletions tests/chains/Rootstock/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright © 2017-2023 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
//
// This is a GENERATED FILE, changes made here MAY BE LOST.
// Generated one-time (codegen/bin/cointests)
//

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


TEST(TWRootstockCoinType, TWCoinType) {
const auto coin = TWCoinTypeRootstock;
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
const auto chainId = WRAPS(TWCoinTypeChainId(coin));
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0xeb8fa0488a655f8dc975153bffd066800bcaae5f21cf372356365b2a1d6d2288"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0x4e5dabc28e4a0f5e5b19fcb56b28c5a1989352c1"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));

assertStringsEqual(id, "rootstock");
assertStringsEqual(name, "Rootstock");
assertStringsEqual(symbol, "RBTC");
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x0);
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x0);
assertStringsEqual(chainId, "30");
assertStringsEqual(txUrl, "https://explorer.rsk.co/tx/0xeb8fa0488a655f8dc975153bffd066800bcaae5f21cf372356365b2a1d6d2288");
assertStringsEqual(accUrl, "https://explorer.rsk.co/address/0x4e5dabc28e4a0f5e5b19fcb56b28c5a1989352c1");
}
3 changes: 3 additions & 0 deletions tests/common/CoinAddressDerivationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ TEST(Coin, DeriveAddress) {
case TWCoinTypeNoble:
EXPECT_EQ(address, "noble1hkfq3zahaqkkzx5mjnamwjsfpq2jk7z03c2t50");
break;
case TWCoinTypeRootstock:
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
break;
// no default branch here, intentionally, to better notice any missing coins
}
}
Expand Down