Guides

Open Actions

You can act on open actions available for a publication. note wallet can collect and act on certain things without a profile you can find those docs Open actions without a profile

🚧

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) Act on a publication via Lens Profile Manager

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

Request

ActOnOpenActionLensManagerRequest

Invocation

const result = await client.publication.actions.actOn({
  actOn: {
    simpleCollectOpenAction: true,
  },
  for: '0x123-0x456',
});
mutation ActOnOpenAction($request: ActOnOpenActionLensManagerRequest!) {
  result: actOnOpenAction(request: $request) {
    ... on RelaySuccess {
      ...RelaySuccess
    }
    ... on LensProfileManagerRelayError {
      ...LensProfileManagerRelayError
    }
  }
}

Response

RelaySuccess or LensProfileManagerRelayError


b) Act on a publication using TypedData and broadcasting Onchain via the API

Request

ActOnOpenActionRequest

Invocation

const resultTypedData = await client.publication.actions.createActOnTypedData({
  actOn: {
    simpleCollectOpenAction: true,
  },
  for: '0x123-0x456',
});
fragment CreateActOnOpenActionBroadcastItemResult on CreateActOnOpenActionBroadcastItemResult {
  id
  expiresAt
  typedData {
    ...CreateActOnOpenActionEIP712TypedData
  }
}

mutation CreateActOnOpenActionTypedData(
  $request: ActOnOpenActionRequest!
  $options: TypedDataOptions
) {
  result: createActOnOpenActionTypedData(request: $request, options: $options) {
    ...CreateActOnOpenActionBroadcastItemResult
  }
}

Response

CreateActOnOpenActionBroadcastItemResult

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 onchain.

See Broadcasting Onchain for more information.