Skip to content

Commit

Permalink
Marketplace pNFT support added (#51)
Browse files Browse the repository at this point in the history
* pNFT support added on list, unlist, buy APIs

* 0.2.32
  • Loading branch information
impin2rex authored Dec 20, 2023
1 parent f0f12c0 commit dd2e4a8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.2.31",
"version": "0.2.32",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/api/mp-listing-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class MpListingClient {
sellerWallet: string;
buyerWallet: string;
serviceCharge?: ServiceCharge;
}): Promise<NftBuyResponse> {
}): Promise<NftBuyResponse & { signers: string[] }> {
try {
const reqBody = {
network: input?.network ?? this.config.network,
Expand All @@ -243,7 +243,7 @@ export class MpListingClient {
url: 'marketplace/buy',
data: reqBody,
});
const response = data.result as NftBuyResponse;
const response = data.result as NftBuyResponse & { signers: string[] };
return response;
} catch (error) {
throw error;
Expand Down
30 changes: 21 additions & 9 deletions tests/marketplace-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const shyft = new ShyftSdk({
});

describe('Marketplace test', () => {
beforeEach((): void => {
jest.setTimeout(20000);
});

it('create mp', async () => {
const { encoded_transaction } = await shyft.marketplace.create({
creatorWallet: '2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc',
Expand Down Expand Up @@ -91,15 +95,23 @@ describe('Marketplace test', () => {
});

it('buy', async () => {
const { encoded_transaction } = await shyft.marketplace.listing.buy({
network: Network.Mainnet,
marketplaceAddress: 'AxrRwpzk4T6BsWhttPwVCmfeEMbfbasv1QxVc5JhUfvB',
nftAddress: 'A6v4ucyJ2sYnn4HiSnw4Z8mYhzQosRhE5tsH4NXM5v2N',
sellerWallet: '4AQHWYvT647XtdoW7KcVzjEwG3ZqmMDhBpZ316yJWrTp',
buyerWallet: 'Bme4LRYLq199vosFJcP2YrHSduMj27tmqdTNadYDma9A',
price: 250,
});
expect(typeof encoded_transaction).toBe('string');
const { encoded_transaction, transaction_version, signers } =
await shyft.marketplace.listing.buy({
network: Network.Devnet,
marketplaceAddress: '5LSMwR5GLr4WjDHS5FoUXQCN5osZYHRoDGjmcEsS843B',
nftAddress: '6PStcTWbV546dQCHbjVj4SP6Ht8e2eE4D8Mc951mH1yq',
sellerWallet: '2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc',
buyerWallet: '5KW2twHzRsAaiLeEx4zYNV35CV2hRrZGw7NYbwMfL4a2',
price: 0.3,
serviceCharge: {
receiver: '5KW2twHzRsAaiLeEx4zYNV35CV2hRrZGw7NYbwMfL4a2',
token: 'HtXwt7NchBTV7xoqmjhQJqEjSrApq5FNnB8rxYu6eC7k',
amount: 0.01,
},
});

expect(transaction_version).toBe(0);
expect(signers.length).toBe(2);
});

it('bid', async () => {
Expand Down

0 comments on commit dd2e4a8

Please sign in to comment.