@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.cjs.js
CHANGED
|
@@ -9,6 +9,7 @@ var sdk = require('@drift-labs/sdk');
|
|
|
9
9
|
var marinadeTsSdk = require('@marinade.finance/marinade-ts-sdk');
|
|
10
10
|
var splStakePool = require('@solana/spl-stake-pool');
|
|
11
11
|
var borsh = require('@coral-xyz/borsh');
|
|
12
|
+
var DLMM = require('@meteora-ag/dlmm');
|
|
12
13
|
|
|
13
14
|
function _interopNamespaceDefault(e) {
|
|
14
15
|
var n = Object.create(null);
|
|
@@ -33,7 +34,7 @@ var borsh__namespace = /*#__PURE__*/_interopNamespaceDefault(borsh);
|
|
|
33
34
|
var address = "GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc";
|
|
34
35
|
var metadata = {
|
|
35
36
|
name: "glam",
|
|
36
|
-
version: "0.4.
|
|
37
|
+
version: "0.4.6",
|
|
37
38
|
spec: "0.1.0",
|
|
38
39
|
description: "Glam Protocol"
|
|
39
40
|
};
|
|
@@ -41,7 +42,6 @@ var instructions = [
|
|
|
41
42
|
{
|
|
42
43
|
name: "add_mint",
|
|
43
44
|
docs: [
|
|
44
|
-
"Mint",
|
|
45
45
|
"Adds a new mint.",
|
|
46
46
|
"",
|
|
47
47
|
"# Parameters",
|
|
@@ -67,14 +67,14 @@ var instructions = [
|
|
|
67
67
|
writable: true
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
|
-
name: "
|
|
71
|
-
writable: true
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: "signer",
|
|
70
|
+
name: "glam_signer",
|
|
75
71
|
writable: true,
|
|
76
72
|
signer: true
|
|
77
73
|
},
|
|
74
|
+
{
|
|
75
|
+
name: "new_mint",
|
|
76
|
+
writable: true
|
|
77
|
+
},
|
|
78
78
|
{
|
|
79
79
|
name: "extra_account_meta_list",
|
|
80
80
|
writable: true,
|
|
@@ -187,6 +187,11 @@ var instructions = [
|
|
|
187
187
|
{
|
|
188
188
|
name: "glam_state"
|
|
189
189
|
},
|
|
190
|
+
{
|
|
191
|
+
name: "glam_signer",
|
|
192
|
+
writable: true,
|
|
193
|
+
signer: true
|
|
194
|
+
},
|
|
190
195
|
{
|
|
191
196
|
name: "glam_mint",
|
|
192
197
|
writable: true
|
|
@@ -251,11 +256,6 @@ var instructions = [
|
|
|
251
256
|
{
|
|
252
257
|
name: "from"
|
|
253
258
|
},
|
|
254
|
-
{
|
|
255
|
-
name: "signer",
|
|
256
|
-
writable: true,
|
|
257
|
-
signer: true
|
|
258
|
-
},
|
|
259
259
|
{
|
|
260
260
|
name: "token_2022_program",
|
|
261
261
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -300,7 +300,7 @@ var instructions = [
|
|
|
300
300
|
writable: true
|
|
301
301
|
},
|
|
302
302
|
{
|
|
303
|
-
name: "
|
|
303
|
+
name: "glam_vault",
|
|
304
304
|
writable: true,
|
|
305
305
|
pda: {
|
|
306
306
|
seeds: [
|
|
@@ -321,6 +321,11 @@ var instructions = [
|
|
|
321
321
|
]
|
|
322
322
|
}
|
|
323
323
|
},
|
|
324
|
+
{
|
|
325
|
+
name: "glam_signer",
|
|
326
|
+
writable: true,
|
|
327
|
+
signer: true
|
|
328
|
+
},
|
|
324
329
|
{
|
|
325
330
|
name: "glam_mint",
|
|
326
331
|
writable: true
|
|
@@ -386,11 +391,6 @@ var instructions = [
|
|
|
386
391
|
]
|
|
387
392
|
}
|
|
388
393
|
},
|
|
389
|
-
{
|
|
390
|
-
name: "signer",
|
|
391
|
-
writable: true,
|
|
392
|
-
signer: true
|
|
393
|
-
},
|
|
394
394
|
{
|
|
395
395
|
name: "token_2022_program",
|
|
396
396
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -426,61 +426,61 @@ var instructions = [
|
|
|
426
426
|
],
|
|
427
427
|
accounts: [
|
|
428
428
|
{
|
|
429
|
-
name: "
|
|
429
|
+
name: "glam_state",
|
|
430
430
|
writable: true
|
|
431
431
|
},
|
|
432
432
|
{
|
|
433
|
-
name: "
|
|
433
|
+
name: "glam_vault",
|
|
434
434
|
writable: true,
|
|
435
435
|
pda: {
|
|
436
436
|
seeds: [
|
|
437
437
|
{
|
|
438
438
|
kind: "const",
|
|
439
439
|
value: [
|
|
440
|
-
|
|
441
|
-
101,
|
|
442
|
-
116,
|
|
443
|
-
97,
|
|
444
|
-
100,
|
|
440
|
+
118,
|
|
445
441
|
97,
|
|
446
|
-
|
|
447
|
-
|
|
442
|
+
117,
|
|
443
|
+
108,
|
|
444
|
+
116
|
|
448
445
|
]
|
|
449
446
|
},
|
|
450
447
|
{
|
|
451
448
|
kind: "account",
|
|
452
|
-
path: "
|
|
449
|
+
path: "glam_state"
|
|
453
450
|
}
|
|
454
451
|
]
|
|
455
452
|
}
|
|
456
453
|
},
|
|
457
454
|
{
|
|
458
|
-
name: "
|
|
455
|
+
name: "glam_signer",
|
|
456
|
+
writable: true,
|
|
457
|
+
signer: true
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "metadata",
|
|
459
461
|
writable: true,
|
|
460
462
|
pda: {
|
|
461
463
|
seeds: [
|
|
462
464
|
{
|
|
463
465
|
kind: "const",
|
|
464
466
|
value: [
|
|
465
|
-
|
|
467
|
+
109,
|
|
468
|
+
101,
|
|
469
|
+
116,
|
|
466
470
|
97,
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
116
|
|
471
|
+
100,
|
|
472
|
+
97,
|
|
473
|
+
116,
|
|
474
|
+
97
|
|
470
475
|
]
|
|
471
476
|
},
|
|
472
477
|
{
|
|
473
478
|
kind: "account",
|
|
474
|
-
path: "
|
|
479
|
+
path: "glam_state"
|
|
475
480
|
}
|
|
476
481
|
]
|
|
477
482
|
}
|
|
478
483
|
},
|
|
479
|
-
{
|
|
480
|
-
name: "signer",
|
|
481
|
-
writable: true,
|
|
482
|
-
signer: true
|
|
483
|
-
},
|
|
484
484
|
{
|
|
485
485
|
name: "system_program",
|
|
486
486
|
address: "11111111111111111111111111111111"
|
|
@@ -511,11 +511,11 @@ var instructions = [
|
|
|
511
511
|
],
|
|
512
512
|
accounts: [
|
|
513
513
|
{
|
|
514
|
-
name: "
|
|
514
|
+
name: "glam_state",
|
|
515
515
|
writable: true
|
|
516
516
|
},
|
|
517
517
|
{
|
|
518
|
-
name: "
|
|
518
|
+
name: "glam_vault",
|
|
519
519
|
writable: true,
|
|
520
520
|
pda: {
|
|
521
521
|
seeds: [
|
|
@@ -531,13 +531,13 @@ var instructions = [
|
|
|
531
531
|
},
|
|
532
532
|
{
|
|
533
533
|
kind: "account",
|
|
534
|
-
path: "
|
|
534
|
+
path: "glam_state"
|
|
535
535
|
}
|
|
536
536
|
]
|
|
537
537
|
}
|
|
538
538
|
},
|
|
539
539
|
{
|
|
540
|
-
name: "
|
|
540
|
+
name: "glam_signer",
|
|
541
541
|
writable: true,
|
|
542
542
|
signer: true
|
|
543
543
|
},
|
|
@@ -578,15 +578,10 @@ var instructions = [
|
|
|
578
578
|
],
|
|
579
579
|
accounts: [
|
|
580
580
|
{
|
|
581
|
-
name: "
|
|
582
|
-
writable: true,
|
|
583
|
-
signer: true
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
name: "state"
|
|
581
|
+
name: "glam_state"
|
|
587
582
|
},
|
|
588
583
|
{
|
|
589
|
-
name: "
|
|
584
|
+
name: "glam_vault",
|
|
590
585
|
writable: true,
|
|
591
586
|
pda: {
|
|
592
587
|
seeds: [
|
|
@@ -602,11 +597,16 @@ var instructions = [
|
|
|
602
597
|
},
|
|
603
598
|
{
|
|
604
599
|
kind: "account",
|
|
605
|
-
path: "
|
|
600
|
+
path: "glam_state"
|
|
606
601
|
}
|
|
607
602
|
]
|
|
608
603
|
}
|
|
609
604
|
},
|
|
605
|
+
{
|
|
606
|
+
name: "glam_signer",
|
|
607
|
+
writable: true,
|
|
608
|
+
signer: true
|
|
609
|
+
},
|
|
610
610
|
{
|
|
611
611
|
name: "clock",
|
|
612
612
|
address: "SysvarC1ock11111111111111111111111111111111"
|
|
@@ -1056,7 +1056,6 @@ var instructions = [
|
|
|
1056
1056
|
{
|
|
1057
1057
|
name: "drift_initialize_user_stats",
|
|
1058
1058
|
docs: [
|
|
1059
|
-
"Drift",
|
|
1060
1059
|
"Initializes a drift account owned by vault and creates a subaccount.",
|
|
1061
1060
|
"",
|
|
1062
1061
|
"# Parameters",
|
|
@@ -1664,6 +1663,11 @@ var instructions = [
|
|
|
1664
1663
|
name: "glam_state",
|
|
1665
1664
|
writable: true
|
|
1666
1665
|
},
|
|
1666
|
+
{
|
|
1667
|
+
name: "glam_signer",
|
|
1668
|
+
writable: true,
|
|
1669
|
+
signer: true
|
|
1670
|
+
},
|
|
1667
1671
|
{
|
|
1668
1672
|
name: "glam_mint",
|
|
1669
1673
|
writable: true
|
|
@@ -1788,11 +1792,6 @@ var instructions = [
|
|
|
1788
1792
|
{
|
|
1789
1793
|
name: "to"
|
|
1790
1794
|
},
|
|
1791
|
-
{
|
|
1792
|
-
name: "signer",
|
|
1793
|
-
writable: true,
|
|
1794
|
-
signer: true
|
|
1795
|
-
},
|
|
1796
1795
|
{
|
|
1797
1796
|
name: "token_2022_program",
|
|
1798
1797
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -1836,16 +1835,11 @@ var instructions = [
|
|
|
1836
1835
|
],
|
|
1837
1836
|
accounts: [
|
|
1838
1837
|
{
|
|
1839
|
-
name: "
|
|
1840
|
-
writable: true,
|
|
1841
|
-
signer: true
|
|
1842
|
-
},
|
|
1843
|
-
{
|
|
1844
|
-
name: "state",
|
|
1838
|
+
name: "glam_state",
|
|
1845
1839
|
writable: true
|
|
1846
1840
|
},
|
|
1847
1841
|
{
|
|
1848
|
-
name: "
|
|
1842
|
+
name: "glam_vault",
|
|
1849
1843
|
writable: true,
|
|
1850
1844
|
pda: {
|
|
1851
1845
|
seeds: [
|
|
@@ -1861,11 +1855,16 @@ var instructions = [
|
|
|
1861
1855
|
},
|
|
1862
1856
|
{
|
|
1863
1857
|
kind: "account",
|
|
1864
|
-
path: "
|
|
1858
|
+
path: "glam_state"
|
|
1865
1859
|
}
|
|
1866
1860
|
]
|
|
1867
1861
|
}
|
|
1868
1862
|
},
|
|
1863
|
+
{
|
|
1864
|
+
name: "glam_signer",
|
|
1865
|
+
writable: true,
|
|
1866
|
+
signer: true
|
|
1867
|
+
},
|
|
1869
1868
|
{
|
|
1870
1869
|
name: "vault_stake_account",
|
|
1871
1870
|
writable: true
|
|
@@ -1907,7 +1906,6 @@ var instructions = [
|
|
|
1907
1906
|
{
|
|
1908
1907
|
name: "initialize_state",
|
|
1909
1908
|
docs: [
|
|
1910
|
-
"State",
|
|
1911
1909
|
"Initializes a state account from the provided StateModel instance.",
|
|
1912
1910
|
"",
|
|
1913
1911
|
"# Parameters",
|
|
@@ -1929,7 +1927,7 @@ var instructions = [
|
|
|
1929
1927
|
],
|
|
1930
1928
|
accounts: [
|
|
1931
1929
|
{
|
|
1932
|
-
name: "
|
|
1930
|
+
name: "glam_state",
|
|
1933
1931
|
writable: true,
|
|
1934
1932
|
pda: {
|
|
1935
1933
|
seeds: [
|
|
@@ -1945,7 +1943,7 @@ var instructions = [
|
|
|
1945
1943
|
},
|
|
1946
1944
|
{
|
|
1947
1945
|
kind: "account",
|
|
1948
|
-
path: "
|
|
1946
|
+
path: "glam_signer"
|
|
1949
1947
|
},
|
|
1950
1948
|
{
|
|
1951
1949
|
kind: "arg",
|
|
@@ -1955,7 +1953,7 @@ var instructions = [
|
|
|
1955
1953
|
}
|
|
1956
1954
|
},
|
|
1957
1955
|
{
|
|
1958
|
-
name: "
|
|
1956
|
+
name: "glam_vault",
|
|
1959
1957
|
writable: true,
|
|
1960
1958
|
pda: {
|
|
1961
1959
|
seeds: [
|
|
@@ -1971,13 +1969,13 @@ var instructions = [
|
|
|
1971
1969
|
},
|
|
1972
1970
|
{
|
|
1973
1971
|
kind: "account",
|
|
1974
|
-
path: "
|
|
1972
|
+
path: "glam_state"
|
|
1975
1973
|
}
|
|
1976
1974
|
]
|
|
1977
1975
|
}
|
|
1978
1976
|
},
|
|
1979
1977
|
{
|
|
1980
|
-
name: "
|
|
1978
|
+
name: "glam_signer",
|
|
1981
1979
|
writable: true,
|
|
1982
1980
|
signer: true
|
|
1983
1981
|
},
|
|
@@ -2002,7 +2000,7 @@ var instructions = [
|
|
|
2002
2000
|
},
|
|
2003
2001
|
{
|
|
2004
2002
|
kind: "account",
|
|
2005
|
-
path: "
|
|
2003
|
+
path: "glam_state"
|
|
2006
2004
|
}
|
|
2007
2005
|
]
|
|
2008
2006
|
}
|
|
@@ -2129,11 +2127,11 @@ var instructions = [
|
|
|
2129
2127
|
],
|
|
2130
2128
|
accounts: [
|
|
2131
2129
|
{
|
|
2132
|
-
name: "
|
|
2130
|
+
name: "glam_state",
|
|
2133
2131
|
writable: true
|
|
2134
2132
|
},
|
|
2135
2133
|
{
|
|
2136
|
-
name: "
|
|
2134
|
+
name: "glam_signer",
|
|
2137
2135
|
writable: true,
|
|
2138
2136
|
signer: true
|
|
2139
2137
|
}
|
|
@@ -2176,11 +2174,11 @@ var instructions = [
|
|
|
2176
2174
|
],
|
|
2177
2175
|
accounts: [
|
|
2178
2176
|
{
|
|
2179
|
-
name: "
|
|
2177
|
+
name: "glam_state",
|
|
2180
2178
|
writable: true
|
|
2181
2179
|
},
|
|
2182
2180
|
{
|
|
2183
|
-
name: "
|
|
2181
|
+
name: "glam_vault",
|
|
2184
2182
|
writable: true,
|
|
2185
2183
|
pda: {
|
|
2186
2184
|
seeds: [
|
|
@@ -2196,11 +2194,20 @@ var instructions = [
|
|
|
2196
2194
|
},
|
|
2197
2195
|
{
|
|
2198
2196
|
kind: "account",
|
|
2199
|
-
path: "
|
|
2197
|
+
path: "glam_state"
|
|
2200
2198
|
}
|
|
2201
2199
|
]
|
|
2202
2200
|
}
|
|
2203
2201
|
},
|
|
2202
|
+
{
|
|
2203
|
+
name: "glam_signer",
|
|
2204
|
+
writable: true,
|
|
2205
|
+
signer: true
|
|
2206
|
+
},
|
|
2207
|
+
{
|
|
2208
|
+
name: "cpi_program",
|
|
2209
|
+
address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
|
|
2210
|
+
},
|
|
2204
2211
|
{
|
|
2205
2212
|
name: "input_vault_ata",
|
|
2206
2213
|
writable: true,
|
|
@@ -2208,7 +2215,7 @@ var instructions = [
|
|
|
2208
2215
|
seeds: [
|
|
2209
2216
|
{
|
|
2210
2217
|
kind: "account",
|
|
2211
|
-
path: "
|
|
2218
|
+
path: "glam_vault"
|
|
2212
2219
|
},
|
|
2213
2220
|
{
|
|
2214
2221
|
kind: "account",
|
|
@@ -2265,7 +2272,7 @@ var instructions = [
|
|
|
2265
2272
|
seeds: [
|
|
2266
2273
|
{
|
|
2267
2274
|
kind: "account",
|
|
2268
|
-
path: "
|
|
2275
|
+
path: "glam_vault"
|
|
2269
2276
|
},
|
|
2270
2277
|
{
|
|
2271
2278
|
kind: "account",
|
|
@@ -2321,11 +2328,6 @@ var instructions = [
|
|
|
2321
2328
|
{
|
|
2322
2329
|
name: "output_mint"
|
|
2323
2330
|
},
|
|
2324
|
-
{
|
|
2325
|
-
name: "signer",
|
|
2326
|
-
writable: true,
|
|
2327
|
-
signer: true
|
|
2328
|
-
},
|
|
2329
2331
|
{
|
|
2330
2332
|
name: "input_stake_pool",
|
|
2331
2333
|
optional: true
|
|
@@ -2334,10 +2336,6 @@ var instructions = [
|
|
|
2334
2336
|
name: "output_stake_pool",
|
|
2335
2337
|
optional: true
|
|
2336
2338
|
},
|
|
2337
|
-
{
|
|
2338
|
-
name: "jupiter_program",
|
|
2339
|
-
address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
|
|
2340
|
-
},
|
|
2341
2339
|
{
|
|
2342
2340
|
name: "associated_token_program",
|
|
2343
2341
|
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
@@ -3471,12 +3469,12 @@ var instructions = [
|
|
|
3471
3469
|
]
|
|
3472
3470
|
},
|
|
3473
3471
|
{
|
|
3474
|
-
name: "
|
|
3472
|
+
name: "marinade_claim",
|
|
3475
3473
|
docs: [
|
|
3476
3474
|
"Claims tickets that were unstaked in the previous epoch to get SOL.",
|
|
3477
3475
|
"",
|
|
3478
3476
|
"# Parameters",
|
|
3479
|
-
"- `ctx`: The context
|
|
3477
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3480
3478
|
"",
|
|
3481
3479
|
"# Permission required",
|
|
3482
3480
|
"- Permission::Unstake",
|
|
@@ -3485,27 +3483,22 @@ var instructions = [
|
|
|
3485
3483
|
"- Integration::Marinade"
|
|
3486
3484
|
],
|
|
3487
3485
|
discriminator: [
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3486
|
+
54,
|
|
3487
|
+
44,
|
|
3488
|
+
48,
|
|
3489
|
+
204,
|
|
3490
|
+
218,
|
|
3491
|
+
141,
|
|
3492
|
+
36,
|
|
3493
|
+
5
|
|
3496
3494
|
],
|
|
3497
3495
|
accounts: [
|
|
3498
3496
|
{
|
|
3499
|
-
name: "
|
|
3500
|
-
writable: true,
|
|
3501
|
-
signer: true
|
|
3502
|
-
},
|
|
3503
|
-
{
|
|
3504
|
-
name: "state",
|
|
3497
|
+
name: "glam_state",
|
|
3505
3498
|
writable: true
|
|
3506
3499
|
},
|
|
3507
3500
|
{
|
|
3508
|
-
name: "
|
|
3501
|
+
name: "glam_vault",
|
|
3509
3502
|
writable: true,
|
|
3510
3503
|
pda: {
|
|
3511
3504
|
seeds: [
|
|
@@ -3521,13 +3514,22 @@ var instructions = [
|
|
|
3521
3514
|
},
|
|
3522
3515
|
{
|
|
3523
3516
|
kind: "account",
|
|
3524
|
-
path: "
|
|
3517
|
+
path: "glam_state"
|
|
3525
3518
|
}
|
|
3526
3519
|
]
|
|
3527
3520
|
}
|
|
3528
3521
|
},
|
|
3529
3522
|
{
|
|
3530
|
-
name: "
|
|
3523
|
+
name: "glam_signer",
|
|
3524
|
+
writable: true,
|
|
3525
|
+
signer: true
|
|
3526
|
+
},
|
|
3527
|
+
{
|
|
3528
|
+
name: "cpi_program",
|
|
3529
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3530
|
+
},
|
|
3531
|
+
{
|
|
3532
|
+
name: "state",
|
|
3531
3533
|
writable: true
|
|
3532
3534
|
},
|
|
3533
3535
|
{
|
|
@@ -3535,65 +3537,50 @@ var instructions = [
|
|
|
3535
3537
|
writable: true
|
|
3536
3538
|
},
|
|
3537
3539
|
{
|
|
3538
|
-
name: "
|
|
3539
|
-
|
|
3540
|
+
name: "ticket_account",
|
|
3541
|
+
writable: true
|
|
3540
3542
|
},
|
|
3541
3543
|
{
|
|
3542
|
-
name: "clock"
|
|
3543
|
-
address: "SysvarC1ock11111111111111111111111111111111"
|
|
3544
|
+
name: "clock"
|
|
3544
3545
|
},
|
|
3545
3546
|
{
|
|
3546
3547
|
name: "system_program",
|
|
3547
3548
|
address: "11111111111111111111111111111111"
|
|
3548
|
-
},
|
|
3549
|
-
{
|
|
3550
|
-
name: "token_program",
|
|
3551
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
3552
|
-
},
|
|
3553
|
-
{
|
|
3554
|
-
name: "marinade_program",
|
|
3555
|
-
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3556
3549
|
}
|
|
3557
3550
|
],
|
|
3558
3551
|
args: []
|
|
3559
3552
|
},
|
|
3560
3553
|
{
|
|
3561
|
-
name: "
|
|
3554
|
+
name: "marinade_deposit",
|
|
3562
3555
|
docs: [
|
|
3563
|
-
"
|
|
3556
|
+
"Deposits SOL to get mSOL.",
|
|
3564
3557
|
"",
|
|
3565
3558
|
"# Parameters",
|
|
3566
|
-
"- `ctx`: The context
|
|
3567
|
-
"- `
|
|
3559
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3560
|
+
"- `lamports`: The amount of SOL (in lamports) to deposit.",
|
|
3568
3561
|
"",
|
|
3569
3562
|
"# Permission required",
|
|
3570
|
-
"- Permission::
|
|
3563
|
+
"- Permission::Stake",
|
|
3571
3564
|
"",
|
|
3572
3565
|
"# Integration required",
|
|
3573
3566
|
"- Integration::Marinade"
|
|
3574
3567
|
],
|
|
3575
3568
|
discriminator: [
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3569
|
+
62,
|
|
3570
|
+
236,
|
|
3571
|
+
248,
|
|
3572
|
+
28,
|
|
3579
3573
|
222,
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
95
|
|
3574
|
+
232,
|
|
3575
|
+
182,
|
|
3576
|
+
73
|
|
3584
3577
|
],
|
|
3585
3578
|
accounts: [
|
|
3586
3579
|
{
|
|
3587
|
-
name: "
|
|
3588
|
-
writable: true,
|
|
3589
|
-
signer: true
|
|
3590
|
-
},
|
|
3591
|
-
{
|
|
3592
|
-
name: "state",
|
|
3593
|
-
writable: true
|
|
3580
|
+
name: "glam_state"
|
|
3594
3581
|
},
|
|
3595
3582
|
{
|
|
3596
|
-
name: "
|
|
3583
|
+
name: "glam_vault",
|
|
3597
3584
|
writable: true,
|
|
3598
3585
|
pda: {
|
|
3599
3586
|
seeds: [
|
|
@@ -3609,13 +3596,22 @@ var instructions = [
|
|
|
3609
3596
|
},
|
|
3610
3597
|
{
|
|
3611
3598
|
kind: "account",
|
|
3612
|
-
path: "
|
|
3599
|
+
path: "glam_state"
|
|
3613
3600
|
}
|
|
3614
3601
|
]
|
|
3615
3602
|
}
|
|
3616
3603
|
},
|
|
3617
3604
|
{
|
|
3618
|
-
name: "
|
|
3605
|
+
name: "glam_signer",
|
|
3606
|
+
writable: true,
|
|
3607
|
+
signer: true
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
name: "cpi_program",
|
|
3611
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3612
|
+
},
|
|
3613
|
+
{
|
|
3614
|
+
name: "state",
|
|
3619
3615
|
writable: true
|
|
3620
3616
|
},
|
|
3621
3617
|
{
|
|
@@ -3623,54 +3619,50 @@ var instructions = [
|
|
|
3623
3619
|
writable: true
|
|
3624
3620
|
},
|
|
3625
3621
|
{
|
|
3626
|
-
name: "
|
|
3622
|
+
name: "liq_pool_sol_leg_pda",
|
|
3627
3623
|
writable: true
|
|
3628
3624
|
},
|
|
3629
3625
|
{
|
|
3630
|
-
name: "
|
|
3626
|
+
name: "liq_pool_msol_leg",
|
|
3631
3627
|
writable: true
|
|
3632
3628
|
},
|
|
3629
|
+
{
|
|
3630
|
+
name: "liq_pool_msol_leg_authority"
|
|
3631
|
+
},
|
|
3633
3632
|
{
|
|
3634
3633
|
name: "reserve_pda",
|
|
3635
3634
|
writable: true
|
|
3636
3635
|
},
|
|
3637
3636
|
{
|
|
3638
|
-
name: "
|
|
3639
|
-
|
|
3637
|
+
name: "mint_to",
|
|
3638
|
+
writable: true
|
|
3640
3639
|
},
|
|
3641
3640
|
{
|
|
3642
|
-
name: "
|
|
3643
|
-
address: "SysvarC1ock11111111111111111111111111111111"
|
|
3641
|
+
name: "msol_mint_authority"
|
|
3644
3642
|
},
|
|
3645
3643
|
{
|
|
3646
3644
|
name: "system_program",
|
|
3647
3645
|
address: "11111111111111111111111111111111"
|
|
3648
3646
|
},
|
|
3649
3647
|
{
|
|
3650
|
-
name: "token_program"
|
|
3651
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
3652
|
-
},
|
|
3653
|
-
{
|
|
3654
|
-
name: "marinade_program",
|
|
3655
|
-
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3648
|
+
name: "token_program"
|
|
3656
3649
|
}
|
|
3657
3650
|
],
|
|
3658
3651
|
args: [
|
|
3659
3652
|
{
|
|
3660
|
-
name: "
|
|
3653
|
+
name: "lamports",
|
|
3661
3654
|
type: "u64"
|
|
3662
3655
|
}
|
|
3663
3656
|
]
|
|
3664
3657
|
},
|
|
3665
3658
|
{
|
|
3666
|
-
name: "
|
|
3659
|
+
name: "marinade_deposit_stake_account",
|
|
3667
3660
|
docs: [
|
|
3668
|
-
"
|
|
3669
|
-
"Deposits SOL to get mSOL.",
|
|
3661
|
+
"Deposits a stake account to get mSOL.",
|
|
3670
3662
|
"",
|
|
3671
3663
|
"# Parameters",
|
|
3672
|
-
"- `ctx`: The context
|
|
3673
|
-
"- `
|
|
3664
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3665
|
+
"- `validator_idx`: Validator index in Marinade's validator list.",
|
|
3674
3666
|
"",
|
|
3675
3667
|
"# Permission required",
|
|
3676
3668
|
"- Permission::Stake",
|
|
@@ -3679,26 +3671,22 @@ var instructions = [
|
|
|
3679
3671
|
"- Integration::Marinade"
|
|
3680
3672
|
],
|
|
3681
3673
|
discriminator: [
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
56,
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3674
|
+
141,
|
|
3675
|
+
230,
|
|
3676
|
+
58,
|
|
3677
|
+
103,
|
|
3678
|
+
56,
|
|
3679
|
+
205,
|
|
3680
|
+
159,
|
|
3681
|
+
138
|
|
3690
3682
|
],
|
|
3691
3683
|
accounts: [
|
|
3692
3684
|
{
|
|
3693
|
-
name: "
|
|
3694
|
-
writable: true
|
|
3695
|
-
signer: true
|
|
3696
|
-
},
|
|
3697
|
-
{
|
|
3698
|
-
name: "state"
|
|
3685
|
+
name: "glam_state",
|
|
3686
|
+
writable: true
|
|
3699
3687
|
},
|
|
3700
3688
|
{
|
|
3701
|
-
name: "
|
|
3689
|
+
name: "glam_vault",
|
|
3702
3690
|
writable: true,
|
|
3703
3691
|
pda: {
|
|
3704
3692
|
seeds: [
|
|
@@ -3714,189 +3702,207 @@ var instructions = [
|
|
|
3714
3702
|
},
|
|
3715
3703
|
{
|
|
3716
3704
|
kind: "account",
|
|
3717
|
-
path: "
|
|
3705
|
+
path: "glam_state"
|
|
3718
3706
|
}
|
|
3719
3707
|
]
|
|
3720
3708
|
}
|
|
3721
3709
|
},
|
|
3722
3710
|
{
|
|
3723
|
-
name: "
|
|
3724
|
-
writable: true
|
|
3711
|
+
name: "glam_signer",
|
|
3712
|
+
writable: true,
|
|
3713
|
+
signer: true
|
|
3725
3714
|
},
|
|
3726
3715
|
{
|
|
3727
|
-
name: "
|
|
3716
|
+
name: "cpi_program",
|
|
3717
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
name: "state",
|
|
3728
3721
|
writable: true
|
|
3729
3722
|
},
|
|
3730
3723
|
{
|
|
3731
|
-
name: "
|
|
3724
|
+
name: "validator_list",
|
|
3732
3725
|
writable: true
|
|
3733
3726
|
},
|
|
3734
3727
|
{
|
|
3735
|
-
name: "
|
|
3728
|
+
name: "stake_list",
|
|
3736
3729
|
writable: true
|
|
3737
3730
|
},
|
|
3738
3731
|
{
|
|
3739
|
-
name: "
|
|
3732
|
+
name: "stake_account",
|
|
3740
3733
|
writable: true
|
|
3741
3734
|
},
|
|
3742
3735
|
{
|
|
3743
|
-
name: "
|
|
3736
|
+
name: "duplication_flag",
|
|
3744
3737
|
writable: true
|
|
3745
3738
|
},
|
|
3746
3739
|
{
|
|
3747
|
-
name: "
|
|
3740
|
+
name: "msol_mint",
|
|
3748
3741
|
writable: true
|
|
3749
3742
|
},
|
|
3750
3743
|
{
|
|
3751
3744
|
name: "mint_to",
|
|
3745
|
+
writable: true
|
|
3746
|
+
},
|
|
3747
|
+
{
|
|
3748
|
+
name: "msol_mint_authority"
|
|
3749
|
+
},
|
|
3750
|
+
{
|
|
3751
|
+
name: "clock"
|
|
3752
|
+
},
|
|
3753
|
+
{
|
|
3754
|
+
name: "rent",
|
|
3755
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
3756
|
+
},
|
|
3757
|
+
{
|
|
3758
|
+
name: "system_program",
|
|
3759
|
+
address: "11111111111111111111111111111111"
|
|
3760
|
+
},
|
|
3761
|
+
{
|
|
3762
|
+
name: "token_program"
|
|
3763
|
+
},
|
|
3764
|
+
{
|
|
3765
|
+
name: "stake_program"
|
|
3766
|
+
}
|
|
3767
|
+
],
|
|
3768
|
+
args: [
|
|
3769
|
+
{
|
|
3770
|
+
name: "validator_idx",
|
|
3771
|
+
type: "u32"
|
|
3772
|
+
}
|
|
3773
|
+
]
|
|
3774
|
+
},
|
|
3775
|
+
{
|
|
3776
|
+
name: "marinade_liquid_unstake",
|
|
3777
|
+
docs: [
|
|
3778
|
+
"Unstakes mSOL to get SOL immediately with a small fee.",
|
|
3779
|
+
"",
|
|
3780
|
+
"# Parameters",
|
|
3781
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3782
|
+
"- `msol_amount`: Amount of mSOL to unstake.",
|
|
3783
|
+
"",
|
|
3784
|
+
"# Permission required",
|
|
3785
|
+
"- Permission::Unstake",
|
|
3786
|
+
"",
|
|
3787
|
+
"# Integration required",
|
|
3788
|
+
"- Integration::Marinade"
|
|
3789
|
+
],
|
|
3790
|
+
discriminator: [
|
|
3791
|
+
29,
|
|
3792
|
+
146,
|
|
3793
|
+
34,
|
|
3794
|
+
21,
|
|
3795
|
+
26,
|
|
3796
|
+
68,
|
|
3797
|
+
141,
|
|
3798
|
+
161
|
|
3799
|
+
],
|
|
3800
|
+
accounts: [
|
|
3801
|
+
{
|
|
3802
|
+
name: "glam_state"
|
|
3803
|
+
},
|
|
3804
|
+
{
|
|
3805
|
+
name: "glam_vault",
|
|
3752
3806
|
writable: true,
|
|
3753
3807
|
pda: {
|
|
3754
3808
|
seeds: [
|
|
3755
|
-
{
|
|
3756
|
-
kind: "account",
|
|
3757
|
-
path: "vault"
|
|
3758
|
-
},
|
|
3759
3809
|
{
|
|
3760
3810
|
kind: "const",
|
|
3761
3811
|
value: [
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
101,
|
|
3768
|
-
161,
|
|
3769
|
-
147,
|
|
3770
|
-
217,
|
|
3771
|
-
203,
|
|
3772
|
-
225,
|
|
3773
|
-
70,
|
|
3774
|
-
206,
|
|
3775
|
-
235,
|
|
3776
|
-
121,
|
|
3777
|
-
172,
|
|
3778
|
-
28,
|
|
3779
|
-
180,
|
|
3780
|
-
133,
|
|
3781
|
-
237,
|
|
3782
|
-
95,
|
|
3783
|
-
91,
|
|
3784
|
-
55,
|
|
3785
|
-
145,
|
|
3786
|
-
58,
|
|
3787
|
-
140,
|
|
3788
|
-
245,
|
|
3789
|
-
133,
|
|
3790
|
-
126,
|
|
3791
|
-
255,
|
|
3792
|
-
0,
|
|
3793
|
-
169
|
|
3812
|
+
118,
|
|
3813
|
+
97,
|
|
3814
|
+
117,
|
|
3815
|
+
108,
|
|
3816
|
+
116
|
|
3794
3817
|
]
|
|
3795
3818
|
},
|
|
3796
3819
|
{
|
|
3797
3820
|
kind: "account",
|
|
3798
|
-
path: "
|
|
3821
|
+
path: "glam_state"
|
|
3799
3822
|
}
|
|
3800
|
-
]
|
|
3801
|
-
program: {
|
|
3802
|
-
kind: "const",
|
|
3803
|
-
value: [
|
|
3804
|
-
140,
|
|
3805
|
-
151,
|
|
3806
|
-
37,
|
|
3807
|
-
143,
|
|
3808
|
-
78,
|
|
3809
|
-
36,
|
|
3810
|
-
137,
|
|
3811
|
-
241,
|
|
3812
|
-
187,
|
|
3813
|
-
61,
|
|
3814
|
-
16,
|
|
3815
|
-
41,
|
|
3816
|
-
20,
|
|
3817
|
-
142,
|
|
3818
|
-
13,
|
|
3819
|
-
131,
|
|
3820
|
-
11,
|
|
3821
|
-
90,
|
|
3822
|
-
19,
|
|
3823
|
-
153,
|
|
3824
|
-
218,
|
|
3825
|
-
255,
|
|
3826
|
-
16,
|
|
3827
|
-
132,
|
|
3828
|
-
4,
|
|
3829
|
-
142,
|
|
3830
|
-
123,
|
|
3831
|
-
216,
|
|
3832
|
-
219,
|
|
3833
|
-
233,
|
|
3834
|
-
248,
|
|
3835
|
-
89
|
|
3836
|
-
]
|
|
3837
|
-
}
|
|
3823
|
+
]
|
|
3838
3824
|
}
|
|
3839
3825
|
},
|
|
3840
3826
|
{
|
|
3841
|
-
name: "
|
|
3827
|
+
name: "glam_signer",
|
|
3828
|
+
writable: true,
|
|
3829
|
+
signer: true
|
|
3830
|
+
},
|
|
3831
|
+
{
|
|
3832
|
+
name: "cpi_program",
|
|
3842
3833
|
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3843
3834
|
},
|
|
3844
3835
|
{
|
|
3845
|
-
name: "
|
|
3846
|
-
|
|
3836
|
+
name: "state",
|
|
3837
|
+
writable: true
|
|
3838
|
+
},
|
|
3839
|
+
{
|
|
3840
|
+
name: "msol_mint",
|
|
3841
|
+
writable: true
|
|
3842
|
+
},
|
|
3843
|
+
{
|
|
3844
|
+
name: "liq_pool_sol_leg_pda",
|
|
3845
|
+
writable: true
|
|
3846
|
+
},
|
|
3847
|
+
{
|
|
3848
|
+
name: "liq_pool_msol_leg",
|
|
3849
|
+
writable: true
|
|
3850
|
+
},
|
|
3851
|
+
{
|
|
3852
|
+
name: "treasury_msol_account",
|
|
3853
|
+
writable: true
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
name: "get_msol_from",
|
|
3857
|
+
writable: true
|
|
3847
3858
|
},
|
|
3848
3859
|
{
|
|
3849
3860
|
name: "system_program",
|
|
3850
3861
|
address: "11111111111111111111111111111111"
|
|
3851
3862
|
},
|
|
3852
3863
|
{
|
|
3853
|
-
name: "token_program"
|
|
3854
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
3864
|
+
name: "token_program"
|
|
3855
3865
|
}
|
|
3856
3866
|
],
|
|
3857
3867
|
args: [
|
|
3858
3868
|
{
|
|
3859
|
-
name: "
|
|
3869
|
+
name: "msol_amount",
|
|
3860
3870
|
type: "u64"
|
|
3861
3871
|
}
|
|
3862
3872
|
]
|
|
3863
3873
|
},
|
|
3864
3874
|
{
|
|
3865
|
-
name: "
|
|
3875
|
+
name: "marinade_order_unstake",
|
|
3866
3876
|
docs: [
|
|
3867
|
-
"
|
|
3877
|
+
"Unstakes mSOL to get a ticket that can be claimed at the next epoch.",
|
|
3868
3878
|
"",
|
|
3869
3879
|
"# Parameters",
|
|
3870
|
-
"- `ctx`: The context
|
|
3871
|
-
"- `
|
|
3880
|
+
"- `ctx`: The context containing the required accounts.",
|
|
3881
|
+
"- `msol_amount`: Amount of mSOL to unstake.",
|
|
3872
3882
|
"",
|
|
3873
3883
|
"# Permission required",
|
|
3874
|
-
"- Permission::
|
|
3884
|
+
"- Permission::Unstake",
|
|
3875
3885
|
"",
|
|
3876
3886
|
"# Integration required",
|
|
3877
3887
|
"- Integration::Marinade"
|
|
3878
3888
|
],
|
|
3879
3889
|
discriminator: [
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3890
|
+
202,
|
|
3891
|
+
3,
|
|
3892
|
+
33,
|
|
3893
|
+
27,
|
|
3894
|
+
183,
|
|
3895
|
+
156,
|
|
3896
|
+
57,
|
|
3897
|
+
231
|
|
3888
3898
|
],
|
|
3889
3899
|
accounts: [
|
|
3890
3900
|
{
|
|
3891
|
-
name: "
|
|
3892
|
-
writable: true
|
|
3893
|
-
signer: true
|
|
3894
|
-
},
|
|
3895
|
-
{
|
|
3896
|
-
name: "state"
|
|
3901
|
+
name: "glam_state",
|
|
3902
|
+
writable: true
|
|
3897
3903
|
},
|
|
3898
3904
|
{
|
|
3899
|
-
name: "
|
|
3905
|
+
name: "glam_vault",
|
|
3900
3906
|
writable: true,
|
|
3901
3907
|
pda: {
|
|
3902
3908
|
seeds: [
|
|
@@ -3912,200 +3918,523 @@ var instructions = [
|
|
|
3912
3918
|
},
|
|
3913
3919
|
{
|
|
3914
3920
|
kind: "account",
|
|
3915
|
-
path: "
|
|
3921
|
+
path: "glam_state"
|
|
3916
3922
|
}
|
|
3917
3923
|
]
|
|
3918
3924
|
}
|
|
3919
3925
|
},
|
|
3920
3926
|
{
|
|
3921
|
-
name: "
|
|
3922
|
-
writable: true
|
|
3927
|
+
name: "glam_signer",
|
|
3928
|
+
writable: true,
|
|
3929
|
+
signer: true
|
|
3923
3930
|
},
|
|
3924
3931
|
{
|
|
3925
|
-
name: "
|
|
3926
|
-
|
|
3932
|
+
name: "cpi_program",
|
|
3933
|
+
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
3927
3934
|
},
|
|
3928
3935
|
{
|
|
3929
|
-
name: "
|
|
3936
|
+
name: "state",
|
|
3930
3937
|
writable: true
|
|
3931
3938
|
},
|
|
3932
3939
|
{
|
|
3933
|
-
name: "
|
|
3940
|
+
name: "msol_mint",
|
|
3934
3941
|
writable: true
|
|
3935
3942
|
},
|
|
3936
3943
|
{
|
|
3937
|
-
name: "
|
|
3944
|
+
name: "burn_msol_from",
|
|
3938
3945
|
writable: true
|
|
3939
3946
|
},
|
|
3940
3947
|
{
|
|
3941
|
-
name: "
|
|
3948
|
+
name: "new_ticket_account",
|
|
3942
3949
|
writable: true
|
|
3943
3950
|
},
|
|
3944
3951
|
{
|
|
3945
|
-
name: "
|
|
3952
|
+
name: "clock"
|
|
3946
3953
|
},
|
|
3947
3954
|
{
|
|
3948
|
-
name: "
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3955
|
+
name: "rent",
|
|
3956
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
3957
|
+
},
|
|
3958
|
+
{
|
|
3959
|
+
name: "token_program"
|
|
3960
|
+
}
|
|
3961
|
+
],
|
|
3962
|
+
args: [
|
|
3963
|
+
{
|
|
3964
|
+
name: "msol_amount",
|
|
3965
|
+
type: "u64"
|
|
3966
|
+
}
|
|
3967
|
+
]
|
|
3968
|
+
},
|
|
3969
|
+
{
|
|
3970
|
+
name: "merge_stake_accounts",
|
|
3971
|
+
docs: [
|
|
3972
|
+
"Merges two stake accounts.",
|
|
3973
|
+
"",
|
|
3974
|
+
"# Parameters",
|
|
3975
|
+
"- `ctx`: The context for the instruction.",
|
|
3976
|
+
"",
|
|
3977
|
+
"# Permission required",
|
|
3978
|
+
"- Permission::Stake",
|
|
3979
|
+
"",
|
|
3980
|
+
"# Integration required",
|
|
3981
|
+
"- Integration::NativeStaking"
|
|
3982
|
+
],
|
|
3983
|
+
discriminator: [
|
|
3984
|
+
173,
|
|
3985
|
+
206,
|
|
3986
|
+
10,
|
|
3987
|
+
246,
|
|
3988
|
+
109,
|
|
3989
|
+
50,
|
|
3990
|
+
244,
|
|
3991
|
+
110
|
|
3992
|
+
],
|
|
3993
|
+
accounts: [
|
|
3994
|
+
{
|
|
3995
|
+
name: "glam_state",
|
|
3996
|
+
writable: true
|
|
3997
|
+
},
|
|
3998
|
+
{
|
|
3999
|
+
name: "glam_vault",
|
|
4000
|
+
writable: true,
|
|
4001
|
+
pda: {
|
|
4002
|
+
seeds: [
|
|
4003
|
+
{
|
|
4004
|
+
kind: "const",
|
|
4005
|
+
value: [
|
|
4006
|
+
118,
|
|
4007
|
+
97,
|
|
4008
|
+
117,
|
|
4009
|
+
108,
|
|
4010
|
+
116
|
|
4011
|
+
]
|
|
4012
|
+
},
|
|
4013
|
+
{
|
|
3953
4014
|
kind: "account",
|
|
3954
|
-
path: "
|
|
4015
|
+
path: "glam_state"
|
|
4016
|
+
}
|
|
4017
|
+
]
|
|
4018
|
+
}
|
|
4019
|
+
},
|
|
4020
|
+
{
|
|
4021
|
+
name: "glam_signer",
|
|
4022
|
+
writable: true,
|
|
4023
|
+
signer: true
|
|
4024
|
+
},
|
|
4025
|
+
{
|
|
4026
|
+
name: "to_stake",
|
|
4027
|
+
writable: true
|
|
4028
|
+
},
|
|
4029
|
+
{
|
|
4030
|
+
name: "from_stake",
|
|
4031
|
+
writable: true
|
|
4032
|
+
},
|
|
4033
|
+
{
|
|
4034
|
+
name: "clock",
|
|
4035
|
+
address: "SysvarC1ock11111111111111111111111111111111"
|
|
4036
|
+
},
|
|
4037
|
+
{
|
|
4038
|
+
name: "stake_history",
|
|
4039
|
+
address: "SysvarStakeHistory1111111111111111111111111"
|
|
4040
|
+
},
|
|
4041
|
+
{
|
|
4042
|
+
name: "stake_program",
|
|
4043
|
+
address: "Stake11111111111111111111111111111111111111"
|
|
4044
|
+
},
|
|
4045
|
+
{
|
|
4046
|
+
name: "system_program",
|
|
4047
|
+
address: "11111111111111111111111111111111"
|
|
4048
|
+
}
|
|
4049
|
+
],
|
|
4050
|
+
args: []
|
|
4051
|
+
},
|
|
4052
|
+
{
|
|
4053
|
+
name: "meteora_dlmm_add_liquidity_by_strategy",
|
|
4054
|
+
discriminator: [
|
|
4055
|
+
81,
|
|
4056
|
+
139,
|
|
4057
|
+
59,
|
|
4058
|
+
146,
|
|
4059
|
+
176,
|
|
4060
|
+
196,
|
|
4061
|
+
240,
|
|
4062
|
+
216
|
|
4063
|
+
],
|
|
4064
|
+
accounts: [
|
|
4065
|
+
{
|
|
4066
|
+
name: "glam_state"
|
|
4067
|
+
},
|
|
4068
|
+
{
|
|
4069
|
+
name: "glam_vault",
|
|
4070
|
+
writable: true,
|
|
4071
|
+
pda: {
|
|
4072
|
+
seeds: [
|
|
4073
|
+
{
|
|
4074
|
+
kind: "const",
|
|
4075
|
+
value: [
|
|
4076
|
+
118,
|
|
4077
|
+
97,
|
|
4078
|
+
117,
|
|
4079
|
+
108,
|
|
4080
|
+
116
|
|
4081
|
+
]
|
|
3955
4082
|
},
|
|
4083
|
+
{
|
|
4084
|
+
kind: "account",
|
|
4085
|
+
path: "glam_state"
|
|
4086
|
+
}
|
|
4087
|
+
]
|
|
4088
|
+
}
|
|
4089
|
+
},
|
|
4090
|
+
{
|
|
4091
|
+
name: "glam_signer",
|
|
4092
|
+
writable: true,
|
|
4093
|
+
signer: true
|
|
4094
|
+
},
|
|
4095
|
+
{
|
|
4096
|
+
name: "cpi_program",
|
|
4097
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4098
|
+
},
|
|
4099
|
+
{
|
|
4100
|
+
name: "position",
|
|
4101
|
+
writable: true
|
|
4102
|
+
},
|
|
4103
|
+
{
|
|
4104
|
+
name: "lb_pair",
|
|
4105
|
+
writable: true
|
|
4106
|
+
},
|
|
4107
|
+
{
|
|
4108
|
+
name: "bin_array_bitmap_extension",
|
|
4109
|
+
writable: true
|
|
4110
|
+
},
|
|
4111
|
+
{
|
|
4112
|
+
name: "user_token_x",
|
|
4113
|
+
writable: true
|
|
4114
|
+
},
|
|
4115
|
+
{
|
|
4116
|
+
name: "user_token_y",
|
|
4117
|
+
writable: true
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
name: "reserve_x",
|
|
4121
|
+
writable: true
|
|
4122
|
+
},
|
|
4123
|
+
{
|
|
4124
|
+
name: "reserve_y",
|
|
4125
|
+
writable: true
|
|
4126
|
+
},
|
|
4127
|
+
{
|
|
4128
|
+
name: "token_x_mint"
|
|
4129
|
+
},
|
|
4130
|
+
{
|
|
4131
|
+
name: "token_y_mint"
|
|
4132
|
+
},
|
|
4133
|
+
{
|
|
4134
|
+
name: "bin_array_lower",
|
|
4135
|
+
writable: true
|
|
4136
|
+
},
|
|
4137
|
+
{
|
|
4138
|
+
name: "bin_array_upper",
|
|
4139
|
+
writable: true
|
|
4140
|
+
},
|
|
4141
|
+
{
|
|
4142
|
+
name: "token_x_program"
|
|
4143
|
+
},
|
|
4144
|
+
{
|
|
4145
|
+
name: "token_y_program"
|
|
4146
|
+
},
|
|
4147
|
+
{
|
|
4148
|
+
name: "event_authority"
|
|
4149
|
+
},
|
|
4150
|
+
{
|
|
4151
|
+
name: "program"
|
|
4152
|
+
}
|
|
4153
|
+
],
|
|
4154
|
+
args: [
|
|
4155
|
+
{
|
|
4156
|
+
name: "params",
|
|
4157
|
+
type: {
|
|
4158
|
+
defined: {
|
|
4159
|
+
name: "LiquidityParameterByStrategy"
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
]
|
|
4164
|
+
},
|
|
4165
|
+
{
|
|
4166
|
+
name: "meteora_dlmm_claim_fee",
|
|
4167
|
+
discriminator: [
|
|
4168
|
+
78,
|
|
4169
|
+
116,
|
|
4170
|
+
98,
|
|
4171
|
+
78,
|
|
4172
|
+
50,
|
|
4173
|
+
82,
|
|
4174
|
+
72,
|
|
4175
|
+
37
|
|
4176
|
+
],
|
|
4177
|
+
accounts: [
|
|
4178
|
+
{
|
|
4179
|
+
name: "glam_state"
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
name: "glam_vault",
|
|
4183
|
+
writable: true,
|
|
4184
|
+
pda: {
|
|
4185
|
+
seeds: [
|
|
3956
4186
|
{
|
|
3957
4187
|
kind: "const",
|
|
3958
4188
|
value: [
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
4189
|
+
118,
|
|
4190
|
+
97,
|
|
4191
|
+
117,
|
|
4192
|
+
108,
|
|
4193
|
+
116
|
|
4194
|
+
]
|
|
4195
|
+
},
|
|
4196
|
+
{
|
|
4197
|
+
kind: "account",
|
|
4198
|
+
path: "glam_state"
|
|
4199
|
+
}
|
|
4200
|
+
]
|
|
4201
|
+
}
|
|
4202
|
+
},
|
|
4203
|
+
{
|
|
4204
|
+
name: "glam_signer",
|
|
4205
|
+
writable: true,
|
|
4206
|
+
signer: true
|
|
4207
|
+
},
|
|
4208
|
+
{
|
|
4209
|
+
name: "cpi_program",
|
|
4210
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4211
|
+
},
|
|
4212
|
+
{
|
|
4213
|
+
name: "lb_pair",
|
|
4214
|
+
writable: true
|
|
4215
|
+
},
|
|
4216
|
+
{
|
|
4217
|
+
name: "position",
|
|
4218
|
+
writable: true
|
|
4219
|
+
},
|
|
4220
|
+
{
|
|
4221
|
+
name: "bin_array_lower",
|
|
4222
|
+
writable: true
|
|
4223
|
+
},
|
|
4224
|
+
{
|
|
4225
|
+
name: "bin_array_upper",
|
|
4226
|
+
writable: true
|
|
4227
|
+
},
|
|
4228
|
+
{
|
|
4229
|
+
name: "reserve_x",
|
|
4230
|
+
writable: true
|
|
4231
|
+
},
|
|
4232
|
+
{
|
|
4233
|
+
name: "reserve_y",
|
|
4234
|
+
writable: true
|
|
4235
|
+
},
|
|
4236
|
+
{
|
|
4237
|
+
name: "user_token_x",
|
|
4238
|
+
writable: true
|
|
4239
|
+
},
|
|
4240
|
+
{
|
|
4241
|
+
name: "user_token_y",
|
|
4242
|
+
writable: true
|
|
4243
|
+
},
|
|
4244
|
+
{
|
|
4245
|
+
name: "token_x_mint"
|
|
4246
|
+
},
|
|
4247
|
+
{
|
|
4248
|
+
name: "token_y_mint"
|
|
4249
|
+
},
|
|
4250
|
+
{
|
|
4251
|
+
name: "token_program"
|
|
4252
|
+
},
|
|
4253
|
+
{
|
|
4254
|
+
name: "event_authority"
|
|
4255
|
+
},
|
|
4256
|
+
{
|
|
4257
|
+
name: "program"
|
|
4258
|
+
}
|
|
4259
|
+
],
|
|
4260
|
+
args: []
|
|
4261
|
+
},
|
|
4262
|
+
{
|
|
4263
|
+
name: "meteora_dlmm_close_position",
|
|
4264
|
+
discriminator: [
|
|
4265
|
+
186,
|
|
4266
|
+
117,
|
|
4267
|
+
42,
|
|
4268
|
+
24,
|
|
4269
|
+
221,
|
|
4270
|
+
194,
|
|
4271
|
+
34,
|
|
4272
|
+
143
|
|
4273
|
+
],
|
|
4274
|
+
accounts: [
|
|
4275
|
+
{
|
|
4276
|
+
name: "glam_state"
|
|
4277
|
+
},
|
|
4278
|
+
{
|
|
4279
|
+
name: "glam_vault",
|
|
4280
|
+
writable: true,
|
|
4281
|
+
pda: {
|
|
4282
|
+
seeds: [
|
|
4283
|
+
{
|
|
4284
|
+
kind: "const",
|
|
4285
|
+
value: [
|
|
4286
|
+
118,
|
|
4287
|
+
97,
|
|
4288
|
+
117,
|
|
4289
|
+
108,
|
|
4290
|
+
116
|
|
4291
|
+
]
|
|
4292
|
+
},
|
|
4293
|
+
{
|
|
4294
|
+
kind: "account",
|
|
4295
|
+
path: "glam_state"
|
|
4296
|
+
}
|
|
4297
|
+
]
|
|
4298
|
+
}
|
|
4299
|
+
},
|
|
4300
|
+
{
|
|
4301
|
+
name: "glam_signer",
|
|
4302
|
+
writable: true,
|
|
4303
|
+
signer: true
|
|
4304
|
+
},
|
|
4305
|
+
{
|
|
4306
|
+
name: "cpi_program",
|
|
4307
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4308
|
+
},
|
|
4309
|
+
{
|
|
4310
|
+
name: "position",
|
|
4311
|
+
writable: true
|
|
4312
|
+
},
|
|
4313
|
+
{
|
|
4314
|
+
name: "lb_pair",
|
|
4315
|
+
writable: true
|
|
4316
|
+
},
|
|
4317
|
+
{
|
|
4318
|
+
name: "bin_array_lower",
|
|
4319
|
+
writable: true
|
|
4320
|
+
},
|
|
4321
|
+
{
|
|
4322
|
+
name: "bin_array_upper",
|
|
4323
|
+
writable: true
|
|
4324
|
+
},
|
|
4325
|
+
{
|
|
4326
|
+
name: "event_authority"
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
name: "program"
|
|
4330
|
+
}
|
|
4331
|
+
],
|
|
4332
|
+
args: []
|
|
4333
|
+
},
|
|
4334
|
+
{
|
|
4335
|
+
name: "meteora_dlmm_initialize_position",
|
|
4336
|
+
discriminator: [
|
|
4337
|
+
223,
|
|
4338
|
+
94,
|
|
4339
|
+
215,
|
|
4340
|
+
96,
|
|
4341
|
+
175,
|
|
4342
|
+
181,
|
|
4343
|
+
195,
|
|
4344
|
+
204
|
|
4345
|
+
],
|
|
4346
|
+
accounts: [
|
|
4347
|
+
{
|
|
4348
|
+
name: "glam_state"
|
|
4349
|
+
},
|
|
4350
|
+
{
|
|
4351
|
+
name: "glam_vault",
|
|
4352
|
+
writable: true,
|
|
4353
|
+
pda: {
|
|
4354
|
+
seeds: [
|
|
4355
|
+
{
|
|
4356
|
+
kind: "const",
|
|
4357
|
+
value: [
|
|
4358
|
+
118,
|
|
4359
|
+
97,
|
|
4360
|
+
117,
|
|
4361
|
+
108,
|
|
4362
|
+
116
|
|
3991
4363
|
]
|
|
3992
4364
|
},
|
|
3993
4365
|
{
|
|
3994
4366
|
kind: "account",
|
|
3995
|
-
path: "
|
|
4367
|
+
path: "glam_state"
|
|
3996
4368
|
}
|
|
3997
|
-
]
|
|
3998
|
-
program: {
|
|
3999
|
-
kind: "const",
|
|
4000
|
-
value: [
|
|
4001
|
-
140,
|
|
4002
|
-
151,
|
|
4003
|
-
37,
|
|
4004
|
-
143,
|
|
4005
|
-
78,
|
|
4006
|
-
36,
|
|
4007
|
-
137,
|
|
4008
|
-
241,
|
|
4009
|
-
187,
|
|
4010
|
-
61,
|
|
4011
|
-
16,
|
|
4012
|
-
41,
|
|
4013
|
-
20,
|
|
4014
|
-
142,
|
|
4015
|
-
13,
|
|
4016
|
-
131,
|
|
4017
|
-
11,
|
|
4018
|
-
90,
|
|
4019
|
-
19,
|
|
4020
|
-
153,
|
|
4021
|
-
218,
|
|
4022
|
-
255,
|
|
4023
|
-
16,
|
|
4024
|
-
132,
|
|
4025
|
-
4,
|
|
4026
|
-
142,
|
|
4027
|
-
123,
|
|
4028
|
-
216,
|
|
4029
|
-
219,
|
|
4030
|
-
233,
|
|
4031
|
-
248,
|
|
4032
|
-
89
|
|
4033
|
-
]
|
|
4034
|
-
}
|
|
4369
|
+
]
|
|
4035
4370
|
}
|
|
4036
4371
|
},
|
|
4037
4372
|
{
|
|
4038
|
-
name: "
|
|
4039
|
-
|
|
4373
|
+
name: "glam_signer",
|
|
4374
|
+
writable: true,
|
|
4375
|
+
signer: true
|
|
4040
4376
|
},
|
|
4041
4377
|
{
|
|
4042
|
-
name: "
|
|
4043
|
-
address: "
|
|
4378
|
+
name: "cpi_program",
|
|
4379
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4044
4380
|
},
|
|
4045
4381
|
{
|
|
4046
|
-
name: "
|
|
4047
|
-
|
|
4382
|
+
name: "payer",
|
|
4383
|
+
writable: true,
|
|
4384
|
+
signer: true
|
|
4048
4385
|
},
|
|
4049
4386
|
{
|
|
4050
|
-
name: "
|
|
4051
|
-
|
|
4387
|
+
name: "position",
|
|
4388
|
+
writable: true,
|
|
4389
|
+
signer: true
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
name: "lb_pair"
|
|
4052
4393
|
},
|
|
4053
4394
|
{
|
|
4054
4395
|
name: "system_program",
|
|
4055
4396
|
address: "11111111111111111111111111111111"
|
|
4056
4397
|
},
|
|
4057
4398
|
{
|
|
4058
|
-
name: "
|
|
4059
|
-
address: "
|
|
4399
|
+
name: "rent",
|
|
4400
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
4060
4401
|
},
|
|
4061
4402
|
{
|
|
4062
|
-
name: "
|
|
4063
|
-
|
|
4403
|
+
name: "event_authority"
|
|
4404
|
+
},
|
|
4405
|
+
{
|
|
4406
|
+
name: "program"
|
|
4064
4407
|
}
|
|
4065
4408
|
],
|
|
4066
4409
|
args: [
|
|
4067
4410
|
{
|
|
4068
|
-
name: "
|
|
4069
|
-
type: "
|
|
4411
|
+
name: "lower_bin_id",
|
|
4412
|
+
type: "i32"
|
|
4413
|
+
},
|
|
4414
|
+
{
|
|
4415
|
+
name: "width",
|
|
4416
|
+
type: "i32"
|
|
4070
4417
|
}
|
|
4071
4418
|
]
|
|
4072
4419
|
},
|
|
4073
4420
|
{
|
|
4074
|
-
name: "
|
|
4075
|
-
docs: [
|
|
4076
|
-
"Unstakes mSOL to get SOL immediately.",
|
|
4077
|
-
"",
|
|
4078
|
-
"# Parameters",
|
|
4079
|
-
"- `ctx`: The context for the instruction.",
|
|
4080
|
-
"- `msol_amount`: Amount of mSOL to unstake.",
|
|
4081
|
-
"",
|
|
4082
|
-
"# Permission required",
|
|
4083
|
-
"- Permission::LiquidUnstake",
|
|
4084
|
-
"",
|
|
4085
|
-
"# Integration required",
|
|
4086
|
-
"- Integration::Marinade"
|
|
4087
|
-
],
|
|
4421
|
+
name: "meteora_dlmm_remove_liquidity_by_range",
|
|
4088
4422
|
discriminator: [
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4423
|
+
223,
|
|
4424
|
+
12,
|
|
4425
|
+
177,
|
|
4426
|
+
181,
|
|
4427
|
+
96,
|
|
4428
|
+
109,
|
|
4429
|
+
60,
|
|
4430
|
+
124
|
|
4097
4431
|
],
|
|
4098
4432
|
accounts: [
|
|
4099
4433
|
{
|
|
4100
|
-
name: "
|
|
4101
|
-
writable: true,
|
|
4102
|
-
signer: true
|
|
4103
|
-
},
|
|
4104
|
-
{
|
|
4105
|
-
name: "state"
|
|
4434
|
+
name: "glam_state"
|
|
4106
4435
|
},
|
|
4107
4436
|
{
|
|
4108
|
-
name: "
|
|
4437
|
+
name: "glam_vault",
|
|
4109
4438
|
writable: true,
|
|
4110
4439
|
pda: {
|
|
4111
4440
|
seeds: [
|
|
@@ -4121,95 +4450,108 @@ var instructions = [
|
|
|
4121
4450
|
},
|
|
4122
4451
|
{
|
|
4123
4452
|
kind: "account",
|
|
4124
|
-
path: "
|
|
4453
|
+
path: "glam_state"
|
|
4125
4454
|
}
|
|
4126
4455
|
]
|
|
4127
4456
|
}
|
|
4128
4457
|
},
|
|
4129
4458
|
{
|
|
4130
|
-
name: "
|
|
4459
|
+
name: "glam_signer",
|
|
4460
|
+
writable: true,
|
|
4461
|
+
signer: true
|
|
4462
|
+
},
|
|
4463
|
+
{
|
|
4464
|
+
name: "cpi_program",
|
|
4465
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4466
|
+
},
|
|
4467
|
+
{
|
|
4468
|
+
name: "position",
|
|
4131
4469
|
writable: true
|
|
4132
4470
|
},
|
|
4133
4471
|
{
|
|
4134
|
-
name: "
|
|
4472
|
+
name: "lb_pair",
|
|
4135
4473
|
writable: true
|
|
4136
4474
|
},
|
|
4137
4475
|
{
|
|
4138
|
-
name: "
|
|
4476
|
+
name: "bin_array_bitmap_extension",
|
|
4139
4477
|
writable: true
|
|
4140
4478
|
},
|
|
4141
4479
|
{
|
|
4142
|
-
name: "
|
|
4480
|
+
name: "user_token_x",
|
|
4143
4481
|
writable: true
|
|
4144
4482
|
},
|
|
4145
4483
|
{
|
|
4146
|
-
name: "
|
|
4484
|
+
name: "user_token_y",
|
|
4147
4485
|
writable: true
|
|
4148
4486
|
},
|
|
4149
4487
|
{
|
|
4150
|
-
name: "
|
|
4488
|
+
name: "reserve_x",
|
|
4151
4489
|
writable: true
|
|
4152
4490
|
},
|
|
4153
4491
|
{
|
|
4154
|
-
name: "
|
|
4492
|
+
name: "reserve_y",
|
|
4155
4493
|
writable: true
|
|
4156
4494
|
},
|
|
4157
4495
|
{
|
|
4158
|
-
name: "
|
|
4159
|
-
address: "MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"
|
|
4496
|
+
name: "token_x_mint"
|
|
4160
4497
|
},
|
|
4161
4498
|
{
|
|
4162
|
-
name: "
|
|
4163
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
4499
|
+
name: "token_y_mint"
|
|
4164
4500
|
},
|
|
4165
4501
|
{
|
|
4166
|
-
name: "
|
|
4167
|
-
|
|
4502
|
+
name: "bin_array_lower",
|
|
4503
|
+
writable: true
|
|
4504
|
+
},
|
|
4505
|
+
{
|
|
4506
|
+
name: "bin_array_upper",
|
|
4507
|
+
writable: true
|
|
4508
|
+
},
|
|
4509
|
+
{
|
|
4510
|
+
name: "token_x_program"
|
|
4511
|
+
},
|
|
4512
|
+
{
|
|
4513
|
+
name: "token_y_program"
|
|
4514
|
+
},
|
|
4515
|
+
{
|
|
4516
|
+
name: "event_authority"
|
|
4517
|
+
},
|
|
4518
|
+
{
|
|
4519
|
+
name: "program"
|
|
4168
4520
|
}
|
|
4169
4521
|
],
|
|
4170
4522
|
args: [
|
|
4171
4523
|
{
|
|
4172
|
-
name: "
|
|
4173
|
-
type: "
|
|
4524
|
+
name: "from_bin_id",
|
|
4525
|
+
type: "i32"
|
|
4526
|
+
},
|
|
4527
|
+
{
|
|
4528
|
+
name: "to_bin_id",
|
|
4529
|
+
type: "i32"
|
|
4530
|
+
},
|
|
4531
|
+
{
|
|
4532
|
+
name: "bps_to_remove",
|
|
4533
|
+
type: "u16"
|
|
4174
4534
|
}
|
|
4175
4535
|
]
|
|
4176
4536
|
},
|
|
4177
4537
|
{
|
|
4178
|
-
name: "
|
|
4179
|
-
docs: [
|
|
4180
|
-
"Merges two stake accounts.",
|
|
4181
|
-
"",
|
|
4182
|
-
"# Parameters",
|
|
4183
|
-
"- `ctx`: The context for the instruction.",
|
|
4184
|
-
"",
|
|
4185
|
-
"# Permission required",
|
|
4186
|
-
"- Permission::Stake",
|
|
4187
|
-
"",
|
|
4188
|
-
"# Integration required",
|
|
4189
|
-
"- Integration::NativeStaking"
|
|
4190
|
-
],
|
|
4538
|
+
name: "meteora_dlmm_swap",
|
|
4191
4539
|
discriminator: [
|
|
4540
|
+
127,
|
|
4541
|
+
64,
|
|
4542
|
+
37,
|
|
4543
|
+
138,
|
|
4192
4544
|
173,
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
109,
|
|
4197
|
-
50,
|
|
4198
|
-
244,
|
|
4199
|
-
110
|
|
4545
|
+
243,
|
|
4546
|
+
207,
|
|
4547
|
+
84
|
|
4200
4548
|
],
|
|
4201
4549
|
accounts: [
|
|
4202
4550
|
{
|
|
4203
|
-
name: "
|
|
4204
|
-
writable: true,
|
|
4205
|
-
signer: true
|
|
4206
|
-
},
|
|
4207
|
-
{
|
|
4208
|
-
name: "state",
|
|
4209
|
-
writable: true
|
|
4551
|
+
name: "glam_state"
|
|
4210
4552
|
},
|
|
4211
4553
|
{
|
|
4212
|
-
name: "
|
|
4554
|
+
name: "glam_vault",
|
|
4213
4555
|
writable: true,
|
|
4214
4556
|
pda: {
|
|
4215
4557
|
seeds: [
|
|
@@ -4225,37 +4567,80 @@ var instructions = [
|
|
|
4225
4567
|
},
|
|
4226
4568
|
{
|
|
4227
4569
|
kind: "account",
|
|
4228
|
-
path: "
|
|
4570
|
+
path: "glam_state"
|
|
4229
4571
|
}
|
|
4230
4572
|
]
|
|
4231
4573
|
}
|
|
4232
4574
|
},
|
|
4233
4575
|
{
|
|
4234
|
-
name: "
|
|
4576
|
+
name: "glam_signer",
|
|
4577
|
+
writable: true,
|
|
4578
|
+
signer: true
|
|
4579
|
+
},
|
|
4580
|
+
{
|
|
4581
|
+
name: "cpi_program",
|
|
4582
|
+
address: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"
|
|
4583
|
+
},
|
|
4584
|
+
{
|
|
4585
|
+
name: "lb_pair",
|
|
4235
4586
|
writable: true
|
|
4236
4587
|
},
|
|
4237
4588
|
{
|
|
4238
|
-
name: "
|
|
4589
|
+
name: "bin_array_bitmap_extension"
|
|
4590
|
+
},
|
|
4591
|
+
{
|
|
4592
|
+
name: "reserve_x",
|
|
4239
4593
|
writable: true
|
|
4240
4594
|
},
|
|
4241
4595
|
{
|
|
4242
|
-
name: "
|
|
4243
|
-
|
|
4596
|
+
name: "reserve_y",
|
|
4597
|
+
writable: true
|
|
4244
4598
|
},
|
|
4245
4599
|
{
|
|
4246
|
-
name: "
|
|
4247
|
-
|
|
4600
|
+
name: "user_token_in",
|
|
4601
|
+
writable: true
|
|
4248
4602
|
},
|
|
4249
4603
|
{
|
|
4250
|
-
name: "
|
|
4251
|
-
|
|
4604
|
+
name: "user_token_out",
|
|
4605
|
+
writable: true
|
|
4252
4606
|
},
|
|
4253
4607
|
{
|
|
4254
|
-
name: "
|
|
4255
|
-
|
|
4608
|
+
name: "token_x_mint"
|
|
4609
|
+
},
|
|
4610
|
+
{
|
|
4611
|
+
name: "token_y_mint"
|
|
4612
|
+
},
|
|
4613
|
+
{
|
|
4614
|
+
name: "oracle",
|
|
4615
|
+
writable: true
|
|
4616
|
+
},
|
|
4617
|
+
{
|
|
4618
|
+
name: "host_fee_in",
|
|
4619
|
+
writable: true
|
|
4620
|
+
},
|
|
4621
|
+
{
|
|
4622
|
+
name: "token_x_program"
|
|
4623
|
+
},
|
|
4624
|
+
{
|
|
4625
|
+
name: "token_y_program"
|
|
4626
|
+
},
|
|
4627
|
+
{
|
|
4628
|
+
name: "event_authority"
|
|
4629
|
+
},
|
|
4630
|
+
{
|
|
4631
|
+
name: "program"
|
|
4256
4632
|
}
|
|
4257
4633
|
],
|
|
4258
|
-
args: [
|
|
4634
|
+
args: [
|
|
4635
|
+
{
|
|
4636
|
+
name: "amount_in",
|
|
4637
|
+
type: "u64"
|
|
4638
|
+
},
|
|
4639
|
+
{
|
|
4640
|
+
name: "min_amount_out",
|
|
4641
|
+
type: "u64"
|
|
4642
|
+
}
|
|
4643
|
+
]
|
|
4259
4644
|
},
|
|
4260
4645
|
{
|
|
4261
4646
|
name: "mint_tokens",
|
|
@@ -4289,14 +4674,14 @@ var instructions = [
|
|
|
4289
4674
|
writable: true
|
|
4290
4675
|
},
|
|
4291
4676
|
{
|
|
4292
|
-
name: "
|
|
4293
|
-
writable: true
|
|
4294
|
-
},
|
|
4295
|
-
{
|
|
4296
|
-
name: "signer",
|
|
4677
|
+
name: "glam_signer",
|
|
4297
4678
|
writable: true,
|
|
4298
4679
|
signer: true
|
|
4299
4680
|
},
|
|
4681
|
+
{
|
|
4682
|
+
name: "glam_mint",
|
|
4683
|
+
writable: true
|
|
4684
|
+
},
|
|
4300
4685
|
{
|
|
4301
4686
|
name: "mint_to",
|
|
4302
4687
|
writable: true,
|
|
@@ -4519,16 +4904,11 @@ var instructions = [
|
|
|
4519
4904
|
],
|
|
4520
4905
|
accounts: [
|
|
4521
4906
|
{
|
|
4522
|
-
name: "
|
|
4523
|
-
writable: true,
|
|
4524
|
-
signer: true
|
|
4525
|
-
},
|
|
4526
|
-
{
|
|
4527
|
-
name: "state",
|
|
4907
|
+
name: "glam_state",
|
|
4528
4908
|
writable: true
|
|
4529
4909
|
},
|
|
4530
4910
|
{
|
|
4531
|
-
name: "
|
|
4911
|
+
name: "glam_vault",
|
|
4532
4912
|
writable: true,
|
|
4533
4913
|
pda: {
|
|
4534
4914
|
seeds: [
|
|
@@ -4544,11 +4924,16 @@ var instructions = [
|
|
|
4544
4924
|
},
|
|
4545
4925
|
{
|
|
4546
4926
|
kind: "account",
|
|
4547
|
-
path: "
|
|
4927
|
+
path: "glam_state"
|
|
4548
4928
|
}
|
|
4549
4929
|
]
|
|
4550
4930
|
}
|
|
4551
4931
|
},
|
|
4932
|
+
{
|
|
4933
|
+
name: "glam_signer",
|
|
4934
|
+
writable: true,
|
|
4935
|
+
signer: true
|
|
4936
|
+
},
|
|
4552
4937
|
{
|
|
4553
4938
|
name: "existing_stake",
|
|
4554
4939
|
writable: true
|
|
@@ -4604,11 +4989,11 @@ var instructions = [
|
|
|
4604
4989
|
],
|
|
4605
4990
|
accounts: [
|
|
4606
4991
|
{
|
|
4607
|
-
name: "
|
|
4992
|
+
name: "glam_state",
|
|
4608
4993
|
writable: true
|
|
4609
4994
|
},
|
|
4610
4995
|
{
|
|
4611
|
-
name: "
|
|
4996
|
+
name: "glam_signer",
|
|
4612
4997
|
writable: true,
|
|
4613
4998
|
signer: true
|
|
4614
4999
|
}
|
|
@@ -4651,14 +5036,14 @@ var instructions = [
|
|
|
4651
5036
|
name: "glam_state"
|
|
4652
5037
|
},
|
|
4653
5038
|
{
|
|
4654
|
-
name: "
|
|
4655
|
-
writable: true
|
|
4656
|
-
},
|
|
4657
|
-
{
|
|
4658
|
-
name: "signer",
|
|
5039
|
+
name: "glam_signer",
|
|
4659
5040
|
writable: true,
|
|
4660
5041
|
signer: true
|
|
4661
5042
|
},
|
|
5043
|
+
{
|
|
5044
|
+
name: "glam_mint",
|
|
5045
|
+
writable: true
|
|
5046
|
+
},
|
|
4662
5047
|
{
|
|
4663
5048
|
name: "token_2022_program",
|
|
4664
5049
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -4702,16 +5087,11 @@ var instructions = [
|
|
|
4702
5087
|
],
|
|
4703
5088
|
accounts: [
|
|
4704
5089
|
{
|
|
4705
|
-
name: "
|
|
4706
|
-
writable: true,
|
|
4707
|
-
signer: true
|
|
4708
|
-
},
|
|
4709
|
-
{
|
|
4710
|
-
name: "state",
|
|
5090
|
+
name: "glam_state",
|
|
4711
5091
|
writable: true
|
|
4712
5092
|
},
|
|
4713
5093
|
{
|
|
4714
|
-
name: "
|
|
5094
|
+
name: "glam_vault",
|
|
4715
5095
|
writable: true,
|
|
4716
5096
|
pda: {
|
|
4717
5097
|
seeds: [
|
|
@@ -4727,11 +5107,16 @@ var instructions = [
|
|
|
4727
5107
|
},
|
|
4728
5108
|
{
|
|
4729
5109
|
kind: "account",
|
|
4730
|
-
path: "
|
|
5110
|
+
path: "glam_state"
|
|
4731
5111
|
}
|
|
4732
5112
|
]
|
|
4733
5113
|
}
|
|
4734
5114
|
},
|
|
5115
|
+
{
|
|
5116
|
+
name: "glam_signer",
|
|
5117
|
+
writable: true,
|
|
5118
|
+
signer: true
|
|
5119
|
+
},
|
|
4735
5120
|
{
|
|
4736
5121
|
name: "existing_stake",
|
|
4737
5122
|
writable: true
|
|
@@ -4787,15 +5172,10 @@ var instructions = [
|
|
|
4787
5172
|
],
|
|
4788
5173
|
accounts: [
|
|
4789
5174
|
{
|
|
4790
|
-
name: "
|
|
4791
|
-
writable: true,
|
|
4792
|
-
signer: true
|
|
4793
|
-
},
|
|
4794
|
-
{
|
|
4795
|
-
name: "state"
|
|
5175
|
+
name: "glam_state"
|
|
4796
5176
|
},
|
|
4797
5177
|
{
|
|
4798
|
-
name: "
|
|
5178
|
+
name: "glam_vault",
|
|
4799
5179
|
writable: true,
|
|
4800
5180
|
pda: {
|
|
4801
5181
|
seeds: [
|
|
@@ -4811,11 +5191,16 @@ var instructions = [
|
|
|
4811
5191
|
},
|
|
4812
5192
|
{
|
|
4813
5193
|
kind: "account",
|
|
4814
|
-
path: "
|
|
5194
|
+
path: "glam_state"
|
|
4815
5195
|
}
|
|
4816
5196
|
]
|
|
4817
5197
|
}
|
|
4818
5198
|
},
|
|
5199
|
+
{
|
|
5200
|
+
name: "glam_signer",
|
|
5201
|
+
writable: true,
|
|
5202
|
+
signer: true
|
|
5203
|
+
},
|
|
4819
5204
|
{
|
|
4820
5205
|
name: "stake_pool",
|
|
4821
5206
|
writable: true
|
|
@@ -4842,7 +5227,7 @@ var instructions = [
|
|
|
4842
5227
|
seeds: [
|
|
4843
5228
|
{
|
|
4844
5229
|
kind: "account",
|
|
4845
|
-
path: "
|
|
5230
|
+
path: "glam_vault"
|
|
4846
5231
|
},
|
|
4847
5232
|
{
|
|
4848
5233
|
kind: "const",
|
|
@@ -4973,16 +5358,11 @@ var instructions = [
|
|
|
4973
5358
|
],
|
|
4974
5359
|
accounts: [
|
|
4975
5360
|
{
|
|
4976
|
-
name: "
|
|
4977
|
-
writable: true,
|
|
4978
|
-
signer: true
|
|
4979
|
-
},
|
|
4980
|
-
{
|
|
4981
|
-
name: "state",
|
|
5361
|
+
name: "glam_state",
|
|
4982
5362
|
writable: true
|
|
4983
5363
|
},
|
|
4984
5364
|
{
|
|
4985
|
-
name: "
|
|
5365
|
+
name: "glam_vault",
|
|
4986
5366
|
writable: true,
|
|
4987
5367
|
pda: {
|
|
4988
5368
|
seeds: [
|
|
@@ -4998,11 +5378,16 @@ var instructions = [
|
|
|
4998
5378
|
},
|
|
4999
5379
|
{
|
|
5000
5380
|
kind: "account",
|
|
5001
|
-
path: "
|
|
5381
|
+
path: "glam_state"
|
|
5002
5382
|
}
|
|
5003
5383
|
]
|
|
5004
5384
|
}
|
|
5005
5385
|
},
|
|
5386
|
+
{
|
|
5387
|
+
name: "glam_signer",
|
|
5388
|
+
writable: true,
|
|
5389
|
+
signer: true
|
|
5390
|
+
},
|
|
5006
5391
|
{
|
|
5007
5392
|
name: "vault_stake_account",
|
|
5008
5393
|
writable: true
|
|
@@ -5014,7 +5399,7 @@ var instructions = [
|
|
|
5014
5399
|
seeds: [
|
|
5015
5400
|
{
|
|
5016
5401
|
kind: "account",
|
|
5017
|
-
path: "
|
|
5402
|
+
path: "glam_vault"
|
|
5018
5403
|
},
|
|
5019
5404
|
{
|
|
5020
5405
|
kind: "const",
|
|
@@ -5183,15 +5568,10 @@ var instructions = [
|
|
|
5183
5568
|
],
|
|
5184
5569
|
accounts: [
|
|
5185
5570
|
{
|
|
5186
|
-
name: "
|
|
5187
|
-
writable: true,
|
|
5188
|
-
signer: true
|
|
5189
|
-
},
|
|
5190
|
-
{
|
|
5191
|
-
name: "state"
|
|
5571
|
+
name: "glam_state"
|
|
5192
5572
|
},
|
|
5193
5573
|
{
|
|
5194
|
-
name: "
|
|
5574
|
+
name: "glam_vault",
|
|
5195
5575
|
writable: true,
|
|
5196
5576
|
pda: {
|
|
5197
5577
|
seeds: [
|
|
@@ -5207,11 +5587,16 @@ var instructions = [
|
|
|
5207
5587
|
},
|
|
5208
5588
|
{
|
|
5209
5589
|
kind: "account",
|
|
5210
|
-
path: "
|
|
5590
|
+
path: "glam_state"
|
|
5211
5591
|
}
|
|
5212
5592
|
]
|
|
5213
5593
|
}
|
|
5214
5594
|
},
|
|
5595
|
+
{
|
|
5596
|
+
name: "glam_signer",
|
|
5597
|
+
writable: true,
|
|
5598
|
+
signer: true
|
|
5599
|
+
},
|
|
5215
5600
|
{
|
|
5216
5601
|
name: "stake_pool",
|
|
5217
5602
|
writable: true
|
|
@@ -5292,16 +5677,11 @@ var instructions = [
|
|
|
5292
5677
|
],
|
|
5293
5678
|
accounts: [
|
|
5294
5679
|
{
|
|
5295
|
-
name: "
|
|
5296
|
-
writable: true,
|
|
5297
|
-
signer: true
|
|
5298
|
-
},
|
|
5299
|
-
{
|
|
5300
|
-
name: "state",
|
|
5680
|
+
name: "glam_state",
|
|
5301
5681
|
writable: true
|
|
5302
5682
|
},
|
|
5303
5683
|
{
|
|
5304
|
-
name: "
|
|
5684
|
+
name: "glam_vault",
|
|
5305
5685
|
writable: true,
|
|
5306
5686
|
pda: {
|
|
5307
5687
|
seeds: [
|
|
@@ -5317,11 +5697,16 @@ var instructions = [
|
|
|
5317
5697
|
},
|
|
5318
5698
|
{
|
|
5319
5699
|
kind: "account",
|
|
5320
|
-
path: "
|
|
5700
|
+
path: "glam_state"
|
|
5321
5701
|
}
|
|
5322
5702
|
]
|
|
5323
5703
|
}
|
|
5324
5704
|
},
|
|
5705
|
+
{
|
|
5706
|
+
name: "glam_signer",
|
|
5707
|
+
writable: true,
|
|
5708
|
+
signer: true
|
|
5709
|
+
},
|
|
5325
5710
|
{
|
|
5326
5711
|
name: "vault_stake_account",
|
|
5327
5712
|
writable: true
|
|
@@ -5382,7 +5767,6 @@ var instructions = [
|
|
|
5382
5767
|
{
|
|
5383
5768
|
name: "subscribe",
|
|
5384
5769
|
docs: [
|
|
5385
|
-
"Investor",
|
|
5386
5770
|
"Subscribes to a specified amount of shares.",
|
|
5387
5771
|
"",
|
|
5388
5772
|
"# Parameters",
|
|
@@ -5698,6 +6082,202 @@ var instructions = [
|
|
|
5698
6082
|
}
|
|
5699
6083
|
]
|
|
5700
6084
|
},
|
|
6085
|
+
{
|
|
6086
|
+
name: "transfer_sol_to_wsol",
|
|
6087
|
+
docs: [
|
|
6088
|
+
"Transfer vault SOL to wSOL token account.",
|
|
6089
|
+
"",
|
|
6090
|
+
"# Parameters",
|
|
6091
|
+
"- `ctx`: The context for the instruction.",
|
|
6092
|
+
"- `lamports`: The amount of SOL to transfer.",
|
|
6093
|
+
"",
|
|
6094
|
+
"# Permission required",
|
|
6095
|
+
"- Permission::WSolWrap"
|
|
6096
|
+
],
|
|
6097
|
+
discriminator: [
|
|
6098
|
+
42,
|
|
6099
|
+
189,
|
|
6100
|
+
85,
|
|
6101
|
+
229,
|
|
6102
|
+
150,
|
|
6103
|
+
198,
|
|
6104
|
+
3,
|
|
6105
|
+
195
|
|
6106
|
+
],
|
|
6107
|
+
accounts: [
|
|
6108
|
+
{
|
|
6109
|
+
name: "glam_state"
|
|
6110
|
+
},
|
|
6111
|
+
{
|
|
6112
|
+
name: "glam_vault",
|
|
6113
|
+
writable: true,
|
|
6114
|
+
pda: {
|
|
6115
|
+
seeds: [
|
|
6116
|
+
{
|
|
6117
|
+
kind: "const",
|
|
6118
|
+
value: [
|
|
6119
|
+
118,
|
|
6120
|
+
97,
|
|
6121
|
+
117,
|
|
6122
|
+
108,
|
|
6123
|
+
116
|
|
6124
|
+
]
|
|
6125
|
+
},
|
|
6126
|
+
{
|
|
6127
|
+
kind: "account",
|
|
6128
|
+
path: "glam_state"
|
|
6129
|
+
}
|
|
6130
|
+
]
|
|
6131
|
+
}
|
|
6132
|
+
},
|
|
6133
|
+
{
|
|
6134
|
+
name: "glam_signer",
|
|
6135
|
+
writable: true,
|
|
6136
|
+
signer: true
|
|
6137
|
+
},
|
|
6138
|
+
{
|
|
6139
|
+
name: "to",
|
|
6140
|
+
writable: true,
|
|
6141
|
+
pda: {
|
|
6142
|
+
seeds: [
|
|
6143
|
+
{
|
|
6144
|
+
kind: "account",
|
|
6145
|
+
path: "glam_vault"
|
|
6146
|
+
},
|
|
6147
|
+
{
|
|
6148
|
+
kind: "const",
|
|
6149
|
+
value: [
|
|
6150
|
+
6,
|
|
6151
|
+
221,
|
|
6152
|
+
246,
|
|
6153
|
+
225,
|
|
6154
|
+
215,
|
|
6155
|
+
101,
|
|
6156
|
+
161,
|
|
6157
|
+
147,
|
|
6158
|
+
217,
|
|
6159
|
+
203,
|
|
6160
|
+
225,
|
|
6161
|
+
70,
|
|
6162
|
+
206,
|
|
6163
|
+
235,
|
|
6164
|
+
121,
|
|
6165
|
+
172,
|
|
6166
|
+
28,
|
|
6167
|
+
180,
|
|
6168
|
+
133,
|
|
6169
|
+
237,
|
|
6170
|
+
95,
|
|
6171
|
+
91,
|
|
6172
|
+
55,
|
|
6173
|
+
145,
|
|
6174
|
+
58,
|
|
6175
|
+
140,
|
|
6176
|
+
245,
|
|
6177
|
+
133,
|
|
6178
|
+
126,
|
|
6179
|
+
255,
|
|
6180
|
+
0,
|
|
6181
|
+
169
|
|
6182
|
+
]
|
|
6183
|
+
},
|
|
6184
|
+
{
|
|
6185
|
+
kind: "const",
|
|
6186
|
+
value: [
|
|
6187
|
+
6,
|
|
6188
|
+
155,
|
|
6189
|
+
136,
|
|
6190
|
+
87,
|
|
6191
|
+
254,
|
|
6192
|
+
171,
|
|
6193
|
+
129,
|
|
6194
|
+
132,
|
|
6195
|
+
251,
|
|
6196
|
+
104,
|
|
6197
|
+
127,
|
|
6198
|
+
99,
|
|
6199
|
+
70,
|
|
6200
|
+
24,
|
|
6201
|
+
192,
|
|
6202
|
+
53,
|
|
6203
|
+
218,
|
|
6204
|
+
196,
|
|
6205
|
+
57,
|
|
6206
|
+
220,
|
|
6207
|
+
26,
|
|
6208
|
+
235,
|
|
6209
|
+
59,
|
|
6210
|
+
85,
|
|
6211
|
+
152,
|
|
6212
|
+
160,
|
|
6213
|
+
240,
|
|
6214
|
+
0,
|
|
6215
|
+
0,
|
|
6216
|
+
0,
|
|
6217
|
+
0,
|
|
6218
|
+
1
|
|
6219
|
+
]
|
|
6220
|
+
}
|
|
6221
|
+
],
|
|
6222
|
+
program: {
|
|
6223
|
+
kind: "const",
|
|
6224
|
+
value: [
|
|
6225
|
+
140,
|
|
6226
|
+
151,
|
|
6227
|
+
37,
|
|
6228
|
+
143,
|
|
6229
|
+
78,
|
|
6230
|
+
36,
|
|
6231
|
+
137,
|
|
6232
|
+
241,
|
|
6233
|
+
187,
|
|
6234
|
+
61,
|
|
6235
|
+
16,
|
|
6236
|
+
41,
|
|
6237
|
+
20,
|
|
6238
|
+
142,
|
|
6239
|
+
13,
|
|
6240
|
+
131,
|
|
6241
|
+
11,
|
|
6242
|
+
90,
|
|
6243
|
+
19,
|
|
6244
|
+
153,
|
|
6245
|
+
218,
|
|
6246
|
+
255,
|
|
6247
|
+
16,
|
|
6248
|
+
132,
|
|
6249
|
+
4,
|
|
6250
|
+
142,
|
|
6251
|
+
123,
|
|
6252
|
+
216,
|
|
6253
|
+
219,
|
|
6254
|
+
233,
|
|
6255
|
+
248,
|
|
6256
|
+
89
|
|
6257
|
+
]
|
|
6258
|
+
}
|
|
6259
|
+
}
|
|
6260
|
+
},
|
|
6261
|
+
{
|
|
6262
|
+
name: "system_program",
|
|
6263
|
+
address: "11111111111111111111111111111111"
|
|
6264
|
+
},
|
|
6265
|
+
{
|
|
6266
|
+
name: "token_program",
|
|
6267
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
6268
|
+
},
|
|
6269
|
+
{
|
|
6270
|
+
name: "associated_token_program",
|
|
6271
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
6272
|
+
}
|
|
6273
|
+
],
|
|
6274
|
+
args: [
|
|
6275
|
+
{
|
|
6276
|
+
name: "lamports",
|
|
6277
|
+
type: "u64"
|
|
6278
|
+
}
|
|
6279
|
+
]
|
|
6280
|
+
},
|
|
5701
6281
|
{
|
|
5702
6282
|
name: "update_mint",
|
|
5703
6283
|
docs: [
|
|
@@ -5723,18 +6303,18 @@ var instructions = [
|
|
|
5723
6303
|
],
|
|
5724
6304
|
accounts: [
|
|
5725
6305
|
{
|
|
5726
|
-
name: "glam_state",
|
|
5727
|
-
writable: true
|
|
5728
|
-
},
|
|
5729
|
-
{
|
|
5730
|
-
name: "glam_mint",
|
|
6306
|
+
name: "glam_state",
|
|
5731
6307
|
writable: true
|
|
5732
6308
|
},
|
|
5733
6309
|
{
|
|
5734
|
-
name: "
|
|
6310
|
+
name: "glam_signer",
|
|
5735
6311
|
writable: true,
|
|
5736
6312
|
signer: true
|
|
5737
6313
|
},
|
|
6314
|
+
{
|
|
6315
|
+
name: "glam_mint",
|
|
6316
|
+
writable: true
|
|
6317
|
+
},
|
|
5738
6318
|
{
|
|
5739
6319
|
name: "token_2022_program",
|
|
5740
6320
|
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
@@ -5779,11 +6359,11 @@ var instructions = [
|
|
|
5779
6359
|
],
|
|
5780
6360
|
accounts: [
|
|
5781
6361
|
{
|
|
5782
|
-
name: "
|
|
6362
|
+
name: "glam_state",
|
|
5783
6363
|
writable: true
|
|
5784
6364
|
},
|
|
5785
6365
|
{
|
|
5786
|
-
name: "
|
|
6366
|
+
name: "glam_signer",
|
|
5787
6367
|
writable: true,
|
|
5788
6368
|
signer: true
|
|
5789
6369
|
}
|
|
@@ -5823,11 +6403,11 @@ var instructions = [
|
|
|
5823
6403
|
],
|
|
5824
6404
|
accounts: [
|
|
5825
6405
|
{
|
|
5826
|
-
name: "
|
|
6406
|
+
name: "glam_state",
|
|
5827
6407
|
writable: true
|
|
5828
6408
|
},
|
|
5829
6409
|
{
|
|
5830
|
-
name: "
|
|
6410
|
+
name: "glam_vault",
|
|
5831
6411
|
writable: true,
|
|
5832
6412
|
pda: {
|
|
5833
6413
|
seeds: [
|
|
@@ -5843,11 +6423,16 @@ var instructions = [
|
|
|
5843
6423
|
},
|
|
5844
6424
|
{
|
|
5845
6425
|
kind: "account",
|
|
5846
|
-
path: "
|
|
6426
|
+
path: "glam_state"
|
|
5847
6427
|
}
|
|
5848
6428
|
]
|
|
5849
6429
|
}
|
|
5850
6430
|
},
|
|
6431
|
+
{
|
|
6432
|
+
name: "glam_signer",
|
|
6433
|
+
writable: true,
|
|
6434
|
+
signer: true
|
|
6435
|
+
},
|
|
5851
6436
|
{
|
|
5852
6437
|
name: "asset"
|
|
5853
6438
|
},
|
|
@@ -5858,7 +6443,7 @@ var instructions = [
|
|
|
5858
6443
|
seeds: [
|
|
5859
6444
|
{
|
|
5860
6445
|
kind: "account",
|
|
5861
|
-
path: "
|
|
6446
|
+
path: "glam_vault"
|
|
5862
6447
|
},
|
|
5863
6448
|
{
|
|
5864
6449
|
kind: "account",
|
|
@@ -5915,7 +6500,7 @@ var instructions = [
|
|
|
5915
6500
|
seeds: [
|
|
5916
6501
|
{
|
|
5917
6502
|
kind: "account",
|
|
5918
|
-
path: "
|
|
6503
|
+
path: "glam_signer"
|
|
5919
6504
|
},
|
|
5920
6505
|
{
|
|
5921
6506
|
kind: "account",
|
|
@@ -5965,11 +6550,6 @@ var instructions = [
|
|
|
5965
6550
|
}
|
|
5966
6551
|
}
|
|
5967
6552
|
},
|
|
5968
|
-
{
|
|
5969
|
-
name: "signer",
|
|
5970
|
-
writable: true,
|
|
5971
|
-
signer: true
|
|
5972
|
-
},
|
|
5973
6553
|
{
|
|
5974
6554
|
name: "token_program"
|
|
5975
6555
|
}
|
|
@@ -6007,16 +6587,11 @@ var instructions = [
|
|
|
6007
6587
|
],
|
|
6008
6588
|
accounts: [
|
|
6009
6589
|
{
|
|
6010
|
-
name: "
|
|
6011
|
-
writable: true,
|
|
6012
|
-
signer: true
|
|
6013
|
-
},
|
|
6014
|
-
{
|
|
6015
|
-
name: "state",
|
|
6590
|
+
name: "glam_state",
|
|
6016
6591
|
writable: true
|
|
6017
6592
|
},
|
|
6018
6593
|
{
|
|
6019
|
-
name: "
|
|
6594
|
+
name: "glam_vault",
|
|
6020
6595
|
writable: true,
|
|
6021
6596
|
pda: {
|
|
6022
6597
|
seeds: [
|
|
@@ -6032,11 +6607,16 @@ var instructions = [
|
|
|
6032
6607
|
},
|
|
6033
6608
|
{
|
|
6034
6609
|
kind: "account",
|
|
6035
|
-
path: "
|
|
6610
|
+
path: "glam_state"
|
|
6036
6611
|
}
|
|
6037
6612
|
]
|
|
6038
6613
|
}
|
|
6039
6614
|
},
|
|
6615
|
+
{
|
|
6616
|
+
name: "glam_signer",
|
|
6617
|
+
writable: true,
|
|
6618
|
+
signer: true
|
|
6619
|
+
},
|
|
6040
6620
|
{
|
|
6041
6621
|
name: "clock",
|
|
6042
6622
|
address: "SysvarC1ock11111111111111111111111111111111"
|
|
@@ -6075,10 +6655,10 @@ var instructions = [
|
|
|
6075
6655
|
],
|
|
6076
6656
|
accounts: [
|
|
6077
6657
|
{
|
|
6078
|
-
name: "
|
|
6658
|
+
name: "glam_state"
|
|
6079
6659
|
},
|
|
6080
6660
|
{
|
|
6081
|
-
name: "
|
|
6661
|
+
name: "glam_vault",
|
|
6082
6662
|
writable: true,
|
|
6083
6663
|
pda: {
|
|
6084
6664
|
seeds: [
|
|
@@ -6094,11 +6674,16 @@ var instructions = [
|
|
|
6094
6674
|
},
|
|
6095
6675
|
{
|
|
6096
6676
|
kind: "account",
|
|
6097
|
-
path: "
|
|
6677
|
+
path: "glam_state"
|
|
6098
6678
|
}
|
|
6099
6679
|
]
|
|
6100
6680
|
}
|
|
6101
6681
|
},
|
|
6682
|
+
{
|
|
6683
|
+
name: "glam_signer",
|
|
6684
|
+
writable: true,
|
|
6685
|
+
signer: true
|
|
6686
|
+
},
|
|
6102
6687
|
{
|
|
6103
6688
|
name: "vault_wsol_ata",
|
|
6104
6689
|
writable: true,
|
|
@@ -6106,7 +6691,7 @@ var instructions = [
|
|
|
6106
6691
|
seeds: [
|
|
6107
6692
|
{
|
|
6108
6693
|
kind: "account",
|
|
6109
|
-
path: "
|
|
6694
|
+
path: "glam_vault"
|
|
6110
6695
|
},
|
|
6111
6696
|
{
|
|
6112
6697
|
kind: "const",
|
|
@@ -6146,8 +6731,41 @@ var instructions = [
|
|
|
6146
6731
|
]
|
|
6147
6732
|
},
|
|
6148
6733
|
{
|
|
6149
|
-
kind: "
|
|
6150
|
-
|
|
6734
|
+
kind: "const",
|
|
6735
|
+
value: [
|
|
6736
|
+
6,
|
|
6737
|
+
155,
|
|
6738
|
+
136,
|
|
6739
|
+
87,
|
|
6740
|
+
254,
|
|
6741
|
+
171,
|
|
6742
|
+
129,
|
|
6743
|
+
132,
|
|
6744
|
+
251,
|
|
6745
|
+
104,
|
|
6746
|
+
127,
|
|
6747
|
+
99,
|
|
6748
|
+
70,
|
|
6749
|
+
24,
|
|
6750
|
+
192,
|
|
6751
|
+
53,
|
|
6752
|
+
218,
|
|
6753
|
+
196,
|
|
6754
|
+
57,
|
|
6755
|
+
220,
|
|
6756
|
+
26,
|
|
6757
|
+
235,
|
|
6758
|
+
59,
|
|
6759
|
+
85,
|
|
6760
|
+
152,
|
|
6761
|
+
160,
|
|
6762
|
+
240,
|
|
6763
|
+
0,
|
|
6764
|
+
0,
|
|
6765
|
+
0,
|
|
6766
|
+
0,
|
|
6767
|
+
1
|
|
6768
|
+
]
|
|
6151
6769
|
}
|
|
6152
6770
|
],
|
|
6153
6771
|
program: {
|
|
@@ -6189,15 +6807,6 @@ var instructions = [
|
|
|
6189
6807
|
}
|
|
6190
6808
|
}
|
|
6191
6809
|
},
|
|
6192
|
-
{
|
|
6193
|
-
name: "wsol_mint",
|
|
6194
|
-
address: "So11111111111111111111111111111111111111112"
|
|
6195
|
-
},
|
|
6196
|
-
{
|
|
6197
|
-
name: "signer",
|
|
6198
|
-
writable: true,
|
|
6199
|
-
signer: true
|
|
6200
|
-
},
|
|
6201
6810
|
{
|
|
6202
6811
|
name: "token_program",
|
|
6203
6812
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -6229,10 +6838,10 @@ var instructions = [
|
|
|
6229
6838
|
],
|
|
6230
6839
|
accounts: [
|
|
6231
6840
|
{
|
|
6232
|
-
name: "
|
|
6841
|
+
name: "glam_state"
|
|
6233
6842
|
},
|
|
6234
6843
|
{
|
|
6235
|
-
name: "
|
|
6844
|
+
name: "glam_vault",
|
|
6236
6845
|
writable: true,
|
|
6237
6846
|
pda: {
|
|
6238
6847
|
seeds: [
|
|
@@ -6248,11 +6857,16 @@ var instructions = [
|
|
|
6248
6857
|
},
|
|
6249
6858
|
{
|
|
6250
6859
|
kind: "account",
|
|
6251
|
-
path: "
|
|
6860
|
+
path: "glam_state"
|
|
6252
6861
|
}
|
|
6253
6862
|
]
|
|
6254
6863
|
}
|
|
6255
6864
|
},
|
|
6865
|
+
{
|
|
6866
|
+
name: "glam_signer",
|
|
6867
|
+
writable: true,
|
|
6868
|
+
signer: true
|
|
6869
|
+
},
|
|
6256
6870
|
{
|
|
6257
6871
|
name: "vault_wsol_ata",
|
|
6258
6872
|
writable: true,
|
|
@@ -6260,7 +6874,7 @@ var instructions = [
|
|
|
6260
6874
|
seeds: [
|
|
6261
6875
|
{
|
|
6262
6876
|
kind: "account",
|
|
6263
|
-
path: "
|
|
6877
|
+
path: "glam_vault"
|
|
6264
6878
|
},
|
|
6265
6879
|
{
|
|
6266
6880
|
kind: "const",
|
|
@@ -6344,13 +6958,7 @@ var instructions = [
|
|
|
6344
6958
|
}
|
|
6345
6959
|
},
|
|
6346
6960
|
{
|
|
6347
|
-
name: "wsol_mint"
|
|
6348
|
-
address: "So11111111111111111111111111111111111111112"
|
|
6349
|
-
},
|
|
6350
|
-
{
|
|
6351
|
-
name: "signer",
|
|
6352
|
-
writable: true,
|
|
6353
|
-
signer: true
|
|
6961
|
+
name: "wsol_mint"
|
|
6354
6962
|
},
|
|
6355
6963
|
{
|
|
6356
6964
|
name: "system_program",
|
|
@@ -6543,7 +7151,7 @@ var errors = [
|
|
|
6543
7151
|
{
|
|
6544
7152
|
code: 51002,
|
|
6545
7153
|
name: "SubscribeRedeemDisable",
|
|
6546
|
-
msg: "
|
|
7154
|
+
msg: "Subscription and redemption disabled"
|
|
6547
7155
|
},
|
|
6548
7156
|
{
|
|
6549
7157
|
code: 51003,
|
|
@@ -7344,6 +7952,41 @@ var types = [
|
|
|
7344
7952
|
},
|
|
7345
7953
|
{
|
|
7346
7954
|
name: "KaminoLending"
|
|
7955
|
+
},
|
|
7956
|
+
{
|
|
7957
|
+
name: "MeteoraDlmm"
|
|
7958
|
+
}
|
|
7959
|
+
]
|
|
7960
|
+
}
|
|
7961
|
+
},
|
|
7962
|
+
{
|
|
7963
|
+
name: "LiquidityParameterByStrategy",
|
|
7964
|
+
type: {
|
|
7965
|
+
kind: "struct",
|
|
7966
|
+
fields: [
|
|
7967
|
+
{
|
|
7968
|
+
name: "amount_x",
|
|
7969
|
+
type: "u64"
|
|
7970
|
+
},
|
|
7971
|
+
{
|
|
7972
|
+
name: "amount_y",
|
|
7973
|
+
type: "u64"
|
|
7974
|
+
},
|
|
7975
|
+
{
|
|
7976
|
+
name: "active_id",
|
|
7977
|
+
type: "i32"
|
|
7978
|
+
},
|
|
7979
|
+
{
|
|
7980
|
+
name: "max_active_bin_slippage",
|
|
7981
|
+
type: "i32"
|
|
7982
|
+
},
|
|
7983
|
+
{
|
|
7984
|
+
name: "strategy_parameters",
|
|
7985
|
+
type: {
|
|
7986
|
+
defined: {
|
|
7987
|
+
name: "StrategyParameters"
|
|
7988
|
+
}
|
|
7989
|
+
}
|
|
7347
7990
|
}
|
|
7348
7991
|
]
|
|
7349
7992
|
}
|
|
@@ -8110,6 +8753,18 @@ var types = [
|
|
|
8110
8753
|
},
|
|
8111
8754
|
{
|
|
8112
8755
|
name: "DriftModifyOrders"
|
|
8756
|
+
},
|
|
8757
|
+
{
|
|
8758
|
+
name: "MeteoraDlmmInitPosition"
|
|
8759
|
+
},
|
|
8760
|
+
{
|
|
8761
|
+
name: "MeteoraDlmmClosePosition"
|
|
8762
|
+
},
|
|
8763
|
+
{
|
|
8764
|
+
name: "MeteoraDlmmLiquidity"
|
|
8765
|
+
},
|
|
8766
|
+
{
|
|
8767
|
+
name: "MeteoraDlmmSwap"
|
|
8113
8768
|
}
|
|
8114
8769
|
]
|
|
8115
8770
|
}
|
|
@@ -8685,6 +9340,74 @@ var types = [
|
|
|
8685
9340
|
}
|
|
8686
9341
|
]
|
|
8687
9342
|
}
|
|
9343
|
+
},
|
|
9344
|
+
{
|
|
9345
|
+
name: "StrategyParameters",
|
|
9346
|
+
type: {
|
|
9347
|
+
kind: "struct",
|
|
9348
|
+
fields: [
|
|
9349
|
+
{
|
|
9350
|
+
name: "min_bin_id",
|
|
9351
|
+
type: "i32"
|
|
9352
|
+
},
|
|
9353
|
+
{
|
|
9354
|
+
name: "max_bin_id",
|
|
9355
|
+
type: "i32"
|
|
9356
|
+
},
|
|
9357
|
+
{
|
|
9358
|
+
name: "strategy_type",
|
|
9359
|
+
type: {
|
|
9360
|
+
defined: {
|
|
9361
|
+
name: "StrategyType"
|
|
9362
|
+
}
|
|
9363
|
+
}
|
|
9364
|
+
},
|
|
9365
|
+
{
|
|
9366
|
+
name: "parameteres",
|
|
9367
|
+
type: {
|
|
9368
|
+
array: [
|
|
9369
|
+
"u8",
|
|
9370
|
+
64
|
|
9371
|
+
]
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
]
|
|
9375
|
+
}
|
|
9376
|
+
},
|
|
9377
|
+
{
|
|
9378
|
+
name: "StrategyType",
|
|
9379
|
+
type: {
|
|
9380
|
+
kind: "enum",
|
|
9381
|
+
variants: [
|
|
9382
|
+
{
|
|
9383
|
+
name: "SpotOneSide"
|
|
9384
|
+
},
|
|
9385
|
+
{
|
|
9386
|
+
name: "CurveOneSide"
|
|
9387
|
+
},
|
|
9388
|
+
{
|
|
9389
|
+
name: "BidAskOneSide"
|
|
9390
|
+
},
|
|
9391
|
+
{
|
|
9392
|
+
name: "SpotBalanced"
|
|
9393
|
+
},
|
|
9394
|
+
{
|
|
9395
|
+
name: "CurveBalanced"
|
|
9396
|
+
},
|
|
9397
|
+
{
|
|
9398
|
+
name: "BidAskBalanced"
|
|
9399
|
+
},
|
|
9400
|
+
{
|
|
9401
|
+
name: "SpotImBalanced"
|
|
9402
|
+
},
|
|
9403
|
+
{
|
|
9404
|
+
name: "CurveImBalanced"
|
|
9405
|
+
},
|
|
9406
|
+
{
|
|
9407
|
+
name: "BidAskImBalanced"
|
|
9408
|
+
}
|
|
9409
|
+
]
|
|
9410
|
+
}
|
|
8688
9411
|
}
|
|
8689
9412
|
];
|
|
8690
9413
|
var constants = [
|
|
@@ -8909,7 +9632,7 @@ class StateModel extends StateIdlModel {
|
|
|
8909
9632
|
// @ts-ignore
|
|
8910
9633
|
mintOpenfundsFields[name] = value;
|
|
8911
9634
|
});
|
|
8912
|
-
mintIdlModel["rawOpenfunds"] = new
|
|
9635
|
+
mintIdlModel["rawOpenfunds"] = new MintOpenfundsModel(mintOpenfundsFields);
|
|
8913
9636
|
}
|
|
8914
9637
|
if (glamMint) {
|
|
8915
9638
|
const extMetadata = splToken.getExtensionData(splToken.ExtensionType.TokenMetadata, glamMint.tlvData);
|
|
@@ -8987,7 +9710,7 @@ class MintModel extends MintIdlModel {
|
|
|
8987
9710
|
super(data);
|
|
8988
9711
|
}
|
|
8989
9712
|
}
|
|
8990
|
-
class
|
|
9713
|
+
class MintOpenfundsModel {
|
|
8991
9714
|
constructor(obj){
|
|
8992
9715
|
this.isin = obj.isin ?? null;
|
|
8993
9716
|
this.shareClassCurrency = obj.shareClassCurrency ?? null;
|
|
@@ -9289,10 +10012,10 @@ const getErrorFromRPCResponse = (rpcResponse)=>{
|
|
|
9289
10012
|
}
|
|
9290
10013
|
],
|
|
9291
10014
|
[
|
|
9292
|
-
//
|
|
9293
|
-
"
|
|
10015
|
+
// BNSOL - Binance Staked SOL
|
|
10016
|
+
"BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85",
|
|
9294
10017
|
{
|
|
9295
|
-
stateAccount: new web3_js.PublicKey("
|
|
10018
|
+
stateAccount: new web3_js.PublicKey("Hr9pzexrBge3vgmBNRR8u42CNQgBXdHm4UkUN2DH4a7r")
|
|
9296
10019
|
}
|
|
9297
10020
|
],
|
|
9298
10021
|
[
|
|
@@ -9814,7 +10537,15 @@ class BaseClient {
|
|
|
9814
10537
|
// - when we run tests with failure cases, this RPC call fails with an incorrect error message so we should ignore it by default
|
|
9815
10538
|
// - gui: wallet apps usually do the simulation themselves, we should ignore the simulation error here by default
|
|
9816
10539
|
// - cli: we should set simulate=true
|
|
9817
|
-
if (simulate)
|
|
10540
|
+
if (simulate) {
|
|
10541
|
+
tx.recentBlockhash = recentBlockhash;
|
|
10542
|
+
tx.feePayer = signer;
|
|
10543
|
+
console.log("Tx payload:", tx.serialize({
|
|
10544
|
+
verifySignatures: false
|
|
10545
|
+
}).toString("base64"));
|
|
10546
|
+
console.error("Simulation failed.");
|
|
10547
|
+
throw e;
|
|
10548
|
+
}
|
|
9818
10549
|
}
|
|
9819
10550
|
if (computeUnitLimit) {
|
|
9820
10551
|
const vTx = new web3_js.VersionedTransaction(new web3_js.TransactionMessage({
|
|
@@ -9831,7 +10562,7 @@ class BaseClient {
|
|
|
9831
10562
|
instructions
|
|
9832
10563
|
}).compileToV0Message(lookupTables));
|
|
9833
10564
|
}
|
|
9834
|
-
async sendAndConfirm(tx,
|
|
10565
|
+
async sendAndConfirm(tx, additionalSigners = []) {
|
|
9835
10566
|
const connection = this.provider.connection;
|
|
9836
10567
|
// Mainnet only: use dedicated connection for sending transactions if available
|
|
9837
10568
|
const txConnection = this.cluster === exports.ClusterNetwork.Mainnet ? new web3_js.Connection(process.env?.NEXT_PUBLIC_TX_RPC || process.env.TX_RPC || connection.rpcEndpoint, {
|
|
@@ -9841,22 +10572,19 @@ class BaseClient {
|
|
|
9841
10572
|
// txs, for example transfer SOL, create ATA, etc.
|
|
9842
10573
|
if (tx instanceof web3_js.Transaction) {
|
|
9843
10574
|
return await web3_js.sendAndConfirmTransaction(txConnection, tx, [
|
|
9844
|
-
|
|
10575
|
+
this.getWallet().payer,
|
|
10576
|
+
...additionalSigners
|
|
9845
10577
|
]);
|
|
9846
10578
|
}
|
|
9847
10579
|
let serializedTx;
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
const wallet = this.getWallet();
|
|
9857
|
-
const signedTx = await wallet.signTransaction(tx);
|
|
9858
|
-
serializedTx = signedTx.serialize();
|
|
9859
|
-
}
|
|
10580
|
+
// Anchor provider.sendAndConfirm forces a signature with the wallet, which we don't want
|
|
10581
|
+
// https://github.com/coral-xyz/anchor/blob/v0.30.0/ts/packages/anchor/src/provider.ts#L159
|
|
10582
|
+
const wallet = this.getWallet();
|
|
10583
|
+
const signedTx = await wallet.signTransaction(tx);
|
|
10584
|
+
if (additionalSigners && additionalSigners.length > 0) {
|
|
10585
|
+
signedTx.sign(additionalSigners);
|
|
10586
|
+
}
|
|
10587
|
+
serializedTx = signedTx.serialize();
|
|
9860
10588
|
const txSig = await txConnection.sendRawTransaction(serializedTx, {
|
|
9861
10589
|
// skip simulation since we just did it to compute CUs
|
|
9862
10590
|
// however this means that we need to reconstruct the error, if
|
|
@@ -9936,8 +10664,8 @@ class BaseClient {
|
|
|
9936
10664
|
], this.program.programId);
|
|
9937
10665
|
return pda;
|
|
9938
10666
|
}
|
|
9939
|
-
getVaultAta(
|
|
9940
|
-
return this.getAta(mint, this.getVaultPda(
|
|
10667
|
+
getVaultAta(glamState, mint, programId) {
|
|
10668
|
+
return this.getAta(mint, this.getVaultPda(glamState), programId);
|
|
9941
10669
|
}
|
|
9942
10670
|
/**
|
|
9943
10671
|
* Fetch all the token accounts (including token program and token 2022 program) owned by a public key.
|
|
@@ -9976,8 +10704,8 @@ class BaseClient {
|
|
|
9976
10704
|
const lamports = await this.provider.connection.getBalance(vault);
|
|
9977
10705
|
return lamports / web3_js.LAMPORTS_PER_SOL;
|
|
9978
10706
|
}
|
|
9979
|
-
async getVaultTokenBalance(
|
|
9980
|
-
const ata = this.getVaultAta(
|
|
10707
|
+
async getVaultTokenBalance(glamState, mint, programId) {
|
|
10708
|
+
const ata = this.getVaultAta(glamState, mint);
|
|
9981
10709
|
const _mint = await splToken.getMint(this.provider.connection, mint);
|
|
9982
10710
|
try {
|
|
9983
10711
|
const account = await splToken.getAccount(this.provider.connection, ata);
|
|
@@ -10045,25 +10773,25 @@ class BaseClient {
|
|
|
10045
10773
|
*
|
|
10046
10774
|
* @param lamports Desired amount of wSOL
|
|
10047
10775
|
* @returns
|
|
10048
|
-
*/ async maybeWrapSol(
|
|
10049
|
-
const
|
|
10050
|
-
const vaultWsolAta = this.getVaultAta(
|
|
10776
|
+
*/ async maybeWrapSol(glamState, amount, signer) {
|
|
10777
|
+
const glamVault = this.getVaultPda(glamState);
|
|
10778
|
+
const vaultWsolAta = this.getVaultAta(glamState, WSOL);
|
|
10051
10779
|
let wsolBalance = new anchor__namespace.BN(0);
|
|
10052
10780
|
try {
|
|
10053
10781
|
wsolBalance = new anchor__namespace.BN((await this.provider.connection.getTokenAccountBalance(vaultWsolAta)).value.amount);
|
|
10054
10782
|
} catch (err) {}
|
|
10055
|
-
const solBalance = new anchor__namespace.BN(await this.provider.connection.getBalance(
|
|
10783
|
+
const solBalance = new anchor__namespace.BN(await this.provider.connection.getBalance(glamVault));
|
|
10056
10784
|
const delta = new anchor__namespace.BN(amount).sub(wsolBalance); // wSOL amount needed
|
|
10057
10785
|
if (solBalance.lt(delta)) {
|
|
10058
10786
|
throw new Error("Insufficient funds in vault to complete the transaction");
|
|
10059
10787
|
}
|
|
10060
10788
|
if (delta.gt(new anchor__namespace.BN(0)) && solBalance.gte(delta)) {
|
|
10061
10789
|
return await this.program.methods.wsolWrap(delta).accountsPartial({
|
|
10062
|
-
|
|
10063
|
-
|
|
10790
|
+
glamState,
|
|
10791
|
+
glamVault,
|
|
10792
|
+
glamSigner: signer || this.getSigner(),
|
|
10064
10793
|
vaultWsolAta,
|
|
10065
|
-
wsolMint: WSOL
|
|
10066
|
-
signer: signer || this.getSigner()
|
|
10794
|
+
wsolMint: WSOL
|
|
10067
10795
|
}).instruction();
|
|
10068
10796
|
}
|
|
10069
10797
|
return null;
|
|
@@ -10116,22 +10844,32 @@ class BaseClient {
|
|
|
10116
10844
|
}
|
|
10117
10845
|
return StateModel.fromOnchainAccounts(statePda, stateAccount, openfundsMetadataAccount, undefined, this.program.programId);
|
|
10118
10846
|
}
|
|
10119
|
-
|
|
10847
|
+
/**
|
|
10848
|
+
* Fetch all glam states if no filter options provided
|
|
10849
|
+
*
|
|
10850
|
+
* @param filterOptions
|
|
10851
|
+
* @returns
|
|
10852
|
+
*/ async fetchGlamStates(filterOptions) {
|
|
10853
|
+
const { owner, delegate, type } = filterOptions || {};
|
|
10120
10854
|
const stateAccounts = await this.program.account.stateAccount.all();
|
|
10121
10855
|
const openfundsMetadataAccounts = await this.program.account.openfundsMetadataAccount.all();
|
|
10856
|
+
const filteredStateAccounts = stateAccounts.filter((s)=>!type || Object.keys(s.account.accountType)[0] === type).filter((s)=>// if neither owner nor delegate is set, return all
|
|
10857
|
+
// if owner is set, return states owned by the owner
|
|
10858
|
+
// if delegate is set, return states with the delegate
|
|
10859
|
+
!owner && !delegate || owner && s.account.owner.equals(owner) || delegate && s.account.delegateAcls.some((acl)=>acl.pubkey.equals(delegate)));
|
|
10122
10860
|
let openfundsCache = new Map();
|
|
10123
10861
|
openfundsMetadataAccounts.forEach((of)=>{
|
|
10124
10862
|
openfundsCache.set(of.publicKey.toBase58(), of.account);
|
|
10125
10863
|
});
|
|
10126
10864
|
/* fetch first mint */ let mintCache = new Map();
|
|
10127
10865
|
const connection = this.provider.connection;
|
|
10128
|
-
const mintAddresses =
|
|
10866
|
+
const mintAddresses = filteredStateAccounts.map((s)=>s.account.mints[0]).filter((addr)=>!!addr);
|
|
10129
10867
|
const mintAccounts = await connection.getMultipleAccountsInfo(mintAddresses);
|
|
10130
10868
|
mintAccounts.forEach((info, j)=>{
|
|
10131
10869
|
const mintInfo = splToken.unpackMint(mintAddresses[j], info, splToken.TOKEN_2022_PROGRAM_ID);
|
|
10132
10870
|
mintCache.set(mintAddresses[j].toBase58(), mintInfo);
|
|
10133
10871
|
});
|
|
10134
|
-
return
|
|
10872
|
+
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));
|
|
10135
10873
|
}
|
|
10136
10874
|
constructor(config){
|
|
10137
10875
|
if (config?.provider) {
|
|
@@ -10169,8 +10907,8 @@ class DriftClient {
|
|
|
10169
10907
|
const tx = await this.updateUserCustomMarginRatioTx(statePda, maxLeverage, subAccountId);
|
|
10170
10908
|
return await this.base.sendAndConfirm(tx);
|
|
10171
10909
|
}
|
|
10172
|
-
async updateUserMarginTradingEnabled(statePda, marginTradingEnabled, subAccountId = 0) {
|
|
10173
|
-
const tx = await this.updateUserMarginTradingEnabledTx(statePda, marginTradingEnabled, subAccountId);
|
|
10910
|
+
async updateUserMarginTradingEnabled(statePda, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
10911
|
+
const tx = await this.updateUserMarginTradingEnabledTx(statePda, marginTradingEnabled, subAccountId, txOptions);
|
|
10174
10912
|
return await this.base.sendAndConfirm(tx);
|
|
10175
10913
|
}
|
|
10176
10914
|
async updateUserDelegate(statePda, delegate, subAccountId = 0) {
|
|
@@ -10278,7 +11016,7 @@ class DriftClient {
|
|
|
10278
11016
|
this.base.getVaultPda(glamState);
|
|
10279
11017
|
const [user, userStats] = this.getUser(glamState);
|
|
10280
11018
|
const state = await sdk.getDriftStateAccountPublicKey(this.DRIFT_PROGRAM);
|
|
10281
|
-
const GLAM_NAME = "GLAM *.+".split("").concat(Array(24).fill(0));
|
|
11019
|
+
const GLAM_NAME = "GLAM *.+".split("").map((char)=>char.charCodeAt(0)).concat(Array(24).fill(0));
|
|
10282
11020
|
const initializeUserIx = await this.base.program.methods//@ts-ignore
|
|
10283
11021
|
.driftInitializeUser(0, GLAM_NAME).accounts({
|
|
10284
11022
|
glamState,
|
|
@@ -10297,37 +11035,45 @@ class DriftClient {
|
|
|
10297
11035
|
]).transaction();
|
|
10298
11036
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10299
11037
|
}
|
|
10300
|
-
async
|
|
11038
|
+
async updateUserCustomMarginRatioIx(glamState, maxLeverage, subAccountId = 0, txOptions = {}) {
|
|
10301
11039
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10302
|
-
this.base.getVaultPda(glamState);
|
|
10303
11040
|
const [user] = this.getUser(glamState, subAccountId);
|
|
10304
11041
|
// https://github.com/drift-labs/protocol-v2/blob/babed162b08b1fe34e49a81c5aa3e4ec0a88ecdf/programs/drift/src/math/constants.rs#L183-L184
|
|
10305
11042
|
const marginRatio = DRIFT_MARGIN_PRECISION / maxLeverage;
|
|
10306
|
-
|
|
11043
|
+
return await this.base.program.methods.driftUpdateUserCustomMarginRatio(subAccountId, marginRatio).accounts({
|
|
10307
11044
|
glamState,
|
|
10308
11045
|
glamSigner,
|
|
10309
11046
|
user
|
|
10310
|
-
}).
|
|
11047
|
+
}).instruction();
|
|
11048
|
+
}
|
|
11049
|
+
async updateUserCustomMarginRatioTx(glamState, maxLeverage, subAccountId = 0, txOptions = {}) {
|
|
11050
|
+
const tx = new web3_js.Transaction().add(await this.updateUserCustomMarginRatioIx(glamState, maxLeverage, subAccountId, txOptions));
|
|
10311
11051
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10312
11052
|
}
|
|
10313
|
-
async
|
|
11053
|
+
async updateUserMarginTradingEnabledIx(glamState, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
10314
11054
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10315
11055
|
const [user] = this.getUser(glamState, subAccountId);
|
|
10316
|
-
|
|
11056
|
+
return await this.base.program.methods.driftUpdateUserMarginTradingEnabled(subAccountId, marginTradingEnabled).accounts({
|
|
10317
11057
|
glamState,
|
|
10318
11058
|
glamSigner,
|
|
10319
11059
|
user
|
|
10320
|
-
}).
|
|
11060
|
+
}).instruction();
|
|
11061
|
+
}
|
|
11062
|
+
async updateUserMarginTradingEnabledTx(glamState, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
11063
|
+
const tx = new web3_js.Transaction().add(...txOptions.preInstructions || [], await this.updateUserMarginTradingEnabledIx(glamState, marginTradingEnabled, subAccountId, txOptions));
|
|
10321
11064
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10322
11065
|
}
|
|
10323
|
-
async
|
|
11066
|
+
async updateUserDelegateIx(glamState, delegate, subAccountId = 0, txOptions = {}) {
|
|
10324
11067
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10325
11068
|
const [user] = this.getUser(glamState, subAccountId);
|
|
10326
|
-
|
|
11069
|
+
return await this.base.program.methods.driftUpdateUserDelegate(subAccountId, new web3_js.PublicKey(delegate)).accounts({
|
|
10327
11070
|
glamState,
|
|
10328
11071
|
glamSigner,
|
|
10329
11072
|
user
|
|
10330
|
-
}).
|
|
11073
|
+
}).instruction();
|
|
11074
|
+
}
|
|
11075
|
+
async updateUserDelegateTx(glamState, delegate, subAccountId = 0, txOptions = {}) {
|
|
11076
|
+
const tx = new web3_js.Transaction().add(await this.updateUserDelegateIx(glamState, delegate, subAccountId, txOptions));
|
|
10331
11077
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10332
11078
|
}
|
|
10333
11079
|
async deleteUserTx(glamState, subAccountId = 0, txOptions = {}) {
|
|
@@ -10343,25 +11089,46 @@ class DriftClient {
|
|
|
10343
11089
|
}).transaction();
|
|
10344
11090
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
10345
11091
|
}
|
|
10346
|
-
async depositTx(
|
|
11092
|
+
async depositTx(glamState, amount, marketIndex = 1, subAccountId = 0, marketConfigs, txOptions = {}) {
|
|
10347
11093
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10348
|
-
const [user, userStats] = this.getUser(
|
|
11094
|
+
const [user, userStats] = this.getUser(glamState, subAccountId);
|
|
10349
11095
|
const state = await sdk.getDriftStateAccountPublicKey(this.DRIFT_PROGRAM);
|
|
10350
11096
|
const { mint, oracle, marketPDA, vaultPDA } = marketConfigs.spot[marketIndex];
|
|
10351
11097
|
const preInstructions = [];
|
|
11098
|
+
// If drift user doesn't exist, create it first
|
|
11099
|
+
const vault = this.base.getVaultPda(glamState);
|
|
11100
|
+
const response = await fetch(`https://api.glam.systems/v0/drift/user?authority=${vault.toBase58()}&accountId=${subAccountId}`);
|
|
11101
|
+
const data = await response.json();
|
|
11102
|
+
if (!data) {
|
|
11103
|
+
const initializeUserStatsIx = await this.base.program.methods.driftInitializeUserStats().accounts({
|
|
11104
|
+
glamState,
|
|
11105
|
+
state,
|
|
11106
|
+
userStats,
|
|
11107
|
+
glamSigner
|
|
11108
|
+
}).instruction();
|
|
11109
|
+
const GLAM_NAME = "GLAM *.+".split("").map((char)=>char.charCodeAt(0)).concat(Array(24).fill(0));
|
|
11110
|
+
const initializeUserIx = await this.base.program.methods.driftInitializeUser(0, GLAM_NAME).accounts({
|
|
11111
|
+
glamState,
|
|
11112
|
+
user,
|
|
11113
|
+
userStats,
|
|
11114
|
+
state,
|
|
11115
|
+
glamSigner
|
|
11116
|
+
}).instruction();
|
|
11117
|
+
preInstructions.push(initializeUserStatsIx, initializeUserIx); // init user stats first
|
|
11118
|
+
}
|
|
10352
11119
|
if (mint === WSOL.toBase58()) {
|
|
10353
|
-
const wrapSolIx = await this.base.maybeWrapSol(
|
|
11120
|
+
const wrapSolIx = await this.base.maybeWrapSol(glamState, amount, glamSigner);
|
|
10354
11121
|
if (wrapSolIx) {
|
|
10355
11122
|
preInstructions.push(wrapSolIx);
|
|
10356
11123
|
}
|
|
10357
11124
|
}
|
|
10358
11125
|
const tx = await this.base.program.methods.driftDeposit(marketIndex, amount, false).accounts({
|
|
10359
|
-
glamState:
|
|
11126
|
+
glamState: glamState,
|
|
10360
11127
|
state,
|
|
10361
11128
|
user,
|
|
10362
11129
|
userStats,
|
|
10363
11130
|
spotMarketVault: new web3_js.PublicKey(vaultPDA),
|
|
10364
|
-
userTokenAccount: this.base.getVaultAta(
|
|
11131
|
+
userTokenAccount: this.base.getVaultAta(glamState, new web3_js.PublicKey(mint)),
|
|
10365
11132
|
glamSigner,
|
|
10366
11133
|
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
10367
11134
|
}).remainingAccounts([
|
|
@@ -10644,8 +11411,8 @@ const BASE = new web3_js.PublicKey("bJ1TRoFo2P6UHVwqdiipp6Qhp2HaaHpLowZ5LHet8Gm"
|
|
|
10644
11411
|
class JupiterSwapClient {
|
|
10645
11412
|
/*
|
|
10646
11413
|
* Client methods
|
|
10647
|
-
*/ async swap(
|
|
10648
|
-
const tx = await this.swapTx(
|
|
11414
|
+
*/ async swap(glamState, quoteParams, quoteResponse, swapInstructions, txOptions = {}) {
|
|
11415
|
+
const tx = await this.swapTx(glamState, quoteParams, quoteResponse, swapInstructions, txOptions);
|
|
10649
11416
|
return await this.base.sendAndConfirm(tx);
|
|
10650
11417
|
}
|
|
10651
11418
|
async setMaxSwapSlippage(statePda, slippageBps, txOptions = {}) {
|
|
@@ -10654,9 +11421,9 @@ class JupiterSwapClient {
|
|
|
10654
11421
|
}
|
|
10655
11422
|
/*
|
|
10656
11423
|
* API methods
|
|
10657
|
-
*/ async swapTx(
|
|
10658
|
-
const
|
|
10659
|
-
const
|
|
11424
|
+
*/ async swapTx(glamState, quoteParams, quoteResponse, swapInstructions, txOptions = {}) {
|
|
11425
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11426
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
10660
11427
|
let swapInstruction;
|
|
10661
11428
|
let addressLookupTableAddresses;
|
|
10662
11429
|
const inputMint = new web3_js.PublicKey(quoteParams?.inputMint || quoteResponse.inputMint);
|
|
@@ -10670,7 +11437,7 @@ class JupiterSwapClient {
|
|
|
10670
11437
|
}
|
|
10671
11438
|
quoteResponse = await this.getQuoteResponse(quoteParams);
|
|
10672
11439
|
}
|
|
10673
|
-
const ins = await this.getSwapInstructions(quoteResponse,
|
|
11440
|
+
const ins = await this.getSwapInstructions(quoteResponse, glamVault);
|
|
10674
11441
|
swapInstruction = ins.swapInstruction;
|
|
10675
11442
|
addressLookupTableAddresses = ins.addressLookupTableAddresses;
|
|
10676
11443
|
} else {
|
|
@@ -10678,17 +11445,17 @@ class JupiterSwapClient {
|
|
|
10678
11445
|
addressLookupTableAddresses = swapInstructions.addressLookupTableAddresses;
|
|
10679
11446
|
}
|
|
10680
11447
|
const lookupTables = await this.base.getAdressLookupTableAccounts(addressLookupTableAddresses);
|
|
10681
|
-
const swapIx = this.toTransactionInstruction(swapInstruction,
|
|
11448
|
+
const swapIx = this.toTransactionInstruction(swapInstruction, glamVault.toBase58());
|
|
10682
11449
|
const [inputTokenProgram, outputTokenProgram] = await Promise.all([
|
|
10683
11450
|
this.getTokenProgram(inputMint),
|
|
10684
11451
|
this.getTokenProgram(outputMint)
|
|
10685
11452
|
]);
|
|
10686
11453
|
const inputStakePool = ASSETS_MAINNET.get(inputMint.toBase58())?.stateAccount || null;
|
|
10687
11454
|
const outputStakePool = ASSETS_MAINNET.get(outputMint.toBase58())?.stateAccount || null;
|
|
10688
|
-
const preInstructions = await this.getPreInstructions(
|
|
11455
|
+
const preInstructions = await this.getPreInstructions(glamState, glamSigner, inputMint, outputMint, amount, inputTokenProgram, outputTokenProgram);
|
|
10689
11456
|
const tx = await this.base.program.methods.jupiterSwap(amount, swapIx.data).accounts({
|
|
10690
|
-
|
|
10691
|
-
|
|
11457
|
+
glamState,
|
|
11458
|
+
glamSigner,
|
|
10692
11459
|
inputMint,
|
|
10693
11460
|
outputMint,
|
|
10694
11461
|
inputTokenProgram,
|
|
@@ -10701,16 +11468,23 @@ class JupiterSwapClient {
|
|
|
10701
11468
|
...txOptions
|
|
10702
11469
|
});
|
|
10703
11470
|
}
|
|
10704
|
-
async setMaxSwapSlippageTx(
|
|
10705
|
-
const
|
|
11471
|
+
async setMaxSwapSlippageTx(glamState, slippageBps, txOptions = {}) {
|
|
11472
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
10706
11473
|
const tx = await this.base.program.methods.jupiterSetMaxSwapSlippage(new anchor.BN(slippageBps)).accounts({
|
|
10707
|
-
|
|
10708
|
-
|
|
11474
|
+
glamState,
|
|
11475
|
+
glamSigner
|
|
10709
11476
|
}).transaction();
|
|
10710
11477
|
return this.base.intoVersionedTransaction(tx, {
|
|
10711
11478
|
...txOptions
|
|
10712
11479
|
});
|
|
10713
11480
|
}
|
|
11481
|
+
async setMaxSwapSlippageIx(glamState, slippageBps, txOptions = {}) {
|
|
11482
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11483
|
+
return await this.base.program.methods.jupiterSetMaxSwapSlippage(new anchor.BN(slippageBps)).accounts({
|
|
11484
|
+
glamState,
|
|
11485
|
+
glamSigner
|
|
11486
|
+
}).instruction();
|
|
11487
|
+
}
|
|
10714
11488
|
async getQuoteResponse(quoteParams) {
|
|
10715
11489
|
const res = await fetch(`${this.base.jupiterApi}/quote?` + new URLSearchParams(Object.entries(quoteParams).map(([key, val])=>[
|
|
10716
11490
|
key,
|
|
@@ -10892,15 +11666,8 @@ class JupiterVoteClient {
|
|
|
10892
11666
|
* @returns
|
|
10893
11667
|
*/ async voteOnProposal(glamState, proposal, side, txOptions = {}) {
|
|
10894
11668
|
const glamVault = this.base.getVaultPda(glamState);
|
|
10895
|
-
const
|
|
10896
|
-
|
|
10897
|
-
proposal.toBuffer(),
|
|
10898
|
-
glamVault.toBuffer()
|
|
10899
|
-
], GOVERNANCE_PROGRAM_ID);
|
|
10900
|
-
const [governor] = web3_js.PublicKey.findProgramAddressSync([
|
|
10901
|
-
Buffer.from("Governor"),
|
|
10902
|
-
BASE.toBuffer()
|
|
10903
|
-
], GOVERNANCE_PROGRAM_ID);
|
|
11669
|
+
const vote = this.getVotePda(proposal, glamVault);
|
|
11670
|
+
const governor = this.getGovernorPda();
|
|
10904
11671
|
const voteAccountInfo = await this.base.provider.connection.getAccountInfo(vote);
|
|
10905
11672
|
const voteCreated = voteAccountInfo ? true : false;
|
|
10906
11673
|
const preInstructions = [];
|
|
@@ -10921,7 +11688,7 @@ class JupiterVoteClient {
|
|
|
10921
11688
|
locker: this.stakeLocker,
|
|
10922
11689
|
governor,
|
|
10923
11690
|
governProgram: GOVERNANCE_PROGRAM_ID
|
|
10924
|
-
}).transaction();
|
|
11691
|
+
}).preInstructions(preInstructions).transaction();
|
|
10925
11692
|
const vTx = await this.base.intoVersionedTransaction(tx, {
|
|
10926
11693
|
...txOptions
|
|
10927
11694
|
});
|
|
@@ -10929,7 +11696,23 @@ class JupiterVoteClient {
|
|
|
10929
11696
|
}
|
|
10930
11697
|
/*
|
|
10931
11698
|
* Utils
|
|
10932
|
-
*/
|
|
11699
|
+
*/ async fetchVotes(glamState, proposals) {
|
|
11700
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11701
|
+
const votes = proposals.map((proposal)=>this.getVotePda(new web3_js.PublicKey(proposal), glamVault));
|
|
11702
|
+
const votesAccountInfo = await this.base.provider.connection.getMultipleAccountsInfo(votes);
|
|
11703
|
+
return votesAccountInfo.filter((accountInfo)=>accountInfo !== null).map((accountInfo)=>({
|
|
11704
|
+
// offsets:
|
|
11705
|
+
// 8 (discriminator)
|
|
11706
|
+
// 32 (proposal)
|
|
11707
|
+
// 32 (voter)
|
|
11708
|
+
// 1 (bump)
|
|
11709
|
+
// 1 (side)
|
|
11710
|
+
proposal: new web3_js.PublicKey(accountInfo.data.subarray(8, 40)),
|
|
11711
|
+
voter: new web3_js.PublicKey(accountInfo.data.subarray(40, 72)),
|
|
11712
|
+
side: accountInfo.data.readUInt8(73)
|
|
11713
|
+
}));
|
|
11714
|
+
}
|
|
11715
|
+
get stakeLocker() {
|
|
10933
11716
|
const [locker] = web3_js.PublicKey.findProgramAddressSync([
|
|
10934
11717
|
Buffer.from("Locker"),
|
|
10935
11718
|
BASE.toBuffer()
|
|
@@ -10944,6 +11727,21 @@ class JupiterVoteClient {
|
|
|
10944
11727
|
], JUP_VOTE_PROGRAM);
|
|
10945
11728
|
return escrow;
|
|
10946
11729
|
}
|
|
11730
|
+
getVotePda(proposal, voter) {
|
|
11731
|
+
const [vote] = web3_js.PublicKey.findProgramAddressSync([
|
|
11732
|
+
Buffer.from("Vote"),
|
|
11733
|
+
proposal.toBuffer(),
|
|
11734
|
+
voter.toBuffer()
|
|
11735
|
+
], GOVERNANCE_PROGRAM_ID);
|
|
11736
|
+
return vote;
|
|
11737
|
+
}
|
|
11738
|
+
getGovernorPda() {
|
|
11739
|
+
const [governor] = web3_js.PublicKey.findProgramAddressSync([
|
|
11740
|
+
Buffer.from("Governor"),
|
|
11741
|
+
BASE.toBuffer()
|
|
11742
|
+
], GOVERNANCE_PROGRAM_ID);
|
|
11743
|
+
return governor;
|
|
11744
|
+
}
|
|
10947
11745
|
constructor(base){
|
|
10948
11746
|
this.base = base;
|
|
10949
11747
|
}
|
|
@@ -10953,73 +11751,43 @@ const TICKET_SIZE = 88;
|
|
|
10953
11751
|
class MarinadeClient {
|
|
10954
11752
|
/*
|
|
10955
11753
|
* Client methods
|
|
10956
|
-
*/ async
|
|
10957
|
-
const tx = await this.
|
|
11754
|
+
*/ async deposit(statePda, amount) {
|
|
11755
|
+
const tx = await this.depositTx(statePda, amount, {});
|
|
10958
11756
|
return await this.base.sendAndConfirm(tx);
|
|
10959
11757
|
}
|
|
10960
|
-
async
|
|
10961
|
-
const tx = await this.
|
|
11758
|
+
async depositStakeAccount(statePda, stakeAccount) {
|
|
11759
|
+
const tx = await this.depositStakeAccountTx(statePda, stakeAccount, {});
|
|
10962
11760
|
return await this.base.sendAndConfirm(tx);
|
|
10963
11761
|
}
|
|
10964
11762
|
async liquidUnstake(statePda, amount) {
|
|
10965
11763
|
const tx = await this.liquidUnstakeTx(statePda, amount, {});
|
|
10966
11764
|
return await this.base.sendAndConfirm(tx);
|
|
10967
11765
|
}
|
|
10968
|
-
async
|
|
10969
|
-
const tx = await this.
|
|
10970
|
-
return await this.base.sendAndConfirm(tx);
|
|
10971
|
-
}
|
|
10972
|
-
async
|
|
10973
|
-
const tx = await this.
|
|
11766
|
+
async orderUnstake(statePda, amount, txOptions = {}) {
|
|
11767
|
+
const tx = await this.orderUnstakeTx(statePda, amount, txOptions);
|
|
11768
|
+
return await this.base.sendAndConfirm(tx);
|
|
11769
|
+
}
|
|
11770
|
+
async claim(statePda, tickets, txOptions = {}) {
|
|
11771
|
+
const tx = await this.claimTx(statePda, tickets, txOptions);
|
|
10974
11772
|
return await this.base.sendAndConfirm(tx);
|
|
10975
11773
|
}
|
|
10976
|
-
/*
|
|
10977
|
-
* Utils
|
|
10978
|
-
*/ async getExistingTickets(state) {
|
|
10979
|
-
const accounts = await this.base.provider.connection.getParsedProgramAccounts(MARINADE_PROGRAM_ID, {
|
|
10980
|
-
filters: [
|
|
10981
|
-
{
|
|
10982
|
-
dataSize: 88
|
|
10983
|
-
},
|
|
10984
|
-
{
|
|
10985
|
-
memcmp: {
|
|
10986
|
-
offset: 40,
|
|
10987
|
-
bytes: this.base.getVaultPda(state).toBase58()
|
|
10988
|
-
}
|
|
10989
|
-
}
|
|
10990
|
-
]
|
|
10991
|
-
});
|
|
10992
|
-
return accounts.map((a)=>a.pubkey);
|
|
10993
|
-
}
|
|
10994
11774
|
async getTickets(state) {
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
// }
|
|
11001
|
-
const accounts = await this.base.provider.connection.getParsedProgramAccounts(MARINADE_PROGRAM_ID, {
|
|
11002
|
-
filters: [
|
|
11003
|
-
{
|
|
11004
|
-
dataSize: TICKET_SIZE
|
|
11005
|
-
},
|
|
11006
|
-
{
|
|
11007
|
-
memcmp: {
|
|
11008
|
-
offset: 40,
|
|
11009
|
-
bytes: this.base.getVaultPda(state).toBase58()
|
|
11010
|
-
}
|
|
11011
|
-
}
|
|
11012
|
-
]
|
|
11013
|
-
});
|
|
11775
|
+
const accounts = await this._getTicketsAccounts(state);
|
|
11776
|
+
return accounts.map((a)=>a.pubkey);
|
|
11777
|
+
}
|
|
11778
|
+
async getParsedTickets(state) {
|
|
11779
|
+
const accounts = await this._getTicketsAccounts(state);
|
|
11014
11780
|
const currentEpoch = await this.base.provider.connection.getEpochInfo();
|
|
11015
11781
|
return accounts.map((a)=>{
|
|
11016
11782
|
const lamports = Number(a.account.data.readBigInt64LE(72));
|
|
11017
11783
|
const createdEpoch = Number(a.account.data.readBigInt64LE(80));
|
|
11784
|
+
const isDue = currentEpoch.epoch > createdEpoch;
|
|
11018
11785
|
return {
|
|
11019
11786
|
address: a.pubkey,
|
|
11020
11787
|
lamports,
|
|
11021
11788
|
createdEpoch,
|
|
11022
|
-
isDue
|
|
11789
|
+
isDue,
|
|
11790
|
+
isClaimable: isDue && currentEpoch.slotIndex > 5000
|
|
11023
11791
|
};
|
|
11024
11792
|
});
|
|
11025
11793
|
}
|
|
@@ -11060,30 +11828,31 @@ class MarinadeClient {
|
|
|
11060
11828
|
}
|
|
11061
11829
|
/*
|
|
11062
11830
|
* API methods
|
|
11063
|
-
*/ async
|
|
11064
|
-
const
|
|
11065
|
-
const vault = this.base.getVaultPda(
|
|
11831
|
+
*/ async depositTx(glamState, amount, txOptions) {
|
|
11832
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11833
|
+
const vault = this.base.getVaultPda(glamState);
|
|
11066
11834
|
const marinadeState = this.getMarinadeState();
|
|
11067
11835
|
const vaultMsolAta = this.base.getAta(marinadeState.msolMintAddress, vault);
|
|
11068
|
-
const
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11836
|
+
const createMsolAtaIx = splToken.createAssociatedTokenAccountIdempotentInstruction(glamSigner, vaultMsolAta, vault, marinadeState.msolMintAddress);
|
|
11837
|
+
const tx = await this.base.program.methods.marinadeDeposit(amount).accounts({
|
|
11838
|
+
glamState,
|
|
11839
|
+
glamSigner,
|
|
11072
11840
|
reservePda: marinadeState.reserveAddress,
|
|
11073
|
-
|
|
11841
|
+
state: marinadeState.marinadeStateAddress,
|
|
11074
11842
|
msolMint: marinadeState.msolMintAddress,
|
|
11075
11843
|
msolMintAuthority: marinadeState.mSolMintAuthority,
|
|
11076
11844
|
liqPoolMsolLeg: marinadeState.msolLeg,
|
|
11077
11845
|
liqPoolMsolLegAuthority: marinadeState.msolLegAuthority,
|
|
11078
11846
|
liqPoolSolLegPda: marinadeState.solLeg,
|
|
11079
11847
|
mintTo: vaultMsolAta,
|
|
11080
|
-
|
|
11081
|
-
}).
|
|
11848
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
11849
|
+
}).preInstructions([
|
|
11850
|
+
createMsolAtaIx
|
|
11851
|
+
]).transaction();
|
|
11082
11852
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11083
11853
|
}
|
|
11084
|
-
async
|
|
11085
|
-
const
|
|
11086
|
-
const vault = this.base.getVaultPda(statePda);
|
|
11854
|
+
async depositStakeAccountTx(glamState, stakeAccount, txOptions) {
|
|
11855
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11087
11856
|
const stakeAccountInfo = await this.getParsedStakeAccountInfo(stakeAccount);
|
|
11088
11857
|
console.log("Stake account info", stakeAccountInfo);
|
|
11089
11858
|
const marinadeState = await new marinadeTsSdk.Marinade().getMarinadeState();
|
|
@@ -11091,138 +11860,140 @@ class MarinadeClient {
|
|
|
11091
11860
|
const validatorLookupIndex = validatorRecords.findIndex(({ validatorAccount })=>validatorAccount.equals(stakeAccountInfo.voter));
|
|
11092
11861
|
const validatorIndex = validatorLookupIndex === -1 ? marinadeState.state.validatorSystem.validatorList.count : validatorLookupIndex;
|
|
11093
11862
|
const duplicationFlag = await marinadeState.validatorDuplicationFlag(stakeAccountInfo.voter);
|
|
11094
|
-
const tx = await this.base.program.methods.
|
|
11095
|
-
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
marinadeState: marinadeState.marinadeStateAddress,
|
|
11863
|
+
const tx = await this.base.program.methods.marinadeDepositStakeAccount(validatorIndex).accounts({
|
|
11864
|
+
glamState,
|
|
11865
|
+
glamSigner,
|
|
11866
|
+
state: marinadeState.marinadeStateAddress,
|
|
11099
11867
|
validatorList: marinadeState.state.validatorSystem.validatorList.account,
|
|
11100
11868
|
stakeList: marinadeState.state.stakeSystem.stakeList.account,
|
|
11101
|
-
|
|
11869
|
+
stakeAccount,
|
|
11102
11870
|
duplicationFlag,
|
|
11103
11871
|
msolMint: MSOL,
|
|
11104
11872
|
msolMintAuthority: await marinadeState.mSolMintAuthority(),
|
|
11105
|
-
mintTo: this.base.getVaultAta(
|
|
11106
|
-
marinadeProgram: MARINADE_PROGRAM_ID,
|
|
11873
|
+
mintTo: this.base.getVaultAta(glamState, MSOL),
|
|
11107
11874
|
clock: web3_js.SYSVAR_CLOCK_PUBKEY,
|
|
11108
|
-
rent: web3_js.SYSVAR_RENT_PUBKEY,
|
|
11109
11875
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
11110
11876
|
stakeProgram: web3_js.StakeProgram.programId
|
|
11111
11877
|
}).transaction();
|
|
11112
11878
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11113
11879
|
}
|
|
11114
|
-
async
|
|
11115
|
-
const
|
|
11116
|
-
const vault = this.base.getVaultPda(state);
|
|
11880
|
+
async orderUnstakeTx(glamState, amount, txOptions) {
|
|
11881
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11117
11882
|
const marinadeState = this.getMarinadeState();
|
|
11118
|
-
const vaultMsolAta = this.base.getVaultAta(
|
|
11883
|
+
const vaultMsolAta = this.base.getVaultAta(glamState, marinadeState.msolMintAddress);
|
|
11119
11884
|
const ticketSeed = Date.now().toString();
|
|
11120
|
-
const ticket = await web3_js.PublicKey.createWithSeed(
|
|
11885
|
+
const ticket = await web3_js.PublicKey.createWithSeed(glamSigner, ticketSeed, MARINADE_PROGRAM_ID);
|
|
11121
11886
|
const lamports = await this.base.provider.connection.getMinimumBalanceForRentExemption(TICKET_SIZE);
|
|
11122
11887
|
const createTicketIx = web3_js.SystemProgram.createAccountWithSeed({
|
|
11123
|
-
fromPubkey:
|
|
11888
|
+
fromPubkey: glamSigner,
|
|
11124
11889
|
newAccountPubkey: ticket,
|
|
11125
|
-
basePubkey:
|
|
11890
|
+
basePubkey: glamSigner,
|
|
11126
11891
|
seed: ticketSeed,
|
|
11127
11892
|
lamports,
|
|
11128
11893
|
space: TICKET_SIZE,
|
|
11129
11894
|
programId: MARINADE_PROGRAM_ID
|
|
11130
11895
|
});
|
|
11131
|
-
const tx = await this.base.program.methods.
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
ticket,
|
|
11896
|
+
const tx = await this.base.program.methods.marinadeOrderUnstake(amount).accounts({
|
|
11897
|
+
glamState,
|
|
11898
|
+
glamSigner,
|
|
11899
|
+
newTicketAccount: ticket,
|
|
11136
11900
|
msolMint: marinadeState.msolMintAddress,
|
|
11137
11901
|
burnMsolFrom: vaultMsolAta,
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11902
|
+
state: marinadeState.marinadeStateAddress,
|
|
11903
|
+
clock: web3_js.SYSVAR_CLOCK_PUBKEY,
|
|
11904
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
11141
11905
|
}).preInstructions([
|
|
11142
11906
|
createTicketIx
|
|
11143
11907
|
]).transaction();
|
|
11144
11908
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11145
11909
|
}
|
|
11146
|
-
async
|
|
11147
|
-
|
|
11148
|
-
|
|
11910
|
+
async claimTx(glamState, tickets, txOptions) {
|
|
11911
|
+
if (tickets.length < 1) {
|
|
11912
|
+
throw new Error("At least one ticket is required");
|
|
11913
|
+
}
|
|
11914
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11149
11915
|
const marinadeState = this.getMarinadeState();
|
|
11150
|
-
const tx = await this.base.program.methods.
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11916
|
+
const tx = await this.base.program.methods.marinadeClaim().accounts({
|
|
11917
|
+
glamState,
|
|
11918
|
+
glamSigner,
|
|
11919
|
+
ticketAccount: tickets[0],
|
|
11920
|
+
state: marinadeState.marinadeStateAddress,
|
|
11155
11921
|
reservePda: marinadeState.reserveAddress,
|
|
11156
|
-
|
|
11157
|
-
}).remainingAccounts(tickets.map((t)=>({
|
|
11922
|
+
clock: web3_js.SYSVAR_CLOCK_PUBKEY
|
|
11923
|
+
}).remainingAccounts(tickets.slice(1).map((t)=>({
|
|
11158
11924
|
pubkey: t,
|
|
11159
11925
|
isSigner: false,
|
|
11160
11926
|
isWritable: true
|
|
11161
11927
|
}))).transaction();
|
|
11162
11928
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11163
11929
|
}
|
|
11164
|
-
async liquidUnstakeTx(
|
|
11165
|
-
const
|
|
11166
|
-
const vault = this.base.getVaultPda(
|
|
11930
|
+
async liquidUnstakeTx(glamState, amount, txOptions) {
|
|
11931
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11932
|
+
const vault = this.base.getVaultPda(glamState);
|
|
11167
11933
|
const marinadeState = this.getMarinadeState();
|
|
11168
11934
|
const vaultMsolAta = this.base.getAta(marinadeState.msolMintAddress, vault);
|
|
11169
|
-
const tx = await this.base.program.methods.marinadeLiquidUnstake(amount).
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
marinadeState: marinadeState.marinadeStateAddress,
|
|
11935
|
+
const tx = await this.base.program.methods.marinadeLiquidUnstake(amount).accounts({
|
|
11936
|
+
glamState,
|
|
11937
|
+
glamSigner,
|
|
11938
|
+
state: marinadeState.marinadeStateAddress,
|
|
11174
11939
|
msolMint: marinadeState.msolMintAddress,
|
|
11175
11940
|
liqPoolSolLegPda: marinadeState.solLeg,
|
|
11176
11941
|
liqPoolMsolLeg: marinadeState.msolLeg,
|
|
11177
11942
|
getMsolFrom: vaultMsolAta,
|
|
11178
|
-
getMsolFromAuthority: vault,
|
|
11179
11943
|
treasuryMsolAccount: marinadeState.treasuryMsolAccount,
|
|
11180
|
-
|
|
11944
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
11181
11945
|
}).transaction();
|
|
11182
11946
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11183
11947
|
}
|
|
11184
11948
|
constructor(base){
|
|
11185
11949
|
this.base = base;
|
|
11950
|
+
this./*
|
|
11951
|
+
* Utils
|
|
11952
|
+
*/ _getTicketsAccounts = async (state)=>await this.base.provider.connection.getParsedProgramAccounts(MARINADE_PROGRAM_ID, {
|
|
11953
|
+
filters: [
|
|
11954
|
+
{
|
|
11955
|
+
dataSize: TICKET_SIZE
|
|
11956
|
+
},
|
|
11957
|
+
{
|
|
11958
|
+
memcmp: {
|
|
11959
|
+
offset: 40,
|
|
11960
|
+
bytes: this.base.getVaultPda(state).toBase58()
|
|
11961
|
+
}
|
|
11962
|
+
}
|
|
11963
|
+
]
|
|
11964
|
+
});
|
|
11186
11965
|
}
|
|
11187
11966
|
}
|
|
11188
11967
|
|
|
11189
11968
|
class WSolClient {
|
|
11190
11969
|
/*
|
|
11191
11970
|
* Client methods
|
|
11192
|
-
*/ async wrap(
|
|
11193
|
-
const tx = await this.wrapTx(
|
|
11971
|
+
*/ async wrap(glamState, amount, txOptions = {}) {
|
|
11972
|
+
const tx = await this.wrapTx(glamState, amount, txOptions);
|
|
11194
11973
|
return await this.base.sendAndConfirm(tx);
|
|
11195
11974
|
}
|
|
11196
|
-
async unwrap(
|
|
11197
|
-
const tx = await this.unwrapTx(
|
|
11975
|
+
async unwrap(glamState, txOptions = {}) {
|
|
11976
|
+
const tx = await this.unwrapTx(glamState, txOptions);
|
|
11198
11977
|
return await this.base.sendAndConfirm(tx);
|
|
11199
11978
|
}
|
|
11200
11979
|
/*
|
|
11201
11980
|
* API methods
|
|
11202
|
-
*/ async wrapTx(
|
|
11203
|
-
const
|
|
11204
|
-
const
|
|
11205
|
-
const vaultWsolAta = this.base.getVaultAta(statePda, WSOL);
|
|
11206
|
-
// @ts-ignore
|
|
11981
|
+
*/ async wrapTx(glamState, amount, txOptions) {
|
|
11982
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11983
|
+
const vaultWsolAta = this.base.getVaultAta(glamState, WSOL);
|
|
11207
11984
|
const tx = await this.base.program.methods.wsolWrap(amount).accountsPartial({
|
|
11208
|
-
|
|
11209
|
-
|
|
11985
|
+
glamState,
|
|
11986
|
+
glamSigner,
|
|
11210
11987
|
vaultWsolAta,
|
|
11211
|
-
wsolMint: WSOL
|
|
11212
|
-
signer
|
|
11988
|
+
wsolMint: WSOL
|
|
11213
11989
|
}).transaction();
|
|
11214
11990
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11215
11991
|
}
|
|
11216
|
-
async unwrapTx(
|
|
11217
|
-
const
|
|
11218
|
-
const
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
state: statePda,
|
|
11222
|
-
vault,
|
|
11223
|
-
vaultWsolAta,
|
|
11224
|
-
wsolMint: WSOL,
|
|
11225
|
-
signer
|
|
11992
|
+
async unwrapTx(glamState, txOptions) {
|
|
11993
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11994
|
+
const tx = await this.base.program.methods.wsolUnwrap().accounts({
|
|
11995
|
+
glamState,
|
|
11996
|
+
glamSigner
|
|
11226
11997
|
}).transaction();
|
|
11227
11998
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11228
11999
|
}
|
|
@@ -11235,62 +12006,62 @@ const STAKE_ACCOUNT_SIZE = 200;
|
|
|
11235
12006
|
class StakingClient {
|
|
11236
12007
|
/*
|
|
11237
12008
|
* High-level API methods
|
|
11238
|
-
*/ async unstake(
|
|
12009
|
+
*/ async unstake(glamState, asset, amount, txOptions = {}) {
|
|
11239
12010
|
const assetStr = asset.toBase58();
|
|
11240
12011
|
let tx;
|
|
11241
12012
|
if (assetStr === MSOL.toBase58()) {
|
|
11242
12013
|
// Marinade
|
|
11243
|
-
tx = await this.marinade.
|
|
12014
|
+
tx = await this.marinade.orderUnstakeTx(glamState, new anchor.BN(amount), txOptions);
|
|
11244
12015
|
} else {
|
|
11245
12016
|
// Other LSTs
|
|
11246
12017
|
const assetMeta = this.base.getAssetMeta(assetStr);
|
|
11247
12018
|
if (!assetMeta || !assetMeta.stateAccount) {
|
|
11248
12019
|
throw new Error("Invalid LST: " + asset);
|
|
11249
12020
|
}
|
|
11250
|
-
tx = await this.stakePoolWithdrawStakeTx(
|
|
12021
|
+
tx = await this.stakePoolWithdrawStakeTx(glamState, assetMeta.stateAccount, new anchor.BN(amount), true, txOptions);
|
|
11251
12022
|
}
|
|
11252
12023
|
return await this.base.sendAndConfirm(tx);
|
|
11253
12024
|
}
|
|
11254
12025
|
/*
|
|
11255
12026
|
* Client methods
|
|
11256
|
-
*/ async stakePoolDepositSol(
|
|
11257
|
-
const tx = await this.stakePoolDepositSolTx(
|
|
12027
|
+
*/ async stakePoolDepositSol(glamState, stakePool, amount, txOptions = {}) {
|
|
12028
|
+
const tx = await this.stakePoolDepositSolTx(glamState, stakePool, amount);
|
|
11258
12029
|
return await this.base.sendAndConfirm(tx);
|
|
11259
12030
|
}
|
|
11260
|
-
async stakePoolDepositStake(
|
|
11261
|
-
const tx = await this.stakePoolDepositStakeTx(
|
|
12031
|
+
async stakePoolDepositStake(glamState, stakePool, stakeAccount) {
|
|
12032
|
+
const tx = await this.stakePoolDepositStakeTx(glamState, stakePool, stakeAccount);
|
|
11262
12033
|
return await this.base.sendAndConfirm(tx);
|
|
11263
12034
|
}
|
|
11264
|
-
async stakePoolWithdrawStake(
|
|
11265
|
-
const tx = await this.stakePoolWithdrawStakeTx(
|
|
12035
|
+
async stakePoolWithdrawStake(glamState, stakePool, amount) {
|
|
12036
|
+
const tx = await this.stakePoolWithdrawStakeTx(glamState, stakePool, amount);
|
|
11266
12037
|
return await this.base.sendAndConfirm(tx);
|
|
11267
12038
|
}
|
|
11268
|
-
async initializeAndDelegateStake(
|
|
11269
|
-
const tx = await this.initializeAndDelegateStakeTx(
|
|
12039
|
+
async initializeAndDelegateStake(glamState, vote, amount) {
|
|
12040
|
+
const tx = await this.initializeAndDelegateStakeTx(glamState, vote, amount);
|
|
11270
12041
|
return await this.base.sendAndConfirm(tx);
|
|
11271
12042
|
}
|
|
11272
|
-
async deactivateStakeAccounts(
|
|
11273
|
-
const tx = await this.deactivateStakeAccountsTx(
|
|
12043
|
+
async deactivateStakeAccounts(glamState, stakeAccounts) {
|
|
12044
|
+
const tx = await this.deactivateStakeAccountsTx(glamState, stakeAccounts);
|
|
11274
12045
|
return await this.base.sendAndConfirm(tx);
|
|
11275
12046
|
}
|
|
11276
|
-
async withdrawFromStakeAccounts(
|
|
11277
|
-
const tx = await this.withdrawFromStakeAccountsTx(
|
|
12047
|
+
async withdrawFromStakeAccounts(glamState, stakeAccounts) {
|
|
12048
|
+
const tx = await this.withdrawFromStakeAccountsTx(glamState, stakeAccounts);
|
|
11278
12049
|
return await this.base.sendAndConfirm(tx);
|
|
11279
12050
|
}
|
|
11280
|
-
async mergeStakeAccounts(
|
|
11281
|
-
const tx = await this.mergeStakeAccountsTx(
|
|
12051
|
+
async mergeStakeAccounts(glamState, toStake, fromStake) {
|
|
12052
|
+
const tx = await this.mergeStakeAccountsTx(glamState, toStake, fromStake);
|
|
11282
12053
|
return await this.base.sendAndConfirm(tx);
|
|
11283
12054
|
}
|
|
11284
|
-
async splitStakeAccount(
|
|
11285
|
-
const { tx, newStake } = await this.splitStakeAccountTx(
|
|
12055
|
+
async splitStakeAccount(glamState, existingStake, lamports) {
|
|
12056
|
+
const { tx, newStake } = await this.splitStakeAccountTx(glamState, existingStake, lamports);
|
|
11286
12057
|
const txSig = await this.base.sendAndConfirm(tx);
|
|
11287
12058
|
return {
|
|
11288
12059
|
newStake,
|
|
11289
12060
|
txSig
|
|
11290
12061
|
};
|
|
11291
12062
|
}
|
|
11292
|
-
async redelegateStake(
|
|
11293
|
-
const { newStake, tx } = await this.redelegateStakeTx(
|
|
12063
|
+
async redelegateStake(glamState, existingStake, vote) {
|
|
12064
|
+
const { newStake, tx } = await this.redelegateStakeTx(glamState, existingStake, vote);
|
|
11294
12065
|
const txSig = await this.base.sendAndConfirm(tx);
|
|
11295
12066
|
return {
|
|
11296
12067
|
newStake,
|
|
@@ -11436,16 +12207,16 @@ class StakingClient {
|
|
|
11436
12207
|
}
|
|
11437
12208
|
/*
|
|
11438
12209
|
* API methods
|
|
11439
|
-
*/ async stakePoolDepositSolTx(
|
|
11440
|
-
const
|
|
11441
|
-
const
|
|
12210
|
+
*/ async stakePoolDepositSolTx(glamState, stakePool, amount, txOptions = {}) {
|
|
12211
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12212
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11442
12213
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
11443
12214
|
console.log(`stakePool ${stakePool}, programId: ${stakePoolProgram}`);
|
|
11444
12215
|
const tx = await this.base.program.methods.stakePoolDepositSol(amount).accountsPartial({
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
mintTo: this.base.getVaultAta(
|
|
12216
|
+
glamSigner,
|
|
12217
|
+
glamState,
|
|
12218
|
+
glamVault,
|
|
12219
|
+
mintTo: this.base.getVaultAta(glamState, poolMint),
|
|
11449
12220
|
stakePoolProgram,
|
|
11450
12221
|
stakePool,
|
|
11451
12222
|
poolMint: poolMint,
|
|
@@ -11456,9 +12227,9 @@ class StakingClient {
|
|
|
11456
12227
|
}).transaction();
|
|
11457
12228
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11458
12229
|
}
|
|
11459
|
-
async stakePoolDepositStakeTx(
|
|
11460
|
-
const
|
|
11461
|
-
const
|
|
12230
|
+
async stakePoolDepositStakeTx(glamState, stakePool, stakeAccount, txOptions = {}) {
|
|
12231
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12232
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11462
12233
|
const { programId: stakePoolProgram, poolMint, depositAuthority, withdrawAuthority, feeAccount, validatorList, tokenProgramId: tokenProgram, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
11463
12234
|
// All stake accounts owned by the stake pool withdraw authority
|
|
11464
12235
|
const validatorStakeCandidates = await this.getStakeAccountsWithStates(withdrawAuthority);
|
|
@@ -11473,11 +12244,11 @@ class StakingClient {
|
|
|
11473
12244
|
throw new Error("Stake account cannot be deposited to the pool");
|
|
11474
12245
|
}
|
|
11475
12246
|
const tx = await this.base.program.methods.stakePoolDepositStake().accountsPartial({
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
12247
|
+
glamSigner,
|
|
12248
|
+
glamState,
|
|
12249
|
+
glamVault,
|
|
11479
12250
|
vaultStakeAccount: stakeAccount,
|
|
11480
|
-
mintTo: this.base.getVaultAta(
|
|
12251
|
+
mintTo: this.base.getVaultAta(glamState, poolMint),
|
|
11481
12252
|
poolMint,
|
|
11482
12253
|
feeAccount,
|
|
11483
12254
|
stakePool,
|
|
@@ -11494,20 +12265,20 @@ class StakingClient {
|
|
|
11494
12265
|
}).transaction();
|
|
11495
12266
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11496
12267
|
}
|
|
11497
|
-
async stakePoolWithdrawStakeTx(
|
|
11498
|
-
const
|
|
11499
|
-
const
|
|
12268
|
+
async stakePoolWithdrawStakeTx(glamState, stakePool, amount, deactivate = false, txOptions = {}) {
|
|
12269
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12270
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11500
12271
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, validatorList, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
11501
12272
|
// The reserve stake account should NOT be used for withdrawals unless we have no other options.
|
|
11502
12273
|
const validatorStakeCandidates = (await this.getStakeAccountsWithStates(withdrawAuthority)).filter((s)=>!s.address.equals(reserveStake));
|
|
11503
12274
|
console.log("validatorStakeCandidates", validatorStakeCandidates);
|
|
11504
12275
|
const validatorStakeAccount = validatorStakeCandidates.length === 0 ? reserveStake : validatorStakeCandidates[0].address;
|
|
11505
|
-
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(
|
|
12276
|
+
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11506
12277
|
const postInstructions = deactivate ? [
|
|
11507
12278
|
await this.base.program.methods.deactivateStakeAccounts().accountsPartial({
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
12279
|
+
glamSigner,
|
|
12280
|
+
glamState,
|
|
12281
|
+
glamVault,
|
|
11511
12282
|
clock: web3_js.SYSVAR_CLOCK_PUBKEY,
|
|
11512
12283
|
stakeProgram: web3_js.StakeProgram.programId
|
|
11513
12284
|
}).remainingAccounts([
|
|
@@ -11519,14 +12290,14 @@ class StakingClient {
|
|
|
11519
12290
|
]).instruction()
|
|
11520
12291
|
] : [];
|
|
11521
12292
|
const tx = await this.base.program.methods.stakePoolWithdrawStake(amount).accountsPartial({
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
12293
|
+
glamSigner,
|
|
12294
|
+
glamState,
|
|
12295
|
+
glamVault,
|
|
11525
12296
|
vaultStakeAccount: stakeAccount,
|
|
11526
12297
|
stakePoolProgram,
|
|
11527
12298
|
stakePool,
|
|
11528
12299
|
poolMint,
|
|
11529
|
-
poolTokenAta: this.base.getVaultAta(
|
|
12300
|
+
poolTokenAta: this.base.getVaultAta(glamState, poolMint),
|
|
11530
12301
|
validatorList,
|
|
11531
12302
|
validatorStakeAccount,
|
|
11532
12303
|
withdrawAuthority,
|
|
@@ -11539,14 +12310,14 @@ class StakingClient {
|
|
|
11539
12310
|
]).postInstructions(postInstructions).transaction();
|
|
11540
12311
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11541
12312
|
}
|
|
11542
|
-
async initializeAndDelegateStakeTx(
|
|
11543
|
-
const
|
|
11544
|
-
const
|
|
11545
|
-
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(
|
|
12313
|
+
async initializeAndDelegateStakeTx(glamState, vote, amount, txOptions = {}) {
|
|
12314
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12315
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12316
|
+
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11546
12317
|
const tx = await this.base.program.methods.initializeAndDelegateStake(amount).accountsPartial({
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
12318
|
+
glamState,
|
|
12319
|
+
glamSigner,
|
|
12320
|
+
glamVault,
|
|
11550
12321
|
vaultStakeAccount: stakeAccount,
|
|
11551
12322
|
vote,
|
|
11552
12323
|
stakeConfig: web3_js.STAKE_CONFIG_ID,
|
|
@@ -11557,13 +12328,13 @@ class StakingClient {
|
|
|
11557
12328
|
]).transaction();
|
|
11558
12329
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11559
12330
|
}
|
|
11560
|
-
async deactivateStakeAccountsTx(
|
|
11561
|
-
const
|
|
11562
|
-
const
|
|
12331
|
+
async deactivateStakeAccountsTx(glamState, stakeAccounts, txOptions = {}) {
|
|
12332
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12333
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11563
12334
|
const tx = await this.base.program.methods.deactivateStakeAccounts().accountsPartial({
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
|
|
12335
|
+
glamState,
|
|
12336
|
+
glamSigner,
|
|
12337
|
+
glamVault,
|
|
11567
12338
|
clock: web3_js.SYSVAR_CLOCK_PUBKEY,
|
|
11568
12339
|
stakeProgram: web3_js.StakeProgram.programId
|
|
11569
12340
|
}).remainingAccounts(stakeAccounts.map((a)=>({
|
|
@@ -11573,13 +12344,13 @@ class StakingClient {
|
|
|
11573
12344
|
}))).transaction();
|
|
11574
12345
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11575
12346
|
}
|
|
11576
|
-
async withdrawFromStakeAccountsTx(
|
|
11577
|
-
const
|
|
11578
|
-
const
|
|
12347
|
+
async withdrawFromStakeAccountsTx(glamState, stakeAccounts, txOptions = {}) {
|
|
12348
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12349
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11579
12350
|
const tx = await this.base.program.methods.withdrawFromStakeAccounts().accountsPartial({
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
12351
|
+
glamSigner,
|
|
12352
|
+
glamState,
|
|
12353
|
+
glamVault,
|
|
11583
12354
|
clock: web3_js.SYSVAR_CLOCK_PUBKEY,
|
|
11584
12355
|
stakeHistory: web3_js.SYSVAR_STAKE_HISTORY_PUBKEY,
|
|
11585
12356
|
stakeProgram: web3_js.StakeProgram.programId
|
|
@@ -11590,13 +12361,13 @@ class StakingClient {
|
|
|
11590
12361
|
}))).transaction();
|
|
11591
12362
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11592
12363
|
}
|
|
11593
|
-
async mergeStakeAccountsTx(
|
|
11594
|
-
const
|
|
11595
|
-
const
|
|
12364
|
+
async mergeStakeAccountsTx(glamState, toStake, fromStake, txOptions = {}) {
|
|
12365
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12366
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
11596
12367
|
const tx = await this.base.program.methods.mergeStakeAccounts().accountsPartial({
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
12368
|
+
glamSigner,
|
|
12369
|
+
glamState,
|
|
12370
|
+
glamVault,
|
|
11600
12371
|
toStake,
|
|
11601
12372
|
fromStake,
|
|
11602
12373
|
stakeProgram: web3_js.StakeProgram.programId,
|
|
@@ -11604,14 +12375,14 @@ class StakingClient {
|
|
|
11604
12375
|
}).transaction();
|
|
11605
12376
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11606
12377
|
}
|
|
11607
|
-
async splitStakeAccountTx(
|
|
11608
|
-
const
|
|
11609
|
-
const
|
|
11610
|
-
const [newStake, createStakeAccountIx] = await this.createStakeAccount(
|
|
12378
|
+
async splitStakeAccountTx(glamState, existingStake, lamports, txOptions = {}) {
|
|
12379
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12380
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12381
|
+
const [newStake, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11611
12382
|
const tx = await this.base.program.methods.splitStakeAccount(lamports).accountsPartial({
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
12383
|
+
glamSigner,
|
|
12384
|
+
glamState,
|
|
12385
|
+
glamVault,
|
|
11615
12386
|
existingStake,
|
|
11616
12387
|
newStake,
|
|
11617
12388
|
stakeProgram: web3_js.StakeProgram.programId
|
|
@@ -11624,14 +12395,14 @@ class StakingClient {
|
|
|
11624
12395
|
newStake
|
|
11625
12396
|
};
|
|
11626
12397
|
}
|
|
11627
|
-
async redelegateStakeTx(
|
|
11628
|
-
const
|
|
11629
|
-
const
|
|
11630
|
-
const [newStake, createStakeAccountIx] = await this.createStakeAccount(
|
|
12398
|
+
async redelegateStakeTx(glamState, existingStake, vote, txOptions = {}) {
|
|
12399
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12400
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12401
|
+
const [newStake, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
11631
12402
|
const tx = await this.base.program.methods.redelegateStake().accountsPartial({
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
12403
|
+
glamSigner,
|
|
12404
|
+
glamState,
|
|
12405
|
+
glamVault,
|
|
11635
12406
|
vote,
|
|
11636
12407
|
existingStake,
|
|
11637
12408
|
newStake,
|
|
@@ -11657,10 +12428,11 @@ function getPublicKey(input) {
|
|
|
11657
12428
|
}
|
|
11658
12429
|
class StateClient {
|
|
11659
12430
|
async createState(partialStateModel, singleTx = false, txOptions = {}) {
|
|
12431
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11660
12432
|
let stateModel = this.enrichStateModel(partialStateModel);
|
|
11661
|
-
const
|
|
11662
|
-
const
|
|
11663
|
-
const openfunds = this.base.getOpenfundsPda(
|
|
12433
|
+
const glamState = this.base.getStatePda(stateModel);
|
|
12434
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
12435
|
+
const openfunds = this.base.getOpenfundsPda(glamState);
|
|
11664
12436
|
const mints = stateModel.mints;
|
|
11665
12437
|
stateModel.mints = [];
|
|
11666
12438
|
if (mints && mints.length > 1) {
|
|
@@ -11669,49 +12441,52 @@ class StateClient {
|
|
|
11669
12441
|
// No share class, only need to initialize the fund
|
|
11670
12442
|
if (mints && mints.length === 0) {
|
|
11671
12443
|
const txSig = await this.base.program.methods.initializeState(stateModel).accountsPartial({
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
12444
|
+
glamState,
|
|
12445
|
+
glamSigner,
|
|
12446
|
+
glamVault
|
|
11675
12447
|
}).rpc();
|
|
11676
12448
|
return [
|
|
11677
12449
|
txSig,
|
|
11678
|
-
|
|
12450
|
+
glamState
|
|
11679
12451
|
];
|
|
11680
12452
|
}
|
|
11681
12453
|
if (mints && mints.length > 0 && singleTx) {
|
|
11682
12454
|
const initStateIx = await this.base.program.methods.initializeState(stateModel).accountsPartial({
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
12455
|
+
glamState,
|
|
12456
|
+
glamSigner,
|
|
12457
|
+
glamVault
|
|
11686
12458
|
}).instruction();
|
|
11687
12459
|
// FIXME: setting rawOpenfunds to null is a workarond for
|
|
11688
12460
|
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
|
|
11689
12461
|
mints[0].rawOpenfunds = null;
|
|
11690
|
-
const
|
|
12462
|
+
const newMint = this.base.getMintPda(glamState, 0);
|
|
11691
12463
|
const txSig = await this.base.program.methods.addMint(mints[0]).accounts({
|
|
11692
|
-
glamState
|
|
11693
|
-
|
|
12464
|
+
glamState,
|
|
12465
|
+
glamSigner,
|
|
12466
|
+
newMint
|
|
11694
12467
|
}).preInstructions([
|
|
11695
12468
|
initStateIx
|
|
11696
12469
|
]).rpc();
|
|
11697
12470
|
return [
|
|
11698
12471
|
txSig,
|
|
11699
|
-
|
|
12472
|
+
glamState
|
|
11700
12473
|
];
|
|
11701
12474
|
}
|
|
11702
12475
|
const txSig = await this.base.program.methods.initializeState(stateModel).accountsPartial({
|
|
11703
|
-
|
|
11704
|
-
|
|
12476
|
+
glamState,
|
|
12477
|
+
glamVault,
|
|
12478
|
+
glamSigner,
|
|
11705
12479
|
openfundsMetadata: openfunds
|
|
11706
12480
|
}).rpc();
|
|
11707
12481
|
const addMintTxs = await Promise.all((mints || []).map(async (mint, j)=>{
|
|
11708
|
-
const
|
|
12482
|
+
const newMint = this.base.getMintPda(glamState, j);
|
|
11709
12483
|
// FIXME: setting rawOpenfunds to null is a workarond for
|
|
11710
12484
|
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
|
|
11711
12485
|
mint.rawOpenfunds = null;
|
|
11712
12486
|
return await this.base.program.methods.addMint(mint).accounts({
|
|
11713
|
-
glamState
|
|
11714
|
-
|
|
12487
|
+
glamState,
|
|
12488
|
+
glamSigner,
|
|
12489
|
+
newMint
|
|
11715
12490
|
}).preInstructions([
|
|
11716
12491
|
// FIXME: estimate compute units
|
|
11717
12492
|
web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
@@ -11722,24 +12497,27 @@ class StateClient {
|
|
|
11722
12497
|
console.log("addMintTxs", addMintTxs);
|
|
11723
12498
|
return [
|
|
11724
12499
|
txSig,
|
|
11725
|
-
|
|
12500
|
+
glamState
|
|
11726
12501
|
];
|
|
11727
12502
|
}
|
|
11728
|
-
async updateState(
|
|
11729
|
-
console.log(`await glam.state.updateState("${
|
|
11730
|
-
const tx = await this.updateStateTx(getPublicKey(
|
|
12503
|
+
async updateState(glamState, updated, txOptions = {}) {
|
|
12504
|
+
console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
|
|
12505
|
+
const tx = await this.updateStateTx(getPublicKey(glamState), updated, txOptions);
|
|
11731
12506
|
return await this.base.sendAndConfirm(tx);
|
|
11732
12507
|
}
|
|
11733
|
-
async updateStateTx(
|
|
12508
|
+
async updateStateTx(glamState, updated, txOptions) {
|
|
12509
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11734
12510
|
const tx = await this.base.program.methods.updateState(new StateModel(updated)).accounts({
|
|
11735
|
-
|
|
11736
|
-
|
|
12511
|
+
glamState,
|
|
12512
|
+
glamSigner
|
|
12513
|
+
}).preInstructions(txOptions.preInstructions || []).transaction();
|
|
11737
12514
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11738
12515
|
}
|
|
11739
|
-
async closeState(
|
|
11740
|
-
this.base.
|
|
12516
|
+
async closeState(glamState, txOptions = {}) {
|
|
12517
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11741
12518
|
const tx = await this.base.program.methods.closeState().accounts({
|
|
11742
|
-
|
|
12519
|
+
glamState,
|
|
12520
|
+
glamSigner
|
|
11743
12521
|
}).preInstructions(txOptions.preInstructions || []).transaction();
|
|
11744
12522
|
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11745
12523
|
return await this.base.sendAndConfirm(vTx);
|
|
@@ -11790,7 +12568,7 @@ class StateClient {
|
|
|
11790
12568
|
if (mint.rawOpenfunds.shareClassLifecycle === "active") {
|
|
11791
12569
|
mint.rawOpenfunds.shareClassLaunchDate = mint.rawOpenfunds.shareClassLaunchDate || defaultDate;
|
|
11792
12570
|
}
|
|
11793
|
-
mint.rawOpenfunds = new
|
|
12571
|
+
mint.rawOpenfunds = new MintOpenfundsModel(mint.rawOpenfunds);
|
|
11794
12572
|
mint.isRawOpenfunds = true;
|
|
11795
12573
|
} else {
|
|
11796
12574
|
mint.isRawOpenfunds = false;
|
|
@@ -11820,39 +12598,43 @@ class StateClient {
|
|
|
11820
12598
|
});
|
|
11821
12599
|
return await this.updateState(statePda, updated, txOptions);
|
|
11822
12600
|
}
|
|
11823
|
-
async upsertDelegateAcls(
|
|
11824
|
-
return await this.updateState(
|
|
12601
|
+
async upsertDelegateAcls(glamState, delegateAcls, txOptions = {}) {
|
|
12602
|
+
return await this.updateState(glamState, {
|
|
11825
12603
|
delegateAcls
|
|
11826
12604
|
}, txOptions);
|
|
11827
12605
|
}
|
|
11828
|
-
async setSubscribeRedeemEnabled(
|
|
12606
|
+
async setSubscribeRedeemEnabled(glamState, enabled, txOptions = {}) {
|
|
12607
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11829
12608
|
return await this.base.program.methods.setSubscribeRedeemEnabled(enabled).accounts({
|
|
11830
|
-
|
|
12609
|
+
glamState,
|
|
12610
|
+
glamSigner
|
|
11831
12611
|
}).rpc();
|
|
11832
12612
|
}
|
|
11833
|
-
async closeTokenAccounts(
|
|
11834
|
-
const tx = await this.closeTokenAccountsTx(
|
|
12613
|
+
async closeTokenAccounts(glamState, tokenAccounts, txOptions = {}) {
|
|
12614
|
+
const tx = await this.closeTokenAccountsTx(glamState, tokenAccounts, txOptions);
|
|
11835
12615
|
return await this.base.sendAndConfirm(tx);
|
|
11836
12616
|
}
|
|
11837
12617
|
/**
|
|
11838
12618
|
* Close fund treasury's token accounts
|
|
11839
12619
|
*
|
|
11840
|
-
* @param
|
|
12620
|
+
* @param glamState
|
|
11841
12621
|
* @param tokenAccounts
|
|
11842
12622
|
* @param txOptions
|
|
11843
12623
|
* @returns
|
|
11844
|
-
*/ async closeTokenAccountsIx(
|
|
12624
|
+
*/ async closeTokenAccountsIx(glamState, tokenAccounts) {
|
|
11845
12625
|
return await this.base.program.methods.closeTokenAccounts().accounts({
|
|
11846
|
-
|
|
12626
|
+
glamState
|
|
11847
12627
|
}).remainingAccounts(tokenAccounts.map((account)=>({
|
|
11848
12628
|
pubkey: account,
|
|
11849
12629
|
isSigner: false,
|
|
11850
12630
|
isWritable: true
|
|
11851
12631
|
}))).instruction();
|
|
11852
12632
|
}
|
|
11853
|
-
async closeTokenAccountsTx(
|
|
12633
|
+
async closeTokenAccountsTx(glamState, tokenAccounts, txOptions) {
|
|
12634
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11854
12635
|
const tx = await this.base.program.methods.closeTokenAccounts().accounts({
|
|
11855
|
-
|
|
12636
|
+
glamState,
|
|
12637
|
+
glamSigner
|
|
11856
12638
|
}).remainingAccounts(tokenAccounts.map((account)=>({
|
|
11857
12639
|
pubkey: account,
|
|
11858
12640
|
isSigner: false,
|
|
@@ -11860,12 +12642,36 @@ class StateClient {
|
|
|
11860
12642
|
}))).transaction();
|
|
11861
12643
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11862
12644
|
}
|
|
11863
|
-
/* Deposit & Withdraw */ async deposit(
|
|
11864
|
-
const tx = await this.depositTx(
|
|
12645
|
+
/* Deposit & Withdraw */ async deposit(glamState, asset, amount, txOptions = {}) {
|
|
12646
|
+
const tx = await this.depositTx(new web3_js.PublicKey(glamState), new web3_js.PublicKey(asset), amount, txOptions);
|
|
12647
|
+
return await this.base.sendAndConfirm(tx);
|
|
12648
|
+
}
|
|
12649
|
+
async depositSol(glamState, lamports, wrap = true, txOptions = {}) {
|
|
12650
|
+
const tx = await this.depositSolTx(glamState, lamports, wrap, txOptions);
|
|
11865
12651
|
return await this.base.sendAndConfirm(tx);
|
|
11866
12652
|
}
|
|
11867
|
-
async
|
|
11868
|
-
const
|
|
12653
|
+
async depositSolTx(glamState, lamports, wrap = true, txOptions = {}) {
|
|
12654
|
+
const signer = txOptions.signer || this.base.getSigner();
|
|
12655
|
+
const vault = this.base.getVaultPda(glamState);
|
|
12656
|
+
const _lamports = lamports instanceof anchor.BN ? BigInt(lamports.toString()) : lamports;
|
|
12657
|
+
if (!wrap) {
|
|
12658
|
+
const tx = new web3_js.Transaction().add(web3_js.SystemProgram.transfer({
|
|
12659
|
+
fromPubkey: signer,
|
|
12660
|
+
toPubkey: vault,
|
|
12661
|
+
lamports: _lamports
|
|
12662
|
+
}));
|
|
12663
|
+
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12664
|
+
}
|
|
12665
|
+
const vaultAta = this.base.getAta(WSOL, vault);
|
|
12666
|
+
const tx = new web3_js.Transaction().add(splToken.createAssociatedTokenAccountIdempotentInstruction(signer, vaultAta, vault, WSOL), web3_js.SystemProgram.transfer({
|
|
12667
|
+
fromPubkey: signer,
|
|
12668
|
+
toPubkey: vaultAta,
|
|
12669
|
+
lamports: _lamports
|
|
12670
|
+
}), splToken.createSyncNativeInstruction(vaultAta));
|
|
12671
|
+
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12672
|
+
}
|
|
12673
|
+
async withdraw(glamState, asset, amount, txOptions = {}) {
|
|
12674
|
+
const tx = await this.withdrawTx(glamState, new web3_js.PublicKey(asset), amount, txOptions);
|
|
11869
12675
|
return await this.base.sendAndConfirm(tx);
|
|
11870
12676
|
}
|
|
11871
12677
|
async depositTx(statePda, asset, amount, txOptions) {
|
|
@@ -11877,40 +12683,42 @@ class StateClient {
|
|
|
11877
12683
|
const tx = new web3_js.Transaction().add(splToken.createAssociatedTokenAccountIdempotentInstruction(signer, vaultAta, vault, asset, tokenProgram), splToken.createTransferCheckedInstruction(signerAta, asset, vaultAta, signer, new anchor.BN(amount).toNumber(), mint.decimals, [], tokenProgram));
|
|
11878
12684
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
11879
12685
|
}
|
|
11880
|
-
async withdrawIxs(
|
|
11881
|
-
const
|
|
12686
|
+
async withdrawIxs(glamState, asset, amount, txOptions) {
|
|
12687
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11882
12688
|
const { tokenProgram } = await this.base.fetchMintWithOwner(asset);
|
|
11883
|
-
const signerAta = this.base.getAta(asset,
|
|
12689
|
+
const signerAta = this.base.getAta(asset, glamSigner, tokenProgram);
|
|
11884
12690
|
return [
|
|
11885
|
-
splToken.createAssociatedTokenAccountIdempotentInstruction(
|
|
12691
|
+
splToken.createAssociatedTokenAccountIdempotentInstruction(glamSigner, signerAta, glamSigner, asset, tokenProgram),
|
|
11886
12692
|
await this.base.program.methods.withdraw(new anchor.BN(amount)).accounts({
|
|
11887
|
-
|
|
12693
|
+
glamState,
|
|
12694
|
+
glamSigner,
|
|
11888
12695
|
asset,
|
|
11889
12696
|
tokenProgram
|
|
11890
12697
|
}).instruction()
|
|
11891
12698
|
];
|
|
11892
12699
|
}
|
|
11893
|
-
async withdrawTx(
|
|
11894
|
-
const
|
|
12700
|
+
async withdrawTx(glamState, asset, amount, txOptions) {
|
|
12701
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
11895
12702
|
const { tokenProgram } = await this.base.fetchMintWithOwner(asset);
|
|
11896
|
-
const signerAta = this.base.getAta(asset,
|
|
12703
|
+
const signerAta = this.base.getAta(asset, glamSigner, tokenProgram);
|
|
11897
12704
|
const preInstructions = [
|
|
11898
|
-
splToken.createAssociatedTokenAccountIdempotentInstruction(
|
|
12705
|
+
splToken.createAssociatedTokenAccountIdempotentInstruction(glamSigner, signerAta, glamSigner, asset, tokenProgram)
|
|
11899
12706
|
];
|
|
11900
12707
|
const postInstructions = [];
|
|
11901
12708
|
if (asset.equals(WSOL)) {
|
|
11902
|
-
const wrapSolIx = await this.base.maybeWrapSol(
|
|
12709
|
+
const wrapSolIx = await this.base.maybeWrapSol(glamState, amount, glamSigner);
|
|
11903
12710
|
if (wrapSolIx) {
|
|
11904
12711
|
preInstructions.push(wrapSolIx);
|
|
11905
12712
|
// If we need to wrap SOL, it means the wSOL balance will be drained,
|
|
11906
12713
|
// and we close the wSOL token account for convenience
|
|
11907
|
-
postInstructions.push(await this.closeTokenAccountsIx(
|
|
11908
|
-
this.base.getVaultAta(
|
|
12714
|
+
postInstructions.push(await this.closeTokenAccountsIx(glamState, [
|
|
12715
|
+
this.base.getVaultAta(glamState, WSOL)
|
|
11909
12716
|
]));
|
|
11910
12717
|
}
|
|
11911
12718
|
}
|
|
11912
12719
|
const tx = await this.base.program.methods.withdraw(new anchor.BN(amount)).accounts({
|
|
11913
|
-
|
|
12720
|
+
glamState,
|
|
12721
|
+
glamSigner,
|
|
11914
12722
|
asset,
|
|
11915
12723
|
tokenProgram
|
|
11916
12724
|
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
@@ -11925,8 +12733,13 @@ class MintClient {
|
|
|
11925
12733
|
async getHolders(state, mintId = 0) {
|
|
11926
12734
|
const mintPda = this.base.getMintPda(state, mintId);
|
|
11927
12735
|
const connection = this.base.provider.connection;
|
|
11928
|
-
|
|
11929
|
-
|
|
12736
|
+
let mint;
|
|
12737
|
+
try {
|
|
12738
|
+
mint = await splToken.getMint(connection, mintPda, connection.commitment, splToken.TOKEN_2022_PROGRAM_ID);
|
|
12739
|
+
} catch (e) {
|
|
12740
|
+
return [];
|
|
12741
|
+
}
|
|
12742
|
+
// Size of a glam mint with perment delegate extension enabled
|
|
11930
12743
|
const dataSize = 175;
|
|
11931
12744
|
const accounts = await connection.getProgramAccounts(splToken.TOKEN_2022_PROGRAM_ID, {
|
|
11932
12745
|
filters: [
|
|
@@ -11956,35 +12769,38 @@ class MintClient {
|
|
|
11956
12769
|
};
|
|
11957
12770
|
});
|
|
11958
12771
|
}
|
|
11959
|
-
async closeMintIx(
|
|
11960
|
-
this.base.
|
|
11961
|
-
const mintPda = this.base.getMintPda(state, mintId);
|
|
12772
|
+
async closeMintIx(glamState, mintId = 0) {
|
|
12773
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
11962
12774
|
return await this.base.program.methods.closeMint(mintId).accounts({
|
|
11963
|
-
glamState
|
|
11964
|
-
glamMint
|
|
12775
|
+
glamState,
|
|
12776
|
+
glamMint
|
|
11965
12777
|
}).instruction();
|
|
11966
12778
|
}
|
|
11967
|
-
async closeMint(
|
|
11968
|
-
this.base.
|
|
11969
|
-
const
|
|
11970
|
-
|
|
11971
|
-
glamState
|
|
11972
|
-
|
|
11973
|
-
|
|
12779
|
+
async closeMint(glamState, mintId = 0, txOptions = {}) {
|
|
12780
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12781
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12782
|
+
const tx = await this.base.program.methods.closeMint(mintId).accounts({
|
|
12783
|
+
glamState,
|
|
12784
|
+
glamSigner,
|
|
12785
|
+
glamMint
|
|
12786
|
+
}).transaction();
|
|
12787
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12788
|
+
return await this.base.sendAndConfirm(vTx);
|
|
11974
12789
|
}
|
|
11975
12790
|
/**
|
|
11976
12791
|
* Create a share class token account for a specific user
|
|
11977
12792
|
*
|
|
11978
|
-
* @param
|
|
12793
|
+
* @param glamState
|
|
11979
12794
|
* @param owner
|
|
11980
12795
|
* @param mintId
|
|
11981
12796
|
* @param txOptions
|
|
11982
12797
|
* @returns
|
|
11983
|
-
*/ async createTokenAccount(
|
|
11984
|
-
const
|
|
11985
|
-
const
|
|
11986
|
-
const
|
|
11987
|
-
|
|
12798
|
+
*/ async createTokenAccount(glamState, owner, mintId = 0, setFrozen = true, txOptions = {}) {
|
|
12799
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12800
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12801
|
+
const ata = this.base.getMintAta(owner, glamMint);
|
|
12802
|
+
const ixCreateAta = splToken.createAssociatedTokenAccountIdempotentInstruction(glamSigner, ata, owner, glamMint, splToken.TOKEN_2022_PROGRAM_ID);
|
|
12803
|
+
return await this.setTokenAccountsStates(glamState, mintId, [
|
|
11988
12804
|
ata
|
|
11989
12805
|
], setFrozen, {
|
|
11990
12806
|
preInstructions: [
|
|
@@ -11996,41 +12812,47 @@ class MintClient {
|
|
|
11996
12812
|
/**
|
|
11997
12813
|
* Freeze or thaw token accounts of a share class
|
|
11998
12814
|
*
|
|
11999
|
-
* @param
|
|
12815
|
+
* @param glamState
|
|
12000
12816
|
* @param mintId
|
|
12001
12817
|
* @param frozen
|
|
12002
12818
|
* @param txOptions
|
|
12003
12819
|
* @returns
|
|
12004
|
-
*/ async setTokenAccountsStates(
|
|
12005
|
-
const
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12820
|
+
*/ async setTokenAccountsStates(glamState, mintId, tokenAccounts, frozen, txOptions = {}) {
|
|
12821
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12822
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12823
|
+
const tx = await this.base.program.methods.setTokenAccountsStates(mintId, frozen).accounts({
|
|
12824
|
+
glamState,
|
|
12825
|
+
glamSigner,
|
|
12826
|
+
glamMint
|
|
12009
12827
|
}).remainingAccounts(tokenAccounts.map((account)=>({
|
|
12010
12828
|
pubkey: account,
|
|
12011
12829
|
isSigner: false,
|
|
12012
12830
|
isWritable: true
|
|
12013
|
-
}))).preInstructions(txOptions.preInstructions || []).
|
|
12831
|
+
}))).preInstructions(txOptions.preInstructions || []).transaction();
|
|
12832
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12833
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12014
12834
|
}
|
|
12015
12835
|
/**
|
|
12016
12836
|
* Mint share to recipient
|
|
12017
12837
|
*
|
|
12018
|
-
* @param
|
|
12838
|
+
* @param glamState
|
|
12019
12839
|
* @param mintId
|
|
12020
12840
|
* @param recipient Recipient's wallet address
|
|
12021
12841
|
* @param amount Amount of shares to mint
|
|
12022
12842
|
* @param forceThaw If true, force unfreezing token account before minting
|
|
12023
12843
|
* @param txOptions
|
|
12024
12844
|
* @returns Transaction signature
|
|
12025
|
-
*/ async mint(
|
|
12026
|
-
const
|
|
12027
|
-
const
|
|
12845
|
+
*/ async mint(glamState, mintId, recipient, amount, forceThaw = false, txOptions = {}) {
|
|
12846
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12847
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12848
|
+
const mintTo = this.base.getMintAta(recipient, glamMint);
|
|
12028
12849
|
const preInstructions = [];
|
|
12029
|
-
preInstructions.push(splToken.createAssociatedTokenAccountIdempotentInstruction(
|
|
12850
|
+
preInstructions.push(splToken.createAssociatedTokenAccountIdempotentInstruction(glamSigner, mintTo, recipient, glamMint, splToken.TOKEN_2022_PROGRAM_ID));
|
|
12030
12851
|
if (forceThaw) {
|
|
12031
12852
|
preInstructions.push(await this.base.program.methods.setTokenAccountsStates(mintId, false).accounts({
|
|
12032
|
-
glamState
|
|
12033
|
-
|
|
12853
|
+
glamState,
|
|
12854
|
+
glamSigner,
|
|
12855
|
+
glamMint
|
|
12034
12856
|
}).remainingAccounts([
|
|
12035
12857
|
{
|
|
12036
12858
|
pubkey: mintTo,
|
|
@@ -12039,20 +12861,25 @@ class MintClient {
|
|
|
12039
12861
|
}
|
|
12040
12862
|
]).instruction());
|
|
12041
12863
|
}
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
glamMint
|
|
12046
|
-
|
|
12864
|
+
const tx = await this.base.program.methods.mintTokens(0, amount).accounts({
|
|
12865
|
+
glamState,
|
|
12866
|
+
glamSigner,
|
|
12867
|
+
glamMint,
|
|
12868
|
+
recipient
|
|
12869
|
+
}).preInstructions(preInstructions).transaction();
|
|
12870
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12871
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12047
12872
|
}
|
|
12048
|
-
async burn(
|
|
12049
|
-
const
|
|
12050
|
-
const
|
|
12873
|
+
async burn(glamState, mintId, amount, from, forceThaw = false, txOptions = {}) {
|
|
12874
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12875
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12876
|
+
const ata = this.base.getMintAta(from, glamMint);
|
|
12051
12877
|
const preInstructions = [];
|
|
12052
12878
|
if (forceThaw) {
|
|
12053
12879
|
preInstructions.push(await this.base.program.methods.setTokenAccountsStates(mintId, false).accounts({
|
|
12054
|
-
glamState
|
|
12055
|
-
|
|
12880
|
+
glamState,
|
|
12881
|
+
glamSigner,
|
|
12882
|
+
glamMint
|
|
12056
12883
|
}).remainingAccounts([
|
|
12057
12884
|
{
|
|
12058
12885
|
pubkey: ata,
|
|
@@ -12061,22 +12888,27 @@ class MintClient {
|
|
|
12061
12888
|
}
|
|
12062
12889
|
]).instruction());
|
|
12063
12890
|
}
|
|
12064
|
-
|
|
12065
|
-
glamState
|
|
12066
|
-
|
|
12891
|
+
const tx = await this.base.program.methods.burnTokens(mintId, amount).accounts({
|
|
12892
|
+
glamState,
|
|
12893
|
+
glamSigner,
|
|
12894
|
+
glamMint,
|
|
12067
12895
|
from
|
|
12068
|
-
}).preInstructions(preInstructions).
|
|
12896
|
+
}).preInstructions(preInstructions).transaction();
|
|
12897
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12898
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12069
12899
|
}
|
|
12070
|
-
async forceTransfer(
|
|
12071
|
-
const
|
|
12072
|
-
const
|
|
12073
|
-
const
|
|
12900
|
+
async forceTransfer(glamState, mintId, amount, from, to, forceThaw = false, txOptions = {}) {
|
|
12901
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
12902
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
12903
|
+
const fromAta = this.base.getMintAta(from, glamMint);
|
|
12904
|
+
const toAta = this.base.getMintAta(to, glamMint);
|
|
12074
12905
|
const preInstructions = [];
|
|
12075
|
-
preInstructions.push(splToken.createAssociatedTokenAccountIdempotentInstruction(this.base.getSigner(), toAta, to,
|
|
12906
|
+
preInstructions.push(splToken.createAssociatedTokenAccountIdempotentInstruction(this.base.getSigner(), toAta, to, glamMint, splToken.TOKEN_2022_PROGRAM_ID));
|
|
12076
12907
|
if (forceThaw) {
|
|
12077
12908
|
preInstructions.push(await this.base.program.methods.setTokenAccountsStates(mintId, false).accounts({
|
|
12078
|
-
glamState
|
|
12079
|
-
|
|
12909
|
+
glamState,
|
|
12910
|
+
glamSigner,
|
|
12911
|
+
glamMint
|
|
12080
12912
|
}).remainingAccounts([
|
|
12081
12913
|
// fromAta is already unfrozen, still add it to test the ix is idempotent
|
|
12082
12914
|
{
|
|
@@ -12091,12 +12923,15 @@ class MintClient {
|
|
|
12091
12923
|
}
|
|
12092
12924
|
]).instruction());
|
|
12093
12925
|
}
|
|
12094
|
-
|
|
12095
|
-
glamState
|
|
12096
|
-
|
|
12926
|
+
const tx = await this.base.program.methods.forceTransferTokens(mintId, amount).accounts({
|
|
12927
|
+
glamState,
|
|
12928
|
+
glamSigner,
|
|
12929
|
+
glamMint,
|
|
12097
12930
|
from,
|
|
12098
12931
|
to
|
|
12099
|
-
}).preInstructions(preInstructions).
|
|
12932
|
+
}).preInstructions(preInstructions).transaction();
|
|
12933
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
12934
|
+
return await this.base.sendAndConfirm(vTx);
|
|
12100
12935
|
}
|
|
12101
12936
|
constructor(base){
|
|
12102
12937
|
this.base = base;
|
|
@@ -12465,6 +13300,185 @@ class KaminoLendingClient {
|
|
|
12465
13300
|
}
|
|
12466
13301
|
}
|
|
12467
13302
|
|
|
13303
|
+
const METEORA_DLMM = new web3_js.PublicKey("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo");
|
|
13304
|
+
new web3_js.PublicKey("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6");
|
|
13305
|
+
const EVENT_AUTHORITY = new web3_js.PublicKey("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6");
|
|
13306
|
+
const DEFAULT_RANGE_INTERVAL = 34; // 34 bins on each side of the active bin, 69 bins in total
|
|
13307
|
+
class MeteoraDlmmClient {
|
|
13308
|
+
async getDlmmPool(pool) {
|
|
13309
|
+
const key = typeof pool === "string" ? pool : pool.toString();
|
|
13310
|
+
if (!this._dlmmPool.get(key)) {
|
|
13311
|
+
this._dlmmPool.set(key, await DLMM.create(this.base.provider.connection, new web3_js.PublicKey(pool)));
|
|
13312
|
+
}
|
|
13313
|
+
const dlmmPool = this._dlmmPool.get(key);
|
|
13314
|
+
if (!dlmmPool) {
|
|
13315
|
+
throw new Error(`DLMM pool ${key} not found`);
|
|
13316
|
+
}
|
|
13317
|
+
return dlmmPool;
|
|
13318
|
+
}
|
|
13319
|
+
async initializePosition(statePda, pool, txOptions = {}) {
|
|
13320
|
+
const glamState = new web3_js.PublicKey(statePda);
|
|
13321
|
+
const dlmmPool = await this.getDlmmPool(pool);
|
|
13322
|
+
const activeBin = await dlmmPool.getActiveBin();
|
|
13323
|
+
const minBinId = activeBin.binId - DEFAULT_RANGE_INTERVAL;
|
|
13324
|
+
const maxBinId = activeBin.binId + DEFAULT_RANGE_INTERVAL;
|
|
13325
|
+
const position = web3_js.Keypair.generate();
|
|
13326
|
+
const tx = await this.base.program.methods.meteoraDlmmInitializePosition(minBinId, maxBinId - minBinId + 1).accounts({
|
|
13327
|
+
glamState,
|
|
13328
|
+
lbPair: new web3_js.PublicKey(pool),
|
|
13329
|
+
position: position.publicKey,
|
|
13330
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13331
|
+
program: METEORA_DLMM
|
|
13332
|
+
}).transaction();
|
|
13333
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13334
|
+
return await this.base.sendAndConfirm(vTx, [
|
|
13335
|
+
position
|
|
13336
|
+
]);
|
|
13337
|
+
}
|
|
13338
|
+
async addLiquidity(statePda, position, amountX, strategyType, txOptions = {}) {
|
|
13339
|
+
const { lbPair, lowerBinId, upperBinId, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js.PublicKey(position));
|
|
13340
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
13341
|
+
const { amountY, activeBinId } = await this.getAmounts(dlmmPool, new anchor.BN(amountX));
|
|
13342
|
+
const glamState = new web3_js.PublicKey(statePda);
|
|
13343
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
13344
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
13345
|
+
const strategy = {
|
|
13346
|
+
amountX: new anchor.BN(amountX),
|
|
13347
|
+
amountY,
|
|
13348
|
+
activeId: activeBinId,
|
|
13349
|
+
maxActiveBinSlippage: 20,
|
|
13350
|
+
strategyParameters: {
|
|
13351
|
+
minBinId: lowerBinId,
|
|
13352
|
+
maxBinId: upperBinId,
|
|
13353
|
+
strategyType: DLMM.Strategy[strategyType],
|
|
13354
|
+
parameteres: Array(64).fill(0)
|
|
13355
|
+
}
|
|
13356
|
+
};
|
|
13357
|
+
const tx = await this.base.program.methods.meteoraDlmmAddLiquidityByStrategy(strategy).accounts({
|
|
13358
|
+
glamState,
|
|
13359
|
+
position: new web3_js.PublicKey(position),
|
|
13360
|
+
lbPair,
|
|
13361
|
+
binArrayBitmapExtension: dlmmPool.binArrayBitmapExtension ? dlmmPool.binArrayBitmapExtension.publicKey : METEORA_DLMM,
|
|
13362
|
+
userTokenX: vaultTokenXAta,
|
|
13363
|
+
userTokenY: vaultTokenYAta,
|
|
13364
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
13365
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
13366
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
13367
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
13368
|
+
binArrayLower,
|
|
13369
|
+
binArrayUpper,
|
|
13370
|
+
tokenXProgram: splToken.TOKEN_PROGRAM_ID,
|
|
13371
|
+
tokenYProgram: splToken.TOKEN_PROGRAM_ID,
|
|
13372
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13373
|
+
program: METEORA_DLMM
|
|
13374
|
+
}).transaction();
|
|
13375
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13376
|
+
return this.base.sendAndConfirm(vTx);
|
|
13377
|
+
}
|
|
13378
|
+
async removeLiquidity(statePda, position, bpsToRemove, txOptions = {}) {
|
|
13379
|
+
const { lbPair, lowerBinId, upperBinId, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js.PublicKey(position));
|
|
13380
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
13381
|
+
const glamState = new web3_js.PublicKey(statePda);
|
|
13382
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
13383
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
13384
|
+
const tx = await this.base.program.methods.meteoraDlmmRemoveLiquidityByRange(lowerBinId, upperBinId, bpsToRemove).accounts({
|
|
13385
|
+
glamState,
|
|
13386
|
+
position: new web3_js.PublicKey(position),
|
|
13387
|
+
lbPair,
|
|
13388
|
+
binArrayBitmapExtension: dlmmPool.binArrayBitmapExtension ? dlmmPool.binArrayBitmapExtension.publicKey : METEORA_DLMM,
|
|
13389
|
+
userTokenX: vaultTokenXAta,
|
|
13390
|
+
userTokenY: vaultTokenYAta,
|
|
13391
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
13392
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
13393
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
13394
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
13395
|
+
binArrayLower,
|
|
13396
|
+
binArrayUpper,
|
|
13397
|
+
tokenXProgram: splToken.TOKEN_PROGRAM_ID,
|
|
13398
|
+
tokenYProgram: splToken.TOKEN_PROGRAM_ID,
|
|
13399
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13400
|
+
program: METEORA_DLMM
|
|
13401
|
+
}).transaction();
|
|
13402
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13403
|
+
return this.base.sendAndConfirm(vTx);
|
|
13404
|
+
}
|
|
13405
|
+
async claimFee(statePda, position, txOptions = {}) {
|
|
13406
|
+
const { lbPair, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js.PublicKey(position));
|
|
13407
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
13408
|
+
const glamState = new web3_js.PublicKey(statePda);
|
|
13409
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
13410
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
13411
|
+
const tx = await this.base.program.methods.meteoraDlmmClaimFee().accounts({
|
|
13412
|
+
glamState,
|
|
13413
|
+
position: new web3_js.PublicKey(position),
|
|
13414
|
+
lbPair,
|
|
13415
|
+
binArrayLower,
|
|
13416
|
+
binArrayUpper,
|
|
13417
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
13418
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
13419
|
+
userTokenX: vaultTokenXAta,
|
|
13420
|
+
userTokenY: vaultTokenYAta,
|
|
13421
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
13422
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
13423
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
13424
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13425
|
+
program: METEORA_DLMM
|
|
13426
|
+
}).transaction();
|
|
13427
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13428
|
+
return await this.base.sendAndConfirm(vTx);
|
|
13429
|
+
}
|
|
13430
|
+
async closePosition(statePda, position, txOptions = {}) {
|
|
13431
|
+
const { lbPair, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js.PublicKey(position));
|
|
13432
|
+
const glamState = new web3_js.PublicKey(statePda);
|
|
13433
|
+
const tx = await this.base.program.methods.meteoraDlmmClosePosition().accounts({
|
|
13434
|
+
glamState,
|
|
13435
|
+
position: new web3_js.PublicKey(position),
|
|
13436
|
+
lbPair,
|
|
13437
|
+
binArrayLower,
|
|
13438
|
+
binArrayUpper,
|
|
13439
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
13440
|
+
program: METEORA_DLMM
|
|
13441
|
+
}).transaction();
|
|
13442
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
13443
|
+
return await this.base.sendAndConfirm(vTx);
|
|
13444
|
+
}
|
|
13445
|
+
async parsePosition(position) {
|
|
13446
|
+
const positionAccountInfo = await this.base.provider.connection.getAccountInfo(position);
|
|
13447
|
+
if (!positionAccountInfo) {
|
|
13448
|
+
throw new Error("Position not found");
|
|
13449
|
+
}
|
|
13450
|
+
const positionData = positionAccountInfo.data;
|
|
13451
|
+
const lbPair = new web3_js.PublicKey(positionData.subarray(8, 40));
|
|
13452
|
+
const lowerBinId = positionData.subarray(7912, 7916).readInt32LE();
|
|
13453
|
+
const upperBinId = positionData.subarray(7916, 7920).readInt32LE();
|
|
13454
|
+
const lowerBinArrayIndex = DLMM.binIdToBinArrayIndex(new anchor.BN(lowerBinId));
|
|
13455
|
+
const [binArrayLower] = DLMM.deriveBinArray(lbPair, lowerBinArrayIndex, METEORA_DLMM);
|
|
13456
|
+
const upperBinArrayIndex = anchor.BN.max(lowerBinArrayIndex.add(new anchor.BN(1)), DLMM.binIdToBinArrayIndex(new anchor.BN(upperBinId)));
|
|
13457
|
+
const [binArrayUpper] = DLMM.deriveBinArray(lbPair, upperBinArrayIndex, METEORA_DLMM);
|
|
13458
|
+
return {
|
|
13459
|
+
lowerBinId,
|
|
13460
|
+
upperBinId,
|
|
13461
|
+
binArrayLower,
|
|
13462
|
+
binArrayUpper,
|
|
13463
|
+
lbPair
|
|
13464
|
+
};
|
|
13465
|
+
}
|
|
13466
|
+
async getAmounts(dlmmPool, amountX) {
|
|
13467
|
+
const activeBin = await dlmmPool.getActiveBin();
|
|
13468
|
+
const activeBinPricePerToken = dlmmPool.fromPricePerLamport(Number(activeBin.price));
|
|
13469
|
+
const amountY = amountX.mul(new anchor.BN(Number(activeBinPricePerToken)));
|
|
13470
|
+
return {
|
|
13471
|
+
amountX,
|
|
13472
|
+
amountY,
|
|
13473
|
+
activeBinId: activeBin.binId
|
|
13474
|
+
};
|
|
13475
|
+
}
|
|
13476
|
+
constructor(base){
|
|
13477
|
+
this.base = base;
|
|
13478
|
+
this._dlmmPool = new Map();
|
|
13479
|
+
}
|
|
13480
|
+
}
|
|
13481
|
+
|
|
12468
13482
|
/**
|
|
12469
13483
|
* Main entrypoint for the GLAM SDK
|
|
12470
13484
|
*
|
|
@@ -12530,6 +13544,12 @@ class KaminoLendingClient {
|
|
|
12530
13544
|
}
|
|
12531
13545
|
return this._kaminoLending;
|
|
12532
13546
|
}
|
|
13547
|
+
get meteoraDlmm() {
|
|
13548
|
+
if (!this._meteoraDlmm) {
|
|
13549
|
+
this._meteoraDlmm = new MeteoraDlmmClient(this);
|
|
13550
|
+
}
|
|
13551
|
+
return this._meteoraDlmm;
|
|
13552
|
+
}
|
|
12533
13553
|
constructor(config){
|
|
12534
13554
|
super(config);
|
|
12535
13555
|
}
|
|
@@ -12571,6 +13591,7 @@ const getPriorityFeeEstimate = async (heliusApiKey, tx, accountKeys, priorityLev
|
|
|
12571
13591
|
return data.result.priorityFeeEstimate;
|
|
12572
13592
|
};
|
|
12573
13593
|
|
|
13594
|
+
exports.BaseClient = BaseClient;
|
|
12574
13595
|
exports.CompanyModel = CompanyModel;
|
|
12575
13596
|
exports.CreatedModel = CreatedModel;
|
|
12576
13597
|
exports.DRIFT_PROGRAM_ID = DRIFT_PROGRAM_ID;
|
|
@@ -12586,6 +13607,7 @@ exports.GlamIntegrations = GlamIntegrations;
|
|
|
12586
13607
|
exports.GlamPermissions = GlamPermissions;
|
|
12587
13608
|
exports.JITOSOL = JITOSOL;
|
|
12588
13609
|
exports.JITO_STAKE_POOL = JITO_STAKE_POOL;
|
|
13610
|
+
exports.JITO_TIP_DEFAULT = JITO_TIP_DEFAULT;
|
|
12589
13611
|
exports.JUP = JUP;
|
|
12590
13612
|
exports.JUPITER_API_DEFAULT = JUPITER_API_DEFAULT;
|
|
12591
13613
|
exports.JUPITER_PROGRAM_ID = JUPITER_PROGRAM_ID;
|
|
@@ -12597,9 +13619,9 @@ exports.MARINADE_PROGRAM_ID = MARINADE_PROGRAM_ID;
|
|
|
12597
13619
|
exports.MSOL = MSOL;
|
|
12598
13620
|
exports.ManagerModel = ManagerModel;
|
|
12599
13621
|
exports.Metadata = Metadata;
|
|
12600
|
-
exports.MintClassOpenfundsModel = MintClassOpenfundsModel;
|
|
12601
13622
|
exports.MintIdlModel = MintIdlModel;
|
|
12602
13623
|
exports.MintModel = MintModel;
|
|
13624
|
+
exports.MintOpenfundsModel = MintOpenfundsModel;
|
|
12603
13625
|
exports.SANCTUM_STAKE_POOL_PROGRAM_ID = SANCTUM_STAKE_POOL_PROGRAM_ID;
|
|
12604
13626
|
exports.SEED_METADATA = SEED_METADATA;
|
|
12605
13627
|
exports.SEED_MINT = SEED_MINT;
|
|
@@ -12615,3 +13637,4 @@ exports.getGlamProgram = getGlamProgram;
|
|
|
12615
13637
|
exports.getGlamProgramId = getGlamProgramId;
|
|
12616
13638
|
exports.getPriorityFeeEstimate = getPriorityFeeEstimate;
|
|
12617
13639
|
exports.getSimulationComputeUnits = getSimulationComputeUnits;
|
|
13640
|
+
exports.isBrowser = isBrowser;
|