Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring for more modularity #58

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6e8d4c0
typo fixes
ochaloup Aug 23, 2023
5b8771d
Exporting default addresses as constants from SDK
ochaloup Aug 23, 2023
fc854a7
[IN PROGRESS] refactoring to be better tree shakable
ochaloup Aug 26, 2023
59510cd
fixing PR points + making tests running
ochaloup Oct 16, 2023
4249185
chore: don't import bn from two different places
AlexStefan Nov 2, 2023
6cfa996
[test] increasing timeout for unit tests
ochaloup Nov 3, 2023
0a7bdc4
chore: update spl-stake-pool dep
AlexStefan Nov 3, 2023
b929056
chore: remove unused props
AlexStefan Nov 3, 2023
5858f89
chore: unify @coral-xyz/anchor imports
AlexStefan Nov 3, 2023
506be0d
chore: more code simplification
AlexStefan Nov 3, 2023
215ac32
chore: missing change
AlexStefan Nov 4, 2023
c6dae3b
chore: remove some redundant code
AlexStefan Dec 17, 2023
cabb211
chore: add warning to the liquid unstake method
AlexStefan Dec 17, 2023
a0c5d46
feat: refactor program initialisation
AlexStefan Dec 17, 2023
5959e6b
chore: rollback test-world provider change
AlexStefan Dec 17, 2023
0ebbc63
fix: program inits
AlexStefan Dec 17, 2023
29af921
Merge branch 'main' into refactoring-more-modularity
ochaloup Dec 19, 2023
c394167
merge fixes
ochaloup Dec 19, 2023
bf799ef
fix on Dockerfile to not print bigint-buffer errors
ochaloup Dec 19, 2023
ddbf1f3
directed stake sdk to use require pubkey
ochaloup Dec 19, 2023
f9361d8
jsdoc for marinde.ts
ochaloup Dec 19, 2023
3ac3543
Merge remote-tracking branch 'origin/main' into refactoring-more-modu…
AlexStefan Feb 11, 2024
b2ed80e
fix: changes after merge
AlexStefan Feb 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prepare": "husky install",
"pretest": "pnpm lint",
"test": "pnpm test:unit",
"test:unit": "jest --roots '<rootDir>/src'",
"test:unit": "jest --testTimeout 20000 --roots '<rootDir>/src'",
"test:integration": "anchor test",
"_test:integration": "jest --testTimeout 90000 --runInBand --globalSetup '<rootDir>/test/setup/globalSetup.ts' --roots '<rootDir>/test' -- $FILE",
"lint": "gts lint",
Expand All @@ -38,8 +38,8 @@
"@coral-xyz/anchor": "^0.28.0",
"@marinade.finance/directed-stake-sdk": "^0.0.4",
"@marinade.finance/native-staking-sdk": "^1.0.0",
"@solana/spl-stake-pool": "^0.6.5",
"@solana/spl-token-3.x": "npm:@solana/spl-token@^0.3.8",
"@solana/spl-stake-pool": "^0.7.0",
"@solana/spl-token": "^0.3.8",
"borsh": "^0.7.0",
"bs58": "^5.0.0"
},
Expand Down
148 changes: 112 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 22 additions & 36 deletions src/config/marinade-config.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
import { web3 } from '@coral-xyz/anchor'

const DEFAULT_PROVIDER_URL = 'https://api.devnet.solana.com'

export class MarinadeConfig {
marinadeFinanceProgramId = new web3.PublicKey(
'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD'
)
marinadeReferralProgramId = new web3.PublicKey(
'MR2LqxoSbw831bNy68utpu5n4YqBH3AzDmddkgk9LQv'
)

marinadeStateAddress = new web3.PublicKey(
'8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC'
)
marinadeReferralGlobalStateAddress = new web3.PublicKey(
'MRSh4rUNrpn7mjAq9ENHV4rvwwPKMij113ScZq3twp2'
)

stakeWithdrawAuthPDA = new web3.PublicKey(
'9eG63CdHjsfhHmobHgLtESGC8GabbmRcaSpHAZrtmhco'
)

lookupTableAddress = new web3.PublicKey(
'DCcQeBaCiYsEsjjmEsSYPCr9o4n174LKqXNDvQT5wVd8'
)

connection = new web3.Connection(DEFAULT_PROVIDER_URL)
publicKey: web3.PublicKey | null = null

referralCode: web3.PublicKey | null = null

constructor(configOverrides: Partial<MarinadeConfig> = {}) {
Object.assign(this, configOverrides)
}
}
import { PublicKey } from '@solana/web3.js'

export const DEFAULT_PROVIDER_URL = 'https://api.devnet.solana.com'

export const DEFAULT_MARINADE_PROGRAM_ID = new PublicKey(
'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD'
)
export const DEFAULT_MARINADE_REFERRAL_PROGRAM_ID = new PublicKey(
'MR2LqxoSbw831bNy68utpu5n4YqBH3AzDmddkgk9LQv'
)
export const DEFAULT_MARINADE_STATE_ADDRESS = new PublicKey(
'8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC'
)
export const DEFAULT_MARINADE_REFERRAL_GLOBAL_STATE_ADDRESS = new PublicKey(
'MRSh4rUNrpn7mjAq9ENHV4rvwwPKMij113ScZq3twp2'
)
// export const DEFAULT_STAKE_WITHDRAW_AUTH_PDA = new PublicKey(
// '9eG63CdHjsfhHmobHgLtESGC8GabbmRcaSpHAZrtmhco'
// )
export const LOOKUP_TABLE_ADDRESS = new PublicKey(
'DCcQeBaCiYsEsjjmEsSYPCr9o4n174LKqXNDvQT5wVd8'
)
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export { Marinade } from './marinade'
export * from './marinade'
export * from './marinade-native-stake'
export { MarinadeConfig } from './config/marinade-config'
export * from './marinade-directed-stake'
export * from './config/marinade-config'
export * from './marinade-referral-state/marinade-referral-global-state'
export * from './marinade-referral-state/marinade-referral-partner-state'
export * from './marinade-state/marinade-state'
export * as MarinadeBorsh from './marinade-state/borsh/index'
export { MarinadeReferralPartnerState } from './marinade-referral-state/marinade-referral-partner-state'
export { MarinadeState } from './marinade-state/marinade-state'
export { MarinadeMint } from './marinade-mint/marinade-mint'
export * as MarinadeUtils from './util/index'
export { Wallet, BN, web3, Provider } from '@coral-xyz/anchor'
export * as StakePoolHelpers from './util/stake-pool-helpers'
Loading
Loading