@@ -2,7 +2,7 @@ import GatewayClientRepository from '@/api/gateway.js';
2
2
import type OktoClient from '@/core/index.js' ;
3
3
import { BaseError } from '@/errors/base.js' ;
4
4
import { getChains } from '@/explorer/chain.js' ;
5
- import type { UserOp } from '@/types/core.js' ;
5
+ import type { Address , UserOp } from '@/types/core.js' ;
6
6
import { Constants } from '@/utils/index.js' ;
7
7
import { generateUUID , nonceToBigInt } from '@/utils/nonce.js' ;
8
8
import {
@@ -29,9 +29,11 @@ import {
29
29
* @param data - The parameters for transferring the token (caip2Id, recipientWalletAddress, tokenAddress, amount).
30
30
* @returns The User Operation (UserOp) for the token transfer.
31
31
*/
32
+ // TODO: Implement a destructured param instead before V1 release
32
33
export async function tokenTransfer (
33
34
oc : OktoClient ,
34
35
data : TokenTransferIntentParams ,
36
+ feePayerAddress ?: Address ,
35
37
) : Promise < UserOp > {
36
38
if ( ! oc . isLoggedIn ( ) ) {
37
39
throw new BaseError ( 'User not logged in' ) ;
@@ -42,6 +44,10 @@ export async function tokenTransfer(
42
44
throw new BaseError ( 'Recipient address cannot be same as the user address' ) ;
43
45
}
44
46
47
+ if ( ! feePayerAddress ) {
48
+ feePayerAddress = Constants . FEE_PAYER_ADDRESS ;
49
+ }
50
+
45
51
const nonce = generateUUID ( ) ;
46
52
47
53
const jobParametersAbiType =
@@ -72,6 +78,7 @@ export async function tokenTransfer(
72
78
toHex ( nonceToBigInt ( nonce ) , { size : 32 } ) ,
73
79
oc . clientSWA ,
74
80
oc . userSWA ,
81
+ feePayerAddress ,
75
82
encodeAbiParameters (
76
83
parseAbiParameters ( '(bool gsnEnabled, bool sponsorshipEnabled)' ) ,
77
84
[
0 commit comments