@@ -2,12 +2,20 @@ import AppBTC from '@ledgerhq/hw-app-btc'
2
2
import { Transaction } from '@ledgerhq/hw-app-btc/lib/types'
3
3
import Transport from '@ledgerhq/hw-transport'
4
4
import { checkFeeBounds , FeeRate , TxHash } from '@xchainjs/xchain-client'
5
- import { broadcastTx , buildTx , getSendTxUrl , LOWER_FEE_BOUND , UPPER_FEE_BOUND } from '@xchainjs/xchain-doge'
5
+ import {
6
+ AssetDOGE ,
7
+ Client ,
8
+ DOGEChain ,
9
+ getSendTxUrl ,
10
+ LOWER_FEE_BOUND ,
11
+ UPPER_FEE_BOUND ,
12
+ defaultDogeParams
13
+ } from '@xchainjs/xchain-doge'
6
14
import { Address , BaseAmount } from '@xchainjs/xchain-util'
15
+ import { BlockcypherProvider , BlockcypherNetwork } from '@xchainjs/xchain-utxo-providers'
7
16
import * as E from 'fp-ts/lib/Either'
8
17
9
18
import { getBlockcypherUrl } from '../../../../shared/api/blockcypher'
10
- import { getSochainUrl } from '../../../../shared/api/sochain'
11
19
import { LedgerError , LedgerErrorId , Network } from '../../../../shared/api/types'
12
20
import { toClientNetwork } from '../../../../shared/utils/client'
13
21
import { isError } from '../../../../shared/utils/guard'
@@ -54,15 +62,19 @@ export const send = async ({
54
62
const clientNetwork = toClientNetwork ( network )
55
63
const derivePath = getDerivationPath ( walletIndex , clientNetwork )
56
64
57
- const { psbt, utxos } = await buildTx ( {
65
+ const dogeInitParams = {
66
+ ...defaultDogeParams ,
67
+ network : clientNetwork
68
+ }
69
+
70
+ const dogeClient = new Client ( dogeInitParams )
71
+
72
+ const { psbt, utxos } = await dogeClient . buildTx ( {
58
73
amount,
59
74
recipient,
60
75
memo,
61
76
feeRate,
62
- sender,
63
- network : clientNetwork ,
64
- sochainUrl : getSochainUrl ( ) ,
65
- withTxHex : true
77
+ sender
66
78
} )
67
79
68
80
const inputs : Array < [ Transaction , number , string | null , number | null ] > = utxos . map ( ( { txHex, hash, index } ) => {
@@ -90,8 +102,9 @@ export const send = async ({
90
102
91
103
// Note: DOGE Ledger is not supported on `testnet` - all txs will be broadcasted to Blockcypher
92
104
const nodeUrl = getSendTxUrl ( { network : clientNetwork , blockcypherUrl : getBlockcypherUrl ( ) } )
105
+ const blockcypherProvider = new BlockcypherProvider ( nodeUrl , DOGEChain , AssetDOGE , 8 , BlockcypherNetwork . DOGE )
93
106
94
- const txHash = await broadcastTx ( { network : clientNetwork , txHex, nodeUrl } )
107
+ const txHash = await blockcypherProvider . broadcastTx ( txHex )
95
108
96
109
if ( ! txHash ) {
97
110
return E . left ( {
0 commit comments