Skip to content

Commit 6b58f54

Browse files
committed
Prettier
1 parent 3b2fddf commit 6b58f54

File tree

16 files changed

+684
-747
lines changed

16 files changed

+684
-747
lines changed

package-lock.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@coral-xyz/anchor": "^0.26.0",
3333
"@solana/web3.js": "^1.30.2",
3434
"@types/bn.js": "^5.1.1",
35+
"@types/bs58": "^4.0.1",
3536
"@types/jest": "^27.0.7",
3637
"@types/node-fetch": "^2.6.2",
3738
"jest": "^27.3.1",

src/PythConnection.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import { Connection, PublicKey, Commitment, AccountInfo } from '@solana/web3.js'
2-
import {
3-
parseBaseData,
4-
parsePriceData,
5-
parseProductData,
6-
PriceData,
7-
Product,
8-
ProductData,
9-
AccountType,
10-
} from './index'
2+
import { parseBaseData, parsePriceData, parseProductData, PriceData, Product, ProductData, AccountType } from './index'
113

124
const ONES = '11111111111111111111111111111111'
135

src/__tests__/Anchor.test.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
import { AnchorProvider, Wallet } from "@coral-xyz/anchor"
2-
import { Connection, Keypair, PublicKey } from "@solana/web3.js"
3-
import { getPythProgramKeyForCluster, pythOracleProgram } from "../index"
1+
import { AnchorProvider, Wallet } from '@coral-xyz/anchor'
2+
import { Connection, Keypair, PublicKey } from '@solana/web3.js'
3+
import { getPythProgramKeyForCluster, pythOracleProgram } from '../index'
44

55
test('Anchor', (done) => {
6-
jest.setTimeout(60000);
7-
const provider = new AnchorProvider(new Connection("https://api.mainnet-beta.solana.com"), new Wallet(new Keypair()), AnchorProvider.defaultOptions());
8-
const pythOracle = pythOracleProgram(getPythProgramKeyForCluster("mainnet-beta"), provider);
9-
pythOracle.methods.initMapping().accounts({fundingAccount : new PublicKey(0)}).instruction().then((x) => console.log(x));
10-
pythOracle.methods.addMapping().accounts({fundingAccount : new PublicKey(0)}).instruction().then((x) => console.log(x));
11-
done()
12-
13-
})
6+
jest.setTimeout(60000)
7+
const provider = new AnchorProvider(
8+
new Connection('https://api.mainnet-beta.solana.com'),
9+
new Wallet(new Keypair()),
10+
AnchorProvider.defaultOptions(),
11+
)
12+
const pythOracle = pythOracleProgram(getPythProgramKeyForCluster('mainnet-beta'), provider)
13+
pythOracle.methods
14+
.initMapping()
15+
.accounts({ fundingAccount: new PublicKey(0) })
16+
.instruction()
17+
.then((x) => console.log(x))
18+
pythOracle.methods
19+
.addMapping()
20+
.accounts({ fundingAccount: new PublicKey(0) })
21+
.instruction()
22+
.then((x) => console.log(x))
23+
done()
24+
})

src/anchor/coder/accounts.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
1-
import { AccountsCoder, ACCOUNT_DISCRIMINATOR_SIZE, Idl } from "@coral-xyz/anchor";
2-
import { IdlTypeDef } from "@coral-xyz/anchor/dist/cjs/idl";
1+
import { AccountsCoder, ACCOUNT_DISCRIMINATOR_SIZE, Idl } from '@coral-xyz/anchor'
2+
import { IdlTypeDef } from '@coral-xyz/anchor/dist/cjs/idl'
33

4-
export class PythOracleAccountCoder<A extends string = string>
5-
implements AccountsCoder
6-
{
4+
export class PythOracleAccountCoder<A extends string = string> implements AccountsCoder {
75
constructor(private idl: Idl) {}
86

97
public async encode<T = any>(accountName: A, account: T): Promise<Buffer> {
10-
throw new Error("Not implemented");
8+
throw new Error('Not implemented')
119
}
1210

1311
public decode<T = any>(accountName: A, ix: Buffer): T {
14-
throw new Error("Not implemented");
12+
throw new Error('Not implemented')
1513
}
1614

1715
public decodeUnchecked<T = any>(accountName: A, ix: Buffer): T {
18-
throw new Error("Not implemented");
16+
throw new Error('Not implemented')
1917
}
2018

21-
public memcmp(
22-
accountName: A,
23-
_appendData?: Buffer
24-
): { dataSize?: number; offset?: number; bytes?: string } {
25-
throw new Error("Not implemented");
19+
public memcmp(accountName: A, _appendData?: Buffer): { dataSize?: number; offset?: number; bytes?: string } {
20+
throw new Error('Not implemented')
2621
}
2722

2823
public size(idlAccount: IdlTypeDef): number {
29-
return 0;
30-
}
31-
24+
return 0
25+
}
3226
}

src/anchor/coder/events.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import { Idl, Event, EventCoder } from "@coral-xyz/anchor";
2-
import { IdlEvent } from "@coral-xyz/anchor/dist/cjs/idl";
1+
import { Idl, Event, EventCoder } from '@coral-xyz/anchor'
2+
import { IdlEvent } from '@coral-xyz/anchor/dist/cjs/idl'
33

44
export class PythOracleEventCoder implements EventCoder {
55
constructor(_idl: Idl) {}
66

7-
decode<E extends IdlEvent = IdlEvent, T = Record<string, string>>(
8-
_log: string
9-
): Event<E, T> | null {
10-
throw new Error("Pyth oracle program does not have events");
7+
decode<E extends IdlEvent = IdlEvent, T = Record<string, string>>(_log: string): Event<E, T> | null {
8+
throw new Error('Pyth oracle program does not have events')
119
}
12-
}
10+
}

0 commit comments

Comments
 (0)