@matrix-labs/matrix-storefront-sdk
Advanced tools
Comparing version 0.0.8 to 0.0.9
export declare const checkStorefront: string; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const createListingScript: string; |
@@ -14,3 +14,3 @@ "use strict"; | ||
let NFTProvider: Capability<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}> | ||
let NFTProvider: Capability<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}> | ||
@@ -22,7 +22,12 @@ let tokenReceiver: Capability<&{FungibleToken.Receiver}> | ||
// borrow Storefront resource | ||
self.storefront = acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath) ?? panic("can't borrow storefront") | ||
self.storefront = acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontPublicPath) ?? panic("can't borrow storefront") | ||
self.NFTProvider = acct.getCapability<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(MatrixMarketplaceNFT.CollectionPublicPath)! | ||
assert(self.NFTProvider.borrow() != nil, message: "Missing or mis-typed MatrixMarketplaceNFT.Collection provider") | ||
// to access 0xsupportedNFTName | ||
if acct.getCapability<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(0xsupportedNFTName.CollectionPublicPath).check() == false { | ||
acct.link<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(0xsupportedNFTName.CollectionPublicPath, target: 0xsupportedNFTName.CollectionStoragePath) | ||
} | ||
self.NFTProvider = acct.getCapability<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(0xsupportedNFTName.CollectionPublicPath)! | ||
assert(self.NFTProvider.borrow() != nil, message: "Missing or mis-typed 0xsupportedNFTName.Collection provider") | ||
// receiver flowtoken after NFT sold | ||
@@ -44,4 +49,4 @@ self.tokenReceiver = acct.getCapability<&{FungibleToken.Receiver}>(/public/flowTokenReceiver)! | ||
saleCuts.append(NFTStorefront.SaleCut( | ||
receiver: getAccount(royaltyReceivers[size-1]).getCapability<&{FungibleToken.Receiver}>(/public/flowTokenReceiver)!, | ||
amount: royaltyMount[size-1] | ||
receiver: royaltyReceivers[size], | ||
amount: royaltyMount[size] | ||
)) | ||
@@ -48,0 +53,0 @@ size = size - 1 |
export declare const getListingIdsScript: string; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const initStorefront: string; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const purchaseListingScript: string; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const removeListingScript: string; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare enum FlowEnv { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -14,6 +14,6 @@ import { FlowEnv } from "./env"; | ||
initStorefront(): Promise<string>; | ||
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: string[], royaltyMount: string[], nftId: number, price: string): Promise<string>; | ||
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: [string], royaltyMount: [string], nftId: number, price: string): Promise<string>; | ||
purchaseList(supportedNFTName: string, supportedNFTAddress: string, listingResourceId: number, sellerAddress: string): Promise<string>; | ||
removeList(listingResourceID: number): Promise<string>; | ||
getListingIds(account: string): Promise<number[]>; | ||
getListingIds(account: string): Promise<[number]>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=IStorefrontClient.js.map |
@@ -0,0 +0,0 @@ export interface MatrixMarketplaceNFT { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=model.js.map |
@@ -10,6 +10,6 @@ import { IBindConfigs, IStorefrontClient } from "./IStorefrontClient"; | ||
initStorefront(): Promise<string>; | ||
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: string[], royaltyMount: string[], nftId: number, price: string): Promise<string>; | ||
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: [string], royaltyMount: [string], nftId: number, price: string): Promise<string>; | ||
purchaseList(supportedNFTName: string, supportedNFTAddress: string, listingResourceId: number, sellerAddress: string): Promise<string>; | ||
removeList(listingResourceID: number): Promise<string>; | ||
getListingIds(account: string): Promise<number[]>; | ||
getListingIds(account: string): Promise<[number]>; | ||
} |
@@ -136,5 +136,4 @@ "use strict"; | ||
await this.setupFcl("0xsupportedNFTAddress", supportedNFTAddress); | ||
await this.setupFcl("0xsupportedNFTName", supportedNFTName); | ||
const response = await this.fcl.send([ | ||
this.fcl.transaction(create_list_1.createListingScript.replaceAll("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.transaction(create_list_1.createListingScript.replace("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.args([this.fcl.arg(royaltyReceivers, t.Array(t.Address)), this.fcl.arg(royaltyMount, t.Array(t.UFix64)), this.fcl.arg(nftId, t.UInt64), this.fcl.arg(price, t.UFix64)]), | ||
@@ -160,5 +159,4 @@ this.fcl.proposer(this.fcl.currentUser().authorization), | ||
await this.setupFcl("0xsupportedNFTAddress", supportedNFTAddress); | ||
await this.setupFcl("0xsupportedNFTName", supportedNFTName); | ||
const response = await this.fcl.send([ | ||
this.fcl.transaction(purchase_list_1.purchaseListingScript.replaceAll("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.transaction(purchase_list_1.purchaseListingScript.replace("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.args([this.fcl.arg(listingResourceId, t.UInt64), this.fcl.arg(sellerAddress, t.Address)]), | ||
@@ -165,0 +163,0 @@ this.fcl.proposer(this.fcl.currentUser().authorization), |
export * from "./client/StorefrontClient"; | ||
export * as fcl from "@onflow/fcl"; | ||
export * from "./client/env"; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "@matrix-labs/matrix-storefront-sdk", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -0,0 +0,0 @@ ### Install |
@@ -0,0 +0,0 @@ import * as fcl from "@onflow/fcl"; |
@@ -11,3 +11,3 @@ export const createListingScript: string = ` | ||
let NFTProvider: Capability<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}> | ||
let NFTProvider: Capability<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}> | ||
@@ -19,7 +19,12 @@ let tokenReceiver: Capability<&{FungibleToken.Receiver}> | ||
// borrow Storefront resource | ||
self.storefront = acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath) ?? panic("can't borrow storefront") | ||
self.storefront = acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontPublicPath) ?? panic("can't borrow storefront") | ||
self.NFTProvider = acct.getCapability<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(MatrixMarketplaceNFT.CollectionPublicPath)! | ||
assert(self.NFTProvider.borrow() != nil, message: "Missing or mis-typed MatrixMarketplaceNFT.Collection provider") | ||
// to access 0xsupportedNFTName | ||
if acct.getCapability<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(0xsupportedNFTName.CollectionPublicPath).check() == false { | ||
acct.link<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(0xsupportedNFTName.CollectionPublicPath, target: 0xsupportedNFTName.CollectionStoragePath) | ||
} | ||
self.NFTProvider = acct.getCapability<&0xsupportedNFTName.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(0xsupportedNFTName.CollectionPublicPath)! | ||
assert(self.NFTProvider.borrow() != nil, message: "Missing or mis-typed 0xsupportedNFTName.Collection provider") | ||
// receiver flowtoken after NFT sold | ||
@@ -41,4 +46,4 @@ self.tokenReceiver = acct.getCapability<&{FungibleToken.Receiver}>(/public/flowTokenReceiver)! | ||
saleCuts.append(NFTStorefront.SaleCut( | ||
receiver: getAccount(royaltyReceivers[size-1]).getCapability<&{FungibleToken.Receiver}>(/public/flowTokenReceiver)!, | ||
amount: royaltyMount[size-1] | ||
receiver: royaltyReceivers[size], | ||
amount: royaltyMount[size] | ||
)) | ||
@@ -58,2 +63,2 @@ size = size - 1 | ||
} | ||
}`; | ||
}` |
@@ -0,0 +0,0 @@ import * as fcl from "@onflow/fcl"; |
@@ -0,0 +0,0 @@ import * as fcl from "@onflow/fcl"; |
@@ -0,0 +0,0 @@ export const purchaseListingScript: string = ` |
@@ -0,0 +0,0 @@ import * as fcl from "@onflow/fcl"; |
@@ -0,0 +0,0 @@ export enum FlowEnv { |
@@ -16,6 +16,6 @@ import {FlowEnv} from "./env"; | ||
initStorefront(): Promise<string>; | ||
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: string[], royaltyMount: string[], nftId: number, price: string): Promise<string>; | ||
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: [string], royaltyMount: [string], nftId: number, price: string): Promise<string>; | ||
purchaseList(supportedNFTName: string, supportedNFTAddress: string, listingResourceId: number, sellerAddress: string): Promise<string>; | ||
removeList(listingResourceID: number): Promise<string>; | ||
getListingIds(account: string): Promise<number[]>; | ||
getListingIds(account: string): Promise<[number]>; | ||
} |
@@ -0,0 +0,0 @@ export interface MatrixMarketplaceNFT { |
@@ -122,8 +122,7 @@ import * as t from "@onflow/types"; | ||
public async createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: string[], royaltyMount: string[], nftId: number, price: string): Promise<string> { | ||
public async createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: [string], royaltyMount: [string], nftId: number, price: string): Promise<string> { | ||
try { | ||
await this.setupFcl("0xsupportedNFTAddress", supportedNFTAddress); | ||
await this.setupFcl("0xsupportedNFTName", supportedNFTName); | ||
const response = await this.fcl.send([ | ||
this.fcl.transaction(createListingScript.replaceAll("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.transaction(createListingScript.replace("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.args([this.fcl.arg( royaltyReceivers, t.Array(t.Address)), this.fcl.arg(royaltyMount, t.Array(t.UFix64)), this.fcl.arg(nftId, t.UInt64), this.fcl.arg(price, t.UFix64)]), | ||
@@ -149,5 +148,4 @@ this.fcl.proposer(this.fcl.currentUser().authorization), | ||
await this.setupFcl("0xsupportedNFTAddress", supportedNFTAddress); | ||
await this.setupFcl("0xsupportedNFTName", supportedNFTName); | ||
const response = await this.fcl.send([ | ||
this.fcl.transaction(purchaseListingScript.replaceAll("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.transaction(purchaseListingScript.replace("0xsupportedNFTName", supportedNFTName)), | ||
this.fcl.args([this.fcl.arg(listingResourceId, t.UInt64), this.fcl.arg(sellerAddress, t.Address)]), | ||
@@ -191,3 +189,3 @@ this.fcl.proposer(this.fcl.currentUser().authorization), | ||
public async getListingIds(account: string): Promise<number[]> { | ||
public async getListingIds(account: string): Promise<[number]> { | ||
try { | ||
@@ -194,0 +192,0 @@ const response = await this.fcl.send([getListingIdsScript, this.fcl.args([this.fcl.arg(account, t.Address)])]); |
declare module "@onflow/fcl"; | ||
declare module "@onflow/types"; |
export * from "./client/StorefrontClient"; | ||
export * as fcl from "@onflow/fcl" | ||
export * from "./client/env" |
@@ -6,5 +6,2 @@ { | ||
"target": "es2020", | ||
"lib": [ | ||
"ES2021.String" | ||
], | ||
"module": "commonjs", | ||
@@ -11,0 +8,0 @@ "declaration": true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76004
50
1