0.0.20 • Published 2 years ago

@white-matrix/matrix-marketplace-nft-sdk v0.0.20

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Install

yarn add @white-matrix/matrix-flow-market-sdk

API reference

core apis VoucherClient You can also check Demo-front-page for reference

public async checkNFTsCollection(address: string): Promise<boolean> {
        try {
            const response = await fcl.send([
                checkNFTsCollection,
                fcl.args([fcl.arg(address, t.Address)]),
                fcl.limit(1000)
            ]);
            return fcl.decode(response);
        } catch (error) {
            console.error(error);
            return Promise.reject(error);
        }
    }

    /**
     * Get all assets from given account
     *
     * @async
     * @param {string} recipient - recipient address
     * @returns {Promise<MatrixMarketPlaceNFT[]>} transaction id
     * @example ret = await client.getNFTs("0x01cf0e2f2f715450");
     */
    public async getNFTs(account: string): Promise<MatrixMarketPlaceNFT[]> {
        try {
            const response = await fcl.send([getNFTsScript, fcl.args([fcl.arg(account, t.Address)]), fcl.limit(2000)]);
            console.log(response);
            return fcl.decode(response);
        } catch (error) {
            console.error(error);
            return Promise.reject(error);
        }
    }

    public async initNFTCollection(): Promise<string> {
        try {
            const response = await fcl.send([
                initNFTCollection,
                fcl.proposer(fcl.currentUser().authorization),
                fcl.authorizations([fcl.currentUser().authorization]),
                fcl.limit(1000),
                fcl.payer(fcl.currentUser().authorization)
            ]);
            const ret = await fcl.tx(response).onceSealed();
            if (ret.errorMessage !== "" && ret.status != 4) {
                return Promise.reject(ret.errorMessage);
            }
            return response.transactionId;
        } catch (error) {
            console.error(error);
            return Promise.reject(error);
        }
    }
0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago