orca-so / orca-sdks

Open-sourced typescript SDKs for Orca
MIT License
43 stars 10 forks source link

Allow PDA as OwnerAddress / Add option to create WSOL account with CreateAccountWithSeed #53

Closed yugure-orca closed 11 months ago

yugure-orca commented 11 months ago

Asana

parent: https://app.asana.com/0/1202413563699470/1204997759596564/f

subtask1: https://app.asana.com/0/0/1204997759596568/f subtask2: https://app.asana.com/0/0/1204997759596569/f

Overview of the changes

add allowPDAOwnerAddress option to resolveOrCreateATA(s)

getAssociatedTokenAddressSync has allowOwnerOffCurve option and its default value is false. If allowOwnerOffCurve is set to false, owner of ATA must be NOT PDA.

Multi-sig wallet makes owner a PDA. To allow use by multisig wallets, add an option to accept PDA for owner.

Although I considered always allowing this option, I decided to make it optional like spl-token to avoid unintentional use of PDA.

see also: getAssociatedTokenAddressSync

add wrappedSolAccountCreateMethod option to resolveOrCreateATA(s)

its value is one of ["keypair", "withSeed"].

Multi-sig wallets are incompatible with transactions requiring signatures other than the wallet address; the addition of withSeed, which does not use Keypair, will facilitate the use of multi-sig wallets.