-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
274 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,4 +69,5 @@ setSupportedCurrencies([ | |
"optimism_sepolia", | ||
"linea", | ||
"linea_sepolia", | ||
"mantra", | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
...er-live-common/src/families/cosmos/datasets/__snapshots__/mantra.integration.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`mantra currency bridge scanAccounts mantra seed 1 1`] = ` | ||
[ | ||
{ | ||
"balance": "715363", | ||
"currencyId": "mantra", | ||
"derivationMode": "", | ||
"freshAddress": "mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
"freshAddressPath": "44'/118'/0'/0/0", | ||
"id": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
"index": 0, | ||
"pendingOperations": [], | ||
"seedIdentifier": "03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e83", | ||
"spendableBalance": "215363", | ||
"swapHistory": [], | ||
"syncHash": undefined, | ||
"used": true, | ||
"xpub": "mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
}, | ||
{ | ||
"balance": "0", | ||
"currencyId": "mantra", | ||
"derivationMode": "", | ||
"freshAddress": "mantra1v2mp0m7k96dm9qv60fkspcqlzpkzrwnefwef05", | ||
"freshAddressPath": "44'/118'/1'/0/0", | ||
"id": "js:2:mantra:mantra1v2mp0m7k96dm9qv60fkspcqlzpkzrwnefwef05:", | ||
"index": 1, | ||
"pendingOperations": [], | ||
"seedIdentifier": "03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e83", | ||
"spendableBalance": "0", | ||
"swapHistory": [], | ||
"syncHash": undefined, | ||
"used": false, | ||
"xpub": "mantra1v2mp0m7k96dm9qv60fkspcqlzpkzrwnefwef05", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`mantra currency bridge scanAccounts mantra seed 1 2`] = ` | ||
[ | ||
[ | ||
{ | ||
"accountId": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
"blockHash": null, | ||
"blockHeight": 446099, | ||
"extra": {}, | ||
"fee": "1950", | ||
"hasFailed": false, | ||
"hash": "4855629335DD67EEB42CC089311697D7F5FAE587CD7E33F81E0AAE5227B4FB8F", | ||
"id": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:-4855629335DD67EEB42CC089311697D7F5FAE587CD7E33F81E0AAE5227B4FB8F-IN", | ||
"recipients": [ | ||
"mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
], | ||
"senders": [ | ||
"mantra1g84934jpu3v5de5yqukkkhxmcvsw3u2aedx9w9", | ||
], | ||
"transactionSequenceNumber": 6, | ||
"type": "IN", | ||
"value": "1000000", | ||
}, | ||
{ | ||
"accountId": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
"blockHash": null, | ||
"blockHeight": 446137, | ||
"extra": {}, | ||
"fee": "1949", | ||
"hasFailed": false, | ||
"hash": "8F9934B90FC0006941F24FA783970CCC6480F991725E8D7A0BFDB3E917DECCB0", | ||
"id": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:-8F9934B90FC0006941F24FA783970CCC6480F991725E8D7A0BFDB3E917DECCB0-OUT", | ||
"recipients": [ | ||
"mantra1g84934jpu3v5de5yqukkkhxmcvsw3u2aedx9w9", | ||
], | ||
"senders": [ | ||
"mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
], | ||
"transactionSequenceNumber": 1, | ||
"type": "OUT", | ||
"value": "301949", | ||
}, | ||
{ | ||
"accountId": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
"blockHash": null, | ||
"blockHeight": 446147, | ||
"extra": { | ||
"memo": "Ledger Live", | ||
}, | ||
"fee": "2385", | ||
"hasFailed": false, | ||
"hash": "AAC85BCAA8EB83298CABABB6A6574082C056092C7139FD8C8ED8849A207B8C8A", | ||
"id": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:-AAC85BCAA8EB83298CABABB6A6574082C056092C7139FD8C8ED8849A207B8C8A-REWARD", | ||
"recipients": [], | ||
"senders": [], | ||
"transactionSequenceNumber": 2, | ||
"type": "REWARD", | ||
"value": "0", | ||
}, | ||
{ | ||
"accountId": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
"blockHash": null, | ||
"blockHeight": 446122, | ||
"extra": { | ||
"memo": "Ledger Live", | ||
"validators": [ | ||
{ | ||
"address": "mantravaloper1y8hxa8q0qk6h2fxtugkx67re38k03888eeqmpd", | ||
"amount": "500000", | ||
}, | ||
], | ||
}, | ||
"fee": "2906", | ||
"hasFailed": false, | ||
"hash": "B1FE340869D47C458F2B6CCD6029E9996B3CC957BE01E8426A7686E50B2987B4", | ||
"id": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:-B1FE340869D47C458F2B6CCD6029E9996B3CC957BE01E8426A7686E50B2987B4-DELEGATE", | ||
"recipients": [], | ||
"senders": [], | ||
"transactionSequenceNumber": 0, | ||
"type": "DELEGATE", | ||
"value": "2906", | ||
}, | ||
{ | ||
"accountId": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
"blockHash": null, | ||
"blockHeight": 445531, | ||
"extra": {}, | ||
"fee": "2125", | ||
"hasFailed": false, | ||
"hash": "E6FA7ACE758FE1C371CDE0503651D07D3F25F65BE2A57B642CC5F3B3D6A3A5F7", | ||
"id": "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:-E6FA7ACE758FE1C371CDE0503651D07D3F25F65BE2A57B642CC5F3B3D6A3A5F7-IN", | ||
"recipients": [ | ||
"mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
], | ||
"senders": [ | ||
"mantra1g84934jpu3v5de5yqukkkhxmcvsw3u2aedx9w9", | ||
], | ||
"transactionSequenceNumber": 5, | ||
"type": "IN", | ||
"value": "20000", | ||
}, | ||
], | ||
[], | ||
] | ||
`; |
14 changes: 14 additions & 0 deletions
14
libs/ledger-live-common/src/families/cosmos/datasets/mantra.integration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { DatasetTest } from "@ledgerhq/types-live"; | ||
import { testBridge } from "../../../__tests__/test-helpers/bridge"; | ||
import "../../../__tests__/test-helpers/setup"; | ||
import type { Transaction } from "../types"; | ||
import mantra from "./mantra"; | ||
|
||
const dataset: DatasetTest<Transaction> = { | ||
implementations: ["js"], | ||
currencies: { | ||
mantra, | ||
}, | ||
}; | ||
|
||
testBridge(dataset); |
70 changes: 70 additions & 0 deletions
70
libs/ledger-live-common/src/families/cosmos/datasets/mantra.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { fromTransactionRaw } from "@ledgerhq/coin-cosmos/transaction"; | ||
import { CurrenciesData } from "@ledgerhq/types-live"; | ||
import { BigNumber } from "bignumber.js"; | ||
import type { Transaction } from "../types"; | ||
|
||
const dataset: CurrenciesData<Transaction> = { | ||
FIXME_ignoreAccountFields: ["cosmosResources", "operationsCount", "operations"], | ||
FIXME_ignorePreloadFields: ["validators"], // the APY of validators changes over time | ||
scanAccounts: [ | ||
{ | ||
name: "mantra seed 1", | ||
apdus: ` | ||
=> 550400001b066d616e7472612c00008076000080000000800000000000000000 | ||
<= 03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e836d616e7472613167796175766c3434713261706e33753361756a6d333671387a726a3734767279376e356e766e9000 | ||
=> 550400001b066d616e7472612c00008076000080000000800000000000000000 | ||
<= 03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e836d616e7472613167796175766c3434713261706e33753361756a6d333671387a726a3734767279376e356e766e9000 | ||
=> 550400001b066d616e7472612c00008076000080010000800000000000000000 | ||
<= 02c8f29e73a2c99d11de0544615a87afc6c6575d22746af18a8ef733066f088b1f6d616e7472613176326d70306d376b3936646d3971763630666b737063716c7a706b7a72776e656677656630359000 | ||
`, | ||
}, | ||
], | ||
accounts: [ | ||
{ | ||
FIXME_tests: ["balance is sum of ops", "pendingOperations are cleaned up"], | ||
raw: { | ||
id: "js:2:mantra:mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn:", | ||
seedIdentifier: "03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e83", | ||
xpub: "mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
derivationMode: "", | ||
index: 0, | ||
freshAddress: "mantra1gyauvl44q2apn3u3aujm36q8zrj74vry7n5nvn", | ||
freshAddressPath: "44'/118'/0'/0/0", | ||
name: "Mantra 1 - Nano X", | ||
blockHeight: 446179, | ||
balance: "715363", | ||
spendableBalance: "215363", | ||
operations: [], | ||
operationsCount: 5, | ||
pendingOperations: [], | ||
currencyId: "mantra", | ||
lastSyncDate: "", | ||
}, | ||
transactions: [ | ||
{ | ||
name: "Normal transaction", | ||
transaction: fromTransactionRaw({ | ||
amount: "10000", | ||
recipient: "mantra108uy5q9jt59gwugq5yrdhkzcd9jryslm2n604w", | ||
useAllAmount: false, | ||
family: "cosmos", | ||
mode: "send", | ||
networkInfo: null, | ||
fees: "8744", | ||
gas: "87440", | ||
validators: [], | ||
memo: "", | ||
sourceValidator: "", | ||
}), | ||
expectedStatus: () => ({ | ||
errors: {}, | ||
warnings: {}, | ||
amount: BigNumber("10000"), | ||
}), | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export default dataset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.