跳至主要內容

如何选择适合的NFT订阅模式

tokenview大约 5 分钟

如何选择适合的NFT订阅模式

Tokenview推出NFT 订阅数据服务open in new window !四种订阅主题随心选:账户、Token 、 NFT Collection以及Event。NFT链上事件随时看,用户轻松获取NFT 铸造/交易/买入/卖出/销毁最新动态,提供稳定、易操作、友好的NFT事件通知提醒。此外NFT订阅适用于所有支持 NFT 的 Layer1 和 Layer2 公链,无需节点数据,无地址监控数量限制,按需配置,通过 APIKey 一键开通。简化一切链上应用程序构建!

Tokenview NFT 订阅提供 4 种订阅模式:

1. 基于‘账户’订阅的推送

基于账户(地址)的订阅可以分为两种消息发送方式:

备注:实体账户指account,具备私钥的账户;对于合约,token等非实体账户不支持NFT订阅功能;

基于账户(地址)资产变动示例

以交易0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6open in new window为例

账户 0x6186…9cfeopen in new window收到了6个NFT: KUMA #1024,1204,2451,643,922,970,价值 0.377 ETH
当订阅0x6186…9cfeopen in new window,推送的json为:

❗️ 基于‘账户’订阅的推送: 推送的每条消息 "msgType" 为 "address-s"

{
  "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
  "ens": "barthazian.eth",
  "height": "15866281",
  "in": [         // 地址获得的内容列表
    {
      "amount": "1",
      "from": "0xc4416a182489671fb96de08a4d1bcc588214e78e",
      "nftid": "1024",
      "symbol": "KUMA",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
      "type": "rc721"
    },
    {
      "amount": "1",
      "from": "0xc29c546064e8fb5506c5e5beaf1594866df7177e",
      "nftid": "1204",
      "symbol": "KUMA",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
      "type": "rc721"
    },
    {
      "amount": "1",
      "from": "0x0ddf9101626a4971a530e0bb17b1ebc2741fe89f",
      "nftid": "2451",
      "symbol": "KUMA",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
      "type": "rc721"
    },
    {
      "amount": "1",
      "from": "0xb0a0bcac1f8010af6c63e7190824ff93186d54e3",
      "nftid": "643",
      "symbol": "KUMA",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
      "type": "rc721"
    },
    {
      "amount": "1",
      "from": "0x6f04aeb4562b56f48ee29893ff89a19e4e837b6a",
      "nftid": "922",
      "symbol": "KUMA",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
      "type": "rc721"
    },
    {
      "amount": "1",
      "from": "0x1fc9345beb50cea9f4ccd0f2a83c2271aa721b90",
      "nftid": "970",
      "symbol": "KUMA",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
      "type": "rc721"
    }
  ],
  "msgType": "address-s",
  "network": "ETH",
  "out": [    // 地址失去的内容列表
    {
      "amount": "0.377",
      "from": "0x6186290b28d511bff971631c916244a9fc539cfe",
      "to": "0x00000000006c3852cbef3e08e8df289169ede581",
      "type": "ETH"
    }
  ],
  "time": "1667198135",
  "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6"
}

基于账户+Token 资产变动

账户地址 0x6186…9cfeopen in new window收到了6个 NFT: KUMA #1024,1204,2451,643,922,970,价值 0.377 ETH
当用户订阅0x6186…9cfeopen in new window,针对交易里的 6 个NFT,会分别推送6条消息,如下所示:

❗️ 基于地址+token资产变动的推送: 推送的每条消息 "msgType" 为 "address-m"

{
    "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
    "amount": "1",
    "ens": "barthazian.eth",
    "height": "15866281",
    "msgType": "address-m",
    "network": "ETH",
    "nftid": "1024",
    "time": "1667198135",
    "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
    "tokenSymbol": "KUMA",
    "txType": "Buy",
    "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
    "type": "rc721"
  }
{
    "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
    "amount": "1",
    "ens": "barthazian.eth",
    "height": "15866281",
    "msgType": "address-m",
    "network": "ETH",
    "nftid": "1204",
    "time": "1667198135",
    "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
    "tokenSymbol": "KUMA",
    "txType": "Buy",
    "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
    "type": "rc721"
  }
{
    "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
    "amount": "1",
    "ens": "barthazian.eth",
    "height": "15866281",
    "msgType": "address-m",
    "network": "ETH",
    "nftid": "2451",
    "time": "1667198135",
    "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
    "tokenSymbol": "KUMA",
    "txType": "Buy",
    "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
    "type": "rc721"
  }
{
    "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
    "amount": "1",
    "ens": "barthazian.eth",
    "height": "15866281",
    "msgType": "address-m",
    "network": "ETH",
    "nftid": "643",
    "time": "1667198135",
    "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
    "tokenSymbol": "KUMA",
    "txType": "Buy",
    "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
    "type": "rc721"
  }	
{
    "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
    "amount": "1",
    "ens": "barthazian.eth",
    "height": "15866281",
    "msgType": "address-m",
    "network": "ETH",
    "nftid": "922",
    "time": "1667198135",
    "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
    "tokenSymbol": "KUMA",
    "txType": "Buy",
    "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
    "type": "rc721"
  }
{
    "address": "0x6186290b28d511bff971631c916244a9fc539cfe",
    "amount": "1",
    "ens": "barthazian.eth",
    "height": "15866281",
    "msgType": "address-m",
    "network": "ETH",
    "nftid": "970",
    "time": "1667198135",
    "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
    "tokenSymbol": "KUMA",
    "txType": "Buy",
    "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
    "type": "rc721"
  }	

2. 基于‘TokenID’订阅的推送

仍以上面的交易为例,假设我们监控的是 #1024,那么接收到的json消息为:

❗️ 基于‘TokenID’订阅的推送: 推送的每条消息 "msgType" 为 "token"

{
  "address": "0x8270fc3b2d23de703b265b2abe008883954fea8e-1024",
  "amount": "1",
  "from": "0xc4416a182489671fb96de08a4d1bcc588214e78e",
  "height": "15866281",
  "msgType": "token",
  "network": "ETH",
  "nftid": "1024",
  "time": "1667198135",
  "to": "0x6186290b28d511bff971631c916244a9fc539cfe",
  "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
  "tokenSymbol": "KUMA",
  "txType": "Exchange",
  "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
  "type": "rc721"
}

3. 基于‘Collection’订阅的推送

仍以上面的交易为例子,假设我们监控的内容是 KUMA 这个 Collection,那么接收到的 json 消息为:

❗️基于‘Collection’的推送: 推送的每条消息 "msgType" 为 "collection"

{
  "address": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
  "height": "15866281",
  "ids": [
    {
      "amount": "1",
      "from": "0xc4416a182489671fb96de08a4d1bcc588214e78e",
      "nftid": "1024",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe"
    },
    {
      "amount": "1",
      "from": "0xc29c546064e8fb5506c5e5beaf1594866df7177e",
      "nftid": "1204",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe"
    },
    {
      "amount": "1",
      "from": "0x0ddf9101626a4971a530e0bb17b1ebc2741fe89f",
      "nftid": "2451",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe"
    },
    {
      "amount": "1",
      "from": "0xb0a0bcac1f8010af6c63e7190824ff93186d54e3",
      "nftid": "643",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe"
    },
    {
      "amount": "1",
      "from": "0x6f04aeb4562b56f48ee29893ff89a19e4e837b6a",
      "nftid": "922",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe"
    },
    {
      "amount": "1",
      "from": "0x1fc9345beb50cea9f4ccd0f2a83c2271aa721b90",
      "nftid": "970",
      "to": "0x6186290b28d511bff971631c916244a9fc539cfe"
    }
  ],
  "msgType": "collection",
  "network": "ETH",
  "time": "1667198135",
  "tokenAddress": "0x8270fc3b2d23de703b265b2abe008883954fea8e",
  "tokenSymbol": "KUMA",
  "txid": "0xad229685025e3c8a9a4a98f752e7f743b46151e1909dbb69f2f0bc32aedc20a6",
  "type": "rc721"
}

4. 基于‘Event’订阅的推送

基于Event的订阅可以分为两种消息发送方式:

  • 4.1 消息多条发送。一个订阅对象在一笔交易中发生的所有NFT相关的行为一次性返回,返回通知条数:1;
  • 4.2 消息单条发送。一个订阅对象在一笔交易中发生的多个 NFT 相关的行为,每个 NFT 发一条消息通知,返回通知条数:多条;

4.1 消息多条发送示例

以交易0x470ed9ae058d85a69c34dc2ea6be62145ba8daf63694e8d3d9dcd35c187de5a3open in new window为例
地址 0x0b28…1d2eopen in new windowmint到了2个NFT: UACD #1504,1505
推送2条消息,每条消息的"msgType" 为 "event-m",推送的json示例如下:

{
    "address": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
    "amount": "1",
    "from": "0x0000000000000000000000000000000000000000",
    "height": "16686117",
    "msgType": "event-m",
    "network": "ETH",
    "nftid": "1505",
    "time": "1677094895",
    "to": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
    "tokenAddress": "0xb95712ac7fbf54ab3fd10c86fd1e9463c8461bf5",
    "tokenSymbol": "UACD",
    "txType": "Mint",
    "txid": "0x470ed9ae058d85a69c34dc2ea6be62145ba8daf63694e8d3d9dcd35c187de5a3",
    "type": "rc721"
}
{
    "address": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
    "amount": "1",
    "from": "0x0000000000000000000000000000000000000000",
    "height": "16686117",
    "msgType": "event-m",
    "network": "ETH",
    "nftid": "1504",
    "time": "1677094895",
    "to": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
    "tokenAddress": "0xb95712ac7fbf54ab3fd10c86fd1e9463c8461bf5",
    "tokenSymbol": "UACD",
    "txType": "Mint",
    "txid": "0x470ed9ae058d85a69c34dc2ea6be62145ba8daf63694e8d3d9dcd35c187de5a3",
    "type": "rc721"
}

4.2 消息单条发送示例

地址 0x0b28…1d2eopen in new windowmint到了2个NFT: UACD #1504,1505
推送1条消息,消息的"msgType" 为 "event-s",推送的json示例如下:

{
    "address": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
    "height": "16686117",
    "list": [
    {
        "amount": "1",
        "from": "0x0000000000000000000000000000000000000000",
        "nftid": "1504",
        "symbol": "UACD",
        "to": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
        "tokenAddress": "0xb95712ac7fbf54ab3fd10c86fd1e9463c8461bf5",
        "type": "rc721"
    },
    {
        "amount": "1",
        "from": "0x0000000000000000000000000000000000000000",
        "nftid": "1505",
        "symbol": "UACD",
        "to": "0x0b28beacf76d1efe9ade22dde6e23f6f4d611d2e",
        "tokenAddress": "0xb95712ac7fbf54ab3fd10c86fd1e9463c8461bf5",
        "type": "rc721"
    }],
    "msgType": "event-s",
    "network": "ETH",
    "time": "1677094895",
    "txType": "Mint",
    "txid": "0x470ed9ae058d85a69c34dc2ea6be62145ba8daf63694e8d3d9dcd35c187de5a3"
} 

点击登入open in new window开始订阅吧!

关于 Tokenview 区块链 APIs & 数据服务平台:

Tokenview 区块链 APIs & 数据服务平台 包含 120+ 条公链数据及其节点集群,现已服务 200,000+ 用户和企业,涵盖各类区块链应用,包括 Wallet,DEX,地址监控机器人,地址追踪,区块链指数分析平台,TVL 统计平台,Gas Tracker, NFT分析监控,合约应用,Web3 场景等,数据丰富,使用简单,使用 APIKey 即可轻松拥有。集丰富的区块链数据种类和数量于一体,消息以Json展示,易于使用,准确度高,数据经多层校验精准完备。
上次编辑于: