Guides

Create a quote on Momoka

🚧

This request is protected by authentication

πŸ“˜

Lens Profile Manager Compatible: Gasless & Signless

This action can be used through the Lens Profile Manager to enable a gasless and signless experience.

a) Create a quote on Momoka via Lens Profile Manager

If possible, using the Lens Profile Manager is the best way to create a quote. This will be a gasless and signless operation.

Request

MomokaQuoteRequest

Invocation

const result = await client.publication.quoteOnMomoka({
  quoteOn: '0x123-0x456',
  contentURI: 'ipfs://Qm...', // or arweave
});
mutation QuoteOnMomoka($request: MomokaQuoteRequest!) {
  result: quoteOnMomoka(request: $request) {
    ... on CreateMomokaPublicationResult {
      ...CreateMomokaPublicationResult
    }
    ... on LensProfileManagerRelayError {
      ...LensProfileManagerRelayError
    }
  }
}

Response

CreateMomokaPublicationResult or LensProfileManagerRelayError


b) Create a quote using TypedData and broadcast to Momoka via the API

Request

MomokaQuoteRequest

Invocation

const typedDataResult = await lensClient.publication.createMomokaQuoteTypedData({
  quoteOn: '0x123-0x456',
  contentURI: 'ipfs://Qm...', // or arweave
});
mutation CreateMomokaQuoteTypedData($request: MomokaQuoteRequest!) {
  result: createMomokaQuoteTypedData(request: $request) {
    ...CreateMomokaQuoteBroadcastItemResult
  }
}

Response

CreateMomokaQuoteBroadcastItemResult

Broadcasting the TypedData

Once you have the typed data for the action, you need to get the user to sign with their wallet and then broadcast it to Momoka.

See Broadcasting Momoka Transaction for more information.


Full LensClient Example

Using the Lens Profile Manager:

// the client instance must be authenticated

const result = await client.publication.quoteOnMomoka({
  quoteOn: '0x123-0x456',
  contentURI: 'ipfs://Qm...', // or arweave
});

const resultValue = result.unwrap();

if (!isCreateMomokaPublicationResult(resultValue)) {
  console.log(`Something went wrong`, resultValue);
  return;
}

console.log(`Transaction was successful`, resultValue);

Using TypedData:

// the client instance must be authenticated

const typedDataResult = await lensClient.publication.createMomokaQuoteTypedData({
  quoteOn: '0x123-0x456',
  contentURI: 'ipfs://Qm...', // or arweave
});

const { id, typedData } = typedDataResult.unwrap();

// sign with the wallet
const signedTypedData = await wallet._signTypedData(
  typedData.domain,
  typedData.types,
  typedData.value,
);

const broadcastResult = await lensClient.transaction.broadcastOnMomoka({
  id,
  signature: signedTypedData,
});

const broadcastValue = broadcastResult.unwrap();

if (!isCreateMomokaPublicationResult(broadcastValue)) {
  console.log(`Something went wrong`);
  return;
}

console.log(`Successfully broadcasted momoka transaction`, broadcastValue);