• OpenSea PHP开发包


    OpenSea PHP开发包是全球最大NFT集市OpenSea的官方API面向对象的PHP封装。

    用熟悉的语言学习 Web3 DApp开发Java | Php | Python | .Net / C# | Golang | Node.JS | Flutter / Dart

    1、安装OpenSea PHP

    OpenSea PHP开发包的前置安装要求如下:

    • PHP >= 7.4
    • PSR-17实现
    • PSR-18实现

    使用Composer安装:

    composer require owenvoke/opensea guzzlehttp/guzzle:^7.0.1 http-interop/http-factory-guzzle:^1.0
    
    • 1

    2、快速上手OpenSea PHP

    查询NFT资产:

    // Include the Composer autoloader
    require_once __DIR__ . '/vendor/autoload.php';
    use OwenVoke\OpenSea\Client;
    
    $client = new Client();
    $assets = $client->assets()->all();
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    API令牌验证:

    use OwenVoke\OpenSea\Client;
    $client = new Client();
    $client->authenticate($apiToken, null, Client::AUTH_ACCESS_TOKEN);
    
    • 1
    • 2
    • 3

    3、资产API

    资产API提供了访问OpenSea资产API的PHP封装。

    查询资产清单:

    // Retrieve a standard list of assets with the default parameters
    $response = $client->assets()->all();
    
    // Retrieve a custom list of assets using parameters
    $response = $client->assets()->all([
        'owner' => 'owners_address_here',
    ]);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    查询指定资产:

    $response = $client->assets()->show($address, $tokenId);
    
    • 1

    4、资产包API

    资产包API提供了访问OpenSea资产包API的PHP封装。

    查询资产包清单:

    // Retrieve a standard list of bundles with the default parameters
    $response = $client->bundles()->all();
    
    // Retrieve a custom list of bundles using parameters
    $response = $client->bundles()->all([
        'owner' => 'owners_address_here',
    ]);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    5、藏品集API

    藏品集API提供了访问OpenSea藏品集API的PHP封装。

    查询藏品集清单:

    // Retrieve a standard list of collections with the default parameters
    $response = $client->collections()->all();
    
    // Retrieve a custom list of collections using parameters
    $response = $client->collections()->all([
        'asset_owner' => 'owners_address_here',
    ]);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    6、合约API

    合约API提供了访问OpenSea合约API的PHP封装。

    查询指定的合约:

    $response = $client->contracts()->show($contractAddress);
    
    • 1

    7、事件API

    事件API提供了访问OpenSea事件API的PHP封装。

    查询事件清单:

    // Retrieve a standard list of events with the default parameters
    $response = $client->events()->all();
    
    // Retrieve a custom list of events using parameters
    $response = $client->events()->all([
        'account_address' => 'accounts_wallet_address_here',
    ]);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    原文链接: OpenSea PHP开发包 — 汇智网

  • 相关阅读:
    把C# 中的集合讲的比较明白的文章
    redis info 详解(InsCode AI 创作助手)
    【LeetCode】合并石头的最低成本 [H](动态规划)
    Xilinx 7系列FPGA配置(ug470)
    C/C++内存管理
    MHA高可用配置及故障切换
    excel如何实现按班级统计?
    C# OpenVINO Cls 图像分类
    Java Web 7 JavaScript 7.9 RegExp对象
    嵌入式养成计划-38----C++--匿名对象--友元--常成员函数和常对象--运算符重载
  • 原文地址:https://blog.csdn.net/shebao3333/article/details/125439636