flash-sdk 11.8.2 → 11.8.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +37 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flash-sdk",
3
- "version": "11.8.2",
3
+ "version": "11.8.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
package/readme.md CHANGED
@@ -34,6 +34,7 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
34
34
  });
35
35
  const perpClient = new PerpetualsClient(provider, programId);
36
36
 
37
+ // NOTE: choose the correct POOL_CONFIG based on the pool you want to interact
37
38
  // flp.1
38
39
  const POOL_CONFIG = PoolConfig.fromIdsByName('Crypto.1','mainnet-beta')
39
40
  // flp.2
@@ -42,9 +43,17 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
42
43
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Governance.1','mainnet-beta')
43
44
  // flp.4
44
45
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Community.1','mainnet-beta')
46
+ // flp.5
47
+ // const POOL_CONFIG = PoolConfig.fromIdsByName('Community.2','mainnet-beta')
48
+ // flp.7
49
+ // const POOL_CONFIG = PoolConfig.fromIdsByName('Trump.1','mainnet-beta')
50
+ // flp.8
51
+ // const POOL_CONFIG = PoolConfig.fromIdsByName('Ore.1','mainnet-beta')
52
+ // flp.r
53
+ // const POOL_CONFIG = PoolConfig.fromIdsByName('Remora.1','mainnet-beta')
45
54
 
46
55
  const poolAddress = POOL_CONFIG.poolAddress.toBase58()
47
- const backupOracleData: any = await (await fetch(`https://beast.flash.trade/api/backup-oracle?poolAddress=${poolAddress}`)).json()
56
+ const backupOracleData: any = await (await fetch(`https://flash.trade/api/backup-oracle?poolAddress=${poolAddress}`)).json()
48
57
  const backUpOracleInstruction = new TransactionInstruction({
49
58
  keys: backupOracleData.keys,
50
59
  programId: new PublicKey(backupOracleData.programId),
@@ -73,9 +82,13 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
73
82
  )
74
83
  const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })
75
84
 
85
+ let addresslookupTables: AddressLookupTableAccount[] = (
86
+ await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
87
+ ).addressLookupTables
88
+
76
89
  const txid = perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...addLiqInstructions ], {
77
90
  addLiqAdditionalSigners,
78
- alts: perpClient.addressLookupTables,
91
+ alts: addresslookupTables,
79
92
  })
80
93
 
81
94
  <!--addCompoundingLiquidity (USDC -> FLP.1 ) -->
@@ -107,9 +120,14 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
107
120
  true
108
121
  )
109
122
  const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })
123
+
124
+ let addresslookupTables: AddressLookupTableAccount[] = (
125
+ await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
126
+ ).addressLookupTables
127
+
110
128
  const txid = perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...removeCompLiqInstructions ], {
111
129
  removeCompLiqAdditionalSigners,
112
- alts: perpClient.addressLookupTables,
130
+ alts: addresslookupTables,
113
131
  })
114
132
 
115
133
  <!-- remove Liquidity (sFLP -> USDC) -->
@@ -121,6 +139,11 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
121
139
  POOL_CONFIG
122
140
  )
123
141
  const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })
142
+
143
+ let addresslookupTables: AddressLookupTableAccount[] = (
144
+ await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
145
+ ).addressLookupTables
146
+
124
147
  const txid = perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...removeLiqInstructions ], {
125
148
  removeLiqAdditionalSigners,
126
149
  alts: perpClient.addressLookupTables,
@@ -131,6 +154,9 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
131
154
  const { instructions: depositStakeInstructions, additionalSigners: depositStakeAdditionalSigners } =
132
155
  await perpClient.depositStake(.provider.wallet.publicKey, provider.wallet.publicKey, flpDepositAmount, POOL_CONFIG)
133
156
 
157
+ let addresslookupTables: AddressLookupTableAccount[] = (
158
+ await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
159
+ ).addressLookupTables
134
160
  const txid = perpClient.sendTransaction([...depositStakeInstructions ], {
135
161
  depositStakeAdditionalSigners,
136
162
  alts: perpClient.addressLookupTables,
@@ -143,6 +169,10 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
143
169
 
144
170
  const { instructions: withdrawStakeInstructions } = await perpClient.withdrawStake(POOL_CONFIG, false)
145
171
 
172
+ let addresslookupTables: AddressLookupTableAccount[] = (
173
+ await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
174
+ ).addressLookupTables
175
+
146
176
  const txid = perpClient.sendTransaction([...unstakeInstantInstructions, ...withdrawStakeInstructions ], {
147
177
  unstakeInstantAdditionalSigners,
148
178
  alts: perpClient.addressLookupTables,
@@ -153,6 +183,10 @@ code : https://github.com/flash-trade/flash-trade-sdk.git
153
183
 
154
184
  const { instructions, additionalSigners } = await perpClient.collectStakeFees('USDC',POOL_CONFIG)
155
185
 
186
+ let addresslookupTables: AddressLookupTableAccount[] = (
187
+ await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
188
+ ).addressLookupTables
189
+
156
190
  const txid = perpClient.sendTransaction([...instructions ], {
157
191
  additionalSigners,
158
192
  alts: perpClient.addressLookupTables,