File tree Expand file tree Collapse file tree 4 files changed +50
-6
lines changed
Expand file tree Collapse file tree 4 files changed +50
-6
lines changed Original file line number Diff line number Diff line change 11export * from "./solanaProgramUtils" ;
2+ export * from "./transactionUtils" ;
Original file line number Diff line number Diff line change @@ -37,11 +37,6 @@ type GetSignaturesForAddressConfig = Parameters<GetSignaturesForAddressApi["getS
3737
3838type GetSignaturesForAddressTransaction = ReturnType < GetSignaturesForAddressApi [ "getSignaturesForAddress" ] > [ number ] ;
3939
40- export type RpcClient = {
41- rpc : Rpc < SolanaRpcApiFromTransport < RpcTransport > > ;
42- rpcSubscriptions : RpcSubscriptions < SignatureNotificationsApi & SlotNotificationsApi > ;
43- } ;
44-
4540/**
4641 * Reads all events for a specific program.
4742 */
@@ -227,7 +222,7 @@ async function sleep(ms: number) {
227222 return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
228223}
229224
230- export async function sendTransactionWithAlt (
225+ export async function sendTransactionWithLookupTable (
231226 client : RpcClient ,
232227 payer : KeyPairSigner ,
233228 instructions : IInstruction [ ] ,
Original file line number Diff line number Diff line change 1+ import {
2+ AddressesByLookupTableAddress ,
3+ appendTransactionMessageInstructions ,
4+ compressTransactionMessageUsingAddressLookupTables as compressTxWithAlt ,
5+ getSignatureFromTransaction ,
6+ IInstruction ,
7+ KeyPairSigner ,
8+ pipe ,
9+ sendAndConfirmTransactionFactory ,
10+ signTransactionMessageWithSigners ,
11+ } from "@solana/kit" ;
12+
13+ import { createDefaultTransaction } from "../../../test/svm/utils" ;
14+
15+ export async function sendTransactionWithLookupTable (
16+ client : RpcClient ,
17+ payer : KeyPairSigner ,
18+ instructions : IInstruction [ ] ,
19+ addressesByLookupTableAddress : AddressesByLookupTableAddress
20+ ) {
21+ return pipe (
22+ await createDefaultTransaction ( client , payer ) ,
23+ ( tx ) => appendTransactionMessageInstructions ( instructions , tx ) ,
24+ ( tx ) => compressTxWithAlt ( tx , addressesByLookupTableAddress ) ,
25+ ( tx ) => signTransactionMessageWithSigners ( tx ) ,
26+ async ( tx ) => {
27+ const signedTx = await tx ;
28+ await sendAndConfirmTransactionFactory ( client ) ( signedTx , {
29+ commitment : "confirmed" ,
30+ skipPreflight : false ,
31+ } ) ;
32+ return getSignatureFromTransaction ( signedTx ) ;
33+ }
34+ ) ;
35+ }
Original file line number Diff line number Diff line change 1+ import {
2+ Rpc ,
3+ RpcSubscriptions ,
4+ RpcTransport ,
5+ SignatureNotificationsApi ,
6+ SlotNotificationsApi ,
7+ SolanaRpcApiFromTransport ,
8+ } from "@solana/kit" ;
9+
10+ export type RpcClient = {
11+ rpc : Rpc < SolanaRpcApiFromTransport < RpcTransport > > ;
12+ rpcSubscriptions : RpcSubscriptions < SignatureNotificationsApi & SlotNotificationsApi > ;
13+ } ;
You can’t perform that action at this time.
0 commit comments