diff --git a/package-lock.json b/package-lock.json index 43848b8..1579179 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@shyft-to/js", - "version": "0.2.31", + "version": "0.2.32", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@shyft-to/js", - "version": "0.2.31", + "version": "0.2.32", "license": "MIT", "dependencies": { "@solana/web3.js": "^1.74.0", diff --git a/package.json b/package.json index 575dcc7..053947b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.2.31", + "version": "0.2.32", "license": "MIT", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/src/api/mp-listing-client.ts b/src/api/mp-listing-client.ts index 3dbf800..166a3b1 100644 --- a/src/api/mp-listing-client.ts +++ b/src/api/mp-listing-client.ts @@ -223,7 +223,7 @@ export class MpListingClient { sellerWallet: string; buyerWallet: string; serviceCharge?: ServiceCharge; - }): Promise { + }): Promise { try { const reqBody = { network: input?.network ?? this.config.network, @@ -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; diff --git a/tests/marketplace-client.spec.ts b/tests/marketplace-client.spec.ts index cfec7a6..679717f 100644 --- a/tests/marketplace-client.spec.ts +++ b/tests/marketplace-client.spec.ts @@ -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', @@ -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 () => {