Skip to content

Commit

Permalink
Remove tx optimizations from SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
mliu committed Jan 23, 2025
1 parent 36e9848 commit 707f77e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 101 deletions.
79 changes: 0 additions & 79 deletions packages/huma-sdk/src/helpers/solana/HumaSolanaProgramHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
TokenAccountNotFoundError,
} from '@solana/spl-token'
import { PublicKey, Transaction } from '@solana/web3.js'
import { buildOptimalTransaction } from '../../utils/solana/buildOptimalTransaction'
import { getReceivableReferenceData } from '../../utils/solana/getReceivableReferenceAccount'
import { HumaSolanaContext } from './HumaSolanaContext'

Expand Down Expand Up @@ -116,21 +115,6 @@ export class HumaSolanaProgramHelper {
.transaction()
tx.add(programTx)

await buildOptimalTransaction(
tx,
[
publicKey,
receivableReferenceData.asset,
new PublicKey(poolInfo.humaConfig),
new PublicKey(poolInfo.poolConfig),
new PublicKey(poolInfo.poolState),
creditConfigAccount,
creditStateAccount,
new PublicKey(MPL_CORE_PROGRAM_ID),
],
this.#solanaContext,
)

return tx
}

Expand Down Expand Up @@ -284,23 +268,8 @@ export class HumaSolanaProgramHelper {
trancheTokenProgram: TOKEN_2022_PROGRAM_ID,
})
.transaction()
const txAccounts: PublicKey[] = [
publicKey,
new PublicKey(poolInfo.humaConfig),
new PublicKey(poolInfo.poolConfig),
yieldDistributingLenderAccount,
new PublicKey(poolInfo.underlyingMint.address),
new PublicKey(poolInfo.poolUnderlyingTokenAccount),
underlyingTokenATA,
new PublicKey(trancheMint),
lenderTrancheToken,
TOKEN_PROGRAM_ID,
TOKEN_2022_PROGRAM_ID,
]
tx.add(programTx)

await buildOptimalTransaction(tx, txAccounts, this.#solanaContext)

return tx
}

Expand Down Expand Up @@ -387,24 +356,6 @@ export class HumaSolanaProgramHelper {
.transaction()
tx.add(programTx)

await buildOptimalTransaction(
tx,
[
publicKey,
new PublicKey(poolInfo.humaConfig),
new PublicKey(poolInfo.poolConfig),
new PublicKey(poolInfo.poolState),
creditConfigAccount,
creditStateAccount,
new PublicKey(poolInfo.poolAuthority),
new PublicKey(poolInfo.underlyingMint.address),
new PublicKey(poolInfo.poolUnderlyingTokenAccount),
borrowerUnderlyingTokenAccountAddress,
TOKEN_PROGRAM_ID,
],
this.#solanaContext,
)

return tx
}

Expand Down Expand Up @@ -453,24 +404,6 @@ export class HumaSolanaProgramHelper {
.transaction()
}

await buildOptimalTransaction(
tx,
[
publicKey,
new PublicKey(poolInfo.humaConfig),
new PublicKey(poolInfo.poolConfig),
new PublicKey(poolInfo.poolState),
creditConfigAccount,
creditStateAccount,
new PublicKey(poolInfo.poolAuthority),
new PublicKey(poolInfo.underlyingMint.address),
new PublicKey(poolInfo.poolUnderlyingTokenAccount),
borrowerUnderlyingTokenAccount,
TOKEN_PROGRAM_ID,
],
this.#solanaContext,
)

return tx
}

Expand Down Expand Up @@ -503,18 +436,6 @@ export class HumaSolanaProgramHelper {
),
)

await buildOptimalTransaction(
tx,
[
publicKey,
borrowerUnderlyingTokenAccount,
new PublicKey(poolInfo.underlyingMint.address),
new PublicKey(getSentinelAddress(chainId)),
TOKEN_PROGRAM_ID,
],
this.#solanaContext,
)

return tx
}

Expand Down
22 changes: 0 additions & 22 deletions packages/huma-sdk/src/helpers/solana/HumaSolanaReceivableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from '../../utils/solana/getReceivableReferenceAccount'
import { HumaSolanaContext } from './HumaSolanaContext'
import { MPL_CORE_PROGRAM_ID } from './HumaSolanaProgramHelper'
import { buildOptimalTransaction } from '../../utils/solana/buildOptimalTransaction'

export type ReceivableState =
| 'deleted'
Expand Down Expand Up @@ -90,17 +89,6 @@ export class HumaSolanaReceivableHelper {
tx.add(programTx)
tx.feePayer = publicKey

await buildOptimalTransaction(
tx,
[
publicKey,
newAsset.publicKey,
new PublicKey(MPL_CORE_PROGRAM_ID),
receivableReferencePDA,
],
this.#solanaContext,
)

return tx
}

Expand Down Expand Up @@ -135,16 +123,6 @@ export class HumaSolanaReceivableHelper {
.transaction()
tx.add(programTx)

await buildOptimalTransaction(
tx,
[
publicKey,
receivableReferenceData.asset,
new PublicKey(MPL_CORE_PROGRAM_ID),
],
this.#solanaContext,
)

return tx
}

Expand Down

0 comments on commit 707f77e

Please sign in to comment.