0.1.14 • Published 1 year ago

market-sui-sdk v0.1.14

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Market-Sui-SDK

Init SDK

import { SDK,TESTNET_CONFIG } from 'market-sui-sdk';
(async function main() {
    const sdk = new SDK(TESTNET_CONFIG);
})();

Query Collection

collectionID='0xb271d4d214de1a8c5a665505dfec98a2c490d80e'
import {  SDK,DEVNET_CONFIG } from "market-sui-sdk";
async function main() {
    
    const sdk = new SDK(DEVNET_CONFIG);
    const details= await sdk.Market.getCollectionInfo('0xb271d4d214de1a8c5a665505dfec98a2c490d80e')
    console.log(details)
};

Query Item

itemID='0x7ba9d57d0ca150aeca6864f58b00e6773234d75e'
import { SDK,DEVNET_CONFIG } from "market-sui-sdk";

async function main() {
    
    const sdk = new SDK(DEVNET_CONFIG);

    const details= await sdk.Market.getItemInfo('0x7ba9d57d0ca150aeca6864f58b00e6773234d75e')
    console.log(details)

};

CreateCollection

import { SDK,DEVNET_CONFIG,CreateCollectionTXPayloadParams } from "market-sui-sdk";
import { Ed25519Keypair, RawSigner } from '@mysten/sui.js';

async function main() {
    
    const sdk = new SDK(DEVNET_CONFIG);
    const keypair = new Ed25519Keypair();
    const signer = new RawSigner(keypair,sdk.jsonRpcProvider);


    const create_collection_param:CreateCollectionTXPayloadParams={
        market: DEVNET_CONFIG.marketObjectId,
        name: 'collection_name',
        description: 'collection_description',
        tags: ['tags'],
        logo_image: 'logo_image',
        featured_image: 'featured_image',
        website: 'website',
        twitter: 'twitter',
        discord: 'discord',
        fee: 1,
        itemType: '0x2::devnet_nft::DevNetNFT',
        //用于支付gas
        gasPaymentObjectId: '0xd6b6961ea31d0a11ea631b14cc96ad53ad923c0e'
    }

    const moveExec= await sdk.Market.buildCreateCollectionTransaction(create_collection_param);
    const Txs=signer.executeMoveCall(moveExec)

    console.log(Txs)

};

List ITem

import { SDK,DEVNET_CONFIG,ListingItemTxPayloadParams } from "market-sui-sdk";
import { Ed25519Keypair, RawSigner } from '@mysten/sui.js';

async function main() {
    
    const sdk = new SDK(DEVNET_CONFIG);
    const keypair = new Ed25519Keypair();
    const signer = new RawSigner(keypair,sdk.jsonRpcProvider);

    const list_item_param:ListingItemTxPayloadParams={
        collectionId: '0x...',
        itemId: '0x...',
        price: 100,
        itemType: '0x2::devnet_nft::DevNetNFT',
        gasPaymentObjectId: '0xd6b6961ea31d0a11ea631b14cc96ad53ad923c0e',
    }

    const moveExec= await sdk.Market.buildListingItemTransaction(list_item_param);
    const Txs=signer.executeMoveCall(moveExec)
    console.log(Txs)

};

Delist Item

0.1.14

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago