@@ -190,14 +190,14 @@ export const createShieldingTransferTx = async (
190190 nativeToken : chain . nativeTokenAddress ,
191191 buildTxFn : async ( workerLink ) => {
192192 const publicKeyRevealed = await isPublicKeyRevealed ( account . address ) ;
193+ // TODO: change "default" to a a "*"
194+ const frontendSusFee =
195+ frontendFeeConfig ?. [ token ] || frontendFeeConfig ?. [ "default" ] ;
193196 const msgValue : ShieldingTransferProps = {
194197 target : destination ,
195198 data : [ { source, token, amount } ] ,
196199 bparams,
197- frontendSusFee : frontendFeeConfig && {
198- address : frontendFeeConfig . target ,
199- amount : frontendFeeConfig . percentage . toString ( ) ,
200- } ,
200+ frontendSusFee,
201201 } ;
202202 const msg : Shield = {
203203 type : "shield" ,
@@ -249,14 +249,14 @@ export const createUnshieldingTransferTx = async (
249249 rpcUrl,
250250 nativeToken : chain . nativeTokenAddress ,
251251 buildTxFn : async ( workerLink ) => {
252+ // TODO: change "default" to a a "*"
253+ const frontendSusFee =
254+ frontendFeeConfig ?. [ token ] || frontendFeeConfig ?. [ "default" ] ;
252255 const msgValue : UnshieldingTransferProps = {
253256 source,
254257 data : [ { target : destination , token, amount } ] ,
255258 bparams,
256- frontendSusFee : frontendFeeConfig && {
257- address : frontendFeeConfig . target ,
258- amount : frontendFeeConfig . percentage . toString ( ) ,
259- } ,
259+ frontendSusFee,
260260 } ;
261261
262262 const msg : Unshield = {
@@ -299,14 +299,20 @@ export const createIbcTx = async (
299299 rpcUrl,
300300 nativeToken : chain . nativeTokenAddress ,
301301 buildTxFn : async ( workerLink ) => {
302+ const firstProps = props [ 0 ] ;
303+ // TODO: change "default" to a a "*"
304+ const isUnshielding = firstProps . gasSpendingKey === firstProps . source ;
305+ const frontendSusFee =
306+ isUnshielding ?
307+ frontendFeeConfig ?. [ firstProps . token ] ||
308+ frontendFeeConfig ?. [ "default" ]
309+ : undefined ;
310+
302311 const msgValue : IbcTransferProps = {
303- ...props [ 0 ] ,
304- gasSpendingKey : props [ 0 ] . gasSpendingKey ,
312+ ...firstProps ,
313+ gasSpendingKey : firstProps . gasSpendingKey ,
305314 bparams,
306- frontendSusFee : frontendFeeConfig && {
307- address : frontendFeeConfig . target ,
308- amount : frontendFeeConfig . percentage . toString ( ) ,
309- } ,
315+ frontendSusFee,
310316 } ;
311317
312318 // We only check if we need to reveal the public key if the gas spending key is not provided
@@ -359,16 +365,19 @@ export const createOsmosisSwapTx = async (
359365 rpcUrl,
360366 nativeToken : chain . nativeTokenAddress ,
361367 buildTxFn : async ( workerLink ) => {
368+ const firstProps = props [ 0 ] ;
369+ // TODO: change "default" to a a "*"
370+ // TODO: ignore when source is not MASP
371+ const frontendSusFee =
372+ frontendFeeConfig ?. [ firstProps . transfer . token ] ||
373+ frontendFeeConfig ?. [ "default" ] ;
362374 const msgValue : OsmosisSwapProps = {
363375 ...props [ 0 ] ,
364376 transfer : {
365377 ...transfer ,
366378 gasSpendingKey : transfer . gasSpendingKey ,
367379 bparams,
368- frontendSusFee : frontendFeeConfig && {
369- address : frontendFeeConfig . target ,
370- amount : frontendFeeConfig . percentage . toString ( ) ,
371- } ,
380+ frontendSusFee,
372381 } ,
373382 } ;
374383 const msg : OsmosisSwap = {
0 commit comments