@@ -36,7 +36,7 @@ export const extractChainportDataFromTransaction = (
36
36
37
37
const getIncomingChainportTransactionData = (
38
38
transaction : RpcWalletTransaction ,
39
- config : { incomingAddresses : Set < string > } ,
39
+ config : { incomingAddresses : Set < string > ; bridgeFeeUpgrade : Date } ,
40
40
) : ChainportTransactionData => {
41
41
const bridgeNote = transaction . notes ?. [ 0 ] ;
42
42
@@ -47,9 +47,19 @@ const getIncomingChainportTransactionData = (
47
47
return undefined ;
48
48
}
49
49
50
- const [ sourceNetwork , address , _ ] = ChainportMemoMetadata . decode (
51
- bridgeNote . memoHex ,
52
- ) ;
50
+ let sourceNetwork : number ;
51
+ let address : string ;
52
+ let _toIronfish : boolean ;
53
+
54
+ if ( new Date ( transaction . timestamp ) < config . bridgeFeeUpgrade ) {
55
+ [ sourceNetwork , address , _toIronfish ] = ChainportMemoMetadata . decodeV1 (
56
+ bridgeNote . memoHex ,
57
+ ) ;
58
+ } else {
59
+ [ sourceNetwork , address , _toIronfish ] = ChainportMemoMetadata . decodeV2 (
60
+ bridgeNote . memoHex ,
61
+ ) ;
62
+ }
53
63
54
64
return {
55
65
type : TransactionType . RECEIVE ,
@@ -60,7 +70,7 @@ const getIncomingChainportTransactionData = (
60
70
61
71
const getOutgoingChainportTransactionData = (
62
72
transaction : RpcWalletTransaction ,
63
- config : { outgoingAddresses : Set < string > } ,
73
+ config : { outgoingAddresses : Set < string > ; bridgeFeeUpgrade : Date } ,
64
74
) : ChainportTransactionData => {
65
75
if ( ! transaction . notes || transaction . notes . length < 2 ) {
66
76
return undefined ;
@@ -80,9 +90,19 @@ const getOutgoingChainportTransactionData = (
80
90
return undefined ;
81
91
}
82
92
83
- const [ sourceNetwork , address , _ ] = ChainportMemoMetadata . decode (
84
- bridgeNote . memoHex ,
85
- ) ;
93
+ let sourceNetwork : number ;
94
+ let address : string ;
95
+ let _toIronfish : boolean ;
96
+
97
+ if ( new Date ( transaction . timestamp ) < config . bridgeFeeUpgrade ) {
98
+ [ sourceNetwork , address , _toIronfish ] = ChainportMemoMetadata . decodeV1 (
99
+ bridgeNote . memoHex ,
100
+ ) ;
101
+ } else {
102
+ [ sourceNetwork , address , _toIronfish ] = ChainportMemoMetadata . decodeV2 (
103
+ bridgeNote . memoHex ,
104
+ ) ;
105
+ }
86
106
87
107
return {
88
108
type : TransactionType . SEND ,
0 commit comments