Using Swig with Web3.js 2.0 (Solana Kit)
@swig-wallet/kit
package provides the same functionality as @swig-wallet/classic
but is designed specifically for Web3.js 2.0 (Solana Kit) applications.
Address
instead of PublicKey
KitInstruction
instead of TransactionInstruction
Rpc<GetAccountInfoApi>
instead of Connection
fetchSwig(rpc, address, config?)
- Fetch a Swig accountfetchMaybeSwigAccount(rpc, address, config?)
- Fetch account or nullfetchNullableSwig(rpc, address, config?)
- Fetch Swig or nullfindSwigPda(id)
- Derive Swig PDA (async)findSwigSubAccountPda(swigId, roleId)
- Derive SubAccount PDA (async)getCreateSwigInstruction(args)
- Create Swig instructiongetAddAuthorityInstructions(swig, roleId, authorityInfo, actions, options?)
- Add authoritygetRemoveAuthorityInstructions(swig, roleId, roleToRemoveId, options?)
- Remove authoritygetSignInstructions(swig, roleId, instructions, withSubAccount?, options?)
- Sign instructionsgetCreateSessionInstructions(swig, roleId, sessionKey, duration?, options?)
- Create sessiongetCreateSubAccountInstructions(swig, roleId, options?)
- Create sub-accountgetToggleSubAccountInstructions(swig, roleId, enabled, options?)
- Toggle sub-accountgetWithdrawFromSubAccountSubAccountInstructions(swig, roleId, withdrawArgs, options?)
- Withdraw from sub-account@swig-wallet/classic
and @swig-wallet/kit
, with only type differences:
Connection
with Rpc<GetAccountInfoApi>
PublicKey
with Address
TransactionInstruction
with KitInstruction
await findSwigPda(id)
)@swig-wallet/kit
when:@swig-wallet/classic
when: