import { RebelfiError, ErrorCode, ClientAccountStatus } from '@rebelfi/sdk';
const account = await client.accounts.create({
reference: 'CLIENT-0042',
organizationName: 'Example Capital LP',
contact: { firstName: 'Jane', lastName: 'Doe', email: 'jane@example.com' }
});
await client.wallets.register({
walletAddress,
blockchain: 'solana',
accountId: account.accountId,
proof: { challengeId, signature }
});
try {
await client.operations.supply({ walletAddress, strategyId, amount: '1000000', tokenAddress });
} catch (error) {
if (error instanceof RebelfiError && error.is(ErrorCode.CLIENT_ACCOUNT_NOT_ACTIVE)) {
// error.details.status is PENDING_ACTIVATION until the contact accepts the terms
}
}
const { status } = await client.accounts.get(account.accountId);
if (status === ClientAccountStatus.ACTIVE) {
const summary = await client.accounts.summary(account.accountId);
}