@@ -307,7 +307,8 @@ const CURRENCY_PLUGINID_MAP: Record<string, string> = {
307307 TON : 'ton' ,
308308 XLM : 'stellar' ,
309309 XRP : 'ripple' ,
310- XTZ : 'tezos'
310+ XTZ : 'tezos' ,
311+ ZEC : 'zcash'
311312}
312313
313314const COIN_TO_CURRENCY_CODE_MAP : StringMap = { BTC : 'BTC' }
@@ -1206,16 +1207,24 @@ export const banxaRampPlugin: RampPluginFactory = (
12061207 )
12071208 return
12081209 }
1209- // Prefer segwit where available; fallback to default public address
1210+ // Prefer transparent or segwit address where available; fallback to default
12101211 const addresses = await coreWallet . getAddresses ( { tokenId : null } )
1211- const [ defaultAddress ] = addresses
1212- if ( defaultAddress == null )
1213- throw new Error ( 'Banxa missing receive address' )
1214- const segwitAddress = addresses . find (
1215- row => row . addressType === 'segwitAddress'
1212+ const getAddressTypePriority = (
1213+ type : string | undefined
1214+ ) : number => {
1215+ if ( type === 'transparentAddress' ) return 1
1216+ if ( type === 'segwitAddress' ) return 1
1217+ return 2
1218+ }
1219+ // Sort addresses by priority
1220+ addresses . sort (
1221+ ( a , b ) =>
1222+ getAddressTypePriority ( a . addressType ) -
1223+ getAddressTypePriority ( b . addressType )
12161224 )
1217- const receivePublicAddress =
1218- segwitAddress ?. publicAddress ?? defaultAddress . publicAddress
1225+ const [ receiveAddress ] = addresses
1226+ if ( receiveAddress == null )
1227+ throw new Error ( 'Banxa missing receive address' )
12191228
12201229 const bodyParams : any = {
12211230 payment_method_id : paymentObj ?. id ?? '' ,
@@ -1240,13 +1249,13 @@ export const banxaRampPlugin: RampPluginFactory = (
12401249 if ( testnet && banxaChain === 'BTC' ) {
12411250 bodyParams . wallet_address = TESTNET_ADDRESS
12421251 } else {
1243- bodyParams . wallet_address = receivePublicAddress
1252+ bodyParams . wallet_address = receiveAddress . publicAddress
12441253 }
12451254 } else {
12461255 if ( testnet && banxaChain === 'BTC' ) {
12471256 bodyParams . refund_address = TESTNET_ADDRESS
12481257 } else {
1249- bodyParams . refund_address = receivePublicAddress
1258+ bodyParams . refund_address = receiveAddress . publicAddress
12501259 }
12511260 }
12521261
@@ -1482,7 +1491,7 @@ export const banxaRampPlugin: RampPluginFactory = (
14821491 // Post the txid back to Banxa
14831492 const bodyParams = {
14841493 tx_hash : txid ,
1485- source_address : receivePublicAddress ,
1494+ source_address : receiveAddress . publicAddress ,
14861495 destination_address : publicAddress
14871496 }
14881497 await banxaFetch ( {
0 commit comments