Invite Codes
Manage user invite codes through the Fuul
SDK. These methods let you list, generate, check, and use invite codes as well as get invitation statuses.
List invite codes
To get the invite codes for a user use the listUserInviteCodes
method.
const result = await Fuul.listUserInviteCodes({
user_identifier: '0x12345',
user_identifier_type: UserIdentifierType.EvmAddress,
});
Invitation Status
This method gets the invitation status of the user, including whether they were invited and with which code.
const status = await Fuul.getInvitationStatus({
user_identifier: '0x12345',
user_identifier_type: UserIdentifierType.EvmAddress
});
if (status.invited) {
console.log('User was invited with code:', status.code);
}
Check Invite Code
To check whether an invite code is free to use the checkInviteCode
method.
const result = await Fuul.checkInviteCode({ code: 'abc1234' });
if (result.is_free) {
console.log('Invite code is available!');
}
Accept Referral
To accept the referral and consume the invite code use the useInviteCode
method.
await Fuul.useInviteCode({
code: 'abc1234',
user_identifier: '0x12345',
user_identifier_type: UserIdentifierType.EvmAddress,
signature: '0xaad9a0b62f87c15a248cb99ca926785b828b5',
signature_message: 'I am using invite code abc1234'
accountChainId: 1 // For smart contract accounts
});
The signed message should have the following structure: I am using invite code ${code}
Last updated