Copy curl -LO https://github.com/WASD3Rplay/nectar-sdk-examples/raw/main/wasd3rplay-nectar-sdk-0.1.4.tgz
npm install ./wasd3rplay-nectar-sdk-0.1.4.tgz
Set environment variables
Copy NODE_NECTAR_WALLET_SECRET="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
NODE_NECTAR_API_KEY="82zkL7mH.F4YxlEzviZBjBLx9ZFp7HvzguPYBnXmZ"
Please note that the values mentioned above are considered public information and should be exclusively used in a testing environment. Utilizing them in a production environment could result in unforeseen drawbacks.
Please ensure the secure storage of the provided values, and we strongly recommend avoiding unnecessary sharing.
Copy import { Nectar } from "@wasd3rplay/nectar-sdk";
const main = async (): Promise<void> => {
const nectar = new Nectar();
const marketList = await nectar.getExchangeInfo();
console.info("Market List: ", marketList);
};
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Copy import { Nectar, OrderType, UserOrder } from "@wasd3rplay/nectar-sdk";
import { Wallet } from "ethers";
const nectar = new Nectar();
const main = async (): Promise<void> => {
// BUY order
const buyerWallet = Wallet.createRandom()
const buyOrderID = await nectar.createLimitOrder({
symbol: marketSymbol,
orderType: OrderType.BUY,
price: "1000", // 1000 USDT
requestAmount: "0.1", // 0.1 ETH
signer: buyerWallet
});
console.debug("BUY order: ", buyOrderID, " BY ", buyerWallet.address);
// SELL order
const sellerWallet = Wallet.createRandom();
const sellOrderID = await nectar.createLimitOrder({
symbol: marketSymbol,
orderType: OrderType.SELL,
price: "1100", // 1100 USDT
requestAmount: "0.5", // 0.5 ETH
signer: sellerWallet
});
console.debug("SELL order: ", sellOrderID, " BY ", sellerWallet.address);
};
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});