Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
157 changes: 67 additions & 90 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion single-pool/js/packages/classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@solana/web3.js": "^1.95.2",
"@solana/addresses": "=2.0.0-experimental.21e994f",
"@solana/addresses": "2.0.0-rc.1",
"@solana/spl-single-pool": "1.0.0"
},
"ava": {
Expand Down
22 changes: 8 additions & 14 deletions single-pool/js/packages/classic/src/addresses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Base58EncodedAddress } from '@solana/addresses';
import type { Address } from '@solana/addresses';
import { PublicKey } from '@solana/web3.js';
import type { PoolAddress, VoteAccountAddress } from '@solana/spl-single-pool';
import {
Expand All @@ -14,34 +14,28 @@ import {
export async function findPoolAddress(programId: PublicKey, voteAccountAddress: PublicKey) {
return new PublicKey(
await findPoolModern(
programId.toBase58() as Base58EncodedAddress,
programId.toBase58() as Address,
voteAccountAddress.toBase58() as VoteAccountAddress,
),
);
}

export async function findPoolStakeAddress(programId: PublicKey, poolAddress: PublicKey) {
return new PublicKey(
await findStakeModern(
programId.toBase58() as Base58EncodedAddress,
poolAddress.toBase58() as PoolAddress,
),
await findStakeModern(programId.toBase58() as Address, poolAddress.toBase58() as PoolAddress),
);
}

export async function findPoolMintAddress(programId: PublicKey, poolAddress: PublicKey) {
return new PublicKey(
await findMintModern(
programId.toBase58() as Base58EncodedAddress,
poolAddress.toBase58() as PoolAddress,
),
await findMintModern(programId.toBase58() as Address, poolAddress.toBase58() as PoolAddress),
);
}

export async function findPoolStakeAuthorityAddress(programId: PublicKey, poolAddress: PublicKey) {
return new PublicKey(
await findStakeAuthorityModern(
programId.toBase58() as Base58EncodedAddress,
programId.toBase58() as Address,
poolAddress.toBase58() as PoolAddress,
),
);
Expand All @@ -50,7 +44,7 @@ export async function findPoolStakeAuthorityAddress(programId: PublicKey, poolAd
export async function findPoolMintAuthorityAddress(programId: PublicKey, poolAddress: PublicKey) {
return new PublicKey(
await findMintAuthorityModern(
programId.toBase58() as Base58EncodedAddress,
programId.toBase58() as Address,
poolAddress.toBase58() as PoolAddress,
),
);
Expand All @@ -59,7 +53,7 @@ export async function findPoolMintAuthorityAddress(programId: PublicKey, poolAdd
export async function findPoolMplAuthorityAddress(programId: PublicKey, poolAddress: PublicKey) {
return new PublicKey(
await findMplAuthorityModern(
programId.toBase58() as Base58EncodedAddress,
programId.toBase58() as Address,
poolAddress.toBase58() as PoolAddress,
),
);
Expand All @@ -72,7 +66,7 @@ export async function findDefaultDepositAccountAddress(
return new PublicKey(
await findDefaultDepositModern(
poolAddress.toBase58() as PoolAddress,
userWallet.toBase58() as Base58EncodedAddress,
userWallet.toBase58() as Address,
),
);
}
18 changes: 9 additions & 9 deletions single-pool/js/packages/classic/src/instructions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Base58EncodedAddress } from '@solana/addresses';
import type { Address } from '@solana/addresses';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import type { PoolAddress, VoteAccountAddress } from '@solana/spl-single-pool';
import { SinglePoolInstruction as PoolInstructionModern } from '@solana/spl-single-pool';
Expand Down Expand Up @@ -28,9 +28,9 @@ export class SinglePoolInstruction {
): Promise<TransactionInstruction> {
const instruction = await PoolInstructionModern.depositStake(
pool.toBase58() as PoolAddress,
userStakeAccount.toBase58() as Base58EncodedAddress,
userTokenAccount.toBase58() as Base58EncodedAddress,
userLamportAccount.toBase58() as Base58EncodedAddress,
userStakeAccount.toBase58() as Address,
userTokenAccount.toBase58() as Address,
userLamportAccount.toBase58() as Address,
);
return modernInstructionToLegacy(instruction);
}
Expand All @@ -44,9 +44,9 @@ export class SinglePoolInstruction {
): Promise<TransactionInstruction> {
const instruction = await PoolInstructionModern.withdrawStake(
pool.toBase58() as PoolAddress,
userStakeAccount.toBase58() as Base58EncodedAddress,
userStakeAuthority.toBase58() as Base58EncodedAddress,
userTokenAccount.toBase58() as Base58EncodedAddress,
userStakeAccount.toBase58() as Address,
userStakeAuthority.toBase58() as Address,
userTokenAccount.toBase58() as Address,
BigInt(tokenAmount),
);
return modernInstructionToLegacy(instruction);
Expand All @@ -58,7 +58,7 @@ export class SinglePoolInstruction {
): Promise<TransactionInstruction> {
const instruction = await PoolInstructionModern.createTokenMetadata(
pool.toBase58() as PoolAddress,
payer.toBase58() as Base58EncodedAddress,
payer.toBase58() as Address,
);
return modernInstructionToLegacy(instruction);
}
Expand All @@ -72,7 +72,7 @@ export class SinglePoolInstruction {
): Promise<TransactionInstruction> {
const instruction = await PoolInstructionModern.updateTokenMetadata(
voteAccount.toBase58() as VoteAccountAddress,
authorizedWithdrawer.toBase58() as Base58EncodedAddress,
authorizedWithdrawer.toBase58() as Address,
tokenName,
tokenSymbol,
tokenUri,
Expand Down
10 changes: 5 additions & 5 deletions single-pool/js/packages/classic/src/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Base58EncodedAddress } from '@solana/addresses';
import type { Address } from '@solana/addresses';
import { PublicKey, Connection } from '@solana/web3.js';
import type { PoolAddress, VoteAccountAddress } from '@solana/spl-single-pool';
import { SinglePoolProgram as PoolProgramModern } from '@solana/spl-single-pool';
Expand Down Expand Up @@ -41,7 +41,7 @@ export class SinglePoolProgram {
const modernTransaction = await PoolProgramModern.initialize(
rpc(connection),
voteAccount.toBase58() as VoteAccountAddress,
payer.toBase58() as Base58EncodedAddress,
payer.toBase58() as Address,
skipMetadata,
);

Expand Down Expand Up @@ -73,7 +73,7 @@ export class SinglePoolProgram {
static async createTokenMetadata(pool: PublicKey, payer: PublicKey) {
const modernTransaction = await PoolProgramModern.createTokenMetadata(
pool.toBase58() as PoolAddress,
payer.toBase58() as Base58EncodedAddress,
payer.toBase58() as Address,
);

return modernTransactionToLegacy(modernTransaction);
Expand All @@ -88,7 +88,7 @@ export class SinglePoolProgram {
) {
const modernTransaction = await PoolProgramModern.updateTokenMetadata(
voteAccount.toBase58() as VoteAccountAddress,
authorizedWithdrawer.toBase58() as Base58EncodedAddress,
authorizedWithdrawer.toBase58() as Address,
name,
symbol,
uri,
Expand All @@ -106,7 +106,7 @@ export class SinglePoolProgram {
const modernTransaction = await PoolProgramModern.createAndDelegateUserStake(
rpc(connection),
voteAccount.toBase58() as VoteAccountAddress,
userWallet.toBase58() as Base58EncodedAddress,
userWallet.toBase58() as Address,
BigInt(stakeAmount),
);

Expand Down
Loading