MyGit

v1.0.0

liteflow-labs/liteflow-js

版本发布时间: 2023-07-03 23:52:44

liteflow-labs/liteflow-js最新发布版本:v3.0.0(2024-05-17 17:40:59)

Migration Guide from @nft/hooks to @liteflow/react

We've made significant changes to our libraries to deliver the most efficient and up-to-date solutions for your development needs. This guide will walk you through the steps to transition from the legacy @nft/hooks library to our new and improved @liteflow/react library.

1. Update LiteflowProvider

The LiteflowProvider now utilizes an apiKey for authentication. You can obtain your apiKey from your dashboard:

Here is a simple example:

import { LiteflowProvider } from "@liteflow/react";

<LiteflowProvider apiKey="your-api-key">
  // your app
</LiteflowProvider>

2. Update Offer Handling

Hooks such as useAcceptOffer and useCancelOffer have been updated to accept the id of the offer directly. You no longer need to pass an object containing the id.

Here is how you can update your hooks:

const [acceptOffer] = useAcceptOffer();

// Before
acceptOffer({ id: "your-offer-id" })

// After
acceptOffer("your-offer-id");

3. Replace assetId with Chain, Collection, and Token

We've replaced assetId with a combination of chain, collection, and token identifiers. This change provides better granularity for your applications.

Replace your asset ID references as follows:

// Before
const assetId = "chain-address-token";

// After
const chain = "chain";
const collection = "address";
const token = "token";

4. Change Price Definition

Price definitions have been updated. Previously, they were a combination of xxxPrice and currencyId. Now, you should use xxx of type price which contains an amount and a currency.

currency can be the address of the currency or null for a native token.

Here is an example:

// Before
const price = {
  xxxPrice: "your-xxx-price",
  currencyId: "your-currency-id",
};

// After
const price = {
  xxx: {
    amount: "your-amount",
    currency: "your-currency-or-null",
  },
};

Remember to check your application thoroughly after making these changes. As always, don't hesitate to reach out if you encounter any difficulties or have any questions regarding this migration. We're here to help! Happy coding!

What's Changed

Full Changelog: https://github.com/liteflow-labs/liteflow-js/compare/v1.0.0-beta.13...v1.0.0

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-07-03发行的版本