Developer Hub
Relation ProtocolRelation ONE APIRelation Graph API
中文
中文
  • 概述
  • 快速开始
    • 基于Relation Protocol 部署合约
    • 使用Graph Indexer部署Social Graph的查询服务
  • 关键概念
    • RDF
    • Semantic SBTs
    • Social Graph
  • Relation Protocol的架构
  • Schema Standard
    • 概述
    • schema如何约束智能合约
    • schema存储
    • schema列表
  • Contract Open Standard
    • 概述
    • Identity
      • Name Service
    • Relationship
      • Follow
      • Dao
    • Publication
      • Content
      • Privacy Content
  • Open Standard API
    • 介绍
    • EIP-6239
    • 业务接口
      • Identity
      • Relationship
      • Publication
  • Graph Indexer
    • 定义与用途
    • 事件监听
    • 解析数据
    • 构建图谱
  • 集成
    • 快速开始
    • 构建Relation Protocol社交图谱
    • Relation Protocol 资源列表
    • NameService 合约请求示例
    • Follow 合约请求示例
    • Dao 合约请求示例
    • Content 合约请求示例
    • PrivacyContent 合约请求示例
  • Relation Name Service
    • Name Service Api
  • 用例
  • 附录
    • 使用Hardhat部署合约
    • SemanticSBT部署工具
Powered by GitBook
On this page
  • Content
  • PrivacyContent
  1. Open Standard API
  2. 业务接口

Publication

Content

  1. 发布内容

  function post(string memory content) external;

提供预生成的tokenId和待发布内容的Arweave哈希,生成一个SBT。实际内容存放在Arweave上,将Arweave交易哈希作为内容记录在链上

参数:

  • content: 发布的内容对应的Arweave交易哈希,可通过此交易哈希访问到原始发布内容

上传至Arweave的内容格式如下:

{
  "content": {
    "body": "${The body of content}",
    "title": "${The title of content}"
  }
}
  1. 查询发布内容

  function contentOf(uint256 tokenId) external view returns (string memory content);

根据tokenId查询关联的发布内容

参数:

  • tokenId

返回:

  • content: 发布的内容对应的Arweave交易哈希,可通过此交易哈希访问到原始发布内容

PrivacyContent

  1. 预生成tokenId

  function prepareToken() external returns (uint256);

用户预生成一个tokenId

返回:

  • tokenId: 预生成的tokenId

  1. 查询持有的预生成tokenId

  function ownedPrepareToken(address owner) external view returns (uint256);

参数:

  • owner: 被查询的地址

返回:

  • tokenId: 预生成的tokenId

  1. 发布隐私内容

  function post(uint256 tokenId, string memory content) external;

提供预生成的tokenId和待发布内容的Arweave哈希,生成一个SBT。实际隐私内容以及许可条件存放在Arweave上,将Arweave交易哈希作为内容记录在链上

参数:

  • tokenId: 预生成的tokenId

  • content: 隐私内容以及许可条件对应的Arweave交易哈希,可通过此交易哈希访问到原始发布内容

上传至Arweave的内容格式如下:

{
  "encryptionBy": "lit-protocol",
  "accessCondition": [
    {
      "contractAddress": "${The contract address of Semantic SBT}",
      "standardContractType": "ERC721",
      "chain": "polygon",
      "method": "isViewerOf",
      "parameters": [
        ":userAddress",
        "${The tokenId}"
      ],
      "returnValueTest": {
        "comparator": "=",
        "value": true
      }
    }
  ],
  "encryptedSymmetricKey": "${A hex string that LIT will use to decrypt your content as long as you satisfy the conditions}",
  // encrypted content
  "encryptedObject": "${The encrypted content}"
}
  1. 是否具备查看权限

  function isViewerOf(address viewer, uint256 tokenId) external view returns (bool);

查询某个地址是否具备tokenId对应的隐私数据的查看权限。

参数:

  • viewer: 查看者的地址

  • tokenId

返回:

  • isViewer: true--具备查看权限;false--不具备查看权限

  1. 查询发布内容

  function contentOf(uint256 tokenId) external view returns (string memory content);

根据tokenId查询关联的发布内容

参数:

  • tokenId

返回:

  • content: 发布的内容对应的Arweave交易哈希,可通过此交易哈希访问到原始发布内容

Last updated 2 years ago