Skip to content

Commit cbd37f2

Browse files
committed
fix tests
1 parent b7c36e8 commit cbd37f2

File tree

7 files changed

+4738
-470
lines changed

7 files changed

+4738
-470
lines changed

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ test-yield:
1717

1818
test-sdk:
1919
@cd sdk && pnpm build
20-
@anchor localnet --skip-build > /dev/null 2>&1 & \
21-
anvil -f https://gateway.tenderly.co/public/sepolia > /dev/null 2>&1 & \
22-
sleep 2 && \
23-
cd tests && pnpm jest --preset ts-jest tests/unit/sdk.test.ts; \
24-
e=$$?; \
25-
kill -9 $$(lsof -ti:8899) & kill -9 $$(lsof -ti:8545); \
26-
exit $$e
20+
cd tests && pnpm jest --preset ts-jest tests/unit/sdk.test.ts; exit $$?
2721

2822
test-merkle:
2923
pnpm jest --preset ts-jest tests/unit/merkle.test.ts; exit $$?

sdk/src/accounts.ts

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ import BN from 'bn.js';
33
import { BorshAccountsCoder, Idl } from '@coral-xyz/anchor';
44
import { IdlDefinedFields } from '@coral-xyz/anchor/dist/cjs/idl';
55

6-
enum YieldVariant {
7-
NoYield = 0,
8-
ScaledUi = 1,
9-
Crank = 2,
10-
}
11-
126
export interface EarnManagerData {
137
isActive: boolean;
148
feeBps: BN;
@@ -21,7 +15,7 @@ export interface GlobalAccountData {
2115
admin: PublicKey;
2216
extMint: PublicKey;
2317
mMint: PublicKey;
24-
variant: YieldVariant;
18+
variant: 'Crank' | 'ScaledUi' | 'NoYield';
2519
wrapAuthorities: PublicKey[];
2620

2721
// crank fields
@@ -52,13 +46,13 @@ export async function loadGlobal(connection: Connection, program: PublicKey): Pr
5246

5347
return {
5448
admin: global.admin,
55-
extMint: global.extMint,
56-
mMint: global.mMint,
57-
variant: global.yieldConfig.yieldVariant,
58-
wrapAuthorities: global.wrapAuthorities,
59-
index: global.yieldConfig.index,
60-
timestamp: global.yieldConfig.ts,
61-
earnAuthority: global.yieldConfig.earnAuthority,
49+
extMint: global.ext_mint,
50+
mMint: global.m_mint,
51+
variant: Object.keys(global.yield_config.yield_variant)[0] as 'Crank' | 'ScaledUi' | 'NoYield',
52+
wrapAuthorities: global.wrap_authorities,
53+
index: global.yield_config.index,
54+
timestamp: global.yield_config.ts,
55+
earnAuthority: global.yield_config.earn_authority,
6256
};
6357
}
6458

@@ -93,27 +87,15 @@ function extensionIDL(variant: number): Idl {
9387
},
9488
{
9589
name: 'fee_bps',
96-
type: {
97-
defined: {
98-
name: 'u64',
99-
},
100-
},
90+
type: 'u64',
10191
},
10292
{
10393
name: 'last_m_index',
104-
type: {
105-
defined: {
106-
name: 'u64',
107-
},
108-
},
94+
type: 'u64',
10995
},
11096
{
11197
name: 'last_ext_index',
112-
type: {
113-
defined: {
114-
name: 'u64',
115-
},
116-
},
98+
type: 'u64',
11799
},
118100
],
119101
[
@@ -127,27 +109,15 @@ function extensionIDL(variant: number): Idl {
127109
},
128110
{
129111
name: 'earn_authority',
130-
type: {
131-
defined: {
132-
name: 'pubkey',
133-
},
134-
},
112+
type: 'pubkey',
135113
},
136114
{
137115
name: 'index',
138-
type: {
139-
defined: {
140-
name: 'u64',
141-
},
142-
},
116+
type: 'u64',
143117
},
144118
{
145119
name: 'ts',
146-
type: {
147-
defined: {
148-
name: 'u64',
149-
},
150-
},
120+
type: 'u64',
151121
},
152122
],
153123
];

0 commit comments

Comments
 (0)