Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Permit Native ATA to be offcurve #88

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion packages/common-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orca-so/common-sdk",
"version": "0.6.0",
"version": "0.6.1",
"description": "Common Typescript components across Orca",
"repository": "https://github.com/orca-so/orca-sdks",
"author": "Orca Foundation",
Expand Down
3 changes: 2 additions & 1 deletion packages/common-sdk/src/web3/ata-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ export async function resolveOrCreateATAs(
accountRentExempt,
payer,
undefined, // use default
wrappedSolAccountCreateMethod
wrappedSolAccountCreateMethod,
allowPDAOwnerAddress
);
}

Expand Down
7 changes: 5 additions & 2 deletions packages/common-sdk/src/web3/token-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class TokenUtil {
payer?: PublicKey,
unwrapDestination?: PublicKey,
createAccountMethod: WrappedSolAccountCreateMethod = "keypair",
allowPDAOwnerAddress: boolean = false,
): ResolvedTokenAddressInstruction {
const payerKey = payer ?? owner;
const unwrapDestinationKey = unwrapDestination ?? owner;
Expand All @@ -65,7 +66,8 @@ export class TokenUtil {
amountIn,
rentExemptLamports,
payerKey,
unwrapDestinationKey
unwrapDestinationKey,
allowPDAOwnerAddress
);
case "keypair":
return createWrappedNativeAccountInstructionWithKeypair(
Expand Down Expand Up @@ -175,8 +177,9 @@ function createWrappedNativeAccountInstructionWithATA(
_rentExemptLamports: number,
payerKey: PublicKey,
unwrapDestinationKey: PublicKey,
allowPDAOwnerAddress: boolean = false,
): ResolvedTokenAddressInstruction {
const tempAccount = getAssociatedTokenAddressSync(NATIVE_MINT, owner);
const tempAccount = getAssociatedTokenAddressSync(NATIVE_MINT, owner, allowPDAOwnerAddress);

const instructions: TransactionInstruction[] = [
createAssociatedTokenAccountIdempotentInstruction(
Expand Down