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 25, 2024
1 parent de89b29 commit d9e3d43
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.

3 comments on commit d9e3d43

@github-actions
Copy link

Choose a reason for hiding this comment

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

[Bot] Testing with 'Nitrogen' 💰 1 miss funds ($0.00) ⏲ 4.7s

💰 1 specs may miss funds: mantra

What is the bot and how does it work? Everything is documented here!

⚠️ 1 spec hints
  • Spec mantra:
    • There are not enough accounts (1) to cover all mutations (6).
      Please increase the account target to at least 7 accounts
Details of the 0 mutations

Spec mantra (failed)

Spec mantra found 1 Mantra accounts (preload: 769ms). Will use Cosmos 2.35.24 on nanoS 2.1.0
undefined: 0 OM (0ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh:

This SEED does not have Mantra. Please send funds to mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh

Details of the 6 uncovered mutations

Spec mantra (6)

  • send some:
  • send max:
  • delegate new validators:
  • undelegate:
  • redelegate:
  • claim rewards:
Portfolio ($0.00) – Details of the 1 currencies
Spec (accounts) State Remaining Runs (est) funds?
mantra (1) 0 ops , 0 OM ($0.00) mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh
undefined: 0 OM (0ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh:
Performance ⏲ 4.7s

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL 769ms 1579ms N/A N/A N/A N/A N/A N/A
mantra (0) 769ms 1579ms N/A N/A N/A N/A N/A N/A

What is the bot and how does it work? Everything is documented here!

@github-actions
Copy link

Choose a reason for hiding this comment

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

[Bot] Testing with 'Nitrogen' ❌ 2 txs 💰 1 miss funds ($0.00) ⏲ 8.8s

💰 1 specs may miss funds: mantra

What is the bot and how does it work? Everything is documented here!

❌ 2 mutation errors
necessary accounts resynced in 0.21ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh: 0.1 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

necessary accounts resynced in 0.21ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0 OM (0ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp: 0 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

⚠️ 2 spec hints
  • Spec mantra:
    • There are not enough accounts (2) to cover all mutations (6).
      Please increase the account target to at least 7 accounts
    • No mutation were found possible. Yet there are funds in the accounts, please investigate.
Details of the 2 mutations

Spec mantra (2)

Spec mantra found 2 Mantra accounts (preload: 798ms). Will use Cosmos 2.35.24 on nanoS 2.1.0
undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh:
undefined: 0 OM (0ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp:
necessary accounts resynced in 0.21ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh: 0.1 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

necessary accounts resynced in 0.21ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0 OM (0ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp: 0 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra


Details of the 6 uncovered mutations

Spec mantra (6)

  • send some:
  • send max:
  • delegate new validators:
  • undelegate:
  • redelegate:
  • claim rewards:
Portfolio ($0.00) – Details of the 1 currencies
Spec (accounts) State Remaining Runs (est) funds?
mantra (2) 1 ops , 0.1 OM ($0.00) ⚠️ 3 mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh
undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh:
undefined: 0 OM (0ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp:
Performance ⏲ 8.8s

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL 798ms 2841ms 0.42ms N/A N/A N/A N/A N/A
mantra (1) 798ms 2841ms 0.42ms N/A N/A N/A N/A N/A

What is the bot and how does it work? Everything is documented here!

@github-actions
Copy link

Choose a reason for hiding this comment

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

[Bot] Testing with 'Nitrogen' ❌ 3 txs 💰 1 miss funds ($0.00) ⏲ 10.9s

💰 1 specs may miss funds: mantra

What is the bot and how does it work? Everything is documented here!

❌ 3 mutation errors
necessary accounts resynced in 0.25ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh: 0.1 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

necessary accounts resynced in 0.31ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0.01 OM (1ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp: 0.01 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

necessary accounts resynced in 0.34ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0 OM (0ops) (mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry on 44'/118'/2'/0/0) #2 js:2:mantra:mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry: 0 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

⚠️ 2 spec hints
  • Spec mantra:
    • There are not enough accounts (3) to cover all mutations (6).
      Please increase the account target to at least 7 accounts
    • No mutation were found possible. Yet there are funds in the accounts, please investigate.
Details of the 3 mutations

Spec mantra (3)

Spec mantra found 3 Mantra accounts (preload: 432ms). Will use Cosmos 2.35.24 on nanoS 2.1.0
undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh:
undefined: 0.01 OM (1ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp:
undefined: 0 OM (0ops) (mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry on 44'/118'/2'/0/0) #2 js:2:mantra:mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry:
necessary accounts resynced in 0.25ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh: 0.1 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

necessary accounts resynced in 0.31ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0.01 OM (1ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp: 0.01 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra

necessary accounts resynced in 0.34ms
▬ Cosmos 2.35.24 on nanoS 2.1.0
→ FROM undefined: 0 OM (0ops) (mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry on 44'/118'/2'/0/0) #2 js:2:mantra:mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry: 0 OM spendable. 

⚠️ Invariant Violation: No abandonseed available for mantra


Details of the 6 uncovered mutations

Spec mantra (6)

  • send some:
  • send max:
  • delegate new validators:
  • undelegate:
  • redelegate:
  • claim rewards:
Portfolio ($0.00) – Details of the 1 currencies
Spec (accounts) State Remaining Runs (est) funds?
mantra (3) 2 ops , 0.11 OM ($0.00) ⚠️ 3 mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh
undefined: 0.1 OM (1ops) (mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh on 44'/118'/0'/0/0) #0 js:2:mantra:mantra1rs97j43nfyvc689y5rjvnnhrq3tes6ghshzpqh:
undefined: 0.01 OM (1ops) (mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp on 44'/118'/1'/0/0) #1 js:2:mantra:mantra1qvtnzptp30maznnhdg30xl2jtdq2shpnvh0jgp:
undefined: 0 OM (0ops) (mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry on 44'/118'/2'/0/0) #2 js:2:mantra:mantra1vvzwc6l3wfdaqa9rncex8k2uwtpwztswnt8zry:
Performance ⏲ 10.9s

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL 432ms 3.7s 0.90ms N/A N/A N/A N/A N/A
mantra (2) 432ms 3.7s 0.90ms N/A N/A N/A N/A N/A

What is the bot and how does it work? Everything is documented here!

Please sign in to comment.