This repository has been archived by the owner on Jul 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'ledgerhq/develop' into HEAD
- Loading branch information
Showing
42 changed files
with
3,268 additions
and
12,069 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
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
96 changes: 96 additions & 0 deletions
96
src/__tests__/families/bitcoin/wallet-btc/xpub.txs.dogecoin.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,96 @@ | ||
import coininfo from "coininfo"; | ||
import BigNumber from "bignumber.js"; | ||
import { DerivationModes } from "../../../../families/bitcoin/wallet-btc/types"; | ||
import Xpub from "../../../../families/bitcoin/wallet-btc/xpub"; | ||
import Doge from "../../../../families/bitcoin/wallet-btc/crypto/doge"; | ||
import BitcoinLikeExplorer from "../../../../families/bitcoin/wallet-btc/explorer"; | ||
import BitcoinLikeStorage from "../../../../families/bitcoin/wallet-btc/storage"; | ||
import { Merge } from "../../../../families/bitcoin/wallet-btc/pickingstrategies/Merge"; | ||
import BitcoinLikeWallet from "../../../../families/bitcoin/wallet-btc/wallet"; | ||
import MockBtc from "../../../../mock/Btc"; | ||
|
||
describe("testing dogecoin transactions", () => { | ||
const wallet = new BitcoinLikeWallet(); | ||
const explorer = new BitcoinLikeExplorer({ | ||
explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/doge", | ||
explorerVersion: "v3", | ||
disableBatchSize: true, | ||
}); | ||
|
||
const network = coininfo.dogecoin.main.toBitcoinJS(); | ||
const crypto = new Doge({ network }); | ||
|
||
const storage = new BitcoinLikeStorage(); | ||
const xpub = new Xpub({ | ||
storage, | ||
explorer, | ||
crypto, | ||
xpub: "dgub8rBf7BYsf5YoMezYuPaEhc2tsr7sQA2v2xNCj4mt1czF1m4hRiBdjYeAq5xDVQhN5HqYQnxv2DwyfmDvp1QEfmi44b8uynPL45KXQJrsoi8", | ||
derivationMode: DerivationModes.LEGACY, | ||
}); | ||
it("testing dogecoin transactions with huge amount", async () => { | ||
const utxoPickingStrategy = new Merge(xpub.crypto, xpub.derivationMode, []); | ||
const changeAddress = await xpub.getNewAddress(1, 0); | ||
xpub.storage.appendTxs([ | ||
{ | ||
id: "c4ee70c30b9c5c5fed60c37ce86046156af3623f32aa5be94556b35dcf0af147", | ||
inputs: [], | ||
outputs: [ | ||
{ | ||
output_index: 0, | ||
value: "500000000000000000", // huge utxo | ||
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb", | ||
output_hash: | ||
"c4ee70c30b9c5c5fed60c37ce86046156af3623f32aa5be94556b35dcf0af147", | ||
block_height: 1, | ||
rbf: false, | ||
}, | ||
{ | ||
output_index: 1, | ||
value: "0", | ||
address: "<unknown>", | ||
output_hash: | ||
"c4ee70c30b9c5c5fed60c37ce86046156af3623f32aa5be94556b35dcf0af147", | ||
block_height: 1, | ||
rbf: false, | ||
}, | ||
], | ||
block: { | ||
hash: "73c565a6f226978df23480e440b27eb02f307855f50aa3bc72ebb586938f23e0", | ||
height: 1, | ||
time: "2021-07-28T13:34:17Z", | ||
}, | ||
account: 0, | ||
index: 0, | ||
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb", | ||
received_at: "2021-07-28T13:34:17Z", | ||
}, | ||
]); | ||
|
||
const txInfo = await xpub.buildTx({ | ||
destAddress: "D9fSjc6zAyjdRgSfbfMLv5z5FpuacvguUi", | ||
amount: new BigNumber(200000000000000000), | ||
feePerByte: 100, | ||
changeAddress, | ||
utxoPickingStrategy, | ||
sequence: 0, | ||
}); | ||
const account = await wallet.generateAccount({ | ||
xpub: xpub.xpub, | ||
path: "44'/0'", | ||
index: 0, | ||
currency: "dogecoin", | ||
network: "mainnet", | ||
derivationMode: DerivationModes.LEGACY, | ||
explorer: "ledgerv3", | ||
explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/doge", | ||
storage: "mock", | ||
storageParams: [], | ||
}); | ||
await wallet.signAccountTx({ | ||
btc: new MockBtc(), | ||
fromAccount: account, | ||
txInfo, | ||
}); | ||
}, 100000); | ||
}); |
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
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
Oops, something went wrong.
991ff42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ 1 txs ($2.40) for Bot 'Hedera'
Details of the 1 mutations
Spec Hedera (3)
Details of the 1 uncovered mutations
Spec Hedera (1)
Portfolio ($2.40)
Details of the 1 currencies