@glamsystems/glam-sdk 0.1.7 → 0.1.8
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/index.cjs.js +2018 -995
- package/index.esm.js +2016 -996
- package/package.json +2 -1
- package/src/client/base.d.ts +15 -5
- package/src/client/drift.d.ts +14 -5
- package/src/client/jupiter.d.ts +11 -3
- package/src/client/marinade.d.ts +22 -16
- package/src/client/meteora.d.ts +27 -0
- package/src/client/mint.d.ts +10 -10
- package/src/client/staking.d.ts +19 -19
- package/src/client/state.d.ts +15 -13
- package/src/client/wsol.d.ts +4 -4
- package/src/client.d.ts +3 -0
- package/src/index.d.ts +1 -0
- package/src/models.d.ts +2 -2
- package/src/react/glam.d.ts +2 -2
- package/target/idl/glam.json +1336 -614
- package/target/types/glam.d.ts +1322 -600
- package/target/types/glam.ts +1336 -614
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from '@coral-xyz/anchor';
|
|
2
2
|
import { Program, BN } from '@coral-xyz/anchor';
|
|
3
|
-
import { PublicKey, ComputeBudgetProgram, VersionedTransaction, TransactionMessage, SystemProgram, Connection, Transaction, sendAndConfirmTransaction, AddressLookupTableAccount, LAMPORTS_PER_SOL, TransactionInstruction, StakeProgram, SYSVAR_CLOCK_PUBKEY,
|
|
3
|
+
import { PublicKey, ComputeBudgetProgram, VersionedTransaction, TransactionMessage, SystemProgram, Connection, Transaction, sendAndConfirmTransaction, AddressLookupTableAccount, LAMPORTS_PER_SOL, TransactionInstruction, StakeProgram, SYSVAR_CLOCK_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, STAKE_CONFIG_ID, SYSVAR_RENT_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, Keypair } from '@solana/web3.js';
|
|
4
4
|
import { getExtensionData, ExtensionType, TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, getMint, getAccount, TokenAccountNotFoundError, unpackMint, createAssociatedTokenAccountIdempotentInstruction, createSyncNativeInstruction, createTransferCheckedInstruction, unpackAccount } from '@solana/spl-token';
|
|
5
5
|
import { unpack } from '@solana/spl-token-metadata';
|
|
6
6
|
import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes';
|
|
@@ -8,11 +8,12 @@ import { getUserAccountPublicKeySync, getUserStatsAccountPublicKey, decodeUser,
|
|
|
8
8
|
import { Marinade } from '@marinade.finance/marinade-ts-sdk';
|
|
9
9
|
import { getStakePoolAccount } from '@solana/spl-stake-pool';
|
|
10
10
|
import * as borsh from '@coral-xyz/borsh';
|
|
11
|
+
import DLMM, { Strategy, binIdToBinArrayIndex, deriveBinArray } from '@meteora-ag/dlmm';
|
|
11
12
|
|
|
12
13
|
var address = "GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc";
|
|
13
14
|
var metadata = {
|
|
14
15
|
name: "glam",
|
|
15
|
-
version: "0.4.
|
|
16
|
+
version: "0.4.6",
|
|
16
17
|
spec: "0.1.0",
|
|
17
18
|
description: "Glam Protocol"
|
|
18
19
|
};
|
|
@@ -20,7 +21,6 @@ var instructions = [
|
|
|
20
21
|
{
|
|
21
22
|
name: "add_mint",
|
|
22
23
|
docs: [
|
|
23
|
-
"Mint",
|
|
24
24
|
"Adds a new mint.",
|
|
25
25
|
"",
|
|
26
26
|
"# Parameters",
|
|
@@ -46,14 +46,14 @@ var instructions = [
|
|
|
46
46
|
writable: true
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
name: "
|
|
50
|
-
writable: true
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "signer",
|
|
49
|
+
name: "glam_signer",
|
|
54
50
|
writable: true,
|
|
55
51
|
signer: true
|
|
56
52
|
},
|
|
53
|
+
{
|
|
54
|
+
name: "new_mint",
|
|
55
|
+
writable: true
|
|
56
|
+
},
|
|
57
57
|
{
|
|
58
58
|
name: "extra_account_meta_list",
|
|
59
59
|
writable: true,
|
|
@@ -166,6 +166,11 @@ var instructions = [
|
|
|
166
166
|
{
|
|
167
167
|
name: "glam_state"
|
|
168
168
|
},
|
|
169
|
+
{
|
|
170
|
+
name: "glam_signer",
|
|
171
|
+
writable: true,
|
|
172
|
+
signer: true
|
|
173
|
+
},
|
|
169
174
|
{
|
|
170
175
|
name: "glam_mint",
|
|
171
176
|
writable: true
|
|
@@ -230,11 +235,6 @@ var instructions = [
|
|
|
230
235
|
{
|
|
231
236
|
name: "from"
|
|
232
237
|
},
|
|
233
|
-
{
|
|
234
|
-
name: "signer",
|
|
235
|
-
writable: true,
|
|
236
|
-
signer: true
|
|
237
|
-
},
|
|
238
238
|
{
|
|
239
239
|
name: "token_2022_program",
|
|
240
240
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -279,7 +279,7 @@ var instructions = [
|
|
|
279
279
|
writable: true
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
|
-
name: "
|
|
282
|
+
name: "glam_vault",
|
|
283
283
|
writable: true,
|
|
284
284
|
pda: {
|
|
285
285
|
seeds: [
|
|
@@ -300,6 +300,11 @@ var instructions = [
|
|
|
300
300
|
]
|
|
301
301
|
}
|
|
302
302
|
},
|
|
303
|
+
{
|
|
304
|
+
name: "glam_signer",
|
|
305
|
+
writable: true,
|
|
306
|
+
signer: true
|
|
307
|
+
},
|
|
303
308
|
{
|
|
304
309
|
name: "glam_mint",
|
|
305
310
|
writable: true
|
|
@@ -365,11 +370,6 @@ var instructions = [
|
|
|
365
370
|
]
|
|
366
371
|
}
|
|
367
372
|
},
|
|
368
|
-
{
|
|
369
|
-
name: "signer",
|
|
370
|
-
writable: true,
|
|
371
|
-
signer: true
|
|
372
|
-
},
|
|
373
373
|
{
|
|
374
374
|
name: "token_2022_program",
|
|
375
375
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -405,61 +405,61 @@ var instructions = [
|
|
|
405
405
|
],
|
|
406
406
|
accounts: [
|
|
407
407
|
{
|
|
408
|
-
name: "
|
|
408
|
+
name: "glam_state",
|
|
409
409
|
writable: true
|
|
410
410
|
},
|
|
411
411
|
{
|
|
412
|
-
name: "
|
|
412
|
+
name: "glam_vault",
|
|
413
413
|
writable: true,
|
|
414
414
|
pda: {
|
|
415
415
|
seeds: [
|
|
416
416
|
{
|
|
417
417
|
kind: "const",
|
|
418
418
|
value: [
|
|
419
|
-
|
|
420
|
-
101,
|
|
421
|
-
116,
|
|
422
|
-
97,
|
|
423
|
-
100,
|
|
419
|
+
118,
|
|
424
420
|
97,
|
|
425
|
-
|
|
426
|
-
|
|
421
|
+
117,
|
|
422
|
+
108,
|
|
423
|
+
116
|
|
427
424
|
]
|
|
428
425
|
},
|
|
429
426
|
{
|
|
430
427
|
kind: "account",
|
|
431
|
-
path: "
|
|
428
|
+
path: "glam_state"
|
|
432
429
|
}
|
|
433
430
|
]
|
|
434
431
|
}
|
|
435
432
|
},
|
|
436
433
|
{
|
|
437
|
-
name: "
|
|
434
|
+
name: "glam_signer",
|
|
435
|
+
writable: true,
|
|
436
|
+
signer: true
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: "metadata",
|
|
438
440
|
writable: true,
|
|
439
441
|
pda: {
|
|
440
442
|
seeds: [
|
|
441
443
|
{
|
|
442
444
|
kind: "const",
|
|
443
445
|
value: [
|
|
444
|
-
|
|
446
|
+
109,
|
|
447
|
+
101,
|
|
448
|
+
116,
|
|
445
449
|
97,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
116
|
|
450
|
+
100,
|
|
451
|
+
97,
|
|
452
|
+
116,
|
|
453
|
+
97
|
|
449
454
|
]
|
|
450
455
|
},
|
|
451
456
|
{
|
|
452
457
|
kind: "account",
|
|
453
|
-
path: "
|
|
458
|
+
path: "glam_state"
|
|
454
459
|
}
|
|
455
460
|
]
|
|
456
461
|
}
|
|
457
462
|
},
|
|
458
|
-
{
|
|
459
|
-
name: "signer",
|
|
460
|
-
writable: true,
|
|
461
|
-
signer: true
|
|
462
|
-
},
|
|
463
463
|
{
|
|
464
464
|
name: "system_program",
|
|
465
465
|
address: "11111111111111111111111111111111"
|
|
@@ -490,11 +490,11 @@ var instructions = [
|
|
|
490
490
|
],
|
|
491
491
|
accounts: [
|
|
492
492
|
{
|
|
493
|
-
name: "
|
|
493
|
+
name: "glam_state",
|
|
494
494
|
writable: true
|
|
495
495
|
},
|
|
496
496
|
{
|
|
497
|
-
name: "
|
|
497
|
+
name: "glam_vault",
|
|
498
498
|
writable: true,
|
|
499
499
|
pda: {
|
|
500
500
|
seeds: [
|
|
@@ -510,13 +510,13 @@ var instructions = [
|
|
|
510
510
|
},
|
|
511
511
|
{
|
|
512
512
|
kind: "account",
|
|
513
|
-
path: "
|
|
513
|
+
path: "glam_state"
|
|
514
514
|
}
|
|
515
515
|
]
|
|
516
516
|
}
|
|
517
517
|
},
|
|
518
518
|
{
|
|
519
|
-
name: "
|
|
519
|
+
name: "glam_signer",
|
|
520
520
|
writable: true,
|
|
521
521
|
signer: true
|
|
522
522
|
},
|
|
@@ -557,15 +557,10 @@ var instructions = [
|
|
|
557
557
|
],
|
|
558
558
|
accounts: [
|
|
559
559
|
{
|
|
560
|
-
name: "
|
|
561
|
-
writable: true,
|
|
562
|
-
signer: true
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
name: "state"
|
|
560
|
+
name: "glam_state"
|
|
566
561
|
},
|
|
567
562
|
{
|
|
568
|
-
name: "
|
|
563
|
+
name: "glam_vault",
|
|
569
564
|
writable: true,
|
|
570
565
|
pda: {
|
|
571
566
|
seeds: [
|
|
@@ -581,11 +576,16 @@ var instructions = [
|
|
|
581
576
|
},
|
|
582
577
|
{
|
|
583
578
|
kind: "account",
|
|
584
|
-
path: "
|
|
579
|
+
path: "glam_state"
|
|
585
580
|
}
|
|
586
581
|
]
|
|
587
582
|
}
|
|
588
583
|
},
|
|
584
|
+
{
|
|
585
|
+
name: "glam_signer",
|
|
586
|
+
writable: true,
|
|
587
|
+
signer: true
|
|
588
|
+
},
|
|
589
589
|
{
|
|
590
590
|
name: "clock",
|
|
591
591
|
address: "SysvarC1ock11111111111111111111111111111111"
|
|
@@ -1035,7 +1035,6 @@ var instructions = [
|
|
|
1035
1035
|
{
|
|
1036
1036
|
name: "drift_initialize_user_stats",
|
|
1037
1037
|
docs: [
|
|
1038
|
-
"Drift",
|
|
1039
1038
|
"Initializes a drift account owned by vault and creates a subaccount.",
|
|
1040
1039
|
"",
|
|
1041
1040
|
"# Parameters",
|
|
@@ -1643,6 +1642,11 @@ var instructions = [
|
|
|
1643
1642
|
name: "glam_state",
|
|
1644
1643
|
writable: true
|
|
1645
1644
|
},
|
|
1645
|
+
{
|
|
1646
|
+
name: "glam_signer",
|
|
1647
|
+
writable: true,
|
|
1648
|
+
signer: true
|
|
1649
|
+
},
|
|
1646
1650
|
{
|
|
1647
1651
|
name: "glam_mint",
|
|
1648
1652
|
writable: true
|
|
@@ -1767,11 +1771,6 @@ var instructions = [
|
|
|
1767
1771
|
{
|
|
1768
1772
|
name: "to"
|
|
1769
1773
|
},
|
|
1770
|
-
{
|
|
1771
|
-
name: "signer",
|
|
1772
|
-
writable: true,
|
|
1773
|
-
signer: true
|
|
1774
|
-
},
|
|
1775
1774
|
{
|
|
1776
1775
|
name: "token_2022_program",
|
|
1777
1776
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -1815,16 +1814,11 @@ var instructions = [
|
|
|
1815
1814
|
],
|
|
1816
1815
|
accounts: [
|
|
1817
1816
|
{
|
|
1818
|
-
name: "
|
|
1819
|
-
writable: true,
|
|
1820
|
-
signer: true
|
|
1821
|
-
},
|
|
1822
|
-
{
|
|
1823
|
-
name: "state",
|
|
1817
|
+
name: "glam_state",
|
|
1824
1818
|
writable: true
|
|
1825
1819
|
},
|
|
1826
1820
|
{
|
|
1827
|
-
name: "
|
|
1821
|
+
name: "glam_vault",
|
|
1828
1822
|
writable: true,
|
|
1829
1823
|
pda: {
|
|
1830
1824
|
seeds: [
|
|
@@ -1840,11 +1834,16 @@ var instructions = [
|
|
|
1840
1834
|
},
|
|
1841
1835
|
{
|
|
1842
1836
|
kind: "account",
|
|
1843
|
-
path: "
|
|
1837
|
+
path: "glam_state"
|
|
1844
1838
|
}
|
|
1845
1839
|
]
|
|
1846
1840
|
}
|
|
1847
1841
|
},
|
|
1842
|
+
{
|
|
1843
|
+
name: "glam_signer",
|
|
1844
|
+
writable: true,
|
|
1845
|
+
signer: true
|
|
1846
|
+
},
|
|
1848
1847
|
{
|
|
1849
1848
|
name: "vault_stake_account",
|
|
1850
1849
|
writable: true
|
|
@@ -1886,7 +1885,6 @@ var instructions = [
|
|
|
1886
1885
|
{
|
|
1887
1886
|
name: "initialize_state",
|
|
1888
1887
|
docs: [
|
|
1889
|
-
"State",
|
|
1890
1888
|
"Initializes a state account from the provided StateModel instance.",
|
|
1891
1889
|
"",
|
|
1892
1890
|
"# Parameters",
|
|
@@ -1908,7 +1906,7 @@ var instructions = [
|
|
|
1908
1906
|
],
|
|
1909
1907
|
accounts: [
|
|
1910
1908
|
{
|
|
1911
|
-
name: "
|
|
1909
|
+
name: "glam_state",
|
|
1912
1910
|
writable: true,
|
|
1913
1911
|
pda: {
|
|
1914
1912
|
seeds: [
|
|
@@ -1924,7 +1922,7 @@ var instructions = [
|
|
|
1924
1922
|
},
|
|
1925
1923
|
{
|
|
1926
1924
|
kind: "account",
|
|
1927
|
-
path: "
|
|
1925
|
+
path: "glam_signer"
|
|
1928
1926
|
},
|
|
1929
1927
|
{
|
|
1930
1928
|
kind: "arg",
|
|
@@ -1934,7 +1932,7 @@ var instructions = [
|
|
|
1934
1932
|
}
|
|
1935
1933
|
},
|
|
1936
1934
|
{
|
|
1937
|
-
name: "
|
|
1935
|
+
name: "glam_vault",
|
|
1938
1936
|
writable: true,
|
|
1939
1937
|
pda: {
|
|
1940
1938
|
seeds: [
|
|
@@ -1950,13 +1948,13 @@ var instructions = [
|
|
|
1950
1948
|
},
|
|
1951
1949
|
{
|
|
1952
1950
|
kind: "account",
|
|
1953
|
-
path: "
|
|
1951
|
+
path: "glam_state"
|
|
1954
1952
|
}
|
|
1955
1953
|
]
|
|
1956
1954
|
}
|
|
1957
1955
|
},
|
|
1958
1956
|
{
|
|
1959
|
-
name: "
|
|
1957
|
+
name: "glam_signer",
|
|
1960
1958
|
writable: true,
|
|
1961
1959
|
signer: true
|
|
1962
1960
|
},
|
|
@@ -1981,7 +1979,7 @@ var instructions = [
|
|
|
1981
1979
|
},
|
|
1982
1980
|
{
|
|
1983
1981
|
kind: "account",
|
|
1984
|
-
path: "
|
|
1982
|
+
path: "glam_state"
|
|
1985
1983
|
}
|
|
1986
1984
|
]
|
|
1987
1985
|
}
|
|
@@ -2108,11 +2106,11 @@ var instructions = [
|
|
|
2108
2106
|
],
|
|
2109
2107
|
accounts: [
|
|
2110
2108
|
{
|
|
2111
|
-
name: "
|
|
2109
|
+
name: "glam_state",
|
|
2112
2110
|
writable: true
|
|
2113
2111
|
},
|
|
2114
2112
|
{
|
|
2115
|
-
name: "
|
|
2113
|
+
name: "glam_signer",
|
|
2116
2114
|
writable: true,
|
|
2117
2115
|
signer: true
|
|
2118
2116
|
}
|
|
@@ -2155,11 +2153,11 @@ var instructions = [
|
|
|
2155
2153
|
],
|
|
2156
2154
|
accounts: [
|
|
2157
2155
|
{
|
|
2158
|
-
name: "
|
|
2156
|
+
name: "glam_state",
|
|
2159
2157
|
writable: true
|
|
2160
2158
|
},
|
|
2161
2159
|
{
|
|
2162
|
-
name: "
|
|
2160
|
+
name: "glam_vault",
|
|
2163
2161
|
writable: true,
|
|
2164
2162
|
pda: {
|
|
2165
2163
|
seeds: [
|
|
@@ -2175,11 +2173,20 @@ var instructions = [
|
|
|
2175
2173
|
},
|
|
2176
2174
|
{
|
|
2177
2175
|
kind: "account",
|
|
2178
|
-
path: "
|
|
2176
|
+
path: "glam_state"
|
|
2179
2177
|
}
|
|
2180
2178
|
]
|
|
2181
2179
|
}
|
|
2182
2180
|
},
|
|
2181
|
+
{
|
|
2182
|
+
name: "glam_signer",
|
|
2183
|
+
writable: true,
|
|
2184
|
+
signer: true
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
name: "cpi_program",
|
|
2188
|
+
address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
|
|
2189
|
+
},
|
|
2183
2190
|
{
|
|
2184
2191
|
name: "input_vault_ata",
|
|
2185
2192
|
writable: true,
|
|
@@ -2187,7 +2194,7 @@ var instructions = [
|
|
|
2187
2194
|
seeds: [
|
|
2188
2195
|
{
|
|
2189
2196
|
kind: "account",
|
|
2190
|
-
path: "
|
|
2197
|
+
path: "glam_vault"
|
|
2191
2198
|
},
|
|
2192
2199
|
{
|
|
2193
2200
|
kind: "account",
|
|
@@ -2244,7 +2251,7 @@ var instructions = [
|
|
|
2244
2251
|
seeds: [
|
|
2245
2252
|
{
|
|
2246
2253
|
kind: "account",
|
|
2247
|
-
path: "
|
|
2254
|
+
path: "glam_vault"
|
|
2248
2255
|
},
|
|
2249
2256
|
{
|
|
2250
2257
|
kind: "account",
|
|
@@ -2300,11 +2307,6 @@ var instructions = [
|
|
|
2300
2307
|
{
|
|
2301
2308
|
name: "output_mint"
|
|
2302
2309
|
},
|
|
2303
|
-
{
|
|
2304
|
-
name: "signer",
|
|
2305
|
-
writable: true,
|
|
2306
|
-
signer: true
|
|
2307
|
-
},
|
|
2308
2310
|
{
|
|
2309
2311
|
name: "input_stake_pool",
|
|
2310
2312
|
optional: true
|
|
@@ -2313,10 +2315,6 @@ var instructions = [
|
|
|
2313
2315
|
name: "output_stake_pool",
|
|
2314
2316
|
optional: true
|
|
2315
2317
|
},
|
|
2316
|
-
{
|
|
2317
|
-
name: "jupiter_program",
|
|
2318
|
-
address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
|
|
2319
|
-
},
|
|
2320
2318
|
{
|
|
2321
2319
|
name: "associated_token_program",
|
|
2322
2320
|
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
@@ -3450,12 +3448,12 @@ var instructions = [
|
|
|
3450
3448
|
]
|
|
3451
3449
|
},
|
|
3452
3450
|
{
|
|
3453
|
-
name: "
|
|
3451
|
+
name: "marinade_claim",
|
|
3454
3452
|
docs: [
|
|
3455
3453
|
"Claims tickets that were unstaked in the previous epoch to get SOL.",
|
|
3456
3454
|
"",
|
|
3457
3455
|
"# Parameters",
|
|
3458
|
-
"- `ctx`: The context
|
|
3456
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3459
3457
|
"",
|
|
3460
3458
|
"# Permission required",
|
|
3461
3459
|
"- Permission::Unstake",
|
|
@@ -3464,27 +3462,22 @@ var instructions = [
|
|
|
3464
3462
|
"- Integration::Marinade"
|
|
3465
3463
|
],
|
|
3466
3464
|
discriminator: [
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3465
|
+
54,
|
|
3466
|
+
44,
|
|
3467
|
+
48,
|
|
3468
|
+
204,
|
|
3469
|
+
218,
|
|
3470
|
+
141,
|
|
3471
|
+
36,
|
|
3472
|
+
5
|
|
3475
3473
|
],
|
|
3476
3474
|
accounts: [
|
|
3477
3475
|
{
|
|
3478
|
-
name: "
|
|
3479
|
-
writable: true,
|
|
3480
|
-
signer: true
|
|
3481
|
-
},
|
|
3482
|
-
{
|
|
3483
|
-
name: "state",
|
|
3476
|
+
name: "glam_state",
|
|
3484
3477
|
writable: true
|
|
3485
3478
|
},
|
|
3486
3479
|
{
|
|
3487
|
-
name: "
|
|
3480
|
+
name: "glam_vault",
|
|
3488
3481
|
writable: true,
|
|
3489
3482
|
pda: {
|
|
3490
3483
|
seeds: [
|
|
@@ -3500,13 +3493,22 @@ var instructions = [
|
|
|
3500
3493
|
},
|
|
3501
3494
|
{
|
|
3502
3495
|
kind: "account",
|
|
3503
|
-
path: "
|
|
3496
|
+
path: "glam_state"
|
|
3504
3497
|
}
|
|
3505
3498
|
]
|
|
3506
3499
|
}
|
|
3507
3500
|
},
|
|
3508
3501
|
{
|
|
3509
|
-
name: "
|
|
3502
|
+
name: "glam_signer",
|
|
3503
|
+
writable: true,
|
|
3504
|
+
signer: true
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
name: "cpi_program",
|
|
3508
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3509
|
+
},
|
|
3510
|
+
{
|
|
3511
|
+
name: "state",
|
|
3510
3512
|
writable: true
|
|
3511
3513
|
},
|
|
3512
3514
|
{
|
|
@@ -3514,65 +3516,50 @@ var instructions = [
|
|
|
3514
3516
|
writable: true
|
|
3515
3517
|
},
|
|
3516
3518
|
{
|
|
3517
|
-
name: "
|
|
3518
|
-
|
|
3519
|
+
name: "ticket_account",
|
|
3520
|
+
writable: true
|
|
3519
3521
|
},
|
|
3520
3522
|
{
|
|
3521
|
-
name: "clock"
|
|
3522
|
-
address: "SysvarC1ock11111111111111111111111111111111"
|
|
3523
|
+
name: "clock"
|
|
3523
3524
|
},
|
|
3524
3525
|
{
|
|
3525
3526
|
name: "system_program",
|
|
3526
3527
|
address: "11111111111111111111111111111111"
|
|
3527
|
-
},
|
|
3528
|
-
{
|
|
3529
|
-
name: "token_program",
|
|
3530
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
3531
|
-
},
|
|
3532
|
-
{
|
|
3533
|
-
name: "marinade_program",
|
|
3534
|
-
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3535
3528
|
}
|
|
3536
3529
|
],
|
|
3537
3530
|
args: []
|
|
3538
3531
|
},
|
|
3539
3532
|
{
|
|
3540
|
-
name: "
|
|
3533
|
+
name: "marinade_deposit",
|
|
3541
3534
|
docs: [
|
|
3542
|
-
"
|
|
3535
|
+
"Deposits SOL to get mSOL.",
|
|
3543
3536
|
"",
|
|
3544
3537
|
"# Parameters",
|
|
3545
|
-
"- `ctx`: The context
|
|
3546
|
-
"- `
|
|
3538
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3539
|
+
"- `lamports`: The amount of SOL (in lamports) to deposit.",
|
|
3547
3540
|
"",
|
|
3548
3541
|
"# Permission required",
|
|
3549
|
-
"- Permission::
|
|
3542
|
+
"- Permission::Stake",
|
|
3550
3543
|
"",
|
|
3551
3544
|
"# Integration required",
|
|
3552
3545
|
"- Integration::Marinade"
|
|
3553
3546
|
],
|
|
3554
3547
|
discriminator: [
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3548
|
+
62,
|
|
3549
|
+
236,
|
|
3550
|
+
248,
|
|
3551
|
+
28,
|
|
3558
3552
|
222,
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
95
|
|
3553
|
+
232,
|
|
3554
|
+
182,
|
|
3555
|
+
73
|
|
3563
3556
|
],
|
|
3564
3557
|
accounts: [
|
|
3565
3558
|
{
|
|
3566
|
-
name: "
|
|
3567
|
-
writable: true,
|
|
3568
|
-
signer: true
|
|
3569
|
-
},
|
|
3570
|
-
{
|
|
3571
|
-
name: "state",
|
|
3572
|
-
writable: true
|
|
3559
|
+
name: "glam_state"
|
|
3573
3560
|
},
|
|
3574
3561
|
{
|
|
3575
|
-
name: "
|
|
3562
|
+
name: "glam_vault",
|
|
3576
3563
|
writable: true,
|
|
3577
3564
|
pda: {
|
|
3578
3565
|
seeds: [
|
|
@@ -3588,13 +3575,22 @@ var instructions = [
|
|
|
3588
3575
|
},
|
|
3589
3576
|
{
|
|
3590
3577
|
kind: "account",
|
|
3591
|
-
path: "
|
|
3578
|
+
path: "glam_state"
|
|
3592
3579
|
}
|
|
3593
3580
|
]
|
|
3594
3581
|
}
|
|
3595
3582
|
},
|
|
3596
3583
|
{
|
|
3597
|
-
name: "
|
|
3584
|
+
name: "glam_signer",
|
|
3585
|
+
writable: true,
|
|
3586
|
+
signer: true
|
|
3587
|
+
},
|
|
3588
|
+
{
|
|
3589
|
+
name: "cpi_program",
|
|
3590
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3591
|
+
},
|
|
3592
|
+
{
|
|
3593
|
+
name: "state",
|
|
3598
3594
|
writable: true
|
|
3599
3595
|
},
|
|
3600
3596
|
{
|
|
@@ -3602,54 +3598,50 @@ var instructions = [
|
|
|
3602
3598
|
writable: true
|
|
3603
3599
|
},
|
|
3604
3600
|
{
|
|
3605
|
-
name: "
|
|
3601
|
+
name: "liq_pool_sol_leg_pda",
|
|
3606
3602
|
writable: true
|
|
3607
3603
|
},
|
|
3608
3604
|
{
|
|
3609
|
-
name: "
|
|
3605
|
+
name: "liq_pool_msol_leg",
|
|
3610
3606
|
writable: true
|
|
3611
3607
|
},
|
|
3608
|
+
{
|
|
3609
|
+
name: "liq_pool_msol_leg_authority"
|
|
3610
|
+
},
|
|
3612
3611
|
{
|
|
3613
3612
|
name: "reserve_pda",
|
|
3614
3613
|
writable: true
|
|
3615
3614
|
},
|
|
3616
3615
|
{
|
|
3617
|
-
name: "
|
|
3618
|
-
|
|
3616
|
+
name: "mint_to",
|
|
3617
|
+
writable: true
|
|
3619
3618
|
},
|
|
3620
3619
|
{
|
|
3621
|
-
name: "
|
|
3622
|
-
address: "SysvarC1ock11111111111111111111111111111111"
|
|
3620
|
+
name: "msol_mint_authority"
|
|
3623
3621
|
},
|
|
3624
3622
|
{
|
|
3625
3623
|
name: "system_program",
|
|
3626
3624
|
address: "11111111111111111111111111111111"
|
|
3627
3625
|
},
|
|
3628
3626
|
{
|
|
3629
|
-
name: "token_program"
|
|
3630
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
3631
|
-
},
|
|
3632
|
-
{
|
|
3633
|
-
name: "marinade_program",
|
|
3634
|
-
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3627
|
+
name: "token_program"
|
|
3635
3628
|
}
|
|
3636
3629
|
],
|
|
3637
3630
|
args: [
|
|
3638
3631
|
{
|
|
3639
|
-
name: "
|
|
3632
|
+
name: "lamports",
|
|
3640
3633
|
type: "u64"
|
|
3641
3634
|
}
|
|
3642
3635
|
]
|
|
3643
3636
|
},
|
|
3644
3637
|
{
|
|
3645
|
-
name: "
|
|
3638
|
+
name: "marinade_deposit_stake_account",
|
|
3646
3639
|
docs: [
|
|
3647
|
-
"
|
|
3648
|
-
"Deposits SOL to get mSOL.",
|
|
3640
|
+
"Deposits a stake account to get mSOL.",
|
|
3649
3641
|
"",
|
|
3650
3642
|
"# Parameters",
|
|
3651
|
-
"- `ctx`: The context
|
|
3652
|
-
"- `
|
|
3643
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3644
|
+
"- `validator_idx`: Validator index in Marinade's validator list.",
|
|
3653
3645
|
"",
|
|
3654
3646
|
"# Permission required",
|
|
3655
3647
|
"- Permission::Stake",
|
|
@@ -3658,26 +3650,22 @@ var instructions = [
|
|
|
3658
3650
|
"- Integration::Marinade"
|
|
3659
3651
|
],
|
|
3660
3652
|
discriminator: [
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
56,
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3653
|
+
141,
|
|
3654
|
+
230,
|
|
3655
|
+
58,
|
|
3656
|
+
103,
|
|
3657
|
+
56,
|
|
3658
|
+
205,
|
|
3659
|
+
159,
|
|
3660
|
+
138
|
|
3669
3661
|
],
|
|
3670
3662
|
accounts: [
|
|
3671
3663
|
{
|
|
3672
|
-
name: "
|
|
3673
|
-
writable: true
|
|
3674
|
-
signer: true
|
|
3675
|
-
},
|
|
3676
|
-
{
|
|
3677
|
-
name: "state"
|
|
3664
|
+
name: "glam_state",
|
|
3665
|
+
writable: true
|
|
3678
3666
|
},
|
|
3679
3667
|
{
|
|
3680
|
-
name: "
|
|
3668
|
+
name: "glam_vault",
|
|
3681
3669
|
writable: true,
|
|
3682
3670
|
pda: {
|
|
3683
3671
|
seeds: [
|
|
@@ -3693,189 +3681,207 @@ var instructions = [
|
|
|
3693
3681
|
},
|
|
3694
3682
|
{
|
|
3695
3683
|
kind: "account",
|
|
3696
|
-
path: "
|
|
3684
|
+
path: "glam_state"
|
|
3697
3685
|
}
|
|
3698
3686
|
]
|
|
3699
3687
|
}
|
|
3700
3688
|
},
|
|
3701
3689
|
{
|
|
3702
|
-
name: "
|
|
3703
|
-
writable: true
|
|
3690
|
+
name: "glam_signer",
|
|
3691
|
+
writable: true,
|
|
3692
|
+
signer: true
|
|
3704
3693
|
},
|
|
3705
3694
|
{
|
|
3706
|
-
name: "
|
|
3695
|
+
name: "cpi_program",
|
|
3696
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3697
|
+
},
|
|
3698
|
+
{
|
|
3699
|
+
name: "state",
|
|
3707
3700
|
writable: true
|
|
3708
3701
|
},
|
|
3709
3702
|
{
|
|
3710
|
-
name: "
|
|
3703
|
+
name: "validator_list",
|
|
3711
3704
|
writable: true
|
|
3712
3705
|
},
|
|
3713
3706
|
{
|
|
3714
|
-
name: "
|
|
3707
|
+
name: "stake_list",
|
|
3715
3708
|
writable: true
|
|
3716
3709
|
},
|
|
3717
3710
|
{
|
|
3718
|
-
name: "
|
|
3711
|
+
name: "stake_account",
|
|
3719
3712
|
writable: true
|
|
3720
3713
|
},
|
|
3721
3714
|
{
|
|
3722
|
-
name: "
|
|
3715
|
+
name: "duplication_flag",
|
|
3723
3716
|
writable: true
|
|
3724
3717
|
},
|
|
3725
3718
|
{
|
|
3726
|
-
name: "
|
|
3719
|
+
name: "msol_mint",
|
|
3727
3720
|
writable: true
|
|
3728
3721
|
},
|
|
3729
3722
|
{
|
|
3730
3723
|
name: "mint_to",
|
|
3724
|
+
writable: true
|
|
3725
|
+
},
|
|
3726
|
+
{
|
|
3727
|
+
name: "msol_mint_authority"
|
|
3728
|
+
},
|
|
3729
|
+
{
|
|
3730
|
+
name: "clock"
|
|
3731
|
+
},
|
|
3732
|
+
{
|
|
3733
|
+
name: "rent",
|
|
3734
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
3735
|
+
},
|
|
3736
|
+
{
|
|
3737
|
+
name: "system_program",
|
|
3738
|
+
address: "11111111111111111111111111111111"
|
|
3739
|
+
},
|
|
3740
|
+
{
|
|
3741
|
+
name: "token_program"
|
|
3742
|
+
},
|
|
3743
|
+
{
|
|
3744
|
+
name: "stake_program"
|
|
3745
|
+
}
|
|
3746
|
+
],
|
|
3747
|
+
args: [
|
|
3748
|
+
{
|
|
3749
|
+
name: "validator_idx",
|
|
3750
|
+
type: "u32"
|
|
3751
|
+
}
|
|
3752
|
+
]
|
|
3753
|
+
},
|
|
3754
|
+
{
|
|
3755
|
+
name: "marinade_liquid_unstake",
|
|
3756
|
+
docs: [
|
|
3757
|
+
"Unstakes mSOL to get SOL immediately with a small fee.",
|
|
3758
|
+
"",
|
|
3759
|
+
"# Parameters",
|
|
3760
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3761
|
+
"- `msol_amount`: Amount of mSOL to unstake.",
|
|
3762
|
+
"",
|
|
3763
|
+
"# Permission required",
|
|
3764
|
+
"- Permission::Unstake",
|
|
3765
|
+
"",
|
|
3766
|
+
"# Integration required",
|
|
3767
|
+
"- Integration::Marinade"
|
|
3768
|
+
],
|
|
3769
|
+
discriminator: [
|
|
3770
|
+
29,
|
|
3771
|
+
146,
|
|
3772
|
+
34,
|
|
3773
|
+
21,
|
|
3774
|
+
26,
|
|
3775
|
+
68,
|
|
3776
|
+
141,
|
|
3777
|
+
161
|
|
3778
|
+
],
|
|
3779
|
+
accounts: [
|
|
3780
|
+
{
|
|
3781
|
+
name: "glam_state"
|
|
3782
|
+
},
|
|
3783
|
+
{
|
|
3784
|
+
name: "glam_vault",
|
|
3731
3785
|
writable: true,
|
|
3732
3786
|
pda: {
|
|
3733
3787
|
seeds: [
|
|
3734
|
-
{
|
|
3735
|
-
kind: "account",
|
|
3736
|
-
path: "vault"
|
|
3737
|
-
},
|
|
3738
3788
|
{
|
|
3739
3789
|
kind: "const",
|
|
3740
3790
|
value: [
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
101,
|
|
3747
|
-
161,
|
|
3748
|
-
147,
|
|
3749
|
-
217,
|
|
3750
|
-
203,
|
|
3751
|
-
225,
|
|
3752
|
-
70,
|
|
3753
|
-
206,
|
|
3754
|
-
235,
|
|
3755
|
-
121,
|
|
3756
|
-
172,
|
|
3757
|
-
28,
|
|
3758
|
-
180,
|
|
3759
|
-
133,
|
|
3760
|
-
237,
|
|
3761
|
-
95,
|
|
3762
|
-
91,
|
|
3763
|
-
55,
|
|
3764
|
-
145,
|
|
3765
|
-
58,
|
|
3766
|
-
140,
|
|
3767
|
-
245,
|
|
3768
|
-
133,
|
|
3769
|
-
126,
|
|
3770
|
-
255,
|
|
3771
|
-
0,
|
|
3772
|
-
169
|
|
3791
|
+
118,
|
|
3792
|
+
97,
|
|
3793
|
+
117,
|
|
3794
|
+
108,
|
|
3795
|
+
116
|
|
3773
3796
|
]
|
|
3774
3797
|
},
|
|
3775
3798
|
{
|
|
3776
3799
|
kind: "account",
|
|
3777
|
-
path: "
|
|
3800
|
+
path: "glam_state"
|
|
3778
3801
|
}
|
|
3779
|
-
]
|
|
3780
|
-
program: {
|
|
3781
|
-
kind: "const",
|
|
3782
|
-
value: [
|
|
3783
|
-
140,
|
|
3784
|
-
151,
|
|
3785
|
-
37,
|
|
3786
|
-
143,
|
|
3787
|
-
78,
|
|
3788
|
-
36,
|
|
3789
|
-
137,
|
|
3790
|
-
241,
|
|
3791
|
-
187,
|
|
3792
|
-
61,
|
|
3793
|
-
16,
|
|
3794
|
-
41,
|
|
3795
|
-
20,
|
|
3796
|
-
142,
|
|
3797
|
-
13,
|
|
3798
|
-
131,
|
|
3799
|
-
11,
|
|
3800
|
-
90,
|
|
3801
|
-
19,
|
|
3802
|
-
153,
|
|
3803
|
-
218,
|
|
3804
|
-
255,
|
|
3805
|
-
16,
|
|
3806
|
-
132,
|
|
3807
|
-
4,
|
|
3808
|
-
142,
|
|
3809
|
-
123,
|
|
3810
|
-
216,
|
|
3811
|
-
219,
|
|
3812
|
-
233,
|
|
3813
|
-
248,
|
|
3814
|
-
89
|
|
3815
|
-
]
|
|
3816
|
-
}
|
|
3802
|
+
]
|
|
3817
3803
|
}
|
|
3818
3804
|
},
|
|
3819
3805
|
{
|
|
3820
|
-
name: "
|
|
3806
|
+
name: "glam_signer",
|
|
3807
|
+
writable: true,
|
|
3808
|
+
signer: true
|
|
3809
|
+
},
|
|
3810
|
+
{
|
|
3811
|
+
name: "cpi_program",
|
|
3821
3812
|
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3822
3813
|
},
|
|
3823
3814
|
{
|
|
3824
|
-
name: "
|
|
3825
|
-
|
|
3815
|
+
name: "state",
|
|
3816
|
+
writable: true
|
|
3817
|
+
},
|
|
3818
|
+
{
|
|
3819
|
+
name: "msol_mint",
|
|
3820
|
+
writable: true
|
|
3821
|
+
},
|
|
3822
|
+
{
|
|
3823
|
+
name: "liq_pool_sol_leg_pda",
|
|
3824
|
+
writable: true
|
|
3825
|
+
},
|
|
3826
|
+
{
|
|
3827
|
+
name: "liq_pool_msol_leg",
|
|
3828
|
+
writable: true
|
|
3829
|
+
},
|
|
3830
|
+
{
|
|
3831
|
+
name: "treasury_msol_account",
|
|
3832
|
+
writable: true
|
|
3833
|
+
},
|
|
3834
|
+
{
|
|
3835
|
+
name: "get_msol_from",
|
|
3836
|
+
writable: true
|
|
3826
3837
|
},
|
|
3827
3838
|
{
|
|
3828
3839
|
name: "system_program",
|
|
3829
3840
|
address: "11111111111111111111111111111111"
|
|
3830
3841
|
},
|
|
3831
3842
|
{
|
|
3832
|
-
name: "token_program"
|
|
3833
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
3843
|
+
name: "token_program"
|
|
3834
3844
|
}
|
|
3835
3845
|
],
|
|
3836
3846
|
args: [
|
|
3837
3847
|
{
|
|
3838
|
-
name: "
|
|
3848
|
+
name: "msol_amount",
|
|
3839
3849
|
type: "u64"
|
|
3840
3850
|
}
|
|
3841
3851
|
]
|
|
3842
3852
|
},
|
|
3843
3853
|
{
|
|
3844
|
-
name: "
|
|
3854
|
+
name: "marinade_order_unstake",
|
|
3845
3855
|
docs: [
|
|
3846
|
-
"
|
|
3856
|
+
"Unstakes mSOL to get a ticket that can be claimed at the next epoch.",
|
|
3847
3857
|
"",
|
|
3848
3858
|
"# Parameters",
|
|
3849
|
-
"- `ctx`: The context
|
|
3850
|
-
"- `
|
|
3859
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3860
|
+
"- `msol_amount`: Amount of mSOL to unstake.",
|
|
3851
3861
|
"",
|
|
3852
3862
|
"# Permission required",
|
|
3853
|
-
"- Permission::
|
|
3863
|
+
"- Permission::Unstake",
|
|
3854
3864
|
"",
|
|
3855
3865
|
"# Integration required",
|
|
3856
3866
|
"- Integration::Marinade"
|
|
3857
3867
|
],
|
|
3858
3868
|
discriminator: [
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3869
|
+
202,
|
|
3870
|
+
3,
|
|
3871
|
+
33,
|
|
3872
|
+
27,
|
|
3873
|
+
183,
|
|
3874
|
+
156,
|
|
3875
|
+
57,
|
|
3876
|
+
231
|
|
3867
3877
|
],
|
|
3868
3878
|
accounts: [
|
|
3869
3879
|
{
|
|
3870
|
-
name: "
|
|
3871
|
-
writable: true
|
|
3872
|
-
signer: true
|
|
3873
|
-
},
|
|
3874
|
-
{
|
|
3875
|
-
name: "state"
|
|
3880
|
+
name: "glam_state",
|
|
3881
|
+
writable: true
|
|
3876
3882
|
},
|
|
3877
3883
|
{
|
|
3878
|
-
name: "
|
|
3884
|
+
name: "glam_vault",
|
|
3879
3885
|
writable: true,
|
|
3880
3886
|
pda: {
|
|
3881
3887
|
seeds: [
|
|
@@ -3891,200 +3897,523 @@ var instructions = [
|
|
|
3891
3897
|
},
|
|
3892
3898
|
{
|
|
3893
3899
|
kind: "account",
|
|
3894
|
-
path: "
|
|
3900
|
+
path: "glam_state"
|
|
3895
3901
|
}
|
|
3896
3902
|
]
|
|
3897
3903
|
}
|
|
3898
3904
|
},
|
|
3899
3905
|
{
|
|
3900
|
-
name: "
|
|
3901
|
-
writable: true
|
|
3906
|
+
name: "glam_signer",
|
|
3907
|
+
writable: true,
|
|
3908
|
+
signer: true
|
|
3902
3909
|
},
|
|
3903
3910
|
{
|
|
3904
|
-
name: "
|
|
3905
|
-
|
|
3911
|
+
name: "cpi_program",
|
|
3912
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3906
3913
|
},
|
|
3907
3914
|
{
|
|
3908
|
-
name: "
|
|
3915
|
+
name: "state",
|
|
3909
3916
|
writable: true
|
|
3910
3917
|
},
|
|
3911
3918
|
{
|
|
3912
|
-
name: "
|
|
3919
|
+
name: "msol_mint",
|
|
3913
3920
|
writable: true
|
|
3914
3921
|
},
|
|
3915
3922
|
{
|
|
3916
|
-
name: "
|
|
3923
|
+
name: "burn_msol_from",
|
|
3917
3924
|
writable: true
|
|
3918
3925
|
},
|
|
3919
3926
|
{
|
|
3920
|
-
name: "
|
|
3927
|
+
name: "new_ticket_account",
|
|
3921
3928
|
writable: true
|
|
3922
3929
|
},
|
|
3923
3930
|
{
|
|
3924
|
-
name: "
|
|
3931
|
+
name: "clock"
|
|
3925
3932
|
},
|
|
3926
3933
|
{
|
|
3927
|
-
name: "
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3934
|
+
name: "rent",
|
|
3935
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
3936
|
+
},
|
|
3937
|
+
{
|
|
3938
|
+
name: "token_program"
|
|
3939
|
+
}
|
|
3940
|
+
],
|
|
3941
|
+
args: [
|
|
3942
|
+
{
|
|
3943
|
+
name: "msol_amount",
|
|
3944
|
+
type: "u64"
|
|
3945
|
+
}
|
|
3946
|
+
]
|
|
3947
|
+
},
|
|
3948
|
+
{
|
|
3949
|
+
name: "merge_stake_accounts",
|
|
3950
|
+
docs: [
|
|
3951
|
+
"Merges two stake accounts.",
|
|
3952
|
+
"",
|
|
3953
|
+
"# Parameters",
|
|
3954
|
+
"- `ctx`: The context for the instruction.",
|
|
3955
|
+
"",
|
|
3956
|
+
"# Permission required",
|
|
3957
|
+
"- Permission::Stake",
|
|
3958
|
+
"",
|
|
3959
|
+
"# Integration required",
|
|
3960
|
+
"- Integration::NativeStaking"
|
|
3961
|
+
],
|
|
3962
|
+
discriminator: [
|
|
3963
|
+
173,
|
|
3964
|
+
206,
|
|
3965
|
+
10,
|
|
3966
|
+
246,
|
|
3967
|
+
109,
|
|
3968
|
+
50,
|
|
3969
|
+
244,
|
|
3970
|
+
110
|
|
3971
|
+
],
|
|
3972
|
+
accounts: [
|
|
3973
|
+
{
|
|
3974
|
+
name: "glam_state",
|
|
3975
|
+
writable: true
|
|
3976
|
+
},
|
|
3977
|
+
{
|
|
3978
|
+
name: "glam_vault",
|
|
3979
|
+
writable: true,
|
|
3980
|
+
pda: {
|
|
3981
|
+
seeds: [
|
|
3982
|
+
{
|
|
3983
|
+
kind: "const",
|
|
3984
|
+
value: [
|
|
3985
|
+
118,
|
|
3986
|
+
97,
|
|
3987
|
+
117,
|
|
3988
|
+
108,
|
|
3989
|
+
116
|
|
3990
|
+
]
|
|
3991
|
+
},
|
|
3992
|
+
{
|
|
3932
3993
|
kind: "account",
|
|
3933
|
-
path: "
|
|
3994
|
+
path: "glam_state"
|
|
3995
|
+
}
|
|
3996
|
+
]
|
|
3997
|
+
}
|
|
3998
|
+
},
|
|
3999
|
+
{
|
|
4000
|
+
name: "glam_signer",
|
|
4001
|
+
writable: true,
|
|
4002
|
+
signer: true
|
|
4003
|
+
},
|
|
4004
|
+
{
|
|
4005
|
+
name: "to_stake",
|
|
4006
|
+
writable: true
|
|
4007
|
+
},
|
|
4008
|
+
{
|
|
4009
|
+
name: "from_stake",
|
|
4010
|
+
writable: true
|
|
4011
|
+
},
|
|
4012
|
+
{
|
|
4013
|
+
name: "clock",
|
|
4014
|
+
address: "SysvarC1ock11111111111111111111111111111111"
|
|
4015
|
+
},
|
|
4016
|
+
{
|
|
4017
|
+
name: "stake_history",
|
|
4018
|
+
address: "SysvarStakeHistory1111111111111111111111111"
|
|
4019
|
+
},
|
|
4020
|
+
{
|
|
4021
|
+
name: "stake_program",
|
|
4022
|
+
address: "Stake11111111111111111111111111111111111111"
|
|
4023
|
+
},
|
|
4024
|
+
{
|
|
4025
|
+
name: "system_program",
|
|
4026
|
+
address: "11111111111111111111111111111111"
|
|
4027
|
+
}
|
|
4028
|
+
],
|
|
4029
|
+
args: []
|
|
4030
|
+
},
|
|
4031
|
+
{
|
|
4032
|
+
name: "meteora_dlmm_add_liquidity_by_strategy",
|
|
4033
|
+
discriminator: [
|
|
4034
|
+
81,
|
|
4035
|
+
139,
|
|
4036
|
+
59,
|
|
4037
|
+
146,
|
|
4038
|
+
176,
|
|
4039
|
+
196,
|
|
4040
|
+
240,
|
|
4041
|
+
216
|
|
4042
|
+
],
|
|
4043
|
+
accounts: [
|
|
4044
|
+
{
|
|
4045
|
+
name: "glam_state"
|
|
4046
|
+
},
|
|
4047
|
+
{
|
|
4048
|
+
name: "glam_vault",
|
|
4049
|
+
writable: true,
|
|
4050
|
+
pda: {
|
|
4051
|
+
seeds: [
|
|
4052
|
+
{
|
|
4053
|
+
kind: "const",
|
|
4054
|
+
value: [
|
|
4055
|
+
118,
|
|
4056
|
+
97,
|
|
4057
|
+
117,
|
|
4058
|
+
108,
|
|
4059
|
+
116
|
|
4060
|
+
]
|
|
3934
4061
|
},
|
|
4062
|
+
{
|
|
4063
|
+
kind: "account",
|
|
4064
|
+
path: "glam_state"
|
|
4065
|
+
}
|
|
4066
|
+
]
|
|
4067
|
+
}
|
|
4068
|
+
},
|
|
4069
|
+
{
|
|
4070
|
+
name: "glam_signer",
|
|
4071
|
+
writable: true,
|
|
4072
|
+
signer: true
|
|
4073
|
+
},
|
|
4074
|
+
{
|
|
4075
|
+
name: "cpi_program",
|
|
4076
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4077
|
+
},
|
|
4078
|
+
{
|
|
4079
|
+
name: "position",
|
|
4080
|
+
writable: true
|
|
4081
|
+
},
|
|
4082
|
+
{
|
|
4083
|
+
name: "lb_pair",
|
|
4084
|
+
writable: true
|
|
4085
|
+
},
|
|
4086
|
+
{
|
|
4087
|
+
name: "bin_array_bitmap_extension",
|
|
4088
|
+
writable: true
|
|
4089
|
+
},
|
|
4090
|
+
{
|
|
4091
|
+
name: "user_token_x",
|
|
4092
|
+
writable: true
|
|
4093
|
+
},
|
|
4094
|
+
{
|
|
4095
|
+
name: "user_token_y",
|
|
4096
|
+
writable: true
|
|
4097
|
+
},
|
|
4098
|
+
{
|
|
4099
|
+
name: "reserve_x",
|
|
4100
|
+
writable: true
|
|
4101
|
+
},
|
|
4102
|
+
{
|
|
4103
|
+
name: "reserve_y",
|
|
4104
|
+
writable: true
|
|
4105
|
+
},
|
|
4106
|
+
{
|
|
4107
|
+
name: "token_x_mint"
|
|
4108
|
+
},
|
|
4109
|
+
{
|
|
4110
|
+
name: "token_y_mint"
|
|
4111
|
+
},
|
|
4112
|
+
{
|
|
4113
|
+
name: "bin_array_lower",
|
|
4114
|
+
writable: true
|
|
4115
|
+
},
|
|
4116
|
+
{
|
|
4117
|
+
name: "bin_array_upper",
|
|
4118
|
+
writable: true
|
|
4119
|
+
},
|
|
4120
|
+
{
|
|
4121
|
+
name: "token_x_program"
|
|
4122
|
+
},
|
|
4123
|
+
{
|
|
4124
|
+
name: "token_y_program"
|
|
4125
|
+
},
|
|
4126
|
+
{
|
|
4127
|
+
name: "event_authority"
|
|
4128
|
+
},
|
|
4129
|
+
{
|
|
4130
|
+
name: "program"
|
|
4131
|
+
}
|
|
4132
|
+
],
|
|
4133
|
+
args: [
|
|
4134
|
+
{
|
|
4135
|
+
name: "params",
|
|
4136
|
+
type: {
|
|
4137
|
+
defined: {
|
|
4138
|
+
name: "LiquidityParameterByStrategy"
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
]
|
|
4143
|
+
},
|
|
4144
|
+
{
|
|
4145
|
+
name: "meteora_dlmm_claim_fee",
|
|
4146
|
+
discriminator: [
|
|
4147
|
+
78,
|
|
4148
|
+
116,
|
|
4149
|
+
98,
|
|
4150
|
+
78,
|
|
4151
|
+
50,
|
|
4152
|
+
82,
|
|
4153
|
+
72,
|
|
4154
|
+
37
|
|
4155
|
+
],
|
|
4156
|
+
accounts: [
|
|
4157
|
+
{
|
|
4158
|
+
name: "glam_state"
|
|
4159
|
+
},
|
|
4160
|
+
{
|
|
4161
|
+
name: "glam_vault",
|
|
4162
|
+
writable: true,
|
|
4163
|
+
pda: {
|
|
4164
|
+
seeds: [
|
|
3935
4165
|
{
|
|
3936
4166
|
kind: "const",
|
|
3937
4167
|
value: [
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
4168
|
+
118,
|
|
4169
|
+
97,
|
|
4170
|
+
117,
|
|
4171
|
+
108,
|
|
4172
|
+
116
|
|
4173
|
+
]
|
|
4174
|
+
},
|
|
4175
|
+
{
|
|
4176
|
+
kind: "account",
|
|
4177
|
+
path: "glam_state"
|
|
4178
|
+
}
|
|
4179
|
+
]
|
|
4180
|
+
}
|
|
4181
|
+
},
|
|
4182
|
+
{
|
|
4183
|
+
name: "glam_signer",
|
|
4184
|
+
writable: true,
|
|
4185
|
+
signer: true
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
name: "cpi_program",
|
|
4189
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4190
|
+
},
|
|
4191
|
+
{
|
|
4192
|
+
name: "lb_pair",
|
|
4193
|
+
writable: true
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
name: "position",
|
|
4197
|
+
writable: true
|
|
4198
|
+
},
|
|
4199
|
+
{
|
|
4200
|
+
name: "bin_array_lower",
|
|
4201
|
+
writable: true
|
|
4202
|
+
},
|
|
4203
|
+
{
|
|
4204
|
+
name: "bin_array_upper",
|
|
4205
|
+
writable: true
|
|
4206
|
+
},
|
|
4207
|
+
{
|
|
4208
|
+
name: "reserve_x",
|
|
4209
|
+
writable: true
|
|
4210
|
+
},
|
|
4211
|
+
{
|
|
4212
|
+
name: "reserve_y",
|
|
4213
|
+
writable: true
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
name: "user_token_x",
|
|
4217
|
+
writable: true
|
|
4218
|
+
},
|
|
4219
|
+
{
|
|
4220
|
+
name: "user_token_y",
|
|
4221
|
+
writable: true
|
|
4222
|
+
},
|
|
4223
|
+
{
|
|
4224
|
+
name: "token_x_mint"
|
|
4225
|
+
},
|
|
4226
|
+
{
|
|
4227
|
+
name: "token_y_mint"
|
|
4228
|
+
},
|
|
4229
|
+
{
|
|
4230
|
+
name: "token_program"
|
|
4231
|
+
},
|
|
4232
|
+
{
|
|
4233
|
+
name: "event_authority"
|
|
4234
|
+
},
|
|
4235
|
+
{
|
|
4236
|
+
name: "program"
|
|
4237
|
+
}
|
|
4238
|
+
],
|
|
4239
|
+
args: []
|
|
4240
|
+
},
|
|
4241
|
+
{
|
|
4242
|
+
name: "meteora_dlmm_close_position",
|
|
4243
|
+
discriminator: [
|
|
4244
|
+
186,
|
|
4245
|
+
117,
|
|
4246
|
+
42,
|
|
4247
|
+
24,
|
|
4248
|
+
221,
|
|
4249
|
+
194,
|
|
4250
|
+
34,
|
|
4251
|
+
143
|
|
4252
|
+
],
|
|
4253
|
+
accounts: [
|
|
4254
|
+
{
|
|
4255
|
+
name: "glam_state"
|
|
4256
|
+
},
|
|
4257
|
+
{
|
|
4258
|
+
name: "glam_vault",
|
|
4259
|
+
writable: true,
|
|
4260
|
+
pda: {
|
|
4261
|
+
seeds: [
|
|
4262
|
+
{
|
|
4263
|
+
kind: "const",
|
|
4264
|
+
value: [
|
|
4265
|
+
118,
|
|
4266
|
+
97,
|
|
4267
|
+
117,
|
|
4268
|
+
108,
|
|
4269
|
+
116
|
|
4270
|
+
]
|
|
4271
|
+
},
|
|
4272
|
+
{
|
|
4273
|
+
kind: "account",
|
|
4274
|
+
path: "glam_state"
|
|
4275
|
+
}
|
|
4276
|
+
]
|
|
4277
|
+
}
|
|
4278
|
+
},
|
|
4279
|
+
{
|
|
4280
|
+
name: "glam_signer",
|
|
4281
|
+
writable: true,
|
|
4282
|
+
signer: true
|
|
4283
|
+
},
|
|
4284
|
+
{
|
|
4285
|
+
name: "cpi_program",
|
|
4286
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4287
|
+
},
|
|
4288
|
+
{
|
|
4289
|
+
name: "position",
|
|
4290
|
+
writable: true
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
name: "lb_pair",
|
|
4294
|
+
writable: true
|
|
4295
|
+
},
|
|
4296
|
+
{
|
|
4297
|
+
name: "bin_array_lower",
|
|
4298
|
+
writable: true
|
|
4299
|
+
},
|
|
4300
|
+
{
|
|
4301
|
+
name: "bin_array_upper",
|
|
4302
|
+
writable: true
|
|
4303
|
+
},
|
|
4304
|
+
{
|
|
4305
|
+
name: "event_authority"
|
|
4306
|
+
},
|
|
4307
|
+
{
|
|
4308
|
+
name: "program"
|
|
4309
|
+
}
|
|
4310
|
+
],
|
|
4311
|
+
args: []
|
|
4312
|
+
},
|
|
4313
|
+
{
|
|
4314
|
+
name: "meteora_dlmm_initialize_position",
|
|
4315
|
+
discriminator: [
|
|
4316
|
+
223,
|
|
4317
|
+
94,
|
|
4318
|
+
215,
|
|
4319
|
+
96,
|
|
4320
|
+
175,
|
|
4321
|
+
181,
|
|
4322
|
+
195,
|
|
4323
|
+
204
|
|
4324
|
+
],
|
|
4325
|
+
accounts: [
|
|
4326
|
+
{
|
|
4327
|
+
name: "glam_state"
|
|
4328
|
+
},
|
|
4329
|
+
{
|
|
4330
|
+
name: "glam_vault",
|
|
4331
|
+
writable: true,
|
|
4332
|
+
pda: {
|
|
4333
|
+
seeds: [
|
|
4334
|
+
{
|
|
4335
|
+
kind: "const",
|
|
4336
|
+
value: [
|
|
4337
|
+
118,
|
|
4338
|
+
97,
|
|
4339
|
+
117,
|
|
4340
|
+
108,
|
|
4341
|
+
116
|
|
3970
4342
|
]
|
|
3971
4343
|
},
|
|
3972
4344
|
{
|
|
3973
4345
|
kind: "account",
|
|
3974
|
-
path: "
|
|
4346
|
+
path: "glam_state"
|
|
3975
4347
|
}
|
|
3976
|
-
]
|
|
3977
|
-
program: {
|
|
3978
|
-
kind: "const",
|
|
3979
|
-
value: [
|
|
3980
|
-
140,
|
|
3981
|
-
151,
|
|
3982
|
-
37,
|
|
3983
|
-
143,
|
|
3984
|
-
78,
|
|
3985
|
-
36,
|
|
3986
|
-
137,
|
|
3987
|
-
241,
|
|
3988
|
-
187,
|
|
3989
|
-
61,
|
|
3990
|
-
16,
|
|
3991
|
-
41,
|
|
3992
|
-
20,
|
|
3993
|
-
142,
|
|
3994
|
-
13,
|
|
3995
|
-
131,
|
|
3996
|
-
11,
|
|
3997
|
-
90,
|
|
3998
|
-
19,
|
|
3999
|
-
153,
|
|
4000
|
-
218,
|
|
4001
|
-
255,
|
|
4002
|
-
16,
|
|
4003
|
-
132,
|
|
4004
|
-
4,
|
|
4005
|
-
142,
|
|
4006
|
-
123,
|
|
4007
|
-
216,
|
|
4008
|
-
219,
|
|
4009
|
-
233,
|
|
4010
|
-
248,
|
|
4011
|
-
89
|
|
4012
|
-
]
|
|
4013
|
-
}
|
|
4348
|
+
]
|
|
4014
4349
|
}
|
|
4015
4350
|
},
|
|
4016
4351
|
{
|
|
4017
|
-
name: "
|
|
4018
|
-
|
|
4352
|
+
name: "glam_signer",
|
|
4353
|
+
writable: true,
|
|
4354
|
+
signer: true
|
|
4019
4355
|
},
|
|
4020
4356
|
{
|
|
4021
|
-
name: "
|
|
4022
|
-
address: "
|
|
4357
|
+
name: "cpi_program",
|
|
4358
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4023
4359
|
},
|
|
4024
4360
|
{
|
|
4025
|
-
name: "
|
|
4026
|
-
|
|
4361
|
+
name: "payer",
|
|
4362
|
+
writable: true,
|
|
4363
|
+
signer: true
|
|
4027
4364
|
},
|
|
4028
4365
|
{
|
|
4029
|
-
name: "
|
|
4030
|
-
|
|
4366
|
+
name: "position",
|
|
4367
|
+
writable: true,
|
|
4368
|
+
signer: true
|
|
4369
|
+
},
|
|
4370
|
+
{
|
|
4371
|
+
name: "lb_pair"
|
|
4031
4372
|
},
|
|
4032
4373
|
{
|
|
4033
4374
|
name: "system_program",
|
|
4034
4375
|
address: "11111111111111111111111111111111"
|
|
4035
4376
|
},
|
|
4036
4377
|
{
|
|
4037
|
-
name: "
|
|
4038
|
-
address: "
|
|
4378
|
+
name: "rent",
|
|
4379
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
4039
4380
|
},
|
|
4040
4381
|
{
|
|
4041
|
-
name: "
|
|
4042
|
-
|
|
4382
|
+
name: "event_authority"
|
|
4383
|
+
},
|
|
4384
|
+
{
|
|
4385
|
+
name: "program"
|
|
4043
4386
|
}
|
|
4044
4387
|
],
|
|
4045
4388
|
args: [
|
|
4046
4389
|
{
|
|
4047
|
-
name: "
|
|
4048
|
-
type: "
|
|
4390
|
+
name: "lower_bin_id",
|
|
4391
|
+
type: "i32"
|
|
4392
|
+
},
|
|
4393
|
+
{
|
|
4394
|
+
name: "width",
|
|
4395
|
+
type: "i32"
|
|
4049
4396
|
}
|
|
4050
4397
|
]
|
|
4051
4398
|
},
|
|
4052
4399
|
{
|
|
4053
|
-
name: "
|
|
4054
|
-
docs: [
|
|
4055
|
-
"Unstakes mSOL to get SOL immediately.",
|
|
4056
|
-
"",
|
|
4057
|
-
"# Parameters",
|
|
4058
|
-
"- `ctx`: The context for the instruction.",
|
|
4059
|
-
"- `msol_amount`: Amount of mSOL to unstake.",
|
|
4060
|
-
"",
|
|
4061
|
-
"# Permission required",
|
|
4062
|
-
"- Permission::LiquidUnstake",
|
|
4063
|
-
"",
|
|
4064
|
-
"# Integration required",
|
|
4065
|
-
"- Integration::Marinade"
|
|
4066
|
-
],
|
|
4400
|
+
name: "meteora_dlmm_remove_liquidity_by_range",
|
|
4067
4401
|
discriminator: [
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4402
|
+
223,
|
|
4403
|
+
12,
|
|
4404
|
+
177,
|
|
4405
|
+
181,
|
|
4406
|
+
96,
|
|
4407
|
+
109,
|
|
4408
|
+
60,
|
|
4409
|
+
124
|
|
4076
4410
|
],
|
|
4077
4411
|
accounts: [
|
|
4078
4412
|
{
|
|
4079
|
-
name: "
|
|
4080
|
-
writable: true,
|
|
4081
|
-
signer: true
|
|
4082
|
-
},
|
|
4083
|
-
{
|
|
4084
|
-
name: "state"
|
|
4413
|
+
name: "glam_state"
|
|
4085
4414
|
},
|
|
4086
4415
|
{
|
|
4087
|
-
name: "
|
|
4416
|
+
name: "glam_vault",
|
|
4088
4417
|
writable: true,
|
|
4089
4418
|
pda: {
|
|
4090
4419
|
seeds: [
|
|
@@ -4100,95 +4429,108 @@ var instructions = [
|
|
|
4100
4429
|
},
|
|
4101
4430
|
{
|
|
4102
4431
|
kind: "account",
|
|
4103
|
-
path: "
|
|
4432
|
+
path: "glam_state"
|
|
4104
4433
|
}
|
|
4105
4434
|
]
|
|
4106
4435
|
}
|
|
4107
4436
|
},
|
|
4108
4437
|
{
|
|
4109
|
-
name: "
|
|
4438
|
+
name: "glam_signer",
|
|
4439
|
+
writable: true,
|
|
4440
|
+
signer: true
|
|
4441
|
+
},
|
|
4442
|
+
{
|
|
4443
|
+
name: "cpi_program",
|
|
4444
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4445
|
+
},
|
|
4446
|
+
{
|
|
4447
|
+
name: "position",
|
|
4110
4448
|
writable: true
|
|
4111
4449
|
},
|
|
4112
4450
|
{
|
|
4113
|
-
name: "
|
|
4451
|
+
name: "lb_pair",
|
|
4114
4452
|
writable: true
|
|
4115
4453
|
},
|
|
4116
4454
|
{
|
|
4117
|
-
name: "
|
|
4455
|
+
name: "bin_array_bitmap_extension",
|
|
4118
4456
|
writable: true
|
|
4119
4457
|
},
|
|
4120
4458
|
{
|
|
4121
|
-
name: "
|
|
4459
|
+
name: "user_token_x",
|
|
4122
4460
|
writable: true
|
|
4123
4461
|
},
|
|
4124
4462
|
{
|
|
4125
|
-
name: "
|
|
4463
|
+
name: "user_token_y",
|
|
4126
4464
|
writable: true
|
|
4127
4465
|
},
|
|
4128
4466
|
{
|
|
4129
|
-
name: "
|
|
4467
|
+
name: "reserve_x",
|
|
4130
4468
|
writable: true
|
|
4131
4469
|
},
|
|
4132
4470
|
{
|
|
4133
|
-
name: "
|
|
4471
|
+
name: "reserve_y",
|
|
4134
4472
|
writable: true
|
|
4135
4473
|
},
|
|
4136
4474
|
{
|
|
4137
|
-
name: "
|
|
4138
|
-
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
4475
|
+
name: "token_x_mint"
|
|
4139
4476
|
},
|
|
4140
4477
|
{
|
|
4141
|
-
name: "
|
|
4142
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
4478
|
+
name: "token_y_mint"
|
|
4143
4479
|
},
|
|
4144
4480
|
{
|
|
4145
|
-
name: "
|
|
4146
|
-
|
|
4481
|
+
name: "bin_array_lower",
|
|
4482
|
+
writable: true
|
|
4483
|
+
},
|
|
4484
|
+
{
|
|
4485
|
+
name: "bin_array_upper",
|
|
4486
|
+
writable: true
|
|
4487
|
+
},
|
|
4488
|
+
{
|
|
4489
|
+
name: "token_x_program"
|
|
4490
|
+
},
|
|
4491
|
+
{
|
|
4492
|
+
name: "token_y_program"
|
|
4493
|
+
},
|
|
4494
|
+
{
|
|
4495
|
+
name: "event_authority"
|
|
4496
|
+
},
|
|
4497
|
+
{
|
|
4498
|
+
name: "program"
|
|
4147
4499
|
}
|
|
4148
4500
|
],
|
|
4149
4501
|
args: [
|
|
4150
4502
|
{
|
|
4151
|
-
name: "
|
|
4152
|
-
type: "
|
|
4503
|
+
name: "from_bin_id",
|
|
4504
|
+
type: "i32"
|
|
4505
|
+
},
|
|
4506
|
+
{
|
|
4507
|
+
name: "to_bin_id",
|
|
4508
|
+
type: "i32"
|
|
4509
|
+
},
|
|
4510
|
+
{
|
|
4511
|
+
name: "bps_to_remove",
|
|
4512
|
+
type: "u16"
|
|
4153
4513
|
}
|
|
4154
4514
|
]
|
|
4155
4515
|
},
|
|
4156
4516
|
{
|
|
4157
|
-
name: "
|
|
4158
|
-
docs: [
|
|
4159
|
-
"Merges two stake accounts.",
|
|
4160
|
-
"",
|
|
4161
|
-
"# Parameters",
|
|
4162
|
-
"- `ctx`: The context for the instruction.",
|
|
4163
|
-
"",
|
|
4164
|
-
"# Permission required",
|
|
4165
|
-
"- Permission::Stake",
|
|
4166
|
-
"",
|
|
4167
|
-
"# Integration required",
|
|
4168
|
-
"- Integration::NativeStaking"
|
|
4169
|
-
],
|
|
4517
|
+
name: "meteora_dlmm_swap",
|
|
4170
4518
|
discriminator: [
|
|
4519
|
+
127,
|
|
4520
|
+
64,
|
|
4521
|
+
37,
|
|
4522
|
+
138,
|
|
4171
4523
|
173,
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
109,
|
|
4176
|
-
50,
|
|
4177
|
-
244,
|
|
4178
|
-
110
|
|
4524
|
+
243,
|
|
4525
|
+
207,
|
|
4526
|
+
84
|
|
4179
4527
|
],
|
|
4180
4528
|
accounts: [
|
|
4181
4529
|
{
|
|
4182
|
-
name: "
|
|
4183
|
-
writable: true,
|
|
4184
|
-
signer: true
|
|
4185
|
-
},
|
|
4186
|
-
{
|
|
4187
|
-
name: "state",
|
|
4188
|
-
writable: true
|
|
4530
|
+
name: "glam_state"
|
|
4189
4531
|
},
|
|
4190
4532
|
{
|
|
4191
|
-
name: "
|
|
4533
|
+
name: "glam_vault",
|
|
4192
4534
|
writable: true,
|
|
4193
4535
|
pda: {
|
|
4194
4536
|
seeds: [
|
|
@@ -4204,37 +4546,80 @@ var instructions = [
|
|
|
4204
4546
|
},
|
|
4205
4547
|
{
|
|
4206
4548
|
kind: "account",
|
|
4207
|
-
path: "
|
|
4549
|
+
path: "glam_state"
|
|
4208
4550
|
}
|
|
4209
4551
|
]
|
|
4210
4552
|
}
|
|
4211
4553
|
},
|
|
4212
4554
|
{
|
|
4213
|
-
name: "
|
|
4555
|
+
name: "glam_signer",
|
|
4556
|
+
writable: true,
|
|
4557
|
+
signer: true
|
|
4558
|
+
},
|
|
4559
|
+
{
|
|
4560
|
+
name: "cpi_program",
|
|
4561
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4562
|
+
},
|
|
4563
|
+
{
|
|
4564
|
+
name: "lb_pair",
|
|
4214
4565
|
writable: true
|
|
4215
4566
|
},
|
|
4216
4567
|
{
|
|
4217
|
-
name: "
|
|
4568
|
+
name: "bin_array_bitmap_extension"
|
|
4569
|
+
},
|
|
4570
|
+
{
|
|
4571
|
+
name: "reserve_x",
|
|
4218
4572
|
writable: true
|
|
4219
4573
|
},
|
|
4220
4574
|
{
|
|
4221
|
-
name: "
|
|
4222
|
-
|
|
4575
|
+
name: "reserve_y",
|
|
4576
|
+
writable: true
|
|
4223
4577
|
},
|
|
4224
4578
|
{
|
|
4225
|
-
name: "
|
|
4226
|
-
|
|
4579
|
+
name: "user_token_in",
|
|
4580
|
+
writable: true
|
|
4227
4581
|
},
|
|
4228
4582
|
{
|
|
4229
|
-
name: "
|
|
4230
|
-
|
|
4583
|
+
name: "user_token_out",
|
|
4584
|
+
writable: true
|
|
4231
4585
|
},
|
|
4232
4586
|
{
|
|
4233
|
-
name: "
|
|
4234
|
-
|
|
4587
|
+
name: "token_x_mint"
|
|
4588
|
+
},
|
|
4589
|
+
{
|
|
4590
|
+
name: "token_y_mint"
|
|
4591
|
+
},
|
|
4592
|
+
{
|
|
4593
|
+
name: "oracle",
|
|
4594
|
+
writable: true
|
|
4595
|
+
},
|
|
4596
|
+
{
|
|
4597
|
+
name: "host_fee_in",
|
|
4598
|
+
writable: true
|
|
4599
|
+
},
|
|
4600
|
+
{
|
|
4601
|
+
name: "token_x_program"
|
|
4602
|
+
},
|
|
4603
|
+
{
|
|
4604
|
+
name: "token_y_program"
|
|
4605
|
+
},
|
|
4606
|
+
{
|
|
4607
|
+
name: "event_authority"
|
|
4608
|
+
},
|
|
4609
|
+
{
|
|
4610
|
+
name: "program"
|
|
4235
4611
|
}
|
|
4236
4612
|
],
|
|
4237
|
-
args: [
|
|
4613
|
+
args: [
|
|
4614
|
+
{
|
|
4615
|
+
name: "amount_in",
|
|
4616
|
+
type: "u64"
|
|
4617
|
+
},
|
|
4618
|
+
{
|
|
4619
|
+
name: "min_amount_out",
|
|
4620
|
+
type: "u64"
|
|
4621
|
+
}
|
|
4622
|
+
]
|
|
4238
4623
|
},
|
|
4239
4624
|
{
|
|
4240
4625
|
name: "mint_tokens",
|
|
@@ -4268,14 +4653,14 @@ var instructions = [
|
|
|
4268
4653
|
writable: true
|
|
4269
4654
|
},
|
|
4270
4655
|
{
|
|
4271
|
-
name: "
|
|
4272
|
-
writable: true
|
|
4273
|
-
},
|
|
4274
|
-
{
|
|
4275
|
-
name: "signer",
|
|
4656
|
+
name: "glam_signer",
|
|
4276
4657
|
writable: true,
|
|
4277
4658
|
signer: true
|
|
4278
4659
|
},
|
|
4660
|
+
{
|
|
4661
|
+
name: "glam_mint",
|
|
4662
|
+
writable: true
|
|
4663
|
+
},
|
|
4279
4664
|
{
|
|
4280
4665
|
name: "mint_to",
|
|
4281
4666
|
writable: true,
|
|
@@ -4498,16 +4883,11 @@ var instructions = [
|
|
|
4498
4883
|
],
|
|
4499
4884
|
accounts: [
|
|
4500
4885
|
{
|
|
4501
|
-
name: "
|
|
4502
|
-
writable: true,
|
|
4503
|
-
signer: true
|
|
4504
|
-
},
|
|
4505
|
-
{
|
|
4506
|
-
name: "state",
|
|
4886
|
+
name: "glam_state",
|
|
4507
4887
|
writable: true
|
|
4508
4888
|
},
|
|
4509
4889
|
{
|
|
4510
|
-
name: "
|
|
4890
|
+
name: "glam_vault",
|
|
4511
4891
|
writable: true,
|
|
4512
4892
|
pda: {
|
|
4513
4893
|
seeds: [
|
|
@@ -4523,11 +4903,16 @@ var instructions = [
|
|
|
4523
4903
|
},
|
|
4524
4904
|
{
|
|
4525
4905
|
kind: "account",
|
|
4526
|
-
path: "
|
|
4906
|
+
path: "glam_state"
|
|
4527
4907
|
}
|
|
4528
4908
|
]
|
|
4529
4909
|
}
|
|
4530
4910
|
},
|
|
4911
|
+
{
|
|
4912
|
+
name: "glam_signer",
|
|
4913
|
+
writable: true,
|
|
4914
|
+
signer: true
|
|
4915
|
+
},
|
|
4531
4916
|
{
|
|
4532
4917
|
name: "existing_stake",
|
|
4533
4918
|
writable: true
|
|
@@ -4583,11 +4968,11 @@ var instructions = [
|
|
|
4583
4968
|
],
|
|
4584
4969
|
accounts: [
|
|
4585
4970
|
{
|
|
4586
|
-
name: "
|
|
4971
|
+
name: "glam_state",
|
|
4587
4972
|
writable: true
|
|
4588
4973
|
},
|
|
4589
4974
|
{
|
|
4590
|
-
name: "
|
|
4975
|
+
name: "glam_signer",
|
|
4591
4976
|
writable: true,
|
|
4592
4977
|
signer: true
|
|
4593
4978
|
}
|
|
@@ -4630,14 +5015,14 @@ var instructions = [
|
|
|
4630
5015
|
name: "glam_state"
|
|
4631
5016
|
},
|
|
4632
5017
|
{
|
|
4633
|
-
name: "
|
|
4634
|
-
writable: true
|
|
4635
|
-
},
|
|
4636
|
-
{
|
|
4637
|
-
name: "signer",
|
|
5018
|
+
name: "glam_signer",
|
|
4638
5019
|
writable: true,
|
|
4639
5020
|
signer: true
|
|
4640
5021
|
},
|
|
5022
|
+
{
|
|
5023
|
+
name: "glam_mint",
|
|
5024
|
+
writable: true
|
|
5025
|
+
},
|
|
4641
5026
|
{
|
|
4642
5027
|
name: "token_2022_program",
|
|
4643
5028
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -4681,16 +5066,11 @@ var instructions = [
|
|
|
4681
5066
|
],
|
|
4682
5067
|
accounts: [
|
|
4683
5068
|
{
|
|
4684
|
-
name: "
|
|
4685
|
-
writable: true,
|
|
4686
|
-
signer: true
|
|
4687
|
-
},
|
|
4688
|
-
{
|
|
4689
|
-
name: "state",
|
|
5069
|
+
name: "glam_state",
|
|
4690
5070
|
writable: true
|
|
4691
5071
|
},
|
|
4692
5072
|
{
|
|
4693
|
-
name: "
|
|
5073
|
+
name: "glam_vault",
|
|
4694
5074
|
writable: true,
|
|
4695
5075
|
pda: {
|
|
4696
5076
|
seeds: [
|
|
@@ -4706,11 +5086,16 @@ var instructions = [
|
|
|
4706
5086
|
},
|
|
4707
5087
|
{
|
|
4708
5088
|
kind: "account",
|
|
4709
|
-
path: "
|
|
5089
|
+
path: "glam_state"
|
|
4710
5090
|
}
|
|
4711
5091
|
]
|
|
4712
5092
|
}
|
|
4713
5093
|
},
|
|
5094
|
+
{
|
|
5095
|
+
name: "glam_signer",
|
|
5096
|
+
writable: true,
|
|
5097
|
+
signer: true
|
|
5098
|
+
},
|
|
4714
5099
|
{
|
|
4715
5100
|
name: "existing_stake",
|
|
4716
5101
|
writable: true
|
|
@@ -4766,15 +5151,10 @@ var instructions = [
|
|
|
4766
5151
|
],
|
|
4767
5152
|
accounts: [
|
|
4768
5153
|
{
|
|
4769
|
-
name: "
|
|
4770
|
-
writable: true,
|
|
4771
|
-
signer: true
|
|
4772
|
-
},
|
|
4773
|
-
{
|
|
4774
|
-
name: "state"
|
|
5154
|
+
name: "glam_state"
|
|
4775
5155
|
},
|
|
4776
5156
|
{
|
|
4777
|
-
name: "
|
|
5157
|
+
name: "glam_vault",
|
|
4778
5158
|
writable: true,
|
|
4779
5159
|
pda: {
|
|
4780
5160
|
seeds: [
|
|
@@ -4790,11 +5170,16 @@ var instructions = [
|
|
|
4790
5170
|
},
|
|
4791
5171
|
{
|
|
4792
5172
|
kind: "account",
|
|
4793
|
-
path: "
|
|
5173
|
+
path: "glam_state"
|
|
4794
5174
|
}
|
|
4795
5175
|
]
|
|
4796
5176
|
}
|
|
4797
5177
|
},
|
|
5178
|
+
{
|
|
5179
|
+
name: "glam_signer",
|
|
5180
|
+
writable: true,
|
|
5181
|
+
signer: true
|
|
5182
|
+
},
|
|
4798
5183
|
{
|
|
4799
5184
|
name: "stake_pool",
|
|
4800
5185
|
writable: true
|
|
@@ -4821,7 +5206,7 @@ var instructions = [
|
|
|
4821
5206
|
seeds: [
|
|
4822
5207
|
{
|
|
4823
5208
|
kind: "account",
|
|
4824
|
-
path: "
|
|
5209
|
+
path: "glam_vault"
|
|
4825
5210
|
},
|
|
4826
5211
|
{
|
|
4827
5212
|
kind: "const",
|
|
@@ -4952,16 +5337,11 @@ var instructions = [
|
|
|
4952
5337
|
],
|
|
4953
5338
|
accounts: [
|
|
4954
5339
|
{
|
|
4955
|
-
name: "
|
|
4956
|
-
writable: true,
|
|
4957
|
-
signer: true
|
|
4958
|
-
},
|
|
4959
|
-
{
|
|
4960
|
-
name: "state",
|
|
5340
|
+
name: "glam_state",
|
|
4961
5341
|
writable: true
|
|
4962
5342
|
},
|
|
4963
5343
|
{
|
|
4964
|
-
name: "
|
|
5344
|
+
name: "glam_vault",
|
|
4965
5345
|
writable: true,
|
|
4966
5346
|
pda: {
|
|
4967
5347
|
seeds: [
|
|
@@ -4977,11 +5357,16 @@ var instructions = [
|
|
|
4977
5357
|
},
|
|
4978
5358
|
{
|
|
4979
5359
|
kind: "account",
|
|
4980
|
-
path: "
|
|
5360
|
+
path: "glam_state"
|
|
4981
5361
|
}
|
|
4982
5362
|
]
|
|
4983
5363
|
}
|
|
4984
5364
|
},
|
|
5365
|
+
{
|
|
5366
|
+
name: "glam_signer",
|
|
5367
|
+
writable: true,
|
|
5368
|
+
signer: true
|
|
5369
|
+
},
|
|
4985
5370
|
{
|
|
4986
5371
|
name: "vault_stake_account",
|
|
4987
5372
|
writable: true
|
|
@@ -4993,7 +5378,7 @@ var instructions = [
|
|
|
4993
5378
|
seeds: [
|
|
4994
5379
|
{
|
|
4995
5380
|
kind: "account",
|
|
4996
|
-
path: "
|
|
5381
|
+
path: "glam_vault"
|
|
4997
5382
|
},
|
|
4998
5383
|
{
|
|
4999
5384
|
kind: "const",
|
|
@@ -5162,15 +5547,10 @@ var instructions = [
|
|
|
5162
5547
|
],
|
|
5163
5548
|
accounts: [
|
|
5164
5549
|
{
|
|
5165
|
-
name: "
|
|
5166
|
-
writable: true,
|
|
5167
|
-
signer: true
|
|
5168
|
-
},
|
|
5169
|
-
{
|
|
5170
|
-
name: "state"
|
|
5550
|
+
name: "glam_state"
|
|
5171
5551
|
},
|
|
5172
5552
|
{
|
|
5173
|
-
name: "
|
|
5553
|
+
name: "glam_vault",
|
|
5174
5554
|
writable: true,
|
|
5175
5555
|
pda: {
|
|
5176
5556
|
seeds: [
|
|
@@ -5186,11 +5566,16 @@ var instructions = [
|
|
|
5186
5566
|
},
|
|
5187
5567
|
{
|
|
5188
5568
|
kind: "account",
|
|
5189
|
-
path: "
|
|
5569
|
+
path: "glam_state"
|
|
5190
5570
|
}
|
|
5191
5571
|
]
|
|
5192
5572
|
}
|
|
5193
5573
|
},
|
|
5574
|
+
{
|
|
5575
|
+
name: "glam_signer",
|
|
5576
|
+
writable: true,
|
|
5577
|
+
signer: true
|
|
5578
|
+
},
|
|
5194
5579
|
{
|
|
5195
5580
|
name: "stake_pool",
|
|
5196
5581
|
writable: true
|
|
@@ -5271,16 +5656,11 @@ var instructions = [
|
|
|
5271
5656
|
],
|
|
5272
5657
|
accounts: [
|
|
5273
5658
|
{
|
|
5274
|
-
name: "
|
|
5275
|
-
writable: true,
|
|
5276
|
-
signer: true
|
|
5277
|
-
},
|
|
5278
|
-
{
|
|
5279
|
-
name: "state",
|
|
5659
|
+
name: "glam_state",
|
|
5280
5660
|
writable: true
|
|
5281
5661
|
},
|
|
5282
5662
|
{
|
|
5283
|
-
name: "
|
|
5663
|
+
name: "glam_vault",
|
|
5284
5664
|
writable: true,
|
|
5285
5665
|
pda: {
|
|
5286
5666
|
seeds: [
|
|
@@ -5296,11 +5676,16 @@ var instructions = [
|
|
|
5296
5676
|
},
|
|
5297
5677
|
{
|
|
5298
5678
|
kind: "account",
|
|
5299
|
-
path: "
|
|
5679
|
+
path: "glam_state"
|
|
5300
5680
|
}
|
|
5301
5681
|
]
|
|
5302
5682
|
}
|
|
5303
5683
|
},
|
|
5684
|
+
{
|
|
5685
|
+
name: "glam_signer",
|
|
5686
|
+
writable: true,
|
|
5687
|
+
signer: true
|
|
5688
|
+
},
|
|
5304
5689
|
{
|
|
5305
5690
|
name: "vault_stake_account",
|
|
5306
5691
|
writable: true
|
|
@@ -5361,7 +5746,6 @@ var instructions = [
|
|
|
5361
5746
|
{
|
|
5362
5747
|
name: "subscribe",
|
|
5363
5748
|
docs: [
|
|
5364
|
-
"Investor",
|
|
5365
5749
|
"Subscribes to a specified amount of shares.",
|
|
5366
5750
|
"",
|
|
5367
5751
|
"# Parameters",
|
|
@@ -5677,6 +6061,202 @@ var instructions = [
|
|
|
5677
6061
|
}
|
|
5678
6062
|
]
|
|
5679
6063
|
},
|
|
6064
|
+
{
|
|
6065
|
+
name: "transfer_sol_to_wsol",
|
|
6066
|
+
docs: [
|
|
6067
|
+
"Transfer vault SOL to wSOL token account.",
|
|
6068
|
+
"",
|
|
6069
|
+
"# Parameters",
|
|
6070
|
+
"- `ctx`: The context for the instruction.",
|
|
6071
|
+
"- `lamports`: The amount of SOL to transfer.",
|
|
6072
|
+
"",
|
|
6073
|
+
"# Permission required",
|
|
6074
|
+
"- Permission::WSolWrap"
|
|
6075
|
+
],
|
|
6076
|
+
discriminator: [
|
|
6077
|
+
42,
|
|
6078
|
+
189,
|
|
6079
|
+
85,
|
|
6080
|
+
229,
|
|
6081
|
+
150,
|
|
6082
|
+
198,
|
|
6083
|
+
3,
|
|
6084
|
+
195
|
|
6085
|
+
],
|
|
6086
|
+
accounts: [
|
|
6087
|
+
{
|
|
6088
|
+
name: "glam_state"
|
|
6089
|
+
},
|
|
6090
|
+
{
|
|
6091
|
+
name: "glam_vault",
|
|
6092
|
+
writable: true,
|
|
6093
|
+
pda: {
|
|
6094
|
+
seeds: [
|
|
6095
|
+
{
|
|
6096
|
+
kind: "const",
|
|
6097
|
+
value: [
|
|
6098
|
+
118,
|
|
6099
|
+
97,
|
|
6100
|
+
117,
|
|
6101
|
+
108,
|
|
6102
|
+
116
|
|
6103
|
+
]
|
|
6104
|
+
},
|
|
6105
|
+
{
|
|
6106
|
+
kind: "account",
|
|
6107
|
+
path: "glam_state"
|
|
6108
|
+
}
|
|
6109
|
+
]
|
|
6110
|
+
}
|
|
6111
|
+
},
|
|
6112
|
+
{
|
|
6113
|
+
name: "glam_signer",
|
|
6114
|
+
writable: true,
|
|
6115
|
+
signer: true
|
|
6116
|
+
},
|
|
6117
|
+
{
|
|
6118
|
+
name: "to",
|
|
6119
|
+
writable: true,
|
|
6120
|
+
pda: {
|
|
6121
|
+
seeds: [
|
|
6122
|
+
{
|
|
6123
|
+
kind: "account",
|
|
6124
|
+
path: "glam_vault"
|
|
6125
|
+
},
|
|
6126
|
+
{
|
|
6127
|
+
kind: "const",
|
|
6128
|
+
value: [
|
|
6129
|
+
6,
|
|
6130
|
+
221,
|
|
6131
|
+
246,
|
|
6132
|
+
225,
|
|
6133
|
+
215,
|
|
6134
|
+
101,
|
|
6135
|
+
161,
|
|
6136
|
+
147,
|
|
6137
|
+
217,
|
|
6138
|
+
203,
|
|
6139
|
+
225,
|
|
6140
|
+
70,
|
|
6141
|
+
206,
|
|
6142
|
+
235,
|
|
6143
|
+
121,
|
|
6144
|
+
172,
|
|
6145
|
+
28,
|
|
6146
|
+
180,
|
|
6147
|
+
133,
|
|
6148
|
+
237,
|
|
6149
|
+
95,
|
|
6150
|
+
91,
|
|
6151
|
+
55,
|
|
6152
|
+
145,
|
|
6153
|
+
58,
|
|
6154
|
+
140,
|
|
6155
|
+
245,
|
|
6156
|
+
133,
|
|
6157
|
+
126,
|
|
6158
|
+
255,
|
|
6159
|
+
0,
|
|
6160
|
+
169
|
|
6161
|
+
]
|
|
6162
|
+
},
|
|
6163
|
+
{
|
|
6164
|
+
kind: "const",
|
|
6165
|
+
value: [
|
|
6166
|
+
6,
|
|
6167
|
+
155,
|
|
6168
|
+
136,
|
|
6169
|
+
87,
|
|
6170
|
+
254,
|
|
6171
|
+
171,
|
|
6172
|
+
129,
|
|
6173
|
+
132,
|
|
6174
|
+
251,
|
|
6175
|
+
104,
|
|
6176
|
+
127,
|
|
6177
|
+
99,
|
|
6178
|
+
70,
|
|
6179
|
+
24,
|
|
6180
|
+
192,
|
|
6181
|
+
53,
|
|
6182
|
+
218,
|
|
6183
|
+
196,
|
|
6184
|
+
57,
|
|
6185
|
+
220,
|
|
6186
|
+
26,
|
|
6187
|
+
235,
|
|
6188
|
+
59,
|
|
6189
|
+
85,
|
|
6190
|
+
152,
|
|
6191
|
+
160,
|
|
6192
|
+
240,
|
|
6193
|
+
0,
|
|
6194
|
+
0,
|
|
6195
|
+
0,
|
|
6196
|
+
0,
|
|
6197
|
+
1
|
|
6198
|
+
]
|
|
6199
|
+
}
|
|
6200
|
+
],
|
|
6201
|
+
program: {
|
|
6202
|
+
kind: "const",
|
|
6203
|
+
value: [
|
|
6204
|
+
140,
|
|
6205
|
+
151,
|
|
6206
|
+
37,
|
|
6207
|
+
143,
|
|
6208
|
+
78,
|
|
6209
|
+
36,
|
|
6210
|
+
137,
|
|
6211
|
+
241,
|
|
6212
|
+
187,
|
|
6213
|
+
61,
|
|
6214
|
+
16,
|
|
6215
|
+
41,
|
|
6216
|
+
20,
|
|
6217
|
+
142,
|
|
6218
|
+
13,
|
|
6219
|
+
131,
|
|
6220
|
+
11,
|
|
6221
|
+
90,
|
|
6222
|
+
19,
|
|
6223
|
+
153,
|
|
6224
|
+
218,
|
|
6225
|
+
255,
|
|
6226
|
+
16,
|
|
6227
|
+
132,
|
|
6228
|
+
4,
|
|
6229
|
+
142,
|
|
6230
|
+
123,
|
|
6231
|
+
216,
|
|
6232
|
+
219,
|
|
6233
|
+
233,
|
|
6234
|
+
248,
|
|
6235
|
+
89
|
|
6236
|
+
]
|
|
6237
|
+
}
|
|
6238
|
+
}
|
|
6239
|
+
},
|
|
6240
|
+
{
|
|
6241
|
+
name: "system_program",
|
|
6242
|
+
address: "11111111111111111111111111111111"
|
|
6243
|
+
},
|
|
6244
|
+
{
|
|
6245
|
+
name: "token_program",
|
|
6246
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
6247
|
+
},
|
|
6248
|
+
{
|
|
6249
|
+
name: "associated_token_program",
|
|
6250
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
6251
|
+
}
|
|
6252
|
+
],
|
|
6253
|
+
args: [
|
|
6254
|
+
{
|
|
6255
|
+
name: "lamports",
|
|
6256
|
+
type: "u64"
|
|
6257
|
+
}
|
|
6258
|
+
]
|
|
6259
|
+
},
|
|
5680
6260
|
{
|
|
5681
6261
|
name: "update_mint",
|
|
5682
6262
|
docs: [
|
|
@@ -5702,18 +6282,18 @@ var instructions = [
|
|
|
5702
6282
|
],
|
|
5703
6283
|
accounts: [
|
|
5704
6284
|
{
|
|
5705
|
-
name: "glam_state",
|
|
5706
|
-
writable: true
|
|
5707
|
-
},
|
|
5708
|
-
{
|
|
5709
|
-
name: "glam_mint",
|
|
6285
|
+
name: "glam_state",
|
|
5710
6286
|
writable: true
|
|
5711
6287
|
},
|
|
5712
6288
|
{
|
|
5713
|
-
name: "
|
|
6289
|
+
name: "glam_signer",
|
|
5714
6290
|
writable: true,
|
|
5715
6291
|
signer: true
|
|
5716
6292
|
},
|
|
6293
|
+
{
|
|
6294
|
+
name: "glam_mint",
|
|
6295
|
+
writable: true
|
|
6296
|
+
},
|
|
5717
6297
|
{
|
|
5718
6298
|
name: "token_2022_program",
|
|
5719
6299
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -5758,11 +6338,11 @@ var instructions = [
|
|
|
5758
6338
|
],
|
|
5759
6339
|
accounts: [
|
|
5760
6340
|
{
|
|
5761
|
-
name: "
|
|
6341
|
+
name: "glam_state",
|
|
5762
6342
|
writable: true
|
|
5763
6343
|
},
|
|
5764
6344
|
{
|
|
5765
|
-
name: "
|
|
6345
|
+
name: "glam_signer",
|
|
5766
6346
|
writable: true,
|
|
5767
6347
|
signer: true
|
|
5768
6348
|
}
|
|
@@ -5802,11 +6382,11 @@ var instructions = [
|
|
|
5802
6382
|
],
|
|
5803
6383
|
accounts: [
|
|
5804
6384
|
{
|
|
5805
|
-
name: "
|
|
6385
|
+
name: "glam_state",
|
|
5806
6386
|
writable: true
|
|
5807
6387
|
},
|
|
5808
6388
|
{
|
|
5809
|
-
name: "
|
|
6389
|
+
name: "glam_vault",
|
|
5810
6390
|
writable: true,
|
|
5811
6391
|
pda: {
|
|
5812
6392
|
seeds: [
|
|
@@ -5822,11 +6402,16 @@ var instructions = [
|
|
|
5822
6402
|
},
|
|
5823
6403
|
{
|
|
5824
6404
|
kind: "account",
|
|
5825
|
-
path: "
|
|
6405
|
+
path: "glam_state"
|
|
5826
6406
|
}
|
|
5827
6407
|
]
|
|
5828
6408
|
}
|
|
5829
6409
|
},
|
|
6410
|
+
{
|
|
6411
|
+
name: "glam_signer",
|
|
6412
|
+
writable: true,
|
|
6413
|
+
signer: true
|
|
6414
|
+
},
|
|
5830
6415
|
{
|
|
5831
6416
|
name: "asset"
|
|
5832
6417
|
},
|
|
@@ -5837,7 +6422,7 @@ var instructions = [
|
|
|
5837
6422
|
seeds: [
|
|
5838
6423
|
{
|
|
5839
6424
|
kind: "account",
|
|
5840
|
-
path: "
|
|
6425
|
+
path: "glam_vault"
|
|
5841
6426
|
},
|
|
5842
6427
|
{
|
|
5843
6428
|
kind: "account",
|
|
@@ -5894,7 +6479,7 @@ var instructions = [
|
|
|
5894
6479
|
seeds: [
|
|
5895
6480
|
{
|
|
5896
6481
|
kind: "account",
|
|
5897
|
-
path: "
|
|
6482
|
+
path: "glam_signer"
|
|
5898
6483
|
},
|
|
5899
6484
|
{
|
|
5900
6485
|
kind: "account",
|
|
@@ -5944,11 +6529,6 @@ var instructions = [
|
|
|
5944
6529
|
}
|
|
5945
6530
|
}
|
|
5946
6531
|
},
|
|
5947
|
-
{
|
|
5948
|
-
name: "signer",
|
|
5949
|
-
writable: true,
|
|
5950
|
-
signer: true
|
|
5951
|
-
},
|
|
5952
6532
|
{
|
|
5953
6533
|
name: "token_program"
|
|
5954
6534
|
}
|
|
@@ -5986,16 +6566,11 @@ var instructions = [
|
|
|
5986
6566
|
],
|
|
5987
6567
|
accounts: [
|
|
5988
6568
|
{
|
|
5989
|
-
name: "
|
|
5990
|
-
writable: true,
|
|
5991
|
-
signer: true
|
|
5992
|
-
},
|
|
5993
|
-
{
|
|
5994
|
-
name: "state",
|
|
6569
|
+
name: "glam_state",
|
|
5995
6570
|
writable: true
|
|
5996
6571
|
},
|
|
5997
6572
|
{
|
|
5998
|
-
name: "
|
|
6573
|
+
name: "glam_vault",
|
|
5999
6574
|
writable: true,
|
|
6000
6575
|
pda: {
|
|
6001
6576
|
seeds: [
|
|
@@ -6011,11 +6586,16 @@ var instructions = [
|
|
|
6011
6586
|
},
|
|
6012
6587
|
{
|
|
6013
6588
|
kind: "account",
|
|
6014
|
-
path: "
|
|
6589
|
+
path: "glam_state"
|
|
6015
6590
|
}
|
|
6016
6591
|
]
|
|
6017
6592
|
}
|
|
6018
6593
|
},
|
|
6594
|
+
{
|
|
6595
|
+
name: "glam_signer",
|
|
6596
|
+
writable: true,
|
|
6597
|
+
signer: true
|
|
6598
|
+
},
|
|
6019
6599
|
{
|
|
6020
6600
|
name: "clock",
|
|
6021
6601
|
address: "SysvarC1ock11111111111111111111111111111111"
|
|
@@ -6054,10 +6634,10 @@ var instructions = [
|
|
|
6054
6634
|
],
|
|
6055
6635
|
accounts: [
|
|
6056
6636
|
{
|
|
6057
|
-
name: "
|
|
6637
|
+
name: "glam_state"
|
|
6058
6638
|
},
|
|
6059
6639
|
{
|
|
6060
|
-
name: "
|
|
6640
|
+
name: "glam_vault",
|
|
6061
6641
|
writable: true,
|
|
6062
6642
|
pda: {
|
|
6063
6643
|
seeds: [
|
|
@@ -6073,11 +6653,16 @@ var instructions = [
|
|
|
6073
6653
|
},
|
|
6074
6654
|
{
|
|
6075
6655
|
kind: "account",
|
|
6076
|
-
path: "
|
|
6656
|
+
path: "glam_state"
|
|
6077
6657
|
}
|
|
6078
6658
|
]
|
|
6079
6659
|
}
|
|
6080
6660
|
},
|
|
6661
|
+
{
|
|
6662
|
+
name: "glam_signer",
|
|
6663
|
+
writable: true,
|
|
6664
|
+
signer: true
|
|
6665
|
+
},
|
|
6081
6666
|
{
|
|
6082
6667
|
name: "vault_wsol_ata",
|
|
6083
6668
|
writable: true,
|
|
@@ -6085,7 +6670,7 @@ var instructions = [
|
|
|
6085
6670
|
seeds: [
|
|
6086
6671
|
{
|
|
6087
6672
|
kind: "account",
|
|
6088
|
-
path: "
|
|
6673
|
+
path: "glam_vault"
|
|
6089
6674
|
},
|
|
6090
6675
|
{
|
|
6091
6676
|
kind: "const",
|
|
@@ -6125,8 +6710,41 @@ var instructions = [
|
|
|
6125
6710
|
]
|
|
6126
6711
|
},
|
|
6127
6712
|
{
|
|
6128
|
-
kind: "
|
|
6129
|
-
|
|
6713
|
+
kind: "const",
|
|
6714
|
+
value: [
|
|
6715
|
+
6,
|
|
6716
|
+
155,
|
|
6717
|
+
136,
|
|
6718
|
+
87,
|
|
6719
|
+
254,
|
|
6720
|
+
171,
|
|
6721
|
+
129,
|
|
6722
|
+
132,
|
|
6723
|
+
251,
|
|
6724
|
+
104,
|
|
6725
|
+
127,
|
|
6726
|
+
99,
|
|
6727
|
+
70,
|
|
6728
|
+
24,
|
|
6729
|
+
192,
|
|
6730
|
+
53,
|
|
6731
|
+
218,
|
|
6732
|
+
196,
|
|
6733
|
+
57,
|
|
6734
|
+
220,
|
|
6735
|
+
26,
|
|
6736
|
+
235,
|
|
6737
|
+
59,
|
|
6738
|
+
85,
|
|
6739
|
+
152,
|
|
6740
|
+
160,
|
|
6741
|
+
240,
|
|
6742
|
+
0,
|
|
6743
|
+
0,
|
|
6744
|
+
0,
|
|
6745
|
+
0,
|
|
6746
|
+
1
|
|
6747
|
+
]
|
|
6130
6748
|
}
|
|
6131
6749
|
],
|
|
6132
6750
|
program: {
|
|
@@ -6168,15 +6786,6 @@ var instructions = [
|
|
|
6168
6786
|
}
|
|
6169
6787
|
}
|
|
6170
6788
|
},
|
|
6171
|
-
{
|
|
6172
|
-
name: "wsol_mint",
|
|
6173
|
-
address: "So11111111111111111111111111111111111111112"
|
|
6174
|
-
},
|
|
6175
|
-
{
|
|
6176
|
-
name: "signer",
|
|
6177
|
-
writable: true,
|
|
6178
|
-
signer: true
|
|
6179
|
-
},
|
|
6180
6789
|
{
|
|
6181
6790
|
name: "token_program",
|
|
6182
6791
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -6208,10 +6817,10 @@ var instructions = [
|
|
|
6208
6817
|
],
|
|
6209
6818
|
accounts: [
|
|
6210
6819
|
{
|
|
6211
|
-
name: "
|
|
6820
|
+
name: "glam_state"
|
|
6212
6821
|
},
|
|
6213
6822
|
{
|
|
6214
|
-
name: "
|
|
6823
|
+
name: "glam_vault",
|
|
6215
6824
|
writable: true,
|
|
6216
6825
|
pda: {
|
|
6217
6826
|
seeds: [
|
|
@@ -6227,11 +6836,16 @@ var instructions = [
|
|
|
6227
6836
|
},
|
|
6228
6837
|
{
|
|
6229
6838
|
kind: "account",
|
|
6230
|
-
path: "
|
|
6839
|
+
path: "glam_state"
|
|
6231
6840
|
}
|
|
6232
6841
|
]
|
|
6233
6842
|
}
|
|
6234
6843
|
},
|
|
6844
|
+
{
|
|
6845
|
+
name: "glam_signer",
|
|
6846
|
+
writable: true,
|
|
6847
|
+
signer: true
|
|
6848
|
+
},
|
|
6235
6849
|
{
|
|
6236
6850
|
name: "vault_wsol_ata",
|
|
6237
6851
|
writable: true,
|
|
@@ -6239,7 +6853,7 @@ var instructions = [
|
|
|
6239
6853
|
seeds: [
|
|
6240
6854
|
{
|
|
6241
6855
|
kind: "account",
|
|
6242
|
-
path: "
|
|
6856
|
+
path: "glam_vault"
|
|
6243
6857
|
},
|
|
6244
6858
|
{
|
|
6245
6859
|
kind: "const",
|
|
@@ -6323,13 +6937,7 @@ var instructions = [
|
|
|
6323
6937
|
}
|
|
6324
6938
|
},
|
|
6325
6939
|
{
|
|
6326
|
-
name: "wsol_mint"
|
|
6327
|
-
address: "So11111111111111111111111111111111111111112"
|
|
6328
|
-
},
|
|
6329
|
-
{
|
|
6330
|
-
name: "signer",
|
|
6331
|
-
writable: true,
|
|
6332
|
-
signer: true
|
|
6940
|
+
name: "wsol_mint"
|
|
6333
6941
|
},
|
|
6334
6942
|
{
|
|
6335
6943
|
name: "system_program",
|
|
@@ -6522,7 +7130,7 @@ var errors = [
|
|
|
6522
7130
|
{
|
|
6523
7131
|
code: 51002,
|
|
6524
7132
|
name: "SubscribeRedeemDisable",
|
|
6525
|
-
msg: "
|
|
7133
|
+
msg: "Subscription and redemption disabled"
|
|
6526
7134
|
},
|
|
6527
7135
|
{
|
|
6528
7136
|
code: 51003,
|
|
@@ -7323,6 +7931,41 @@ var types = [
|
|
|
7323
7931
|
},
|
|
7324
7932
|
{
|
|
7325
7933
|
name: "KaminoLending"
|
|
7934
|
+
},
|
|
7935
|
+
{
|
|
7936
|
+
name: "MeteoraDlmm"
|
|
7937
|
+
}
|
|
7938
|
+
]
|
|
7939
|
+
}
|
|
7940
|
+
},
|
|
7941
|
+
{
|
|
7942
|
+
name: "LiquidityParameterByStrategy",
|
|
7943
|
+
type: {
|
|
7944
|
+
kind: "struct",
|
|
7945
|
+
fields: [
|
|
7946
|
+
{
|
|
7947
|
+
name: "amount_x",
|
|
7948
|
+
type: "u64"
|
|
7949
|
+
},
|
|
7950
|
+
{
|
|
7951
|
+
name: "amount_y",
|
|
7952
|
+
type: "u64"
|
|
7953
|
+
},
|
|
7954
|
+
{
|
|
7955
|
+
name: "active_id",
|
|
7956
|
+
type: "i32"
|
|
7957
|
+
},
|
|
7958
|
+
{
|
|
7959
|
+
name: "max_active_bin_slippage",
|
|
7960
|
+
type: "i32"
|
|
7961
|
+
},
|
|
7962
|
+
{
|
|
7963
|
+
name: "strategy_parameters",
|
|
7964
|
+
type: {
|
|
7965
|
+
defined: {
|
|
7966
|
+
name: "StrategyParameters"
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7326
7969
|
}
|
|
7327
7970
|
]
|
|
7328
7971
|
}
|
|
@@ -8089,6 +8732,18 @@ var types = [
|
|
|
8089
8732
|
},
|
|
8090
8733
|
{
|
|
8091
8734
|
name: "DriftModifyOrders"
|
|
8735
|
+
},
|
|
8736
|
+
{
|
|
8737
|
+
name: "MeteoraDlmmInitPosition"
|
|
8738
|
+
},
|
|
8739
|
+
{
|
|
8740
|
+
name: "MeteoraDlmmClosePosition"
|
|
8741
|
+
},
|
|
8742
|
+
{
|
|
8743
|
+
name: "MeteoraDlmmLiquidity"
|
|
8744
|
+
},
|
|
8745
|
+
{
|
|
8746
|
+
name: "MeteoraDlmmSwap"
|
|
8092
8747
|
}
|
|
8093
8748
|
]
|
|
8094
8749
|
}
|
|
@@ -8664,6 +9319,74 @@ var types = [
|
|
|
8664
9319
|
}
|
|
8665
9320
|
]
|
|
8666
9321
|
}
|
|
9322
|
+
},
|
|
9323
|
+
{
|
|
9324
|
+
name: "StrategyParameters",
|
|
9325
|
+
type: {
|
|
9326
|
+
kind: "struct",
|
|
9327
|
+
fields: [
|
|
9328
|
+
{
|
|
9329
|
+
name: "min_bin_id",
|
|
9330
|
+
type: "i32"
|
|
9331
|
+
},
|
|
9332
|
+
{
|
|
9333
|
+
name: "max_bin_id",
|
|
9334
|
+
type: "i32"
|
|
9335
|
+
},
|
|
9336
|
+
{
|
|
9337
|
+
name: "strategy_type",
|
|
9338
|
+
type: {
|
|
9339
|
+
defined: {
|
|
9340
|
+
name: "StrategyType"
|
|
9341
|
+
}
|
|
9342
|
+
}
|
|
9343
|
+
},
|
|
9344
|
+
{
|
|
9345
|
+
name: "parameteres",
|
|
9346
|
+
type: {
|
|
9347
|
+
array: [
|
|
9348
|
+
"u8",
|
|
9349
|
+
64
|
|
9350
|
+
]
|
|
9351
|
+
}
|
|
9352
|
+
}
|
|
9353
|
+
]
|
|
9354
|
+
}
|
|
9355
|
+
},
|
|
9356
|
+
{
|
|
9357
|
+
name: "StrategyType",
|
|
9358
|
+
type: {
|
|
9359
|
+
kind: "enum",
|
|
9360
|
+
variants: [
|
|
9361
|
+
{
|
|
9362
|
+
name: "SpotOneSide"
|
|
9363
|
+
},
|
|
9364
|
+
{
|
|
9365
|
+
name: "CurveOneSide"
|
|
9366
|
+
},
|
|
9367
|
+
{
|
|
9368
|
+
name: "BidAskOneSide"
|
|
9369
|
+
},
|
|
9370
|
+
{
|
|
9371
|
+
name: "SpotBalanced"
|
|
9372
|
+
},
|
|
9373
|
+
{
|
|
9374
|
+
name: "CurveBalanced"
|
|
9375
|
+
},
|
|
9376
|
+
{
|
|
9377
|
+
name: "BidAskBalanced"
|
|
9378
|
+
},
|
|
9379
|
+
{
|
|
9380
|
+
name: "SpotImBalanced"
|
|
9381
|
+
},
|
|
9382
|
+
{
|
|
9383
|
+
name: "CurveImBalanced"
|
|
9384
|
+
},
|
|
9385
|
+
{
|
|
9386
|
+
name: "BidAskImBalanced"
|
|
9387
|
+
}
|
|
9388
|
+
]
|
|
9389
|
+
}
|
|
8667
9390
|
}
|
|
8668
9391
|
];
|
|
8669
9392
|
var constants = [
|
|
@@ -8888,7 +9611,7 @@ class StateModel extends StateIdlModel {
|
|
|
8888
9611
|
// @ts-ignore
|
|
8889
9612
|
mintOpenfundsFields[name] = value;
|
|
8890
9613
|
});
|
|
8891
|
-
mintIdlModel["rawOpenfunds"] = new
|
|
9614
|
+
mintIdlModel["rawOpenfunds"] = new MintOpenfundsModel(mintOpenfundsFields);
|
|
8892
9615
|
}
|
|
8893
9616
|
if (glamMint) {
|
|
8894
9617
|
const extMetadata = getExtensionData(ExtensionType.TokenMetadata, glamMint.tlvData);
|
|
@@ -8966,7 +9689,7 @@ class MintModel extends MintIdlModel {
|
|
|
8966
9689
|
super(data);
|
|
8967
9690
|
}
|
|
8968
9691
|
}
|
|
8969
|
-
class
|
|
9692
|
+
class MintOpenfundsModel {
|
|
8970
9693
|
constructor(obj){
|
|
8971
9694
|
this.isin = obj.isin ?? null;
|
|
8972
9695
|
this.shareClassCurrency = obj.shareClassCurrency ?? null;
|
|
@@ -9268,10 +9991,10 @@ const getErrorFromRPCResponse = (rpcResponse)=>{
|
|
|
9268
9991
|
}
|
|
9269
9992
|
],
|
|
9270
9993
|
[
|
|
9271
|
-
//
|
|
9272
|
-
"
|
|
9994
|
+
// BNSOL - Binance Staked SOL
|
|
9995
|
+
"BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85",
|
|
9273
9996
|
{
|
|
9274
|
-
stateAccount: new PublicKey("
|
|
9997
|
+
stateAccount: new PublicKey("Hr9pzexrBge3vgmBNRR8u42CNQgBXdHm4UkUN2DH4a7r")
|
|
9275
9998
|
}
|
|
9276
9999
|
],
|
|
9277
10000
|
[
|
|
@@ -9793,7 +10516,15 @@ class BaseClient {
|
|
|
9793
10516
|
// - when we run tests with failure cases, this RPC call fails with an incorrect error message so we should ignore it by default
|
|
9794
10517
|
// - gui: wallet apps usually do the simulation themselves, we should ignore the simulation error here by default
|
|
9795
10518
|
// - cli: we should set simulate=true
|
|
9796
|
-
if (simulate)
|
|
10519
|
+
if (simulate) {
|
|
10520
|
+
tx.recentBlockhash = recentBlockhash;
|
|
10521
|
+
tx.feePayer = signer;
|
|
10522
|
+
console.log("Tx payload:", tx.serialize({
|
|
10523
|
+
verifySignatures: false
|
|
10524
|
+
}).toString("base64"));
|
|
10525
|
+
console.error("Simulation failed.");
|
|
10526
|
+
throw e;
|
|
10527
|
+
}
|
|
9797
10528
|
}
|
|
9798
10529
|
if (computeUnitLimit) {
|
|
9799
10530
|
const vTx = new VersionedTransaction(new TransactionMessage({
|
|
@@ -9810,7 +10541,7 @@ class BaseClient {
|
|
|
9810
10541
|
instructions
|
|
9811
10542
|
}).compileToV0Message(lookupTables));
|
|
9812
10543
|
}
|
|
9813
|
-
async sendAndConfirm(tx,
|
|
10544
|
+
async sendAndConfirm(tx, additionalSigners = []) {
|
|
9814
10545
|
const connection = this.provider.connection;
|
|
9815
10546
|
// Mainnet only: use dedicated connection for sending transactions if available
|
|
9816
10547
|
const txConnection = this.cluster === ClusterNetwork.Mainnet ? new Connection(process.env?.NEXT_PUBLIC_TX_RPC || process.env.TX_RPC || connection.rpcEndpoint, {
|
|
@@ -9820,22 +10551,19 @@ class BaseClient {
|
|
|
9820
10551
|
// txs, for example transfer SOL, create ATA, etc.
|
|
9821
10552
|
if (tx instanceof Transaction) {
|
|
9822
10553
|
return await sendAndConfirmTransaction(txConnection, tx, [
|
|
9823
|
-
|
|
10554
|
+
this.getWallet().payer,
|
|
10555
|
+
...additionalSigners
|
|
9824
10556
|
]);
|
|
9825
10557
|
}
|
|
9826
10558
|
let serializedTx;
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
const wallet = this.getWallet();
|
|
9836
|
-
const signedTx = await wallet.signTransaction(tx);
|
|
9837
|
-
serializedTx = signedTx.serialize();
|
|
9838
|
-
}
|
|
10559
|
+
// Anchor provider.sendAndConfirm forces a signature with the wallet, which we don't want
|
|
10560
|
+
// https://github.com/coral-xyz/anchor/blob/v0.30.0/ts/packages/anchor/src/provider.ts#L159
|
|
10561
|
+
const wallet = this.getWallet();
|
|
10562
|
+
const signedTx = await wallet.signTransaction(tx);
|
|
10563
|
+
if (additionalSigners && additionalSigners.length > 0) {
|
|
10564
|
+
signedTx.sign(additionalSigners);
|
|
10565
|
+
}
|
|
10566
|
+
serializedTx = signedTx.serialize();
|
|
9839
10567
|
const txSig = await txConnection.sendRawTransaction(serializedTx, {
|
|
9840
10568
|
// skip simulation since we just did it to compute CUs
|
|
9841
10569
|
// however this means that we need to reconstruct the error, if
|
|
@@ -9915,8 +10643,8 @@ class BaseClient {
|
|
|
9915
10643
|
], this.program.programId);
|
|
9916
10644
|
return pda;
|
|
9917
10645
|
}
|
|
9918
|
-
getVaultAta(
|
|
9919
|
-
return this.getAta(mint, this.getVaultPda(
|
|
10646
|
+
getVaultAta(glamState, mint, programId) {
|
|
10647
|
+
return this.getAta(mint, this.getVaultPda(glamState), programId);
|
|
9920
10648
|
}
|
|
9921
10649
|
/**
|
|
9922
10650
|
* Fetch all the token accounts (including token program and token 2022 program) owned by a public key.
|
|
@@ -9955,8 +10683,8 @@ class BaseClient {
|
|
|
9955
10683
|
const lamports = await this.provider.connection.getBalance(vault);
|
|
9956
10684
|
return lamports / LAMPORTS_PER_SOL;
|
|
9957
10685
|
}
|
|
9958
|
-
async getVaultTokenBalance(
|
|
9959
|
-
const ata = this.getVaultAta(
|
|
10686
|
+
async getVaultTokenBalance(glamState, mint, programId) {
|
|
10687
|
+
const ata = this.getVaultAta(glamState, mint);
|
|
9960
10688
|
const _mint = await getMint(this.provider.connection, mint);
|
|
9961
10689
|
try {
|
|
9962
10690
|
const account = await getAccount(this.provider.connection, ata);
|
|
@@ -10024,25 +10752,25 @@ class BaseClient {
|
|
|
10024
10752
|
*
|
|
10025
10753
|
* @param lamports Desired amount of wSOL
|
|
10026
10754
|
* @returns
|
|
10027
|
-
*/ async maybeWrapSol(
|
|
10028
|
-
const
|
|
10029
|
-
const vaultWsolAta = this.getVaultAta(
|
|
10755
|
+
*/ async maybeWrapSol(glamState, amount, signer) {
|
|
10756
|
+
const glamVault = this.getVaultPda(glamState);
|
|
10757
|
+
const vaultWsolAta = this.getVaultAta(glamState, WSOL);
|
|
10030
10758
|
let wsolBalance = new anchor.BN(0);
|
|
10031
10759
|
try {
|
|
10032
10760
|
wsolBalance = new anchor.BN((await this.provider.connection.getTokenAccountBalance(vaultWsolAta)).value.amount);
|
|
10033
10761
|
} catch (err) {}
|
|
10034
|
-
const solBalance = new anchor.BN(await this.provider.connection.getBalance(
|
|
10762
|
+
const solBalance = new anchor.BN(await this.provider.connection.getBalance(glamVault));
|
|
10035
10763
|
const delta = new anchor.BN(amount).sub(wsolBalance); // wSOL amount needed
|
|
10036
10764
|
if (solBalance.lt(delta)) {
|
|
10037
10765
|
throw new Error("Insufficient funds in vault to complete the transaction");
|
|
10038
10766
|
}
|
|
10039
10767
|
if (delta.gt(new anchor.BN(0)) && solBalance.gte(delta)) {
|
|
10040
10768
|
return await this.program.methods.wsolWrap(delta).accountsPartial({
|
|
10041
|
-
|
|
10042
|
-
|
|
10769
|
+
glamState,
|
|
10770
|
+
glamVault,
|
|
10771
|
+
glamSigner: signer || this.getSigner(),
|
|
10043
10772
|
vaultWsolAta,
|
|
10044
|
-
wsolMint: WSOL
|
|
10045
|
-
signer: signer || this.getSigner()
|
|
10773
|
+
wsolMint: WSOL
|
|
10046
10774
|
}).instruction();
|
|
10047
10775
|
}
|
|
10048
10776
|
return null;
|
|
@@ -10095,22 +10823,32 @@ class BaseClient {
|
|
|
10095
10823
|
}
|
|
10096
10824
|
return StateModel.fromOnchainAccounts(statePda, stateAccount, openfundsMetadataAccount, undefined, this.program.programId);
|
|
10097
10825
|
}
|
|
10098
|
-
|
|
10826
|
+
/**
|
|
10827
|
+
* Fetch all glam states if no filter options provided
|
|
10828
|
+
*
|
|
10829
|
+
* @param filterOptions
|
|
10830
|
+
* @returns
|
|
10831
|
+
*/ async fetchGlamStates(filterOptions) {
|
|
10832
|
+
const { owner, delegate, type } = filterOptions || {};
|
|
10099
10833
|
const stateAccounts = await this.program.account.stateAccount.all();
|
|
10100
10834
|
const openfundsMetadataAccounts = await this.program.account.openfundsMetadataAccount.all();
|
|
10835
|
+
const filteredStateAccounts = stateAccounts.filter((s)=>!type || Object.keys(s.account.accountType)[0] === type).filter((s)=>// if neither owner nor delegate is set, return all
|
|
10836
|
+
// if owner is set, return states owned by the owner
|
|
10837
|
+
// if delegate is set, return states with the delegate
|
|
10838
|
+
!owner && !delegate || owner && s.account.owner.equals(owner) || delegate && s.account.delegateAcls.some((acl)=>acl.pubkey.equals(delegate)));
|
|
10101
10839
|
let openfundsCache = new Map();
|
|
10102
10840
|
openfundsMetadataAccounts.forEach((of)=>{
|
|
10103
10841
|
openfundsCache.set(of.publicKey.toBase58(), of.account);
|
|
10104
10842
|
});
|
|
10105
10843
|
/* fetch first mint */ let mintCache = new Map();
|
|
10106
10844
|
const connection = this.provider.connection;
|
|
10107
|
-
const mintAddresses =
|
|
10845
|
+
const mintAddresses = filteredStateAccounts.map((s)=>s.account.mints[0]).filter((addr)=>!!addr);
|
|
10108
10846
|
const mintAccounts = await connection.getMultipleAccountsInfo(mintAddresses);
|
|
10109
10847
|
mintAccounts.forEach((info, j)=>{
|
|
10110
10848
|
const mintInfo = unpackMint(mintAddresses[j], info, TOKEN_2022_PROGRAM_ID);
|
|
10111
10849
|
mintCache.set(mintAddresses[j].toBase58(), mintInfo);
|
|
10112
10850
|
});
|
|
10113
|
-
return
|
|
10851
|
+
return filteredStateAccounts.map((s)=>StateModel.fromOnchainAccounts(s.publicKey, s.account, openfundsCache.get(s.account.metadata?.pubkey.toBase58() || ""), mintCache.get(s.account.mints[0]?.toBase58() || ""), this.program.programId));
|
|
10114
10852
|
}
|
|
10115
10853
|
constructor(config){
|
|
10116
10854
|
if (config?.provider) {
|
|
@@ -10148,8 +10886,8 @@ class DriftClient {
|
|
|
10148
10886
|
const tx = await this.updateUserCustomMarginRatioTx(statePda, maxLeverage, subAccountId);
|
|
10149
10887
|
return await this.base.sendAndConfirm(tx);
|
|
10150
10888
|
}
|
|
10151
|
-
async updateUserMarginTradingEnabled(statePda, marginTradingEnabled, subAccountId = 0) {
|
|
10152
|
-
const tx = await this.updateUserMarginTradingEnabledTx(statePda, marginTradingEnabled, subAccountId);
|
|
10889
|
+
async updateUserMarginTradingEnabled(statePda, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
10890
|
+
const tx = await this.updateUserMarginTradingEnabledTx(statePda, marginTradingEnabled, subAccountId, txOptions);
|
|
10153
10891
|
return await this.base.sendAndConfirm(tx);
|
|
10154
10892
|
}
|
|
10155
10893
|
async updateUserDelegate(statePda, delegate, subAccountId = 0) {
|
|
@@ -10257,7 +10995,7 @@ class DriftClient {
|
|
|
10257
10995
|
this.base.getVaultPda(glamState);
|
|
10258
10996
|
const [user, userStats] = this.getUser(glamState);
|
|
10259
10997
|
const state = await getDriftStateAccountPublicKey(this.DRIFT_PROGRAM);
|
|
10260
|
-
const GLAM_NAME = "GLAM *.+".split("").concat(Array(24).fill(0));
|
|
10998
|
+
const GLAM_NAME = "GLAM *.+".split("").map((char)=>char.charCodeAt(0)).concat(Array(24).fill(0));
|
|
10261
10999
|
const initializeUserIx = await this.base.program.methods//@ts-ignore
|
|
10262
11000
|
.driftInitializeUser(0, GLAM_NAME).accounts({
|
|
10263
11001
|
glamState,
|
|
@@ -10276,37 +11014,45 @@ class DriftClient {
|
|
|
10276
11014
|
]).transaction();
|
|
10277
11015
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10278
11016
|
}
|
|
10279
|
-
async
|
|
11017
|
+
async updateUserCustomMarginRatioIx(glamState, maxLeverage, subAccountId = 0, txOptions = {}) {
|
|
10280
11018
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10281
|
-
this.base.getVaultPda(glamState);
|
|
10282
11019
|
const [user] = this.getUser(glamState, subAccountId);
|
|
10283
11020
|
// https://github.com/drift-labs/protocol-v2/blob/babed162b08b1fe34e49a81c5aa3e4ec0a88ecdf/programs/drift/src/math/constants.rs#L183-L184
|
|
10284
11021
|
const marginRatio = DRIFT_MARGIN_PRECISION / maxLeverage;
|
|
10285
|
-
|
|
11022
|
+
return await this.base.program.methods.driftUpdateUserCustomMarginRatio(subAccountId, marginRatio).accounts({
|
|
10286
11023
|
glamState,
|
|
10287
11024
|
glamSigner,
|
|
10288
11025
|
user
|
|
10289
|
-
}).
|
|
11026
|
+
}).instruction();
|
|
11027
|
+
}
|
|
11028
|
+
async updateUserCustomMarginRatioTx(glamState, maxLeverage, subAccountId = 0, txOptions = {}) {
|
|
11029
|
+
const tx = new Transaction().add(await this.updateUserCustomMarginRatioIx(glamState, maxLeverage, subAccountId, txOptions));
|
|
10290
11030
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10291
11031
|
}
|
|
10292
|
-
async
|
|
11032
|
+
async updateUserMarginTradingEnabledIx(glamState, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
10293
11033
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10294
11034
|
const [user] = this.getUser(glamState, subAccountId);
|
|
10295
|
-
|
|
11035
|
+
return await this.base.program.methods.driftUpdateUserMarginTradingEnabled(subAccountId, marginTradingEnabled).accounts({
|
|
10296
11036
|
glamState,
|
|
10297
11037
|
glamSigner,
|
|
10298
11038
|
user
|
|
10299
|
-
}).
|
|
11039
|
+
}).instruction();
|
|
11040
|
+
}
|
|
11041
|
+
async updateUserMarginTradingEnabledTx(glamState, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
11042
|
+
const tx = new Transaction().add(...txOptions.preInstructions || [], await this.updateUserMarginTradingEnabledIx(glamState, marginTradingEnabled, subAccountId, txOptions));
|
|
10300
11043
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10301
11044
|
}
|
|
10302
|
-
async
|
|
11045
|
+
async updateUserDelegateIx(glamState, delegate, subAccountId = 0, txOptions = {}) {
|
|
10303
11046
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10304
11047
|
const [user] = this.getUser(glamState, subAccountId);
|
|
10305
|
-
|
|
11048
|
+
return await this.base.program.methods.driftUpdateUserDelegate(subAccountId, new PublicKey(delegate)).accounts({
|
|
10306
11049
|
glamState,
|
|
10307
11050
|
glamSigner,
|
|
10308
11051
|
user
|
|
10309
|
-
}).
|
|
11052
|
+
}).instruction();
|
|
11053
|
+
}
|
|
11054
|
+
async updateUserDelegateTx(glamState, delegate, subAccountId = 0, txOptions = {}) {
|
|
11055
|
+
const tx = new Transaction().add(await this.updateUserDelegateIx(glamState, delegate, subAccountId, txOptions));
|
|
10310
11056
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10311
11057
|
}
|
|
10312
11058
|
async deleteUserTx(glamState, subAccountId = 0, txOptions = {}) {
|
|
@@ -10322,25 +11068,46 @@ class DriftClient {
|
|
|
10322
11068
|
}).transaction();
|
|
10323
11069
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10324
11070
|
}
|
|
10325
|
-
async depositTx(
|
|
11071
|
+
async depositTx(glamState, amount, marketIndex = 1, subAccountId = 0, marketConfigs, txOptions = {}) {
|
|
10326
11072
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10327
|
-
const [user, userStats] = this.getUser(
|
|
11073
|
+
const [user, userStats] = this.getUser(glamState, subAccountId);
|
|
10328
11074
|
const state = await getDriftStateAccountPublicKey(this.DRIFT_PROGRAM);
|
|
10329
11075
|
const { mint, oracle, marketPDA, vaultPDA } = marketConfigs.spot[marketIndex];
|
|
10330
11076
|
const preInstructions = [];
|
|
11077
|
+
// If drift user doesn't exist, create it first
|
|
11078
|
+
const vault = this.base.getVaultPda(glamState);
|
|
11079
|
+
const response = await fetch(`https://api.glam.systems/v0/drift/user?authority=${vault.toBase58()}&accountId=${subAccountId}`);
|
|
11080
|
+
const data = await response.json();
|
|
11081
|
+
if (!data) {
|
|
11082
|
+
const initializeUserStatsIx = await this.base.program.methods.driftInitializeUserStats().accounts({
|
|
11083
|
+
glamState,
|
|
11084
|
+
state,
|
|
11085
|
+
userStats,
|
|
11086
|
+
glamSigner
|
|
11087
|
+
}).instruction();
|
|
11088
|
+
const GLAM_NAME = "GLAM *.+".split("").map((char)=>char.charCodeAt(0)).concat(Array(24).fill(0));
|
|
11089
|
+
const initializeUserIx = await this.base.program.methods.driftInitializeUser(0, GLAM_NAME).accounts({
|
|
11090
|
+
glamState,
|
|
11091
|
+
user,
|
|
11092
|
+
userStats,
|
|
11093
|
+
state,
|
|
11094
|
+
glamSigner
|
|
11095
|
+
}).instruction();
|
|
11096
|
+
preInstructions.push(initializeUserStatsIx, initializeUserIx); // init user stats first
|
|
11097
|
+
}
|
|
10331
11098
|
if (mint === WSOL.toBase58()) {
|
|
10332
|
-
const wrapSolIx = await this.base.maybeWrapSol(
|
|
11099
|
+
const wrapSolIx = await this.base.maybeWrapSol(glamState, amount, glamSigner);
|
|
10333
11100
|
if (wrapSolIx) {
|
|
10334
11101
|
preInstructions.push(wrapSolIx);
|
|
10335
11102
|
}
|
|
10336
11103
|
}
|
|
10337
11104
|
const tx = await this.base.program.methods.driftDeposit(marketIndex, amount, false).accounts({
|
|
10338
|
-
glamState:
|
|
11105
|
+
glamState: glamState,
|
|
10339
11106
|
state,
|
|
10340
11107
|
user,
|
|
10341
11108
|
userStats,
|
|
10342
11109
|
spotMarketVault: new PublicKey(vaultPDA),
|
|
10343
|
-
userTokenAccount: this.base.getVaultAta(
|
|
11110
|
+
userTokenAccount: this.base.getVaultAta(glamState, new PublicKey(mint)),
|
|
10344
11111
|
glamSigner,
|
|
10345
11112
|
tokenProgram: TOKEN_PROGRAM_ID
|
|
10346
11113
|
}).remainingAccounts([
|
|
@@ -10623,8 +11390,8 @@ const BASE = new PublicKey("bJ1TRoFo2P6UHVwqdiipp6Qhp2HaaHpLowZ5LHet8Gm");
|
|
|
10623
11390
|
class JupiterSwapClient {
|
|
10624
11391
|
/*
|
|
10625
11392
|
* Client methods
|
|
10626
|
-
*/ async swap(
|
|
10627
|
-
const tx = await this.swapTx(
|
|
11393
|
+
*/ async swap(glamState, quoteParams, quoteResponse, swapInstructions, txOptions = {}) {
|
|
11394
|
+
const tx = await this.swapTx(glamState, quoteParams, quoteResponse, swapInstructions, txOptions);
|
|
10628
11395
|
return await this.base.sendAndConfirm(tx);
|
|
10629
11396
|
}
|
|
10630
11397
|
async setMaxSwapSlippage(statePda, slippageBps, txOptions = {}) {
|
|
@@ -10633,9 +11400,9 @@ class JupiterSwapClient {
|
|
|
10633
11400
|
}
|
|
10634
11401
|
/*
|
|
10635
11402
|
* API methods
|
|
10636
|
-
*/ async swapTx(
|
|
10637
|
-
const
|
|
10638
|
-
const
|
|
11403
|
+
*/ async swapTx(glamState, quoteParams, quoteResponse, swapInstructions, txOptions = {}) {
|
|
11404
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11405
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
10639
11406
|
let swapInstruction;
|
|
10640
11407
|
let addressLookupTableAddresses;
|
|
10641
11408
|
const inputMint = new PublicKey(quoteParams?.inputMint || quoteResponse.inputMint);
|
|
@@ -10649,7 +11416,7 @@ class JupiterSwapClient {
|
|
|
10649
11416
|
}
|
|
10650
11417
|
quoteResponse = await this.getQuoteResponse(quoteParams);
|
|
10651
11418
|
}
|
|
10652
|
-
const ins = await this.getSwapInstructions(quoteResponse,
|
|
11419
|
+
const ins = await this.getSwapInstructions(quoteResponse, glamVault);
|
|
10653
11420
|
swapInstruction = ins.swapInstruction;
|
|
10654
11421
|
addressLookupTableAddresses = ins.addressLookupTableAddresses;
|
|
10655
11422
|
} else {
|
|
@@ -10657,17 +11424,17 @@ class JupiterSwapClient {
|
|
|
10657
11424
|
addressLookupTableAddresses = swapInstructions.addressLookupTableAddresses;
|
|
10658
11425
|
}
|
|
10659
11426
|
const lookupTables = await this.base.getAdressLookupTableAccounts(addressLookupTableAddresses);
|
|
10660
|
-
const swapIx = this.toTransactionInstruction(swapInstruction,
|
|
11427
|
+
const swapIx = this.toTransactionInstruction(swapInstruction, glamVault.toBase58());
|
|
10661
11428
|
const [inputTokenProgram, outputTokenProgram] = await Promise.all([
|
|
10662
11429
|
this.getTokenProgram(inputMint),
|
|
10663
11430
|
this.getTokenProgram(outputMint)
|
|
10664
11431
|
]);
|
|
10665
11432
|
const inputStakePool = ASSETS_MAINNET.get(inputMint.toBase58())?.stateAccount || null;
|
|
10666
11433
|
const outputStakePool = ASSETS_MAINNET.get(outputMint.toBase58())?.stateAccount || null;
|
|
10667
|
-
const preInstructions = await this.getPreInstructions(
|
|
11434
|
+
const preInstructions = await this.getPreInstructions(glamState, glamSigner, inputMint, outputMint, amount, inputTokenProgram, outputTokenProgram);
|
|
10668
11435
|
const tx = await this.base.program.methods.jupiterSwap(amount, swapIx.data).accounts({
|
|
10669
|
-
|
|
10670
|
-
|
|
11436
|
+
glamState,
|
|
11437
|
+
glamSigner,
|
|
10671
11438
|
inputMint,
|
|
10672
11439
|
outputMint,
|
|
10673
11440
|
inputTokenProgram,
|
|
@@ -10680,16 +11447,23 @@ class JupiterSwapClient {
|
|
|
10680
11447
|
...txOptions
|
|
10681
11448
|
});
|
|
10682
11449
|
}
|
|
10683
|
-
async setMaxSwapSlippageTx(
|
|
10684
|
-
const
|
|
11450
|
+
async setMaxSwapSlippageTx(glamState, slippageBps, txOptions = {}) {
|
|
11451
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10685
11452
|
const tx = await this.base.program.methods.jupiterSetMaxSwapSlippage(new BN(slippageBps)).accounts({
|
|
10686
|
-
|
|
10687
|
-
|
|
11453
|
+
glamState,
|
|
11454
|
+
glamSigner
|
|
10688
11455
|
}).transaction();
|
|
10689
11456
|
return this.base.intoVersionedTransaction(tx, {
|
|
10690
11457
|
...txOptions
|
|
10691
11458
|
});
|
|
10692
11459
|
}
|
|
11460
|
+
async setMaxSwapSlippageIx(glamState, slippageBps, txOptions = {}) {
|
|
11461
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11462
|
+
return await this.base.program.methods.jupiterSetMaxSwapSlippage(new BN(slippageBps)).accounts({
|
|
11463
|
+
glamState,
|
|
11464
|
+
glamSigner
|
|
11465
|
+
}).instruction();
|
|
11466
|
+
}
|
|
10693
11467
|
async getQuoteResponse(quoteParams) {
|
|
10694
11468
|
const res = await fetch(`${this.base.jupiterApi}/quote?` + new URLSearchParams(Object.entries(quoteParams).map(([key, val])=>[
|
|
10695
11469
|
key,
|
|
@@ -10871,15 +11645,8 @@ class JupiterVoteClient {
|
|
|
10871
11645
|
* @returns
|
|
10872
11646
|
*/ async voteOnProposal(glamState, proposal, side, txOptions = {}) {
|
|
10873
11647
|
const glamVault = this.base.getVaultPda(glamState);
|
|
10874
|
-
const
|
|
10875
|
-
|
|
10876
|
-
proposal.toBuffer(),
|
|
10877
|
-
glamVault.toBuffer()
|
|
10878
|
-
], GOVERNANCE_PROGRAM_ID);
|
|
10879
|
-
const [governor] = PublicKey.findProgramAddressSync([
|
|
10880
|
-
Buffer.from("Governor"),
|
|
10881
|
-
BASE.toBuffer()
|
|
10882
|
-
], GOVERNANCE_PROGRAM_ID);
|
|
11648
|
+
const vote = this.getVotePda(proposal, glamVault);
|
|
11649
|
+
const governor = this.getGovernorPda();
|
|
10883
11650
|
const voteAccountInfo = await this.base.provider.connection.getAccountInfo(vote);
|
|
10884
11651
|
const voteCreated = voteAccountInfo ? true : false;
|
|
10885
11652
|
const preInstructions = [];
|
|
@@ -10900,7 +11667,7 @@ class JupiterVoteClient {
|
|
|
10900
11667
|
locker: this.stakeLocker,
|
|
10901
11668
|
governor,
|
|
10902
11669
|
governProgram: GOVERNANCE_PROGRAM_ID
|
|
10903
|
-
}).transaction();
|
|
11670
|
+
}).preInstructions(preInstructions).transaction();
|
|
10904
11671
|
const vTx = await this.base.intoVersionedTransaction(tx, {
|
|
10905
11672
|
...txOptions
|
|
10906
11673
|
});
|
|
@@ -10908,7 +11675,23 @@ class JupiterVoteClient {
|
|
|
10908
11675
|
}
|
|
10909
11676
|
/*
|
|
10910
11677
|
* Utils
|
|
10911
|
-
*/
|
|
11678
|
+
*/ async fetchVotes(glamState, proposals) {
|
|
11679
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11680
|
+
const votes = proposals.map((proposal)=>this.getVotePda(new PublicKey(proposal), glamVault));
|
|
11681
|
+
const votesAccountInfo = await this.base.provider.connection.getMultipleAccountsInfo(votes);
|
|
11682
|
+
return votesAccountInfo.filter((accountInfo)=>accountInfo !== null).map((accountInfo)=>({
|
|
11683
|
+
// offsets:
|
|
11684
|
+
// 8 (discriminator)
|
|
11685
|
+
// 32 (proposal)
|
|
11686
|
+
// 32 (voter)
|
|
11687
|
+
// 1 (bump)
|
|
11688
|
+
// 1 (side)
|
|
11689
|
+
proposal: new PublicKey(accountInfo.data.subarray(8, 40)),
|
|
11690
|
+
voter: new PublicKey(accountInfo.data.subarray(40, 72)),
|
|
11691
|
+
side: accountInfo.data.readUInt8(73)
|
|
11692
|
+
}));
|
|
11693
|
+
}
|
|
11694
|
+
get stakeLocker() {
|
|
10912
11695
|
const [locker] = PublicKey.findProgramAddressSync([
|
|
10913
11696
|
Buffer.from("Locker"),
|
|
10914
11697
|
BASE.toBuffer()
|
|
@@ -10923,6 +11706,21 @@ class JupiterVoteClient {
|
|
|
10923
11706
|
], JUP_VOTE_PROGRAM);
|
|
10924
11707
|
return escrow;
|
|
10925
11708
|
}
|
|
11709
|
+
getVotePda(proposal, voter) {
|
|
11710
|
+
const [vote] = PublicKey.findProgramAddressSync([
|
|
11711
|
+
Buffer.from("Vote"),
|
|
11712
|
+
proposal.toBuffer(),
|
|
11713
|
+
voter.toBuffer()
|
|
11714
|
+
], GOVERNANCE_PROGRAM_ID);
|
|
11715
|
+
return vote;
|
|
11716
|
+
}
|
|
11717
|
+
getGovernorPda() {
|
|
11718
|
+
const [governor] = PublicKey.findProgramAddressSync([
|
|
11719
|
+
Buffer.from("Governor"),
|
|
11720
|
+
BASE.toBuffer()
|
|
11721
|
+
], GOVERNANCE_PROGRAM_ID);
|
|
11722
|
+
return governor;
|
|
11723
|
+
}
|
|
10926
11724
|
constructor(base){
|
|
10927
11725
|
this.base = base;
|
|
10928
11726
|
}
|
|
@@ -10932,73 +11730,43 @@ const TICKET_SIZE = 88;
|
|
|
10932
11730
|
class MarinadeClient {
|
|
10933
11731
|
/*
|
|
10934
11732
|
* Client methods
|
|
10935
|
-
*/ async
|
|
10936
|
-
const tx = await this.
|
|
11733
|
+
*/ async deposit(statePda, amount) {
|
|
11734
|
+
const tx = await this.depositTx(statePda, amount, {});
|
|
10937
11735
|
return await this.base.sendAndConfirm(tx);
|
|
10938
11736
|
}
|
|
10939
|
-
async
|
|
10940
|
-
const tx = await this.
|
|
11737
|
+
async depositStakeAccount(statePda, stakeAccount) {
|
|
11738
|
+
const tx = await this.depositStakeAccountTx(statePda, stakeAccount, {});
|
|
10941
11739
|
return await this.base.sendAndConfirm(tx);
|
|
10942
11740
|
}
|
|
10943
11741
|
async liquidUnstake(statePda, amount) {
|
|
10944
11742
|
const tx = await this.liquidUnstakeTx(statePda, amount, {});
|
|
10945
11743
|
return await this.base.sendAndConfirm(tx);
|
|
10946
11744
|
}
|
|
10947
|
-
async
|
|
10948
|
-
const tx = await this.
|
|
10949
|
-
return await this.base.sendAndConfirm(tx);
|
|
10950
|
-
}
|
|
10951
|
-
async
|
|
10952
|
-
const tx = await this.
|
|
11745
|
+
async orderUnstake(statePda, amount, txOptions = {}) {
|
|
11746
|
+
const tx = await this.orderUnstakeTx(statePda, amount, txOptions);
|
|
11747
|
+
return await this.base.sendAndConfirm(tx);
|
|
11748
|
+
}
|
|
11749
|
+
async claim(statePda, tickets, txOptions = {}) {
|
|
11750
|
+
const tx = await this.claimTx(statePda, tickets, txOptions);
|
|
10953
11751
|
return await this.base.sendAndConfirm(tx);
|
|
10954
11752
|
}
|
|
10955
|
-
/*
|
|
10956
|
-
* Utils
|
|
10957
|
-
*/ async getExistingTickets(state) {
|
|
10958
|
-
const accounts = await this.base.provider.connection.getParsedProgramAccounts(MARINADE_PROGRAM_ID, {
|
|
10959
|
-
filters: [
|
|
10960
|
-
{
|
|
10961
|
-
dataSize: 88
|
|
10962
|
-
},
|
|
10963
|
-
{
|
|
10964
|
-
memcmp: {
|
|
10965
|
-
offset: 40,
|
|
10966
|
-
bytes: this.base.getVaultPda(state).toBase58()
|
|
10967
|
-
}
|
|
10968
|
-
}
|
|
10969
|
-
]
|
|
10970
|
-
});
|
|
10971
|
-
return accounts.map((a)=>a.pubkey);
|
|
10972
|
-
}
|
|
10973
11753
|
async getTickets(state) {
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
// }
|
|
10980
|
-
const accounts = await this.base.provider.connection.getParsedProgramAccounts(MARINADE_PROGRAM_ID, {
|
|
10981
|
-
filters: [
|
|
10982
|
-
{
|
|
10983
|
-
dataSize: TICKET_SIZE
|
|
10984
|
-
},
|
|
10985
|
-
{
|
|
10986
|
-
memcmp: {
|
|
10987
|
-
offset: 40,
|
|
10988
|
-
bytes: this.base.getVaultPda(state).toBase58()
|
|
10989
|
-
}
|
|
10990
|
-
}
|
|
10991
|
-
]
|
|
10992
|
-
});
|
|
11754
|
+
const accounts = await this._getTicketsAccounts(state);
|
|
11755
|
+
return accounts.map((a)=>a.pubkey);
|
|
11756
|
+
}
|
|
11757
|
+
async getParsedTickets(state) {
|
|
11758
|
+
const accounts = await this._getTicketsAccounts(state);
|
|
10993
11759
|
const currentEpoch = await this.base.provider.connection.getEpochInfo();
|
|
10994
11760
|
return accounts.map((a)=>{
|
|
10995
11761
|
const lamports = Number(a.account.data.readBigInt64LE(72));
|
|
10996
11762
|
const createdEpoch = Number(a.account.data.readBigInt64LE(80));
|
|
11763
|
+
const isDue = currentEpoch.epoch > createdEpoch;
|
|
10997
11764
|
return {
|
|
10998
11765
|
address: a.pubkey,
|
|
10999
11766
|
lamports,
|
|
11000
11767
|
createdEpoch,
|
|
11001
|
-
isDue
|
|
11768
|
+
isDue,
|
|
11769
|
+
isClaimable: isDue && currentEpoch.slotIndex > 5000
|
|
11002
11770
|
};
|
|
11003
11771
|
});
|
|
11004
11772
|
}
|
|
@@ -11039,30 +11807,31 @@ class MarinadeClient {
|
|
|
11039
11807
|
}
|
|
11040
11808
|
/*
|
|
11041
11809
|
* API methods
|
|
11042
|
-
*/ async
|
|
11043
|
-
const
|
|
11044
|
-
const vault = this.base.getVaultPda(
|
|
11810
|
+
*/ async depositTx(glamState, amount, txOptions) {
|
|
11811
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11812
|
+
const vault = this.base.getVaultPda(glamState);
|
|
11045
11813
|
const marinadeState = this.getMarinadeState();
|
|
11046
11814
|
const vaultMsolAta = this.base.getAta(marinadeState.msolMintAddress, vault);
|
|
11047
|
-
const
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11815
|
+
const createMsolAtaIx = createAssociatedTokenAccountIdempotentInstruction(glamSigner, vaultMsolAta, vault, marinadeState.msolMintAddress);
|
|
11816
|
+
const tx = await this.base.program.methods.marinadeDeposit(amount).accounts({
|
|
11817
|
+
glamState,
|
|
11818
|
+
glamSigner,
|
|
11051
11819
|
reservePda: marinadeState.reserveAddress,
|
|
11052
|
-
|
|
11820
|
+
state: marinadeState.marinadeStateAddress,
|
|
11053
11821
|
msolMint: marinadeState.msolMintAddress,
|
|
11054
11822
|
msolMintAuthority: marinadeState.mSolMintAuthority,
|
|
11055
11823
|
liqPoolMsolLeg: marinadeState.msolLeg,
|
|
11056
11824
|
liqPoolMsolLegAuthority: marinadeState.msolLegAuthority,
|
|
11057
11825
|
liqPoolSolLegPda: marinadeState.solLeg,
|
|
11058
11826
|
mintTo: vaultMsolAta,
|
|
11059
|
-
|
|
11060
|
-
}).
|
|
11827
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
11828
|
+
}).preInstructions([
|
|
11829
|
+
createMsolAtaIx
|
|
11830
|
+
]).transaction();
|
|
11061
11831
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11062
11832
|
}
|
|
11063
|
-
async
|
|
11064
|
-
const
|
|
11065
|
-
const vault = this.base.getVaultPda(statePda);
|
|
11833
|
+
async depositStakeAccountTx(glamState, stakeAccount, txOptions) {
|
|
11834
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11066
11835
|
const stakeAccountInfo = await this.getParsedStakeAccountInfo(stakeAccount);
|
|
11067
11836
|
console.log("Stake account info", stakeAccountInfo);
|
|
11068
11837
|
const marinadeState = await new Marinade().getMarinadeState();
|
|
@@ -11070,138 +11839,140 @@ class MarinadeClient {
|
|
|
11070
11839
|
const validatorLookupIndex = validatorRecords.findIndex(({ validatorAccount })=>validatorAccount.equals(stakeAccountInfo.voter));
|
|
11071
11840
|
const validatorIndex = validatorLookupIndex === -1 ? marinadeState.state.validatorSystem.validatorList.count : validatorLookupIndex;
|
|
11072
11841
|
const duplicationFlag = await marinadeState.validatorDuplicationFlag(stakeAccountInfo.voter);
|
|
11073
|
-
const tx = await this.base.program.methods.
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
marinadeState: marinadeState.marinadeStateAddress,
|
|
11842
|
+
const tx = await this.base.program.methods.marinadeDepositStakeAccount(validatorIndex).accounts({
|
|
11843
|
+
glamState,
|
|
11844
|
+
glamSigner,
|
|
11845
|
+
state: marinadeState.marinadeStateAddress,
|
|
11078
11846
|
validatorList: marinadeState.state.validatorSystem.validatorList.account,
|
|
11079
11847
|
stakeList: marinadeState.state.stakeSystem.stakeList.account,
|
|
11080
|
-
|
|
11848
|
+
stakeAccount,
|
|
11081
11849
|
duplicationFlag,
|
|
11082
11850
|
msolMint: MSOL,
|
|
11083
11851
|
msolMintAuthority: await marinadeState.mSolMintAuthority(),
|
|
11084
|
-
mintTo: this.base.getVaultAta(
|
|
11085
|
-
marinadeProgram: MARINADE_PROGRAM_ID,
|
|
11852
|
+
mintTo: this.base.getVaultAta(glamState, MSOL),
|
|
11086
11853
|
clock: SYSVAR_CLOCK_PUBKEY,
|
|
11087
|
-
rent: SYSVAR_RENT_PUBKEY,
|
|
11088
11854
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
11089
11855
|
stakeProgram: StakeProgram.programId
|
|
11090
11856
|
}).transaction();
|
|
11091
11857
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11092
11858
|
}
|
|
11093
|
-
async
|
|
11094
|
-
const
|
|
11095
|
-
const vault = this.base.getVaultPda(state);
|
|
11859
|
+
async orderUnstakeTx(glamState, amount, txOptions) {
|
|
11860
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11096
11861
|
const marinadeState = this.getMarinadeState();
|
|
11097
|
-
const vaultMsolAta = this.base.getVaultAta(
|
|
11862
|
+
const vaultMsolAta = this.base.getVaultAta(glamState, marinadeState.msolMintAddress);
|
|
11098
11863
|
const ticketSeed = Date.now().toString();
|
|
11099
|
-
const ticket = await PublicKey.createWithSeed(
|
|
11864
|
+
const ticket = await PublicKey.createWithSeed(glamSigner, ticketSeed, MARINADE_PROGRAM_ID);
|
|
11100
11865
|
const lamports = await this.base.provider.connection.getMinimumBalanceForRentExemption(TICKET_SIZE);
|
|
11101
11866
|
const createTicketIx = SystemProgram.createAccountWithSeed({
|
|
11102
|
-
fromPubkey:
|
|
11867
|
+
fromPubkey: glamSigner,
|
|
11103
11868
|
newAccountPubkey: ticket,
|
|
11104
|
-
basePubkey:
|
|
11869
|
+
basePubkey: glamSigner,
|
|
11105
11870
|
seed: ticketSeed,
|
|
11106
11871
|
lamports,
|
|
11107
11872
|
space: TICKET_SIZE,
|
|
11108
11873
|
programId: MARINADE_PROGRAM_ID
|
|
11109
11874
|
});
|
|
11110
|
-
const tx = await this.base.program.methods.
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
ticket,
|
|
11875
|
+
const tx = await this.base.program.methods.marinadeOrderUnstake(amount).accounts({
|
|
11876
|
+
glamState,
|
|
11877
|
+
glamSigner,
|
|
11878
|
+
newTicketAccount: ticket,
|
|
11115
11879
|
msolMint: marinadeState.msolMintAddress,
|
|
11116
11880
|
burnMsolFrom: vaultMsolAta,
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11881
|
+
state: marinadeState.marinadeStateAddress,
|
|
11882
|
+
clock: SYSVAR_CLOCK_PUBKEY,
|
|
11883
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
11120
11884
|
}).preInstructions([
|
|
11121
11885
|
createTicketIx
|
|
11122
11886
|
]).transaction();
|
|
11123
11887
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11124
11888
|
}
|
|
11125
|
-
async
|
|
11126
|
-
|
|
11127
|
-
|
|
11889
|
+
async claimTx(glamState, tickets, txOptions) {
|
|
11890
|
+
if (tickets.length < 1) {
|
|
11891
|
+
throw new Error("At least one ticket is required");
|
|
11892
|
+
}
|
|
11893
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11128
11894
|
const marinadeState = this.getMarinadeState();
|
|
11129
|
-
const tx = await this.base.program.methods.
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11895
|
+
const tx = await this.base.program.methods.marinadeClaim().accounts({
|
|
11896
|
+
glamState,
|
|
11897
|
+
glamSigner,
|
|
11898
|
+
ticketAccount: tickets[0],
|
|
11899
|
+
state: marinadeState.marinadeStateAddress,
|
|
11134
11900
|
reservePda: marinadeState.reserveAddress,
|
|
11135
|
-
|
|
11136
|
-
}).remainingAccounts(tickets.map((t)=>({
|
|
11901
|
+
clock: SYSVAR_CLOCK_PUBKEY
|
|
11902
|
+
}).remainingAccounts(tickets.slice(1).map((t)=>({
|
|
11137
11903
|
pubkey: t,
|
|
11138
11904
|
isSigner: false,
|
|
11139
11905
|
isWritable: true
|
|
11140
11906
|
}))).transaction();
|
|
11141
11907
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11142
11908
|
}
|
|
11143
|
-
async liquidUnstakeTx(
|
|
11144
|
-
const
|
|
11145
|
-
const vault = this.base.getVaultPda(
|
|
11909
|
+
async liquidUnstakeTx(glamState, amount, txOptions) {
|
|
11910
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11911
|
+
const vault = this.base.getVaultPda(glamState);
|
|
11146
11912
|
const marinadeState = this.getMarinadeState();
|
|
11147
11913
|
const vaultMsolAta = this.base.getAta(marinadeState.msolMintAddress, vault);
|
|
11148
|
-
const tx = await this.base.program.methods.marinadeLiquidUnstake(amount).
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
marinadeState: marinadeState.marinadeStateAddress,
|
|
11914
|
+
const tx = await this.base.program.methods.marinadeLiquidUnstake(amount).accounts({
|
|
11915
|
+
glamState,
|
|
11916
|
+
glamSigner,
|
|
11917
|
+
state: marinadeState.marinadeStateAddress,
|
|
11153
11918
|
msolMint: marinadeState.msolMintAddress,
|
|
11154
11919
|
liqPoolSolLegPda: marinadeState.solLeg,
|
|
11155
11920
|
liqPoolMsolLeg: marinadeState.msolLeg,
|
|
11156
11921
|
getMsolFrom: vaultMsolAta,
|
|
11157
|
-
getMsolFromAuthority: vault,
|
|
11158
11922
|
treasuryMsolAccount: marinadeState.treasuryMsolAccount,
|
|
11159
|
-
|
|
11923
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
11160
11924
|
}).transaction();
|
|
11161
11925
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11162
11926
|
}
|
|
11163
11927
|
constructor(base){
|
|
11164
11928
|
this.base = base;
|
|
11929
|
+
this./*
|
|
11930
|
+
* Utils
|
|
11931
|
+
*/ _getTicketsAccounts = async (state)=>await this.base.provider.connection.getParsedProgramAccounts(MARINADE_PROGRAM_ID, {
|
|
11932
|
+
filters: [
|
|
11933
|
+
{
|
|
11934
|
+
dataSize: TICKET_SIZE
|
|
11935
|
+
},
|
|
11936
|
+
{
|
|
11937
|
+
memcmp: {
|
|
11938
|
+
offset: 40,
|
|
11939
|
+
bytes: this.base.getVaultPda(state).toBase58()
|
|
11940
|
+
}
|
|
11941
|
+
}
|
|
11942
|
+
]
|
|
11943
|
+
});
|
|
11165
11944
|
}
|
|
11166
11945
|
}
|
|
11167
11946
|
|
|
11168
11947
|
class WSolClient {
|
|
11169
11948
|
/*
|
|
11170
11949
|
* Client methods
|
|
11171
|
-
*/ async wrap(
|
|
11172
|
-
const tx = await this.wrapTx(
|
|
11950
|
+
*/ async wrap(glamState, amount, txOptions = {}) {
|
|
11951
|
+
const tx = await this.wrapTx(glamState, amount, txOptions);
|
|
11173
11952
|
return await this.base.sendAndConfirm(tx);
|
|
11174
11953
|
}
|
|
11175
|
-
async unwrap(
|
|
11176
|
-
const tx = await this.unwrapTx(
|
|
11954
|
+
async unwrap(glamState, txOptions = {}) {
|
|
11955
|
+
const tx = await this.unwrapTx(glamState, txOptions);
|
|
11177
11956
|
return await this.base.sendAndConfirm(tx);
|
|
11178
11957
|
}
|
|
11179
11958
|
/*
|
|
11180
11959
|
* API methods
|
|
11181
|
-
*/ async wrapTx(
|
|
11182
|
-
const
|
|
11183
|
-
const
|
|
11184
|
-
const vaultWsolAta = this.base.getVaultAta(statePda, WSOL);
|
|
11185
|
-
// @ts-ignore
|
|
11960
|
+
*/ async wrapTx(glamState, amount, txOptions) {
|
|
11961
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11962
|
+
const vaultWsolAta = this.base.getVaultAta(glamState, WSOL);
|
|
11186
11963
|
const tx = await this.base.program.methods.wsolWrap(amount).accountsPartial({
|
|
11187
|
-
|
|
11188
|
-
|
|
11964
|
+
glamState,
|
|
11965
|
+
glamSigner,
|
|
11189
11966
|
vaultWsolAta,
|
|
11190
|
-
wsolMint: WSOL
|
|
11191
|
-
signer
|
|
11967
|
+
wsolMint: WSOL
|
|
11192
11968
|
}).transaction();
|
|
11193
11969
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11194
11970
|
}
|
|
11195
|
-
async unwrapTx(
|
|
11196
|
-
const
|
|
11197
|
-
const
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
state: statePda,
|
|
11201
|
-
vault,
|
|
11202
|
-
vaultWsolAta,
|
|
11203
|
-
wsolMint: WSOL,
|
|
11204
|
-
signer
|
|
11971
|
+
async unwrapTx(glamState, txOptions) {
|
|
11972
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11973
|
+
const tx = await this.base.program.methods.wsolUnwrap().accounts({
|
|
11974
|
+
glamState,
|
|
11975
|
+
glamSigner
|
|
11205
11976
|
}).transaction();
|
|
11206
11977
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11207
11978
|
}
|
|
@@ -11214,62 +11985,62 @@ const STAKE_ACCOUNT_SIZE = 200;
|
|
|
11214
11985
|
class StakingClient {
|
|
11215
11986
|
/*
|
|
11216
11987
|
* High-level API methods
|
|
11217
|
-
*/ async unstake(
|
|
11988
|
+
*/ async unstake(glamState, asset, amount, txOptions = {}) {
|
|
11218
11989
|
const assetStr = asset.toBase58();
|
|
11219
11990
|
let tx;
|
|
11220
11991
|
if (assetStr === MSOL.toBase58()) {
|
|
11221
11992
|
// Marinade
|
|
11222
|
-
tx = await this.marinade.
|
|
11993
|
+
tx = await this.marinade.orderUnstakeTx(glamState, new BN(amount), txOptions);
|
|
11223
11994
|
} else {
|
|
11224
11995
|
// Other LSTs
|
|
11225
11996
|
const assetMeta = this.base.getAssetMeta(assetStr);
|
|
11226
11997
|
if (!assetMeta || !assetMeta.stateAccount) {
|
|
11227
11998
|
throw new Error("Invalid LST: " + asset);
|
|
11228
11999
|
}
|
|
11229
|
-
tx = await this.stakePoolWithdrawStakeTx(
|
|
12000
|
+
tx = await this.stakePoolWithdrawStakeTx(glamState, assetMeta.stateAccount, new BN(amount), true, txOptions);
|
|
11230
12001
|
}
|
|
11231
12002
|
return await this.base.sendAndConfirm(tx);
|
|
11232
12003
|
}
|
|
11233
12004
|
/*
|
|
11234
12005
|
* Client methods
|
|
11235
|
-
*/ async stakePoolDepositSol(
|
|
11236
|
-
const tx = await this.stakePoolDepositSolTx(
|
|
12006
|
+
*/ async stakePoolDepositSol(glamState, stakePool, amount, txOptions = {}) {
|
|
12007
|
+
const tx = await this.stakePoolDepositSolTx(glamState, stakePool, amount);
|
|
11237
12008
|
return await this.base.sendAndConfirm(tx);
|
|
11238
12009
|
}
|
|
11239
|
-
async stakePoolDepositStake(
|
|
11240
|
-
const tx = await this.stakePoolDepositStakeTx(
|
|
12010
|
+
async stakePoolDepositStake(glamState, stakePool, stakeAccount) {
|
|
12011
|
+
const tx = await this.stakePoolDepositStakeTx(glamState, stakePool, stakeAccount);
|
|
11241
12012
|
return await this.base.sendAndConfirm(tx);
|
|
11242
12013
|
}
|
|
11243
|
-
async stakePoolWithdrawStake(
|
|
11244
|
-
const tx = await this.stakePoolWithdrawStakeTx(
|
|
12014
|
+
async stakePoolWithdrawStake(glamState, stakePool, amount) {
|
|
12015
|
+
const tx = await this.stakePoolWithdrawStakeTx(glamState, stakePool, amount);
|
|
11245
12016
|
return await this.base.sendAndConfirm(tx);
|
|
11246
12017
|
}
|
|
11247
|
-
async initializeAndDelegateStake(
|
|
11248
|
-
const tx = await this.initializeAndDelegateStakeTx(
|
|
12018
|
+
async initializeAndDelegateStake(glamState, vote, amount) {
|
|
12019
|
+
const tx = await this.initializeAndDelegateStakeTx(glamState, vote, amount);
|
|
11249
12020
|
return await this.base.sendAndConfirm(tx);
|
|
11250
12021
|
}
|
|
11251
|
-
async deactivateStakeAccounts(
|
|
11252
|
-
const tx = await this.deactivateStakeAccountsTx(
|
|
12022
|
+
async deactivateStakeAccounts(glamState, stakeAccounts) {
|
|
12023
|
+
const tx = await this.deactivateStakeAccountsTx(glamState, stakeAccounts);
|
|
11253
12024
|
return await this.base.sendAndConfirm(tx);
|
|
11254
12025
|
}
|
|
11255
|
-
async withdrawFromStakeAccounts(
|
|
11256
|
-
const tx = await this.withdrawFromStakeAccountsTx(
|
|
12026
|
+
async withdrawFromStakeAccounts(glamState, stakeAccounts) {
|
|
12027
|
+
const tx = await this.withdrawFromStakeAccountsTx(glamState, stakeAccounts);
|
|
11257
12028
|
return await this.base.sendAndConfirm(tx);
|
|
11258
12029
|
}
|
|
11259
|
-
async mergeStakeAccounts(
|
|
11260
|
-
const tx = await this.mergeStakeAccountsTx(
|
|
12030
|
+
async mergeStakeAccounts(glamState, toStake, fromStake) {
|
|
12031
|
+
const tx = await this.mergeStakeAccountsTx(glamState, toStake, fromStake);
|
|
11261
12032
|
return await this.base.sendAndConfirm(tx);
|
|
11262
12033
|
}
|
|
11263
|
-
async splitStakeAccount(
|
|
11264
|
-
const { tx, newStake } = await this.splitStakeAccountTx(
|
|
12034
|
+
async splitStakeAccount(glamState, existingStake, lamports) {
|
|
12035
|
+
const { tx, newStake } = await this.splitStakeAccountTx(glamState, existingStake, lamports);
|
|
11265
12036
|
const txSig = await this.base.sendAndConfirm(tx);
|
|
11266
12037
|
return {
|
|
11267
12038
|
newStake,
|
|
11268
12039
|
txSig
|
|
11269
12040
|
};
|
|
11270
12041
|
}
|
|
11271
|
-
async redelegateStake(
|
|
11272
|
-
const { newStake, tx } = await this.redelegateStakeTx(
|
|
12042
|
+
async redelegateStake(glamState, existingStake, vote) {
|
|
12043
|
+
const { newStake, tx } = await this.redelegateStakeTx(glamState, existingStake, vote);
|
|
11273
12044
|
const txSig = await this.base.sendAndConfirm(tx);
|
|
11274
12045
|
return {
|
|
11275
12046
|
newStake,
|
|
@@ -11415,16 +12186,16 @@ class StakingClient {
|
|
|
11415
12186
|
}
|
|
11416
12187
|
/*
|
|
11417
12188
|
* API methods
|
|
11418
|
-
*/ async stakePoolDepositSolTx(
|
|
11419
|
-
const
|
|
11420
|
-
const
|
|
12189
|
+
*/ async stakePoolDepositSolTx(glamState, stakePool, amount, txOptions = {}) {
|
|
12190
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12191
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11421
12192
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
11422
12193
|
console.log(`stakePool ${stakePool}, programId: ${stakePoolProgram}`);
|
|
11423
12194
|
const tx = await this.base.program.methods.stakePoolDepositSol(amount).accountsPartial({
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
mintTo: this.base.getVaultAta(
|
|
12195
|
+
glamSigner,
|
|
12196
|
+
glamState,
|
|
12197
|
+
glamVault,
|
|
12198
|
+
mintTo: this.base.getVaultAta(glamState, poolMint),
|
|
11428
12199
|
stakePoolProgram,
|
|
11429
12200
|
stakePool,
|
|
11430
12201
|
poolMint: poolMint,
|
|
@@ -11435,9 +12206,9 @@ class StakingClient {
|
|
|
11435
12206
|
}).transaction();
|
|
11436
12207
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11437
12208
|
}
|
|
11438
|
-
async stakePoolDepositStakeTx(
|
|
11439
|
-
const
|
|
11440
|
-
const
|
|
12209
|
+
async stakePoolDepositStakeTx(glamState, stakePool, stakeAccount, txOptions = {}) {
|
|
12210
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12211
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11441
12212
|
const { programId: stakePoolProgram, poolMint, depositAuthority, withdrawAuthority, feeAccount, validatorList, tokenProgramId: tokenProgram, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
11442
12213
|
// All stake accounts owned by the stake pool withdraw authority
|
|
11443
12214
|
const validatorStakeCandidates = await this.getStakeAccountsWithStates(withdrawAuthority);
|
|
@@ -11452,11 +12223,11 @@ class StakingClient {
|
|
|
11452
12223
|
throw new Error("Stake account cannot be deposited to the pool");
|
|
11453
12224
|
}
|
|
11454
12225
|
const tx = await this.base.program.methods.stakePoolDepositStake().accountsPartial({
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
12226
|
+
glamSigner,
|
|
12227
|
+
glamState,
|
|
12228
|
+
glamVault,
|
|
11458
12229
|
vaultStakeAccount: stakeAccount,
|
|
11459
|
-
mintTo: this.base.getVaultAta(
|
|
12230
|
+
mintTo: this.base.getVaultAta(glamState, poolMint),
|
|
11460
12231
|
poolMint,
|
|
11461
12232
|
feeAccount,
|
|
11462
12233
|
stakePool,
|
|
@@ -11473,20 +12244,20 @@ class StakingClient {
|
|
|
11473
12244
|
}).transaction();
|
|
11474
12245
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11475
12246
|
}
|
|
11476
|
-
async stakePoolWithdrawStakeTx(
|
|
11477
|
-
const
|
|
11478
|
-
const
|
|
12247
|
+
async stakePoolWithdrawStakeTx(glamState, stakePool, amount, deactivate = false, txOptions = {}) {
|
|
12248
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12249
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11479
12250
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, validatorList, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
11480
12251
|
// The reserve stake account should NOT be used for withdrawals unless we have no other options.
|
|
11481
12252
|
const validatorStakeCandidates = (await this.getStakeAccountsWithStates(withdrawAuthority)).filter((s)=>!s.address.equals(reserveStake));
|
|
11482
12253
|
console.log("validatorStakeCandidates", validatorStakeCandidates);
|
|
11483
12254
|
const validatorStakeAccount = validatorStakeCandidates.length === 0 ? reserveStake : validatorStakeCandidates[0].address;
|
|
11484
|
-
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(
|
|
12255
|
+
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11485
12256
|
const postInstructions = deactivate ? [
|
|
11486
12257
|
await this.base.program.methods.deactivateStakeAccounts().accountsPartial({
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
12258
|
+
glamSigner,
|
|
12259
|
+
glamState,
|
|
12260
|
+
glamVault,
|
|
11490
12261
|
clock: SYSVAR_CLOCK_PUBKEY,
|
|
11491
12262
|
stakeProgram: StakeProgram.programId
|
|
11492
12263
|
}).remainingAccounts([
|
|
@@ -11498,14 +12269,14 @@ class StakingClient {
|
|
|
11498
12269
|
]).instruction()
|
|
11499
12270
|
] : [];
|
|
11500
12271
|
const tx = await this.base.program.methods.stakePoolWithdrawStake(amount).accountsPartial({
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
12272
|
+
glamSigner,
|
|
12273
|
+
glamState,
|
|
12274
|
+
glamVault,
|
|
11504
12275
|
vaultStakeAccount: stakeAccount,
|
|
11505
12276
|
stakePoolProgram,
|
|
11506
12277
|
stakePool,
|
|
11507
12278
|
poolMint,
|
|
11508
|
-
poolTokenAta: this.base.getVaultAta(
|
|
12279
|
+
poolTokenAta: this.base.getVaultAta(glamState, poolMint),
|
|
11509
12280
|
validatorList,
|
|
11510
12281
|
validatorStakeAccount,
|
|
11511
12282
|
withdrawAuthority,
|
|
@@ -11518,14 +12289,14 @@ class StakingClient {
|
|
|
11518
12289
|
]).postInstructions(postInstructions).transaction();
|
|
11519
12290
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11520
12291
|
}
|
|
11521
|
-
async initializeAndDelegateStakeTx(
|
|
11522
|
-
const
|
|
11523
|
-
const
|
|
11524
|
-
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(
|
|
12292
|
+
async initializeAndDelegateStakeTx(glamState, vote, amount, txOptions = {}) {
|
|
12293
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12294
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12295
|
+
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11525
12296
|
const tx = await this.base.program.methods.initializeAndDelegateStake(amount).accountsPartial({
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
12297
|
+
glamState,
|
|
12298
|
+
glamSigner,
|
|
12299
|
+
glamVault,
|
|
11529
12300
|
vaultStakeAccount: stakeAccount,
|
|
11530
12301
|
vote,
|
|
11531
12302
|
stakeConfig: STAKE_CONFIG_ID,
|
|
@@ -11536,13 +12307,13 @@ class StakingClient {
|
|
|
11536
12307
|
]).transaction();
|
|
11537
12308
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11538
12309
|
}
|
|
11539
|
-
async deactivateStakeAccountsTx(
|
|
11540
|
-
const
|
|
11541
|
-
const
|
|
12310
|
+
async deactivateStakeAccountsTx(glamState, stakeAccounts, txOptions = {}) {
|
|
12311
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12312
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11542
12313
|
const tx = await this.base.program.methods.deactivateStakeAccounts().accountsPartial({
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
12314
|
+
glamState,
|
|
12315
|
+
glamSigner,
|
|
12316
|
+
glamVault,
|
|
11546
12317
|
clock: SYSVAR_CLOCK_PUBKEY,
|
|
11547
12318
|
stakeProgram: StakeProgram.programId
|
|
11548
12319
|
}).remainingAccounts(stakeAccounts.map((a)=>({
|
|
@@ -11552,13 +12323,13 @@ class StakingClient {
|
|
|
11552
12323
|
}))).transaction();
|
|
11553
12324
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11554
12325
|
}
|
|
11555
|
-
async withdrawFromStakeAccountsTx(
|
|
11556
|
-
const
|
|
11557
|
-
const
|
|
12326
|
+
async withdrawFromStakeAccountsTx(glamState, stakeAccounts, txOptions = {}) {
|
|
12327
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12328
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11558
12329
|
const tx = await this.base.program.methods.withdrawFromStakeAccounts().accountsPartial({
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
12330
|
+
glamSigner,
|
|
12331
|
+
glamState,
|
|
12332
|
+
glamVault,
|
|
11562
12333
|
clock: SYSVAR_CLOCK_PUBKEY,
|
|
11563
12334
|
stakeHistory: SYSVAR_STAKE_HISTORY_PUBKEY,
|
|
11564
12335
|
stakeProgram: StakeProgram.programId
|
|
@@ -11569,13 +12340,13 @@ class StakingClient {
|
|
|
11569
12340
|
}))).transaction();
|
|
11570
12341
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11571
12342
|
}
|
|
11572
|
-
async mergeStakeAccountsTx(
|
|
11573
|
-
const
|
|
11574
|
-
const
|
|
12343
|
+
async mergeStakeAccountsTx(glamState, toStake, fromStake, txOptions = {}) {
|
|
12344
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12345
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11575
12346
|
const tx = await this.base.program.methods.mergeStakeAccounts().accountsPartial({
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
12347
|
+
glamSigner,
|
|
12348
|
+
glamState,
|
|
12349
|
+
glamVault,
|
|
11579
12350
|
toStake,
|
|
11580
12351
|
fromStake,
|
|
11581
12352
|
stakeProgram: StakeProgram.programId,
|
|
@@ -11583,14 +12354,14 @@ class StakingClient {
|
|
|
11583
12354
|
}).transaction();
|
|
11584
12355
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11585
12356
|
}
|
|
11586
|
-
async splitStakeAccountTx(
|
|
11587
|
-
const
|
|
11588
|
-
const
|
|
11589
|
-
const [newStake, createStakeAccountIx] = await this.createStakeAccount(
|
|
12357
|
+
async splitStakeAccountTx(glamState, existingStake, lamports, txOptions = {}) {
|
|
12358
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12359
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12360
|
+
const [newStake, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11590
12361
|
const tx = await this.base.program.methods.splitStakeAccount(lamports).accountsPartial({
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
12362
|
+
glamSigner,
|
|
12363
|
+
glamState,
|
|
12364
|
+
glamVault,
|
|
11594
12365
|
existingStake,
|
|
11595
12366
|
newStake,
|
|
11596
12367
|
stakeProgram: StakeProgram.programId
|
|
@@ -11603,14 +12374,14 @@ class StakingClient {
|
|
|
11603
12374
|
newStake
|
|
11604
12375
|
};
|
|
11605
12376
|
}
|
|
11606
|
-
async redelegateStakeTx(
|
|
11607
|
-
const
|
|
11608
|
-
const
|
|
11609
|
-
const [newStake, createStakeAccountIx] = await this.createStakeAccount(
|
|
12377
|
+
async redelegateStakeTx(glamState, existingStake, vote, txOptions = {}) {
|
|
12378
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12379
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12380
|
+
const [newStake, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11610
12381
|
const tx = await this.base.program.methods.redelegateStake().accountsPartial({
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
12382
|
+
glamSigner,
|
|
12383
|
+
glamState,
|
|
12384
|
+
glamVault,
|
|
11614
12385
|
vote,
|
|
11615
12386
|
existingStake,
|
|
11616
12387
|
newStake,
|
|
@@ -11636,10 +12407,11 @@ function getPublicKey(input) {
|
|
|
11636
12407
|
}
|
|
11637
12408
|
class StateClient {
|
|
11638
12409
|
async createState(partialStateModel, singleTx = false, txOptions = {}) {
|
|
12410
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11639
12411
|
let stateModel = this.enrichStateModel(partialStateModel);
|
|
11640
|
-
const
|
|
11641
|
-
const
|
|
11642
|
-
const openfunds = this.base.getOpenfundsPda(
|
|
12412
|
+
const glamState = this.base.getStatePda(stateModel);
|
|
12413
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12414
|
+
const openfunds = this.base.getOpenfundsPda(glamState);
|
|
11643
12415
|
const mints = stateModel.mints;
|
|
11644
12416
|
stateModel.mints = [];
|
|
11645
12417
|
if (mints && mints.length > 1) {
|
|
@@ -11648,49 +12420,52 @@ class StateClient {
|
|
|
11648
12420
|
// No share class, only need to initialize the fund
|
|
11649
12421
|
if (mints && mints.length === 0) {
|
|
11650
12422
|
const txSig = await this.base.program.methods.initializeState(stateModel).accountsPartial({
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
12423
|
+
glamState,
|
|
12424
|
+
glamSigner,
|
|
12425
|
+
glamVault
|
|
11654
12426
|
}).rpc();
|
|
11655
12427
|
return [
|
|
11656
12428
|
txSig,
|
|
11657
|
-
|
|
12429
|
+
glamState
|
|
11658
12430
|
];
|
|
11659
12431
|
}
|
|
11660
12432
|
if (mints && mints.length > 0 && singleTx) {
|
|
11661
12433
|
const initStateIx = await this.base.program.methods.initializeState(stateModel).accountsPartial({
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
12434
|
+
glamState,
|
|
12435
|
+
glamSigner,
|
|
12436
|
+
glamVault
|
|
11665
12437
|
}).instruction();
|
|
11666
12438
|
// FIXME: setting rawOpenfunds to null is a workarond for
|
|
11667
12439
|
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
|
|
11668
12440
|
mints[0].rawOpenfunds = null;
|
|
11669
|
-
const
|
|
12441
|
+
const newMint = this.base.getMintPda(glamState, 0);
|
|
11670
12442
|
const txSig = await this.base.program.methods.addMint(mints[0]).accounts({
|
|
11671
|
-
glamState
|
|
11672
|
-
|
|
12443
|
+
glamState,
|
|
12444
|
+
glamSigner,
|
|
12445
|
+
newMint
|
|
11673
12446
|
}).preInstructions([
|
|
11674
12447
|
initStateIx
|
|
11675
12448
|
]).rpc();
|
|
11676
12449
|
return [
|
|
11677
12450
|
txSig,
|
|
11678
|
-
|
|
12451
|
+
glamState
|
|
11679
12452
|
];
|
|
11680
12453
|
}
|
|
11681
12454
|
const txSig = await this.base.program.methods.initializeState(stateModel).accountsPartial({
|
|
11682
|
-
|
|
11683
|
-
|
|
12455
|
+
glamState,
|
|
12456
|
+
glamVault,
|
|
12457
|
+
glamSigner,
|
|
11684
12458
|
openfundsMetadata: openfunds
|
|
11685
12459
|
}).rpc();
|
|
11686
12460
|
const addMintTxs = await Promise.all((mints || []).map(async (mint, j)=>{
|
|
11687
|
-
const
|
|
12461
|
+
const newMint = this.base.getMintPda(glamState, j);
|
|
11688
12462
|
// FIXME: setting rawOpenfunds to null is a workarond for
|
|
11689
12463
|
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
|
|
11690
12464
|
mint.rawOpenfunds = null;
|
|
11691
12465
|
return await this.base.program.methods.addMint(mint).accounts({
|
|
11692
|
-
glamState
|
|
11693
|
-
|
|
12466
|
+
glamState,
|
|
12467
|
+
glamSigner,
|
|
12468
|
+
newMint
|
|
11694
12469
|
}).preInstructions([
|
|
11695
12470
|
// FIXME: estimate compute units
|
|
11696
12471
|
ComputeBudgetProgram.setComputeUnitLimit({
|
|
@@ -11701,24 +12476,27 @@ class StateClient {
|
|
|
11701
12476
|
console.log("addMintTxs", addMintTxs);
|
|
11702
12477
|
return [
|
|
11703
12478
|
txSig,
|
|
11704
|
-
|
|
12479
|
+
glamState
|
|
11705
12480
|
];
|
|
11706
12481
|
}
|
|
11707
|
-
async updateState(
|
|
11708
|
-
console.log(`await glam.state.updateState("${
|
|
11709
|
-
const tx = await this.updateStateTx(getPublicKey(
|
|
12482
|
+
async updateState(glamState, updated, txOptions = {}) {
|
|
12483
|
+
console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
|
|
12484
|
+
const tx = await this.updateStateTx(getPublicKey(glamState), updated, txOptions);
|
|
11710
12485
|
return await this.base.sendAndConfirm(tx);
|
|
11711
12486
|
}
|
|
11712
|
-
async updateStateTx(
|
|
12487
|
+
async updateStateTx(glamState, updated, txOptions) {
|
|
12488
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11713
12489
|
const tx = await this.base.program.methods.updateState(new StateModel(updated)).accounts({
|
|
11714
|
-
|
|
11715
|
-
|
|
12490
|
+
glamState,
|
|
12491
|
+
glamSigner
|
|
12492
|
+
}).preInstructions(txOptions.preInstructions || []).transaction();
|
|
11716
12493
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11717
12494
|
}
|
|
11718
|
-
async closeState(
|
|
11719
|
-
this.base.
|
|
12495
|
+
async closeState(glamState, txOptions = {}) {
|
|
12496
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11720
12497
|
const tx = await this.base.program.methods.closeState().accounts({
|
|
11721
|
-
|
|
12498
|
+
glamState,
|
|
12499
|
+
glamSigner
|
|
11722
12500
|
}).preInstructions(txOptions.preInstructions || []).transaction();
|
|
11723
12501
|
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11724
12502
|
return await this.base.sendAndConfirm(vTx);
|
|
@@ -11769,7 +12547,7 @@ class StateClient {
|
|
|
11769
12547
|
if (mint.rawOpenfunds.shareClassLifecycle === "active") {
|
|
11770
12548
|
mint.rawOpenfunds.shareClassLaunchDate = mint.rawOpenfunds.shareClassLaunchDate || defaultDate;
|
|
11771
12549
|
}
|
|
11772
|
-
mint.rawOpenfunds = new
|
|
12550
|
+
mint.rawOpenfunds = new MintOpenfundsModel(mint.rawOpenfunds);
|
|
11773
12551
|
mint.isRawOpenfunds = true;
|
|
11774
12552
|
} else {
|
|
11775
12553
|
mint.isRawOpenfunds = false;
|
|
@@ -11799,39 +12577,43 @@ class StateClient {
|
|
|
11799
12577
|
});
|
|
11800
12578
|
return await this.updateState(statePda, updated, txOptions);
|
|
11801
12579
|
}
|
|
11802
|
-
async upsertDelegateAcls(
|
|
11803
|
-
return await this.updateState(
|
|
12580
|
+
async upsertDelegateAcls(glamState, delegateAcls, txOptions = {}) {
|
|
12581
|
+
return await this.updateState(glamState, {
|
|
11804
12582
|
delegateAcls
|
|
11805
12583
|
}, txOptions);
|
|
11806
12584
|
}
|
|
11807
|
-
async setSubscribeRedeemEnabled(
|
|
12585
|
+
async setSubscribeRedeemEnabled(glamState, enabled, txOptions = {}) {
|
|
12586
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11808
12587
|
return await this.base.program.methods.setSubscribeRedeemEnabled(enabled).accounts({
|
|
11809
|
-
|
|
12588
|
+
glamState,
|
|
12589
|
+
glamSigner
|
|
11810
12590
|
}).rpc();
|
|
11811
12591
|
}
|
|
11812
|
-
async closeTokenAccounts(
|
|
11813
|
-
const tx = await this.closeTokenAccountsTx(
|
|
12592
|
+
async closeTokenAccounts(glamState, tokenAccounts, txOptions = {}) {
|
|
12593
|
+
const tx = await this.closeTokenAccountsTx(glamState, tokenAccounts, txOptions);
|
|
11814
12594
|
return await this.base.sendAndConfirm(tx);
|
|
11815
12595
|
}
|
|
11816
12596
|
/**
|
|
11817
12597
|
* Close fund treasury's token accounts
|
|
11818
12598
|
*
|
|
11819
|
-
* @param
|
|
12599
|
+
* @param glamState
|
|
11820
12600
|
* @param tokenAccounts
|
|
11821
12601
|
* @param txOptions
|
|
11822
12602
|
* @returns
|
|
11823
|
-
*/ async closeTokenAccountsIx(
|
|
12603
|
+
*/ async closeTokenAccountsIx(glamState, tokenAccounts) {
|
|
11824
12604
|
return await this.base.program.methods.closeTokenAccounts().accounts({
|
|
11825
|
-
|
|
12605
|
+
glamState
|
|
11826
12606
|
}).remainingAccounts(tokenAccounts.map((account)=>({
|
|
11827
12607
|
pubkey: account,
|
|
11828
12608
|
isSigner: false,
|
|
11829
12609
|
isWritable: true
|
|
11830
12610
|
}))).instruction();
|
|
11831
12611
|
}
|
|
11832
|
-
async closeTokenAccountsTx(
|
|
12612
|
+
async closeTokenAccountsTx(glamState, tokenAccounts, txOptions) {
|
|
12613
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11833
12614
|
const tx = await this.base.program.methods.closeTokenAccounts().accounts({
|
|
11834
|
-
|
|
12615
|
+
glamState,
|
|
12616
|
+
glamSigner
|
|
11835
12617
|
}).remainingAccounts(tokenAccounts.map((account)=>({
|
|
11836
12618
|
pubkey: account,
|
|
11837
12619
|
isSigner: false,
|
|
@@ -11839,12 +12621,36 @@ class StateClient {
|
|
|
11839
12621
|
}))).transaction();
|
|
11840
12622
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11841
12623
|
}
|
|
11842
|
-
/* Deposit & Withdraw */ async deposit(
|
|
11843
|
-
const tx = await this.depositTx(
|
|
12624
|
+
/* Deposit & Withdraw */ async deposit(glamState, asset, amount, txOptions = {}) {
|
|
12625
|
+
const tx = await this.depositTx(new PublicKey(glamState), new PublicKey(asset), amount, txOptions);
|
|
12626
|
+
return await this.base.sendAndConfirm(tx);
|
|
12627
|
+
}
|
|
12628
|
+
async depositSol(glamState, lamports, wrap = true, txOptions = {}) {
|
|
12629
|
+
const tx = await this.depositSolTx(glamState, lamports, wrap, txOptions);
|
|
11844
12630
|
return await this.base.sendAndConfirm(tx);
|
|
11845
12631
|
}
|
|
11846
|
-
async
|
|
11847
|
-
const
|
|
12632
|
+
async depositSolTx(glamState, lamports, wrap = true, txOptions = {}) {
|
|
12633
|
+
const signer = txOptions.signer || this.base.getSigner();
|
|
12634
|
+
const vault = this.base.getVaultPda(glamState);
|
|
12635
|
+
const _lamports = lamports instanceof BN ? BigInt(lamports.toString()) : lamports;
|
|
12636
|
+
if (!wrap) {
|
|
12637
|
+
const tx = new Transaction().add(SystemProgram.transfer({
|
|
12638
|
+
fromPubkey: signer,
|
|
12639
|
+
toPubkey: vault,
|
|
12640
|
+
lamports: _lamports
|
|
12641
|
+
}));
|
|
12642
|
+
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12643
|
+
}
|
|
12644
|
+
const vaultAta = this.base.getAta(WSOL, vault);
|
|
12645
|
+
const tx = new Transaction().add(createAssociatedTokenAccountIdempotentInstruction(signer, vaultAta, vault, WSOL), SystemProgram.transfer({
|
|
12646
|
+
fromPubkey: signer,
|
|
12647
|
+
toPubkey: vaultAta,
|
|
12648
|
+
lamports: _lamports
|
|
12649
|
+
}), createSyncNativeInstruction(vaultAta));
|
|
12650
|
+
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12651
|
+
}
|
|
12652
|
+
async withdraw(glamState, asset, amount, txOptions = {}) {
|
|
12653
|
+
const tx = await this.withdrawTx(glamState, new PublicKey(asset), amount, txOptions);
|
|
11848
12654
|
return await this.base.sendAndConfirm(tx);
|
|
11849
12655
|
}
|
|
11850
12656
|
async depositTx(statePda, asset, amount, txOptions) {
|
|
@@ -11856,40 +12662,42 @@ class StateClient {
|
|
|
11856
12662
|
const tx = new Transaction().add(createAssociatedTokenAccountIdempotentInstruction(signer, vaultAta, vault, asset, tokenProgram), createTransferCheckedInstruction(signerAta, asset, vaultAta, signer, new BN(amount).toNumber(), mint.decimals, [], tokenProgram));
|
|
11857
12663
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11858
12664
|
}
|
|
11859
|
-
async withdrawIxs(
|
|
11860
|
-
const
|
|
12665
|
+
async withdrawIxs(glamState, asset, amount, txOptions) {
|
|
12666
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11861
12667
|
const { tokenProgram } = await this.base.fetchMintWithOwner(asset);
|
|
11862
|
-
const signerAta = this.base.getAta(asset,
|
|
12668
|
+
const signerAta = this.base.getAta(asset, glamSigner, tokenProgram);
|
|
11863
12669
|
return [
|
|
11864
|
-
createAssociatedTokenAccountIdempotentInstruction(
|
|
12670
|
+
createAssociatedTokenAccountIdempotentInstruction(glamSigner, signerAta, glamSigner, asset, tokenProgram),
|
|
11865
12671
|
await this.base.program.methods.withdraw(new BN(amount)).accounts({
|
|
11866
|
-
|
|
12672
|
+
glamState,
|
|
12673
|
+
glamSigner,
|
|
11867
12674
|
asset,
|
|
11868
12675
|
tokenProgram
|
|
11869
12676
|
}).instruction()
|
|
11870
12677
|
];
|
|
11871
12678
|
}
|
|
11872
|
-
async withdrawTx(
|
|
11873
|
-
const
|
|
12679
|
+
async withdrawTx(glamState, asset, amount, txOptions) {
|
|
12680
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11874
12681
|
const { tokenProgram } = await this.base.fetchMintWithOwner(asset);
|
|
11875
|
-
const signerAta = this.base.getAta(asset,
|
|
12682
|
+
const signerAta = this.base.getAta(asset, glamSigner, tokenProgram);
|
|
11876
12683
|
const preInstructions = [
|
|
11877
|
-
createAssociatedTokenAccountIdempotentInstruction(
|
|
12684
|
+
createAssociatedTokenAccountIdempotentInstruction(glamSigner, signerAta, glamSigner, asset, tokenProgram)
|
|
11878
12685
|
];
|
|
11879
12686
|
const postInstructions = [];
|
|
11880
12687
|
if (asset.equals(WSOL)) {
|
|
11881
|
-
const wrapSolIx = await this.base.maybeWrapSol(
|
|
12688
|
+
const wrapSolIx = await this.base.maybeWrapSol(glamState, amount, glamSigner);
|
|
11882
12689
|
if (wrapSolIx) {
|
|
11883
12690
|
preInstructions.push(wrapSolIx);
|
|
11884
12691
|
// If we need to wrap SOL, it means the wSOL balance will be drained,
|
|
11885
12692
|
// and we close the wSOL token account for convenience
|
|
11886
|
-
postInstructions.push(await this.closeTokenAccountsIx(
|
|
11887
|
-
this.base.getVaultAta(
|
|
12693
|
+
postInstructions.push(await this.closeTokenAccountsIx(glamState, [
|
|
12694
|
+
this.base.getVaultAta(glamState, WSOL)
|
|
11888
12695
|
]));
|
|
11889
12696
|
}
|
|
11890
12697
|
}
|
|
11891
12698
|
const tx = await this.base.program.methods.withdraw(new BN(amount)).accounts({
|
|
11892
|
-
|
|
12699
|
+
glamState,
|
|
12700
|
+
glamSigner,
|
|
11893
12701
|
asset,
|
|
11894
12702
|
tokenProgram
|
|
11895
12703
|
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
@@ -11904,8 +12712,13 @@ class MintClient {
|
|
|
11904
12712
|
async getHolders(state, mintId = 0) {
|
|
11905
12713
|
const mintPda = this.base.getMintPda(state, mintId);
|
|
11906
12714
|
const connection = this.base.provider.connection;
|
|
11907
|
-
|
|
11908
|
-
|
|
12715
|
+
let mint;
|
|
12716
|
+
try {
|
|
12717
|
+
mint = await getMint(connection, mintPda, connection.commitment, TOKEN_2022_PROGRAM_ID);
|
|
12718
|
+
} catch (e) {
|
|
12719
|
+
return [];
|
|
12720
|
+
}
|
|
12721
|
+
// Size of a glam mint with perment delegate extension enabled
|
|
11909
12722
|
const dataSize = 175;
|
|
11910
12723
|
const accounts = await connection.getProgramAccounts(TOKEN_2022_PROGRAM_ID, {
|
|
11911
12724
|
filters: [
|
|
@@ -11935,35 +12748,38 @@ class MintClient {
|
|
|
11935
12748
|
};
|
|
11936
12749
|
});
|
|
11937
12750
|
}
|
|
11938
|
-
async closeMintIx(
|
|
11939
|
-
this.base.
|
|
11940
|
-
const mintPda = this.base.getMintPda(state, mintId);
|
|
12751
|
+
async closeMintIx(glamState, mintId = 0) {
|
|
12752
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
11941
12753
|
return await this.base.program.methods.closeMint(mintId).accounts({
|
|
11942
|
-
glamState
|
|
11943
|
-
glamMint
|
|
12754
|
+
glamState,
|
|
12755
|
+
glamMint
|
|
11944
12756
|
}).instruction();
|
|
11945
12757
|
}
|
|
11946
|
-
async closeMint(
|
|
11947
|
-
this.base.
|
|
11948
|
-
const
|
|
11949
|
-
|
|
11950
|
-
glamState
|
|
11951
|
-
|
|
11952
|
-
|
|
12758
|
+
async closeMint(glamState, mintId = 0, txOptions = {}) {
|
|
12759
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12760
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12761
|
+
const tx = await this.base.program.methods.closeMint(mintId).accounts({
|
|
12762
|
+
glamState,
|
|
12763
|
+
glamSigner,
|
|
12764
|
+
glamMint
|
|
12765
|
+
}).transaction();
|
|
12766
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12767
|
+
return await this.base.sendAndConfirm(vTx);
|
|
11953
12768
|
}
|
|
11954
12769
|
/**
|
|
11955
12770
|
* Create a share class token account for a specific user
|
|
11956
12771
|
*
|
|
11957
|
-
* @param
|
|
12772
|
+
* @param glamState
|
|
11958
12773
|
* @param owner
|
|
11959
12774
|
* @param mintId
|
|
11960
12775
|
* @param txOptions
|
|
11961
12776
|
* @returns
|
|
11962
|
-
*/ async createTokenAccount(
|
|
11963
|
-
const
|
|
11964
|
-
const
|
|
11965
|
-
const
|
|
11966
|
-
|
|
12777
|
+
*/ async createTokenAccount(glamState, owner, mintId = 0, setFrozen = true, txOptions = {}) {
|
|
12778
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12779
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12780
|
+
const ata = this.base.getMintAta(owner, glamMint);
|
|
12781
|
+
const ixCreateAta = createAssociatedTokenAccountIdempotentInstruction(glamSigner, ata, owner, glamMint, TOKEN_2022_PROGRAM_ID);
|
|
12782
|
+
return await this.setTokenAccountsStates(glamState, mintId, [
|
|
11967
12783
|
ata
|
|
11968
12784
|
], setFrozen, {
|
|
11969
12785
|
preInstructions: [
|
|
@@ -11975,41 +12791,47 @@ class MintClient {
|
|
|
11975
12791
|
/**
|
|
11976
12792
|
* Freeze or thaw token accounts of a share class
|
|
11977
12793
|
*
|
|
11978
|
-
* @param
|
|
12794
|
+
* @param glamState
|
|
11979
12795
|
* @param mintId
|
|
11980
12796
|
* @param frozen
|
|
11981
12797
|
* @param txOptions
|
|
11982
12798
|
* @returns
|
|
11983
|
-
*/ async setTokenAccountsStates(
|
|
11984
|
-
const
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
12799
|
+
*/ async setTokenAccountsStates(glamState, mintId, tokenAccounts, frozen, txOptions = {}) {
|
|
12800
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12801
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12802
|
+
const tx = await this.base.program.methods.setTokenAccountsStates(mintId, frozen).accounts({
|
|
12803
|
+
glamState,
|
|
12804
|
+
glamSigner,
|
|
12805
|
+
glamMint
|
|
11988
12806
|
}).remainingAccounts(tokenAccounts.map((account)=>({
|
|
11989
12807
|
pubkey: account,
|
|
11990
12808
|
isSigner: false,
|
|
11991
12809
|
isWritable: true
|
|
11992
|
-
}))).preInstructions(txOptions.preInstructions || []).
|
|
12810
|
+
}))).preInstructions(txOptions.preInstructions || []).transaction();
|
|
12811
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12812
|
+
return await this.base.sendAndConfirm(vTx);
|
|
11993
12813
|
}
|
|
11994
12814
|
/**
|
|
11995
12815
|
* Mint share to recipient
|
|
11996
12816
|
*
|
|
11997
|
-
* @param
|
|
12817
|
+
* @param glamState
|
|
11998
12818
|
* @param mintId
|
|
11999
12819
|
* @param recipient Recipient's wallet address
|
|
12000
12820
|
* @param amount Amount of shares to mint
|
|
12001
12821
|
* @param forceThaw If true, force unfreezing token account before minting
|
|
12002
12822
|
* @param txOptions
|
|
12003
12823
|
* @returns Transaction signature
|
|
12004
|
-
*/ async mint(
|
|
12005
|
-
const
|
|
12006
|
-
const
|
|
12824
|
+
*/ async mint(glamState, mintId, recipient, amount, forceThaw = false, txOptions = {}) {
|
|
12825
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12826
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12827
|
+
const mintTo = this.base.getMintAta(recipient, glamMint);
|
|
12007
12828
|
const preInstructions = [];
|
|
12008
|
-
preInstructions.push(createAssociatedTokenAccountIdempotentInstruction(
|
|
12829
|
+
preInstructions.push(createAssociatedTokenAccountIdempotentInstruction(glamSigner, mintTo, recipient, glamMint, TOKEN_2022_PROGRAM_ID));
|
|
12009
12830
|
if (forceThaw) {
|
|
12010
12831
|
preInstructions.push(await this.base.program.methods.setTokenAccountsStates(mintId, false).accounts({
|
|
12011
|
-
glamState
|
|
12012
|
-
|
|
12832
|
+
glamState,
|
|
12833
|
+
glamSigner,
|
|
12834
|
+
glamMint
|
|
12013
12835
|
}).remainingAccounts([
|
|
12014
12836
|
{
|
|
12015
12837
|
pubkey: mintTo,
|
|
@@ -12018,20 +12840,25 @@ class MintClient {
|
|
|
12018
12840
|
}
|
|
12019
12841
|
]).instruction());
|
|
12020
12842
|
}
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
glamMint
|
|
12025
|
-
|
|
12843
|
+
const tx = await this.base.program.methods.mintTokens(0, amount).accounts({
|
|
12844
|
+
glamState,
|
|
12845
|
+
glamSigner,
|
|
12846
|
+
glamMint,
|
|
12847
|
+
recipient
|
|
12848
|
+
}).preInstructions(preInstructions).transaction();
|
|
12849
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12850
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12026
12851
|
}
|
|
12027
|
-
async burn(
|
|
12028
|
-
const
|
|
12029
|
-
const
|
|
12852
|
+
async burn(glamState, mintId, amount, from, forceThaw = false, txOptions = {}) {
|
|
12853
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12854
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12855
|
+
const ata = this.base.getMintAta(from, glamMint);
|
|
12030
12856
|
const preInstructions = [];
|
|
12031
12857
|
if (forceThaw) {
|
|
12032
12858
|
preInstructions.push(await this.base.program.methods.setTokenAccountsStates(mintId, false).accounts({
|
|
12033
|
-
glamState
|
|
12034
|
-
|
|
12859
|
+
glamState,
|
|
12860
|
+
glamSigner,
|
|
12861
|
+
glamMint
|
|
12035
12862
|
}).remainingAccounts([
|
|
12036
12863
|
{
|
|
12037
12864
|
pubkey: ata,
|
|
@@ -12040,22 +12867,27 @@ class MintClient {
|
|
|
12040
12867
|
}
|
|
12041
12868
|
]).instruction());
|
|
12042
12869
|
}
|
|
12043
|
-
|
|
12044
|
-
glamState
|
|
12045
|
-
|
|
12870
|
+
const tx = await this.base.program.methods.burnTokens(mintId, amount).accounts({
|
|
12871
|
+
glamState,
|
|
12872
|
+
glamSigner,
|
|
12873
|
+
glamMint,
|
|
12046
12874
|
from
|
|
12047
|
-
}).preInstructions(preInstructions).
|
|
12875
|
+
}).preInstructions(preInstructions).transaction();
|
|
12876
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12877
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12048
12878
|
}
|
|
12049
|
-
async forceTransfer(
|
|
12050
|
-
const
|
|
12051
|
-
const
|
|
12052
|
-
const
|
|
12879
|
+
async forceTransfer(glamState, mintId, amount, from, to, forceThaw = false, txOptions = {}) {
|
|
12880
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12881
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12882
|
+
const fromAta = this.base.getMintAta(from, glamMint);
|
|
12883
|
+
const toAta = this.base.getMintAta(to, glamMint);
|
|
12053
12884
|
const preInstructions = [];
|
|
12054
|
-
preInstructions.push(createAssociatedTokenAccountIdempotentInstruction(this.base.getSigner(), toAta, to,
|
|
12885
|
+
preInstructions.push(createAssociatedTokenAccountIdempotentInstruction(this.base.getSigner(), toAta, to, glamMint, TOKEN_2022_PROGRAM_ID));
|
|
12055
12886
|
if (forceThaw) {
|
|
12056
12887
|
preInstructions.push(await this.base.program.methods.setTokenAccountsStates(mintId, false).accounts({
|
|
12057
|
-
glamState
|
|
12058
|
-
|
|
12888
|
+
glamState,
|
|
12889
|
+
glamSigner,
|
|
12890
|
+
glamMint
|
|
12059
12891
|
}).remainingAccounts([
|
|
12060
12892
|
// fromAta is already unfrozen, still add it to test the ix is idempotent
|
|
12061
12893
|
{
|
|
@@ -12070,12 +12902,15 @@ class MintClient {
|
|
|
12070
12902
|
}
|
|
12071
12903
|
]).instruction());
|
|
12072
12904
|
}
|
|
12073
|
-
|
|
12074
|
-
glamState
|
|
12075
|
-
|
|
12905
|
+
const tx = await this.base.program.methods.forceTransferTokens(mintId, amount).accounts({
|
|
12906
|
+
glamState,
|
|
12907
|
+
glamSigner,
|
|
12908
|
+
glamMint,
|
|
12076
12909
|
from,
|
|
12077
12910
|
to
|
|
12078
|
-
}).preInstructions(preInstructions).
|
|
12911
|
+
}).preInstructions(preInstructions).transaction();
|
|
12912
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12913
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12079
12914
|
}
|
|
12080
12915
|
constructor(base){
|
|
12081
12916
|
this.base = base;
|
|
@@ -12444,6 +13279,185 @@ class KaminoLendingClient {
|
|
|
12444
13279
|
}
|
|
12445
13280
|
}
|
|
12446
13281
|
|
|
13282
|
+
const METEORA_DLMM = new PublicKey("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo");
|
|
13283
|
+
new PublicKey("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6");
|
|
13284
|
+
const EVENT_AUTHORITY = new PublicKey("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6");
|
|
13285
|
+
const DEFAULT_RANGE_INTERVAL = 34; // 34 bins on each side of the active bin, 69 bins in total
|
|
13286
|
+
class MeteoraDlmmClient {
|
|
13287
|
+
async getDlmmPool(pool) {
|
|
13288
|
+
const key = typeof pool === "string" ? pool : pool.toString();
|
|
13289
|
+
if (!this._dlmmPool.get(key)) {
|
|
13290
|
+
this._dlmmPool.set(key, await DLMM.create(this.base.provider.connection, new PublicKey(pool)));
|
|
13291
|
+
}
|
|
13292
|
+
const dlmmPool = this._dlmmPool.get(key);
|
|
13293
|
+
if (!dlmmPool) {
|
|
13294
|
+
throw new Error(`DLMM pool ${key} not found`);
|
|
13295
|
+
}
|
|
13296
|
+
return dlmmPool;
|
|
13297
|
+
}
|
|
13298
|
+
async initializePosition(statePda, pool, txOptions = {}) {
|
|
13299
|
+
const glamState = new PublicKey(statePda);
|
|
13300
|
+
const dlmmPool = await this.getDlmmPool(pool);
|
|
13301
|
+
const activeBin = await dlmmPool.getActiveBin();
|
|
13302
|
+
const minBinId = activeBin.binId - DEFAULT_RANGE_INTERVAL;
|
|
13303
|
+
const maxBinId = activeBin.binId + DEFAULT_RANGE_INTERVAL;
|
|
13304
|
+
const position = Keypair.generate();
|
|
13305
|
+
const tx = await this.base.program.methods.meteoraDlmmInitializePosition(minBinId, maxBinId - minBinId + 1).accounts({
|
|
13306
|
+
glamState,
|
|
13307
|
+
lbPair: new PublicKey(pool),
|
|
13308
|
+
position: position.publicKey,
|
|
13309
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13310
|
+
program: METEORA_DLMM
|
|
13311
|
+
}).transaction();
|
|
13312
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13313
|
+
return await this.base.sendAndConfirm(vTx, [
|
|
13314
|
+
position
|
|
13315
|
+
]);
|
|
13316
|
+
}
|
|
13317
|
+
async addLiquidity(statePda, position, amountX, strategyType, txOptions = {}) {
|
|
13318
|
+
const { lbPair, lowerBinId, upperBinId, binArrayLower, binArrayUpper } = await this.parsePosition(new PublicKey(position));
|
|
13319
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
13320
|
+
const { amountY, activeBinId } = await this.getAmounts(dlmmPool, new BN(amountX));
|
|
13321
|
+
const glamState = new PublicKey(statePda);
|
|
13322
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
13323
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
13324
|
+
const strategy = {
|
|
13325
|
+
amountX: new BN(amountX),
|
|
13326
|
+
amountY,
|
|
13327
|
+
activeId: activeBinId,
|
|
13328
|
+
maxActiveBinSlippage: 20,
|
|
13329
|
+
strategyParameters: {
|
|
13330
|
+
minBinId: lowerBinId,
|
|
13331
|
+
maxBinId: upperBinId,
|
|
13332
|
+
strategyType: Strategy[strategyType],
|
|
13333
|
+
parameteres: Array(64).fill(0)
|
|
13334
|
+
}
|
|
13335
|
+
};
|
|
13336
|
+
const tx = await this.base.program.methods.meteoraDlmmAddLiquidityByStrategy(strategy).accounts({
|
|
13337
|
+
glamState,
|
|
13338
|
+
position: new PublicKey(position),
|
|
13339
|
+
lbPair,
|
|
13340
|
+
binArrayBitmapExtension: dlmmPool.binArrayBitmapExtension ? dlmmPool.binArrayBitmapExtension.publicKey : METEORA_DLMM,
|
|
13341
|
+
userTokenX: vaultTokenXAta,
|
|
13342
|
+
userTokenY: vaultTokenYAta,
|
|
13343
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
13344
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
13345
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
13346
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
13347
|
+
binArrayLower,
|
|
13348
|
+
binArrayUpper,
|
|
13349
|
+
tokenXProgram: TOKEN_PROGRAM_ID,
|
|
13350
|
+
tokenYProgram: TOKEN_PROGRAM_ID,
|
|
13351
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13352
|
+
program: METEORA_DLMM
|
|
13353
|
+
}).transaction();
|
|
13354
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13355
|
+
return this.base.sendAndConfirm(vTx);
|
|
13356
|
+
}
|
|
13357
|
+
async removeLiquidity(statePda, position, bpsToRemove, txOptions = {}) {
|
|
13358
|
+
const { lbPair, lowerBinId, upperBinId, binArrayLower, binArrayUpper } = await this.parsePosition(new PublicKey(position));
|
|
13359
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
13360
|
+
const glamState = new PublicKey(statePda);
|
|
13361
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
13362
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
13363
|
+
const tx = await this.base.program.methods.meteoraDlmmRemoveLiquidityByRange(lowerBinId, upperBinId, bpsToRemove).accounts({
|
|
13364
|
+
glamState,
|
|
13365
|
+
position: new PublicKey(position),
|
|
13366
|
+
lbPair,
|
|
13367
|
+
binArrayBitmapExtension: dlmmPool.binArrayBitmapExtension ? dlmmPool.binArrayBitmapExtension.publicKey : METEORA_DLMM,
|
|
13368
|
+
userTokenX: vaultTokenXAta,
|
|
13369
|
+
userTokenY: vaultTokenYAta,
|
|
13370
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
13371
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
13372
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
13373
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
13374
|
+
binArrayLower,
|
|
13375
|
+
binArrayUpper,
|
|
13376
|
+
tokenXProgram: TOKEN_PROGRAM_ID,
|
|
13377
|
+
tokenYProgram: TOKEN_PROGRAM_ID,
|
|
13378
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13379
|
+
program: METEORA_DLMM
|
|
13380
|
+
}).transaction();
|
|
13381
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13382
|
+
return this.base.sendAndConfirm(vTx);
|
|
13383
|
+
}
|
|
13384
|
+
async claimFee(statePda, position, txOptions = {}) {
|
|
13385
|
+
const { lbPair, binArrayLower, binArrayUpper } = await this.parsePosition(new PublicKey(position));
|
|
13386
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
13387
|
+
const glamState = new PublicKey(statePda);
|
|
13388
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
13389
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
13390
|
+
const tx = await this.base.program.methods.meteoraDlmmClaimFee().accounts({
|
|
13391
|
+
glamState,
|
|
13392
|
+
position: new PublicKey(position),
|
|
13393
|
+
lbPair,
|
|
13394
|
+
binArrayLower,
|
|
13395
|
+
binArrayUpper,
|
|
13396
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
13397
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
13398
|
+
userTokenX: vaultTokenXAta,
|
|
13399
|
+
userTokenY: vaultTokenYAta,
|
|
13400
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
13401
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
13402
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
13403
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13404
|
+
program: METEORA_DLMM
|
|
13405
|
+
}).transaction();
|
|
13406
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13407
|
+
return await this.base.sendAndConfirm(vTx);
|
|
13408
|
+
}
|
|
13409
|
+
async closePosition(statePda, position, txOptions = {}) {
|
|
13410
|
+
const { lbPair, binArrayLower, binArrayUpper } = await this.parsePosition(new PublicKey(position));
|
|
13411
|
+
const glamState = new PublicKey(statePda);
|
|
13412
|
+
const tx = await this.base.program.methods.meteoraDlmmClosePosition().accounts({
|
|
13413
|
+
glamState,
|
|
13414
|
+
position: new PublicKey(position),
|
|
13415
|
+
lbPair,
|
|
13416
|
+
binArrayLower,
|
|
13417
|
+
binArrayUpper,
|
|
13418
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13419
|
+
program: METEORA_DLMM
|
|
13420
|
+
}).transaction();
|
|
13421
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13422
|
+
return await this.base.sendAndConfirm(vTx);
|
|
13423
|
+
}
|
|
13424
|
+
async parsePosition(position) {
|
|
13425
|
+
const positionAccountInfo = await this.base.provider.connection.getAccountInfo(position);
|
|
13426
|
+
if (!positionAccountInfo) {
|
|
13427
|
+
throw new Error("Position not found");
|
|
13428
|
+
}
|
|
13429
|
+
const positionData = positionAccountInfo.data;
|
|
13430
|
+
const lbPair = new PublicKey(positionData.subarray(8, 40));
|
|
13431
|
+
const lowerBinId = positionData.subarray(7912, 7916).readInt32LE();
|
|
13432
|
+
const upperBinId = positionData.subarray(7916, 7920).readInt32LE();
|
|
13433
|
+
const lowerBinArrayIndex = binIdToBinArrayIndex(new BN(lowerBinId));
|
|
13434
|
+
const [binArrayLower] = deriveBinArray(lbPair, lowerBinArrayIndex, METEORA_DLMM);
|
|
13435
|
+
const upperBinArrayIndex = BN.max(lowerBinArrayIndex.add(new BN(1)), binIdToBinArrayIndex(new BN(upperBinId)));
|
|
13436
|
+
const [binArrayUpper] = deriveBinArray(lbPair, upperBinArrayIndex, METEORA_DLMM);
|
|
13437
|
+
return {
|
|
13438
|
+
lowerBinId,
|
|
13439
|
+
upperBinId,
|
|
13440
|
+
binArrayLower,
|
|
13441
|
+
binArrayUpper,
|
|
13442
|
+
lbPair
|
|
13443
|
+
};
|
|
13444
|
+
}
|
|
13445
|
+
async getAmounts(dlmmPool, amountX) {
|
|
13446
|
+
const activeBin = await dlmmPool.getActiveBin();
|
|
13447
|
+
const activeBinPricePerToken = dlmmPool.fromPricePerLamport(Number(activeBin.price));
|
|
13448
|
+
const amountY = amountX.mul(new BN(Number(activeBinPricePerToken)));
|
|
13449
|
+
return {
|
|
13450
|
+
amountX,
|
|
13451
|
+
amountY,
|
|
13452
|
+
activeBinId: activeBin.binId
|
|
13453
|
+
};
|
|
13454
|
+
}
|
|
13455
|
+
constructor(base){
|
|
13456
|
+
this.base = base;
|
|
13457
|
+
this._dlmmPool = new Map();
|
|
13458
|
+
}
|
|
13459
|
+
}
|
|
13460
|
+
|
|
12447
13461
|
/**
|
|
12448
13462
|
* Main entrypoint for the GLAM SDK
|
|
12449
13463
|
*
|
|
@@ -12509,6 +13523,12 @@ class KaminoLendingClient {
|
|
|
12509
13523
|
}
|
|
12510
13524
|
return this._kaminoLending;
|
|
12511
13525
|
}
|
|
13526
|
+
get meteoraDlmm() {
|
|
13527
|
+
if (!this._meteoraDlmm) {
|
|
13528
|
+
this._meteoraDlmm = new MeteoraDlmmClient(this);
|
|
13529
|
+
}
|
|
13530
|
+
return this._meteoraDlmm;
|
|
13531
|
+
}
|
|
12512
13532
|
constructor(config){
|
|
12513
13533
|
super(config);
|
|
12514
13534
|
}
|
|
@@ -12550,4 +13570,4 @@ const getPriorityFeeEstimate = async (heliusApiKey, tx, accountKeys, priorityLev
|
|
|
12550
13570
|
return data.result.priorityFeeEstimate;
|
|
12551
13571
|
};
|
|
12552
13572
|
|
|
12553
|
-
export { ClusterNetwork, CompanyModel, CreatedModel, DRIFT_PROGRAM_ID, DelegateAcl, DriftClient, FundOpenfundsModel, GOVERNANCE_PROGRAM_ID, GlamClient, GlamError, GlamIDL, GlamIDLJson, GlamIntegrations, GlamPermissions, JITOSOL, JITO_STAKE_POOL, JUP, JUPITER_API_DEFAULT, JUPITER_PROGRAM_ID, JUPSOL_STAKE_POOL, JUP_VOTE_PROGRAM, JupiterSwapClient, JupiterVoteClient, MARINADE_PROGRAM_ID, MSOL, ManagerModel, Metadata,
|
|
13573
|
+
export { BaseClient, ClusterNetwork, CompanyModel, CreatedModel, DRIFT_PROGRAM_ID, DelegateAcl, DriftClient, FundOpenfundsModel, GOVERNANCE_PROGRAM_ID, GlamClient, GlamError, GlamIDL, GlamIDLJson, GlamIntegrations, GlamPermissions, JITOSOL, JITO_STAKE_POOL, JITO_TIP_DEFAULT, JUP, JUPITER_API_DEFAULT, JUPITER_PROGRAM_ID, JUPSOL_STAKE_POOL, JUP_VOTE_PROGRAM, JupiterSwapClient, JupiterVoteClient, MARINADE_PROGRAM_ID, MSOL, ManagerModel, Metadata, MintIdlModel, MintModel, MintOpenfundsModel, SANCTUM_STAKE_POOL_PROGRAM_ID, SEED_METADATA, SEED_MINT, SEED_STATE, SEED_VAULT, StateIdlModel, StateModel, USDC, WBTC, WETH, WSOL, getGlamProgram, getGlamProgramId, getPriorityFeeEstimate, getSimulationComputeUnits, isBrowser };
|