Membership

Following a user will only succeed for a Sui address that has an associated Sage user. Unfollowing will only succeed for

Follow a Sage user

import { useSignAndExecuteTransaction } from '@mysten/dapp-kit';
import { useUser } from '@sage-app/sdk/react';

interface JoinUserInput {
  amounts: number[];           // payment amounts set to [0, 0]
  self: string;                // user's wallet address
  soulId: string;              // address of user's owned soul
  userId: string;              // user's object id
}

...

const { mutateAsync: signAndExecuteTransaction } = useSignAndExecuteTransaction();
const { join } = useUser();

...

const followUser = async (data: JoinUserInput) => {
  const { ok, err, transaction } = join(data);
    
  const { digest } = await signAndExecuteTransaction({
    transaction
  });
};

Error Codes

Authentication module

Code
Value
Meaning

370

ENotAuthenticated

User soul object does not exist, is the wrong type, or not owned by the wallet.

User Fees module

Code
Value
Meaning

370

EIncorrectCoinType

Custom payment type does not match configured custom payment coin.

371

EIncorrectCustomPayment

Incorrect custom payment value.

372

EIncorrectSuiPayment

Incorrect sui payment value.

Unfollow a Sage user

Error Codes

User Fees module

Code
Value
Meaning

370

EIncorrectCoinType

Custom payment type does not match configured custom payment coin.

371

EIncorrectCustomPayment

Incorrect custom payment value.

372

EIncorrectSuiPayment

Incorrect sui payment value.

Querying for User Membership Events

In this case events will take the shape of an array of UserMembershipEvent:

Last updated