Minor Changes
-
#261
13a5399Thanks @amilz! - Program address overrides now accept address-bearing objects — i.e. theprogramAddressconfig of instruction builders (sync and async),find*Pdafunctions andfetch*FromSeeds/fetchMaybe*FromSeedshelpers — so that third-party wrappers such as web3.js'sPublicKeycan be passed directly instead of being converted to anAddressfirst. PDA and fetch helpers widen their override toAddress | HasAddress, whilst instruction builders widen it toTProgramAddress | { readonly address: TProgramAddress }. The override is unwrapped to a plainAddressonce at the top of the generated function, so account metas, PDA derivations, resolvers and the returned instruction keep receiving anAddress. Instruction types still carry the literal program address — the program constant by default, or the overriding address whether it is passed directly or wrapped — so their inferred types are unchanged for existing callers. -
#258
c037647Thanks @amilz! - Generated account fetchers now acceptAddress | HasAddress— i.e.fetchXandfetchMaybeXacceptAddress<TAddress> | HasAddress<TAddress>whilstfetchAllXandfetchAllMaybeXacceptArray<Address | HasAddress>— so that third-party wrappers such as web3.js'sPublicKeyor aTransactionSignercan be passed directly instead of being converted to anAddressfirst. The fetchers unwrap such objects to their address before callingfetchEncodedAccountandfetchEncodedAccountsfrom@solana/kit, and theTAddresstype parameter is still inferred from the provided object. The returned accounts keep exposing a plainAddress. -
#262
06d1c59Thanks @amilz! - Generated program plugins andis<Program>Errorhelpers can now target a custom program address — e.g. a program deployed at a different address on another cluster or in tests. The plugin factory accepts an optional{ programAddress }config, which is forwarded to every instruction builder and to thefind*Pdafunctions of PDAs derived from the program, whilst each plugin instruction accepts a per-call config that takes precedence over the plugin one.is<Program>Erroraccepts an optional trailing{ programAddress }config that defaults to the program address constant. Both acceptAddress | HasAddress. Calling the plugin without a config behaves exactly as before.