@@ -44,6 +44,7 @@ func NewClient(baseUrl string) *Client {
4444type Quote struct {
4545 jsonString string
4646 estimatedSwapAmount uint64
47+ useSharedAccounts bool
4748 useLegacyInstructions bool
4849}
4950
@@ -60,13 +61,14 @@ func (c *Client) GetQuote(
6061 slippageBps uint32 ,
6162 forceDirectRoute bool ,
6263 maxAccounts uint8 ,
64+ useSharedAccounts bool ,
6365 useLegacyInstruction bool ,
6466) (* Quote , error ) {
6567 tracer := metrics .TraceMethodCall (ctx , metricsStructName , "GetQuote" )
6668 defer tracer .End ()
6769
6870 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" ,
7072 c .baseUrl ,
7173 quoteEndpointName ,
7274 inputMint ,
@@ -75,6 +77,7 @@ func (c *Client) GetQuote(
7577 slippageBps ,
7678 forceDirectRoute ,
7779 maxAccounts ,
80+ useSharedAccounts ,
7881 useLegacyInstruction ,
7982 )
8083
@@ -107,6 +110,7 @@ func (c *Client) GetQuote(
107110 return & Quote {
108111 jsonString : string (respBody ),
109112 estimatedSwapAmount : estimatedSwapAmount ,
113+ useSharedAccounts : useSharedAccounts ,
110114 useLegacyInstructions : useLegacyInstruction ,
111115 }, nil
112116}
@@ -136,10 +140,11 @@ func (c *Client) GetSwapInstructions(
136140
137141 // todo: struct this
138142 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}` ,
140144 quote .jsonString ,
141145 owner ,
142146 destinationTokenAccount ,
147+ quote .useSharedAccounts ,
143148 quote .useLegacyInstructions ,
144149 )
145150
0 commit comments