Devnet fixes (#112)
This commit is contained in:
parent
31062c98f9
commit
b4555b7560
|
@ -14,7 +14,7 @@
|
|||
"@project-serum/sol-wallet-adapter": "^0.2.0",
|
||||
"@solana/spl-name-service": "^0.1.2",
|
||||
"@solana/spl-token": "^0.1.6",
|
||||
"@solana/web3.js": "0.86.1",
|
||||
"@solana/web3.js": "^1.22.0",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/user-event": "^7.1.2",
|
||||
|
|
|
@ -96,8 +96,8 @@ export default function TopBar() {
|
|||
try {
|
||||
const connection = new Connection(info.endpoint, 'recent');
|
||||
connection
|
||||
.getEpochInfo()
|
||||
.then((result) => {
|
||||
.getBlockTime(0)
|
||||
.then(() => {
|
||||
setTestingConnection(true);
|
||||
console.log(`testing connection to ${info.endpoint}`);
|
||||
const newCustomEndpoints = [
|
||||
|
|
|
@ -25,7 +25,12 @@ import CustomMarketDialog from '../components/CustomMarketDialog';
|
|||
import { notify } from '../utils/notifications';
|
||||
import { useHistory, useParams } from 'react-router-dom';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
import { TVChartContainer } from '../components/TradingView';
|
||||
// Use following stub for quick setup without the TradingView private dependency
|
||||
// function TVChartContainer() {
|
||||
// return <></>
|
||||
// }
|
||||
|
||||
const { Option, OptGroup } = Select;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as BufferLayout from 'buffer-layout';
|
||||
import bs58 from 'bs58';
|
||||
import {AccountInfo, Connection, PublicKey} from '@solana/web3.js';
|
||||
import {WRAPPED_SOL_MINT} from '@project-serum/serum/lib/token-instructions';
|
||||
import {TokenAccount} from './types';
|
||||
|
@ -76,49 +75,22 @@ export async function getOwnedTokenAccounts(
|
|||
publicKey: PublicKey,
|
||||
): Promise<Array<{ publicKey: PublicKey; accountInfo: AccountInfo<Buffer> }>> {
|
||||
let filters = getOwnedAccountsFilters(publicKey);
|
||||
// @ts-ignore
|
||||
let resp = await connection._rpcRequest('getProgramAccounts', [
|
||||
TOKEN_PROGRAM_ID.toBase58(),
|
||||
let resp = await connection.getProgramAccounts(
|
||||
TOKEN_PROGRAM_ID,
|
||||
{
|
||||
commitment: connection.commitment,
|
||||
filters,
|
||||
},
|
||||
]);
|
||||
if (resp.error) {
|
||||
throw new Error(
|
||||
'failed to get token accounts owned by ' +
|
||||
publicKey.toBase58() +
|
||||
': ' +
|
||||
resp.error.message,
|
||||
);
|
||||
}
|
||||
return resp.result
|
||||
);
|
||||
return resp
|
||||
.map(({ pubkey, account: { data, executable, owner, lamports } }) => ({
|
||||
publicKey: new PublicKey(pubkey),
|
||||
accountInfo: {
|
||||
data: bs58.decode(data),
|
||||
data,
|
||||
executable,
|
||||
owner: new PublicKey(owner),
|
||||
lamports,
|
||||
},
|
||||
}))
|
||||
.filter(({ accountInfo }) => {
|
||||
// TODO: remove this check once mainnet is updated
|
||||
return filters.every((filter) => {
|
||||
if (filter.dataSize) {
|
||||
return accountInfo.data.length === filter.dataSize;
|
||||
} else if (filter.memcmp) {
|
||||
let filterBytes = bs58.decode(filter.memcmp.bytes);
|
||||
return accountInfo.data
|
||||
.slice(
|
||||
filter.memcmp.offset,
|
||||
filter.memcmp.offset + filterBytes.length,
|
||||
)
|
||||
.equals(filterBytes);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function getTokenAccountInfo(
|
||||
|
|
53
yarn.lock
53
yarn.lock
|
@ -1629,29 +1629,6 @@
|
|||
buffer-layout "^1.2.0"
|
||||
dotenv "10.0.0"
|
||||
|
||||
"@solana/web3.js@0.86.1":
|
||||
version "0.86.1"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-0.86.1.tgz#034a2cef742569f74dfc9960dfbcabc92e674b08"
|
||||
integrity sha512-9mjWs17ym7PIm7bHA37wnnYyD7rIVHwkx1RI6BzGhMO5h8E+HlZM8ISLgOx+NItg8XRCfFhlrVgJTzK4om1s0g==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
bn.js "^5.0.0"
|
||||
bs58 "^4.0.1"
|
||||
buffer "^5.4.3"
|
||||
buffer-layout "^1.2.0"
|
||||
crypto-hash "^1.2.2"
|
||||
esdoc-inject-style-plugin "^1.0.0"
|
||||
jayson "^3.0.1"
|
||||
keccak "^3.0.1"
|
||||
mz "^2.7.0"
|
||||
node-fetch "^2.2.0"
|
||||
npm-run-all "^4.1.5"
|
||||
rpc-websockets "^7.4.2"
|
||||
secp256k1 "^4.0.2"
|
||||
superstruct "^0.8.3"
|
||||
tweetnacl "^1.0.0"
|
||||
ws "^7.0.0"
|
||||
|
||||
"@solana/web3.js@^0.90.0":
|
||||
version "0.90.5"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-0.90.5.tgz#5be7d78a19f0b5e01bf82c52e3cbf0bb72a38cfd"
|
||||
|
@ -1715,6 +1692,26 @@
|
|||
superstruct "^0.14.2"
|
||||
tweetnacl "^1.0.0"
|
||||
|
||||
"@solana/web3.js@^1.22.0":
|
||||
version "1.22.0"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.22.0.tgz#ded439eb903aff4269a16a7fdfacc6866c6f0c13"
|
||||
integrity sha512-7BQUiR1AIj2L8KJ8LYsI31iPRLytgF8T4hz7xLlvvBfalpUK7qD2om7frlNpXl8ROUpvruNf83QaectJdZJW1w==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.12.5"
|
||||
"@solana/buffer-layout" "^3.0.0"
|
||||
bn.js "^5.0.0"
|
||||
borsh "^0.4.0"
|
||||
bs58 "^4.0.1"
|
||||
buffer "6.0.1"
|
||||
crypto-hash "^1.2.2"
|
||||
jayson "^3.4.4"
|
||||
js-sha3 "^0.8.0"
|
||||
node-fetch "^2.6.1"
|
||||
rpc-websockets "^7.4.2"
|
||||
secp256k1 "^4.0.2"
|
||||
superstruct "^0.14.2"
|
||||
tweetnacl "^1.0.0"
|
||||
|
||||
"@svgr/babel-plugin-add-jsx-attribute@^4.2.0":
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz#dadcb6218503532d6884b210e7f3c502caaa44b1"
|
||||
|
@ -3350,14 +3347,6 @@ buffer@^4.3.0:
|
|||
ieee754 "^1.1.4"
|
||||
isarray "^1.0.0"
|
||||
|
||||
buffer@^5.4.3:
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
|
||||
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
|
||||
dependencies:
|
||||
base64-js "^1.3.1"
|
||||
ieee754 "^1.1.13"
|
||||
|
||||
bufferutil@^4.0.1:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.3.tgz#66724b756bed23cd7c28c4d306d7994f9943cc6b"
|
||||
|
@ -6416,7 +6405,7 @@ identity-obj-proxy@3.0.0:
|
|||
dependencies:
|
||||
harmony-reflect "^1.4.6"
|
||||
|
||||
ieee754@^1.1.13, ieee754@^1.1.4, ieee754@^1.2.1:
|
||||
ieee754@^1.1.4, ieee754@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||
|
|
Loading…
Reference in New Issue