Skip to content

Commit

Permalink
feat(Celestia): Add support for Celestia mainnet (trustwallet#3528)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshiotomakan authored Nov 1, 2023
1 parent 72c67be commit 1382e3c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
8 changes: 4 additions & 4 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@
"symbol": "TIA",
"decimals": 6,
"blockchain": "Cosmos",
"chainId": "mocha-4",
"chainId": "celestia",
"derivation": [
{
"path": "m/44'/118'/0'/0/0"
Expand All @@ -1185,11 +1185,11 @@
"hrp": "celestia",
"addressHasher": "sha256ripemd",
"explorer": {
"url": "https://www.mintscan.io/tia",
"url": "https://www.mintscan.io/celestia",
"txPath": "/txs/",
"accountPath": "/account/",
"sampleTx": "943B1A59EB724A1258CF167834A83558DE5A31E8C1E31FCBCBB99404222E5FBF",
"sampleAccount": "celestia142j9u5eaduzd7faumygud6ruhdwme98qpwmfv7"
"sampleTx": "FF370C65D8D67B8236F9D3A8D2B1256337C60C1965092CADD1FA970288FCE99B",
"sampleAccount": "celestia1tt4tv4jrs4twdtzwywxd8u65duxgk8y73wvfu2"
},
"info": {
"url": "https://celestia.org/",
Expand Down
44 changes: 23 additions & 21 deletions tests/chains/Cosmos/Tia/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@
#include <gtest/gtest.h>

namespace TW::Cosmos::tests {
TEST(TWTiaCoinType, TWCoinType) {
const auto coin = TWCoinTypeTia;
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("943B1A59EB724A1258CF167834A83558DE5A31E8C1E31FCBCBB99404222E5FBF"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("celestia142j9u5eaduzd7faumygud6ruhdwme98qpwmfv7"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
assertStringsEqual(id, "tia");
assertStringsEqual(name, "Celestia");
assertStringsEqual(symbol, "TIA");
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 6);
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainCosmos);
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x0);
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x0);
assertStringsEqual(chainId, "mocha-4");
assertStringsEqual(txUrl, "https://www.mintscan.io/tia/txs/943B1A59EB724A1258CF167834A83558DE5A31E8C1E31FCBCBB99404222E5FBF");
assertStringsEqual(accUrl, "https://www.mintscan.io/tia/account/celestia142j9u5eaduzd7faumygud6ruhdwme98qpwmfv7");
}

TEST(TWTiaCoinType, TWCoinType) {
const auto coin = TWCoinTypeTia;
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("FF370C65D8D67B8236F9D3A8D2B1256337C60C1965092CADD1FA970288FCE99B"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("celestia1tt4tv4jrs4twdtzwywxd8u65duxgk8y73wvfu2"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
assertStringsEqual(id, "tia");
assertStringsEqual(name, "Celestia");
assertStringsEqual(symbol, "TIA");
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 6);
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainCosmos);
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x0);
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x0);
assertStringsEqual(chainId, "celestia");
assertStringsEqual(txUrl, "https://www.mintscan.io/celestia/txs/FF370C65D8D67B8236F9D3A8D2B1256337C60C1965092CADD1FA970288FCE99B");
assertStringsEqual(accUrl, "https://www.mintscan.io/celestia/account/celestia1tt4tv4jrs4twdtzwywxd8u65duxgk8y73wvfu2");
}

} // namespace TW::Cosmos::tests

0 comments on commit 1382e3c

Please sign in to comment.