@@ -113,7 +113,9 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
113
113
* @name handleCreateOfframpAndClaim
114
114
* @description creates an off-ramp transfer for the user, either as a guest or a logged-in user.
115
115
*/
116
- const handleCreateOfframpAndClaim = async ( account : IBankAccountDetails ) => {
116
+ const handleCreateOfframpAndClaim = async (
117
+ account : IBankAccountDetails & { id ?: string ; bridgeAccountId ?: string }
118
+ ) => {
117
119
try {
118
120
setLoadingState ( 'Executing transaction' )
119
121
setError ( null )
@@ -148,6 +150,12 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
148
150
const contractVersion = params . contractVersion
149
151
const peanutContractAddress = peanut . getContractAddress ( chainId , contractVersion ) as Address
150
152
153
+ const externalAccountId = account ?. bridgeAccountId ?? account ?. id
154
+
155
+ if ( ! externalAccountId ) throw new Error ( 'External account ID not found' )
156
+
157
+ const destination = getOfframpCurrencyConfig ( account . country ?? selectedCountry ! . id )
158
+
151
159
// handle offramp request creation
152
160
const offrampRequestParams : TCreateOfframpRequest = {
153
161
onBehalfOf : userForOfframp . bridgeCustomerId ,
@@ -160,8 +168,8 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
160
168
fromAddress : peanutContractAddress ,
161
169
} ,
162
170
destination : {
163
- ...getOfframpCurrencyConfig ( account . country ?? selectedCountry ! . id ) ,
164
- externalAccountId : ( account as any ) . bridgeAccountId ?? ( account as any ) . id ,
171
+ ...destination ,
172
+ externalAccountId,
165
173
} ,
166
174
features : { allowAnyFromAddress : true } ,
167
175
}
0 commit comments