Closed leonardge closed 3 years ago
Hi @leonardge -- sorry about the delay here.
I believe you're passing in a market that corresponds to an old DEX program version (see DEX_PROGRAM_ID
in instructions.js).
You can either:
DEX_PROGRAM_ID
currently in the sourceHere's a market that'll work for (1) in the source's current state (verison 0.6.4, DEX program ID 3v9kjrBLN7Awr9BGC2qmFnWLM1EgMAdNm2rXLQFUcQ2d): 6ibUz1BqSD3f8XP4wEGwoRH4YbYRZ1KDZBeXmrp3KosD on mainnet.
9o1FisE366msTQcEvXapyMorTLmvezrxSD8DnM5e5XKw also doesn't seem to be a market address: it's a program address. When using the solana explorer, market addresses will show their owner (corresponding DEX program) like so: https://explorer.solana.com/address/6ibUz1BqSD3f8XP4wEGwoRH4YbYRZ1KDZBeXmrp3KosD
Hi, @nishadsingh1 thanks for the clarification. I can now get the bids
and asks
however, should the order have the owner
field?
Specificially, I am referring to:
// Full orderbook data
for (let order of asks) {
console.log(
order.orderId,
order.owner.toBase58(), <--- this line
order.price,
order.size,
order.side, // 'buy' or 'sell'
);
}
It is telling me the owner
is undefined when using the market address as you suggested.
I looked at the code, seems like owner
is not part of the Order
interface.
Ah and one more thing, for the following code:
// Placing orders
let owner = new Account('...');
let payer = new PublicKey('...'); // spl-token account
await market.placeOrder(connection, {
owner,
payer,
side: 'buy', // 'buy' or 'sell'
price: 123.45,
size: 17.0,
orderType: 'limit', // 'limit', 'ioc', 'postOnly'
});
why do we need the distinction of owner
and payer
?
what is the address for mainnet ? let connection = new Connection('https://testnet.solana.com');
This: https://api.mainnet-beta.solana.com @chatbox77 And you can find the market as followed:
Z = {
"MSRM/USDT": {
address: "H4snTKK9adiU15gP22ErfZYtro3aqR9BTMXiH3AwiUTQ",
name: "MSRM/USDT"
},
"MSRM/USDC": {
address: "7kgkDyW7dmyMeP8KFXzbcUZz1R2WHsovDZ7n3ihZuNDS",
name: "MSRM/USDC"
},
"BTC/USDT": {
address: "8AcVjMG2LTbpkjNoyq8RwysokqZunkjy3d5JDzxC6BJa",
name: "BTC/USDT"
},
"BTC/USDC": {
address: "CAgAeMD7quTdnr6RPa7JySQpjf3irAmefYNdTb6anemq",
name: "BTC/USDC"
},
"ETH/USDT": {
address: "HfCZdJ1wfsWKfYP2qyWdXTT5PWAGWFctzFjLH48U1Hsd",
name: "ETH/USDT"
},
"ETH/USDC": {
address: "ASKiV944nKg1W9vsf7hf3fTsjawK6DwLwrnB2LH9n61c",
name: "ETH/USDC"
},
"SRM/USDT": {
address: "HARFLhSq8nECZk4DVFKvzqXMNMA9a3hjvridGMFizeLa",
name: "SRM/USDT"
},
"SRM/USDC": {
address: "68J6nkWToik6oM9rTatKSR5ibVSykAtzftBUEAvpRsys",
name: "SRM/USDC"
},
"FTT/USDT": {
address: "DHDdghmkBhEpReno3tbzBPtsxCt6P3KrMzZvxavTktJt",
name: "FTT/USDT"
},
"FTT/USDC": {
address: "FZqrBXz7ADGsmDf1TM9YgysPUfvtG8rJiNUrqDpHc9Au",
name: "FTT/USDC"
},
"YFI/USDT": {
address: "5zu5bTZZvqESAAgFsr12CUMxdQvMrvU9CgvC1GW8vJdf",
name: "YFI/USDT"
},
"YFI/USDC": {
address: "FJg9FUtbN3fg3YFbMCFiZKjGh5Bn4gtzxZmtxFzmz9kT",
name: "YFI/USDC"
},
"LINK/USDT": {
address: "F5xschQBMpu1gD2q1babYEAVJHR1buj1YazLiXyQNqSW",
name: "LINK/USDT"
},
"LINK/USDC": {
address: "7GZ59DMgJ7D6dfoJTpszPayTRyua9jwcaGJXaRMMF1my",
name: "LINK/USDC"
}
Hi, @524119574 thanks. I created an account at https://www.sollet.io/
PublicKey is my wallet address. but what is the owner?
// Placing orders let owner = new Account('...'); let payer = new PublicKey('...'); // spl-token account
I am not super sure about this part. You might find this code helpful.
My current understanding is the owner
is your wallet public key.
Hi, @524119574 thanks.
I use my account at https://www.sollet.io/
when i run this // Placing orders let owner = new Account('wallet public key'); let payer = new PublicKey('...'); // spl-token account
I got Error: bad secret key size at Function.nacl.sign.keyPair.fromSecretKey (/root/node_modules/tweetnacl/nacl-fast.js:2320:11) at new Account (/root/node_modules/@solana/web3.js/lib/index.cjs.js:341:61) at file:///root/serum/serum-js/index.js:30:13
Where could i config my own secret key?
Hey! new Account(...)
actually takes in your privatey key, not your public key. Be very careful handling it, but you can get it from the outfile that solana-keygen new ...
creates
This repository has moved to https://github.com/project-serum/serum-ts/tree/master/packages/serum. Please migrate this issue over, if desired.
In the
README.md
it said to put in the public key of the market, I am wondering when should we put in exactly?I have tried:
According to here
But this doesn't seem to work, it's reporting: