# new OrderManager(MyriaClient)
Create OrderManager instance object
Parameters:
Name | Type | Description |
---|---|---|
MyriaClient |
MyriaClient
|
Interface of Myria Client |
Example
// Approach #1
const mClient: IMyriaClient = {
networkId: Network.SEPOLIA,
provider: web3Instance.currentProvider,
web3: web3Instance,
env: EnvTypes.STAGING,
};
const moduleFactory = ModuleFactory.getInstance(mClient);
const orderManager = moduleFactory.getOrderManager();
// Approach #2
const mClient: IMyriaClient = {
networkId: Network.SEPOLIA,
provider: web3Instance.currentProvider,
web3: web3Instance,
env: EnvTypes.STAGING,
};
const myriaClient = new MyriaClient(mClient);
const orderManager = new OrderManager(myriaClient);
Methods
# async createOrderV2(params) → {OrderEntity}
Create order V2 (supported both of listing NFTs by ETH/MYR)
Parameters:
Name | Type | Description |
---|---|---|
params |
CreateOrderV2Params
|
Create order v2 params including the price/nft/assets information |
Exception: Order type is required
string
Exception: Owner wallet address is required
string
Exception: Owner stark key is required
string
Exception: Price must be define and must be > 0
string
Exception: Asset Ref ID in Marketplace is required
string
Exception: Order is only supported for MINTABLE_ERC721
string
Exception: Token address is required for listing MINTABLE_ERC721
string
Exception: Token ID is required for listing MINTABLE_ERC721
string
Exception: Required the token received to be well-defined and tokenAddress is mandatory
string
Exception: New listing method for ERC20 isn't available on Mainnet yet. Please try with Testnet only.
string
Details order information including fees and Asset_ID_Buy/Asset_ID_Sell/AmountBuy/AmountSell
Example
const mClient: IMyriaClient = {
networkId: Network.SEPOLIA,
provider: web3Instance.currentProvider,
web3: web3Instance,
env: EnvTypes.STAGING,
};
const orderManager: OrderManager = new OrderManager(mClient);
// Define createOrderV2 params
const feeData: FeeDto[] = [
{
feeType: AssetDetailsInfo?.fee?.[0].feeType, // FeeType in asset details info
percentage: AssetDetailsInfo?.fee?.[0].feeType, // Percentage of Fee as apart of asset details info
address: AssetDetailsInfo?.fee?.[0].address, // The destination wallet address which would receive the percentage of Fee
},
];
const paramCreateOrder: CreateOrderV2Params = {
orderType: OrderType.SELL,
ownerWalletAddress: 'owner_wallet_address_that_own_nft',
ownerStarkKey: 'owner_stark_key_0x...',
assetRefId: 'Reference asset ID that intend to listing',
tokenSell: {
tokenType: TokenType.MINTABLE_ERC721,
data: {
tokenId: 'id of token',
tokenAddress: 'token address of NFT',
},
},
tokenReceived: {
tokenType: 'TokenType.ETH or TokenType.ERC20',
data: {
tokenAddress: 'token address of currency',
},
},
price: "100", // Set the price for the NFTs
fees: feeData, // Only having data or undefined
};
const createdOrderResponse: OrderEntity = await orderManager.createOrderV2(paramCreateOrder);
console.log("Order details response:");
console.log(JSON.stringify(data, null, 2));