v1.0.0
版本发布时间: 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:
- Go to the Liteflow Dashboard
- Your
apiKey
can be found under theAPI Keys
section. Copy this key. - Replace the previous authentication method in your LiteflowProvider initialization with the
apiKey
.
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
- update changelog of api with beta.14 by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/140
- Update env for starter kit by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/141
- Update documentation for webhooks by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/145
- update changelog for beta 15 by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/147
- update @nft/api-graphql to v1.0.0-beta.15 by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/149
- Add new auction expired webhook by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/148
- Update @nft/api-graphql and changelog by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/150
- update changelogs of graphql-api and webhook packages by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/153
- add api changelog for v1.0.0-beta.17 by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/154
- Add changelog of beta 18 by @NicolasMahe in https://github.com/liteflow-labs/liteflow-js/pull/156
- Core package base -- placeBid and listToken by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/142
- Core package -- cancel and accept offer by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/144
- Auction SDK by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/159
- Create asset sdk by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/160
- Account core SDK by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/161
- Rename @nft/hooks to @liteflow/react by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/162
- SDK v1 by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/158
- Documentation update by @ismailToyran in https://github.com/liteflow-labs/liteflow-js/pull/163
- Update docs for react SDK by @antho1404 in https://github.com/liteflow-labs/liteflow-js/pull/164
Full Changelog: https://github.com/liteflow-labs/liteflow-js/compare/v1.0.0-beta.13...v1.0.0