@@ -44,6 +44,7 @@ func NewClient(baseUrl string) *Client {
44
44
type Quote struct {
45
45
jsonString string
46
46
estimatedSwapAmount uint64
47
+ useSharedAccounts bool
47
48
useLegacyInstructions bool
48
49
}
49
50
@@ -60,13 +61,14 @@ func (c *Client) GetQuote(
60
61
slippageBps uint32 ,
61
62
forceDirectRoute bool ,
62
63
maxAccounts uint8 ,
64
+ useSharedAccounts bool ,
63
65
useLegacyInstruction bool ,
64
66
) (* Quote , error ) {
65
67
tracer := metrics .TraceMethodCall (ctx , metricsStructName , "GetQuote" )
66
68
defer tracer .End ()
67
69
68
70
url := fmt .Sprintf (
69
- "%s%s?inputMint=%s&outputMint=%s&amount=%d&slippageBps=%d&onlyDirectRoutes=%v&maxAccounts=%d&asLegacyTransaction=%v" ,
71
+ "%s%s?inputMint=%s&outputMint=%s&amount=%d&slippageBps=%d&onlyDirectRoutes=%v&maxAccounts=%d&useSharedAccounts=%v& asLegacyTransaction=%v" ,
70
72
c .baseUrl ,
71
73
quoteEndpointName ,
72
74
inputMint ,
@@ -75,6 +77,7 @@ func (c *Client) GetQuote(
75
77
slippageBps ,
76
78
forceDirectRoute ,
77
79
maxAccounts ,
80
+ useSharedAccounts ,
78
81
useLegacyInstruction ,
79
82
)
80
83
@@ -107,6 +110,7 @@ func (c *Client) GetQuote(
107
110
return & Quote {
108
111
jsonString : string (respBody ),
109
112
estimatedSwapAmount : estimatedSwapAmount ,
113
+ useSharedAccounts : useSharedAccounts ,
110
114
useLegacyInstructions : useLegacyInstruction ,
111
115
}, nil
112
116
}
@@ -136,10 +140,11 @@ func (c *Client) GetSwapInstructions(
136
140
137
141
// todo: struct this
138
142
reqBody := fmt .Sprintf (
139
- `{"quoteResponse": %s, "userPublicKey": "%s", "destinationTokenAccount": "%s", "prioritizationFeeLamports": "auto", "asLegacyTransaction": %v}` ,
143
+ `{"quoteResponse": %s, "userPublicKey": "%s", "destinationTokenAccount": "%s", "prioritizationFeeLamports": "auto", "useSharedAccounts": %v, " asLegacyTransaction": %v}` ,
140
144
quote .jsonString ,
141
145
owner ,
142
146
destinationTokenAccount ,
147
+ quote .useSharedAccounts ,
143
148
quote .useLegacyInstructions ,
144
149
)
145
150
0 commit comments