@wireio/stake 1.2.69 → 1.3.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireio/stake",
3
- "version": "1.2.69",
3
+ "version": "1.3.69",
4
4
  "description": "LIQ Staking Module for Wire Network",
5
5
  "homepage": "https://gitea.gitgo.app/Wire/sdk-stake",
6
6
  "license": "FSL-1.1-Apache-2.0",
@@ -9,7 +9,7 @@ import {
9
9
  } from '@solana/web3.js';
10
10
  import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
11
11
 
12
- import { buildOutpostAccounts } from '../utils';
12
+ import { buildOutpostAccounts, OutpostAccounts } from '../utils';
13
13
  import { LiqsolCoreClientIdl, SolanaProgramService } from '../program';
14
14
  import { ConvertClient } from './convert.client';
15
15
 
@@ -38,6 +38,46 @@ export type SolanaInstaswapConnectedBalances = {
38
38
  liqsolDecimals: number;
39
39
  };
40
40
 
41
+ export function buildSolanaInstaswapCrossChainAccounts(params: {
42
+ user: PublicKey;
43
+ accounts: OutpostAccounts;
44
+ liqsolCoreProgram: PublicKey;
45
+ transferHookProgram: PublicKey;
46
+ pendingAttestations: PublicKey;
47
+ }) {
48
+ const {
49
+ user,
50
+ accounts,
51
+ liqsolCoreProgram,
52
+ transferHookProgram,
53
+ pendingAttestations,
54
+ } = params;
55
+
56
+ return {
57
+ user,
58
+ globalState: accounts.globalState,
59
+ liqsolMint: accounts.liqsolMint,
60
+ distributionState: accounts.distributionState,
61
+ userAta: accounts.userAta,
62
+ senderUserRecord: accounts.userUserRecord,
63
+ bridgeAuthority: accounts.bridgeAuthority,
64
+ bridgeVaultAta: accounts.bridgeVaultAta,
65
+ bridgeUserRecord: accounts.bridgeUserRecord,
66
+ bridgeState: accounts.bridgeState,
67
+ extraAccountMetaList: accounts.extraAccountMetaList,
68
+ liqsolCoreProgram,
69
+ transferHookProgram,
70
+ bucketAuthority: accounts.bucketAuthority,
71
+ bucketTokenAccount: accounts.bucketTokenAccount,
72
+ bucketUserRecord: accounts.bucketUserRecord,
73
+ tokenProgram: TOKEN_2022_PROGRAM_ID,
74
+ systemProgram: SystemProgram.programId,
75
+ globalConfig: accounts.globalConfig,
76
+ oppEpochState: accounts.oppEpochState,
77
+ pendingAttestations,
78
+ };
79
+ }
80
+
41
81
  export class SolanaInstaswapClient {
42
82
  private readonly program: Program<LiqsolCoreClientIdl>;
43
83
  private readonly convertClient: ConvertClient;
@@ -81,29 +121,15 @@ export class SolanaInstaswapClient {
81
121
  destinationAddress,
82
122
  minOut,
83
123
  )
84
- .accounts({
85
- user,
86
- globalState: accounts.globalState,
87
- liqsolMint: accounts.liqsolMint,
88
- distributionState: accounts.distributionState,
89
- userAta: accounts.userAta,
90
- senderUserRecord: accounts.userUserRecord,
91
- poolAuthority: accounts.poolAuthority,
92
- liqsolPoolAta: accounts.liqsolPoolAta,
93
- poolUserRecord: accounts.liqsolPoolUserRecord,
94
- bridgeState: accounts.bridgeState,
95
- extraAccountMetaList: accounts.extraAccountMetaList,
96
- liqsolCoreProgram: this.program.programId,
97
- transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
98
- bucketAuthority: accounts.bucketAuthority,
99
- bucketTokenAccount: accounts.bucketTokenAccount,
100
- bucketUserRecord: accounts.bucketUserRecord,
101
- tokenProgram: TOKEN_2022_PROGRAM_ID,
102
- systemProgram: SystemProgram.programId,
103
- globalConfig: accounts.globalConfig,
104
- oppEpochState: accounts.oppEpochState,
105
- pendingAttestations,
106
- })
124
+ .accounts(
125
+ buildSolanaInstaswapCrossChainAccounts({
126
+ user,
127
+ accounts,
128
+ liqsolCoreProgram: this.program.programId,
129
+ transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
130
+ pendingAttestations,
131
+ }),
132
+ )
107
133
  .preInstructions([
108
134
  ComputeBudgetProgram.setComputeUnitLimit({ units: 900_000 }),
109
135
  ])
@@ -126,29 +152,15 @@ export class SolanaInstaswapClient {
126
152
  destinationAddress,
127
153
  minOut,
128
154
  )
129
- .accounts({
130
- user,
131
- globalState: accounts.globalState,
132
- liqsolMint: accounts.liqsolMint,
133
- distributionState: accounts.distributionState,
134
- userAta: accounts.userAta,
135
- senderUserRecord: accounts.userUserRecord,
136
- poolAuthority: accounts.poolAuthority,
137
- liqsolPoolAta: accounts.liqsolPoolAta,
138
- poolUserRecord: accounts.liqsolPoolUserRecord,
139
- bridgeState: accounts.bridgeState,
140
- extraAccountMetaList: accounts.extraAccountMetaList,
141
- liqsolCoreProgram: this.program.programId,
142
- transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
143
- bucketAuthority: accounts.bucketAuthority,
144
- bucketTokenAccount: accounts.bucketTokenAccount,
145
- bucketUserRecord: accounts.bucketUserRecord,
146
- tokenProgram: TOKEN_2022_PROGRAM_ID,
147
- systemProgram: SystemProgram.programId,
148
- globalConfig: accounts.globalConfig,
149
- oppEpochState: accounts.oppEpochState,
150
- pendingAttestations,
151
- })
155
+ .accounts(
156
+ buildSolanaInstaswapCrossChainAccounts({
157
+ user,
158
+ accounts,
159
+ liqsolCoreProgram: this.program.programId,
160
+ transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
161
+ pendingAttestations,
162
+ }),
163
+ )
152
164
  .preInstructions([
153
165
  ComputeBudgetProgram.setComputeUnitLimit({ units: 900_000 }),
154
166
  ])