package-lock cleanup

This commit is contained in:
Conner Gallagher 2022-12-14 13:17:30 -07:00
parent 5b3a00260c
commit a8114c70fd
2 changed files with 22 additions and 7 deletions

View File

@ -2972,6 +2972,12 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/jsbi": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz",
"integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==",
"peer": true
},
"node_modules/json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
@ -7471,6 +7477,12 @@
"esprima": "^4.0.0"
}
},
"jsbi": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz",
"integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==",
"peer": true
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",

View File

@ -1,6 +1,5 @@
import * as anchor from '@project-serum/anchor';
import * as errors from './errors';
import * as sbv2 from './accounts';
import {
AccountInfo,
Cluster,
@ -11,8 +10,8 @@ import {
TransactionSignature,
} from '@solana/web3.js';
import { NativeMint } from './mint';
import { TransactionObject } from './TransactionObject';
import { SwitchboardEvents } from './SwitchboardEvents';
import { TransactionObject } from './TransactionObject';
import { fromCode as fromSwitchboardCode } from './generated/errors/custom';
import { fromCode as fromAnchorCode } from './generated/errors/anchor';
import { ACCOUNT_DISCRIMINATOR_SIZE } from '@project-serum/anchor';
@ -30,10 +29,14 @@ import {
VrfAccountData,
} from './generated';
import {
BUFFER_DISCRIMINATOR,
CrankAccount,
DISCRIMINATOR_MAP,
JobAccount,
ProgramStateAccount,
QueueAccount,
SwitchboardAccountData,
SwitchboardAccountType,
} from './accounts';
import {
SWITCHBOARD_LABS_DEVNET_PERMISSIONED_CRANK,
@ -134,7 +137,7 @@ export class SwitchboardProgram {
this._program = program;
this.cluster = cluster;
const stateAccount = sbv2.ProgramStateAccount.fromSeed(this);
const stateAccount = ProgramStateAccount.fromSeed(this);
this.programState = {
publicKey: stateAccount[0].publicKey,
bump: stateAccount[1],
@ -444,7 +447,7 @@ export class SwitchboardProgram {
signature: string
) => void
): number {
return this._program.addEventListener(eventName, callback);
return this._program.addEventListener(eventName as string, callback);
}
public async removeEventListener(listenerId: number) {
@ -614,7 +617,7 @@ export class SwitchboardProgram {
return map;
}, new Map<string, Array<AccountInfoResponse>>());
function decodeAccounts<T extends sbv2.SwitchboardAccountData>(
function decodeAccounts<T extends SwitchboardAccountData>(
accounts: Array<AccountInfoResponse>,
decode: (data: Buffer) => T
): Map<string, T> {
@ -638,7 +641,7 @@ export class SwitchboardProgram {
// TODO: Use aggregator.historyBuffer, crank.dataBuffer, queue.dataBuffer to filter these down and decode
const buffers: Map<string, Buffer> = (
discriminatorMap.get(sbv2.BUFFER_DISCRIMINATOR.toString('utf-8')) ?? []
discriminatorMap.get(BUFFER_DISCRIMINATOR.toString('utf-8')) ?? []
).reduce((map, buffer) => {
map.set(buffer.pubkey.toBase58(), buffer.account.data);
return map;
@ -726,7 +729,7 @@ export class SwitchboardProgram {
static getAccountType(
accountInfo: AccountInfo<Buffer>
): sbv2.SwitchboardAccountType | null {
): SwitchboardAccountType | null {
const discriminator = accountInfo.data
.slice(0, ACCOUNT_DISCRIMINATOR_SIZE)
.toString('utf-8');