Skip to content

Commit

Permalink
feat: mantra interation
Browse files Browse the repository at this point in the history
  • Loading branch information
Canestin committed Oct 28, 2024
1 parent 30a8daa commit f42d0d2
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/cli/src/live-common-setup-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ setSupportedCurrencies([
"scroll",
"scroll_sepolia",
"etherlink",
"mantra",
]);

for (const k in process.env) setEnvUnsafe(k as EnvName, process.env[k]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ setSupportedCurrencies([
"scroll_sepolia",
"ton",
"etherlink",
"mantra",
]);
1 change: 1 addition & 0 deletions apps/ledger-live-mobile/src/live-common-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ setSupportedCurrencies([
"scroll_sepolia",
"ton",
"etherlink",
"mantra",
]);

if (Config.BLE_LOG_LEVEL) BluetoothTransport.setLogLevel(Config.BLE_LOG_LEVEL);
Expand Down
20 changes: 20 additions & 0 deletions libs/coin-modules/coin-cosmos/src/chain/Mantra.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import CosmosBase from "./cosmosBase";

class Mantra extends CosmosBase {
stakingDocUrl: string;
unbondingPeriod: number;
prefix: string;
validatorPrefix: string;
// Provided by coin config
ledgerValidator!: string;
lcd!: string;
constructor() {
super();
this.stakingDocUrl = "";
this.unbondingPeriod = 21;
this.prefix = "mantra";
this.validatorPrefix = `${this.prefix}valoper`;
}
}

export default Mantra;
4 changes: 4 additions & 0 deletions libs/coin-modules/coin-cosmos/src/chain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import BinanceBeaconChain from "./BinanceBeaconChain";
import Coreum from "./Coreum";
import Injective from "./Injective";
import Dydx from "./Dydx";
import Mantra from "./Mantra";

const cosmosChainParams: { [key: string]: CosmosBase } = {};
export default function cryptoFactory(currencyId: string): CosmosBase {
Expand Down Expand Up @@ -74,6 +75,9 @@ export default function cryptoFactory(currencyId: string): CosmosBase {
case "injective":
cosmosChainParams[currencyId] = new Injective();
break;
case "mantra":
cosmosChainParams[currencyId] = new Mantra();
break;
default:
throw new Error(`${currencyId} is not supported`);
}
Expand Down
1 change: 1 addition & 0 deletions libs/coin-modules/coin-cosmos/src/chain/chain.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe("cryptoFactory test", () => {
"sei_network",
"stargaze",
"stride",
"mantra",
];
currencies.forEach(currency => {
expect(cryptoFactory(currency)).not.toBeNull();
Expand Down
10 changes: 10 additions & 0 deletions libs/coin-modules/coin-cosmos/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ export const cosmosConfig: CosmosConfig = {
},
},
},
config_currency_mantra: {
type: "object",
default: {
lcd: "https://api.mantrachain.io",
minGasPrice: 0.01,
status: {
type: "active",
},
},
},
};

import buildCoinConfig, { type CurrencyConfig } from "@ledgerhq/coin-framework/config";
Expand Down
10 changes: 10 additions & 0 deletions libs/coin-modules/coin-cosmos/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,15 @@ const injective = {
}),
};

const mantraMinimalTransactionAmount = new BigNumber(20000);
const mantra = {
...generateGenericCosmosTest("mantra", false, {
minViableAmount: mantraMinimalTransactionAmount,
mutations: cosmosLikeMutations(mantraMinimalTransactionAmount),
skipOperationHistory: true,
}),
};

export default {
axelar,
cosmos,
Expand All @@ -605,4 +614,5 @@ export default {
stargaze,
coreum,
injective,
mantra,
};
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ setSupportedCurrencies([
"scroll_sepolia",
"ton",
"etherlink",
"mantra",
]);
LiveConfig.setConfig(liveConfig);

Expand Down
1 change: 1 addition & 0 deletions libs/ledger-live-common/src/account/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const getVotesCount = (
case "osmosis":
case "cosmos":
case "coreum":
case "mantra":
return (mainAccount as CosmosAccount)?.cosmosResources?.delegations.length || 0;
default:
return 0;
Expand Down
29 changes: 29 additions & 0 deletions libs/ledgerjs/packages/cryptoassets/src/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4275,6 +4275,35 @@ export const cryptocurrenciesById: Record<CryptoCurrencyId, CryptoCurrency> = {
},
],
},
mantra: {
type: "CryptoCurrency",
id: "mantra",
coinType: CoinType.ATOM,
name: "Mantra",
managerAppName: "Cosmos",
ticker: "OM",
scheme: "mantra",
color: "#ffb386",
family: "cosmos",
units: [
{
name: "Mantra",
code: "OM",
magnitude: 6,
},
{
name: "Micro-Mantra",
code: "uom",
magnitude: 0,
},
],
explorerViews: [
{
tx: "https://www.mintscan.io/mantra/txs/$hash",
address: "https://www.mintscan.io/mantra/validators/$address",
},
],
},
};

const cryptocurrenciesByScheme: Record<string, CryptoCurrency> = {};
Expand Down
3 changes: 2 additions & 1 deletion libs/ledgerjs/packages/types-cryptoassets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ export type CryptoCurrencyId =
| "blast_sepolia"
| "scroll"
| "scroll_sepolia"
| "etherlink";
| "etherlink"
| "mantra";

export type LedgerExplorerId =
| "btc"
Expand Down
3 changes: 3 additions & 0 deletions libs/ui/packages/crypto-icons/src/svg/OM.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f42d0d2

Please sign in to comment.