added more symbols to mainnet-beta ids.json
This commit is contained in:
parent
cf9e250971
commit
0075bcfb5f
|
@ -19,7 +19,14 @@ import {
|
|||
WideBits,
|
||||
} from './layout';
|
||||
import BN from 'bn.js';
|
||||
import { createAccountInstruction, nativeToUi, uiToNative, zeroKey } from './utils';
|
||||
import {
|
||||
createAccountInstruction,
|
||||
getFilteredProgramAccounts, getUnixTs,
|
||||
nativeToUi,
|
||||
promiseUndef,
|
||||
uiToNative,
|
||||
zeroKey,
|
||||
} from './utils';
|
||||
import { Market, OpenOrders, Orderbook } from '@project-serum/serum';
|
||||
import { SRM_DECIMALS, TOKEN_PROGRAM_ID } from '@project-serum/serum/lib/token-instructions';
|
||||
import { Order } from '@project-serum/serum/lib/market';
|
||||
|
@ -1001,41 +1008,4 @@ async function getMultipleAccounts(
|
|||
);
|
||||
}
|
||||
|
||||
async function getFilteredProgramAccounts(
|
||||
connection: Connection,
|
||||
programId: PublicKey,
|
||||
filters,
|
||||
): Promise<{ publicKey: PublicKey; accountInfo: AccountInfo<Buffer> }[]> {
|
||||
// @ts-ignore
|
||||
const resp = await connection._rpcRequest('getProgramAccounts', [
|
||||
programId.toBase58(),
|
||||
{
|
||||
commitment: connection.commitment,
|
||||
filters,
|
||||
encoding: 'base64',
|
||||
},
|
||||
]);
|
||||
if (resp.error) {
|
||||
throw new Error(resp.error.message);
|
||||
}
|
||||
return resp.result.map(
|
||||
({ pubkey, account: { data, executable, owner, lamports } }) => ({
|
||||
publicKey: new PublicKey(pubkey),
|
||||
accountInfo: {
|
||||
data: Buffer.from(data[0], 'base64'),
|
||||
executable,
|
||||
owner: new PublicKey(owner),
|
||||
lamports,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
async function promiseUndef(): Promise<undefined> {
|
||||
return undefined
|
||||
}
|
||||
|
||||
export const getUnixTs = () => {
|
||||
return new Date().getTime() / 1000;
|
||||
};
|
||||
|
|
|
@ -83,7 +83,11 @@
|
|||
},
|
||||
"symbols": {
|
||||
"MSRM": "MSRMcoVyrFxnSgo5uXwone5SKcGhT1KEJMFEkMEWf9L",
|
||||
"SRM": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"
|
||||
"SRM": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt",
|
||||
"USDT": "BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4",
|
||||
"USDC": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
||||
"BTC": "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",
|
||||
"ETH": "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk"
|
||||
}
|
||||
},
|
||||
"testnet": {
|
||||
|
|
41
src/utils.ts
41
src/utils.ts
|
@ -1,4 +1,4 @@
|
|||
import { Account, Connection, PublicKey, SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
||||
import { Account, AccountInfo, Connection, PublicKey, SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
||||
import { publicKeyLayout, u64 } from './layout';
|
||||
import BN from 'bn.js';
|
||||
import { WRAPPED_SOL_MINT } from '@project-serum/serum/lib/token-instructions';
|
||||
|
@ -132,4 +132,43 @@ export function nativeToUi(amount: number, decimals: number): number {
|
|||
|
||||
return amount / Math.pow(10, decimals)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export async function getFilteredProgramAccounts(
|
||||
connection: Connection,
|
||||
programId: PublicKey,
|
||||
filters,
|
||||
): Promise<{ publicKey: PublicKey; accountInfo: AccountInfo<Buffer> }[]> {
|
||||
// @ts-ignore
|
||||
const resp = await connection._rpcRequest('getProgramAccounts', [
|
||||
programId.toBase58(),
|
||||
{
|
||||
commitment: connection.commitment,
|
||||
filters,
|
||||
encoding: 'base64',
|
||||
},
|
||||
]);
|
||||
if (resp.error) {
|
||||
throw new Error(resp.error.message);
|
||||
}
|
||||
return resp.result.map(
|
||||
({ pubkey, account: { data, executable, owner, lamports } }) => ({
|
||||
publicKey: new PublicKey(pubkey),
|
||||
accountInfo: {
|
||||
data: Buffer.from(data[0], 'base64'),
|
||||
executable,
|
||||
owner: new PublicKey(owner),
|
||||
lamports,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export async function promiseUndef(): Promise<undefined> {
|
||||
return undefined
|
||||
}
|
||||
|
||||
export const getUnixTs = () => {
|
||||
return new Date().getTime() / 1000;
|
||||
}
|
Loading…
Reference in New Issue