@glamsystems/glam-sdk 1.0.13 → 1.0.14-alpha.1
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/README.md +1 -1
- package/index.cjs.js +14513 -21874
- package/index.esm.js +14492 -21817
- package/package.json +2 -2
- package/src/assets.d.ts +6 -15
- package/src/client/base.d.ts +24 -5
- package/src/client/bridge.d.ts +184 -0
- package/src/client/bridgeRegistry.d.ts +32 -0
- package/src/client/epi.d.ts +78 -0
- package/src/client/fees.d.ts +1 -0
- package/src/client/jupiter.d.ts +22 -18
- package/src/client/price.d.ts +13 -37
- package/src/client.d.ts +6 -5
- package/src/constants.d.ts +5 -7
- package/src/deser/index.d.ts +0 -1
- package/src/deser/integrationPolicies.d.ts +23 -20
- package/src/error.d.ts +2 -1
- package/src/glamExports.d.ts +2423 -1787
- package/src/globalConfig.d.ts +22 -0
- package/src/index.d.ts +3 -1
- package/src/react/glam.d.ts +0 -4
- package/src/react/query-keys.d.ts +1 -3
- package/src/utils/accounts.d.ts +4 -1
- package/src/utils/common.d.ts +2 -0
- package/src/utils/index.d.ts +0 -1
- package/src/utils/positionCategorizer.d.ts +3 -21
- package/target/idl/ext_cctp.json +1 -1
- package/target/idl/ext_kamino-staging.json +1 -1
- package/target/idl/ext_kamino.json +109 -1
- package/target/idl/ext_spl-staging.json +1 -1
- package/target/idl/ext_spl.json +1 -1
- package/target/idl/glam_config.json +75 -9
- package/target/idl/glam_mint.json +205 -11
- package/target/idl/glam_policies.json +2 -7
- package/target/idl/glam_protocol-staging.json +118 -522
- package/target/idl/glam_protocol.json +204 -121
- package/target/types/ext_bridge.d.ts +2398 -0
- package/target/types/ext_cctp.d.ts +1 -1
- package/target/types/ext_cctp.ts +1 -1
- package/target/types/ext_epi.d.ts +2175 -0
- package/target/types/ext_kamino-staging.ts +1 -1
- package/target/types/ext_kamino.d.ts +109 -1
- package/target/types/ext_kamino.ts +109 -1
- package/target/types/ext_spl-staging.ts +1 -1
- package/target/types/ext_spl.d.ts +1 -1
- package/target/types/ext_spl.ts +1 -1
- package/target/types/glam_config.d.ts +75 -9
- package/target/types/glam_config.ts +75 -9
- package/target/types/glam_mint.d.ts +205 -11
- package/target/types/glam_mint.ts +205 -11
- package/target/types/glam_policies.ts +2 -7
- package/target/types/glam_protocol-staging.ts +118 -522
- package/target/types/glam_protocol.d.ts +204 -121
- package/target/types/glam_protocol.ts +204 -121
- package/src/client/drift/index.d.ts +0 -2
- package/src/client/drift/protocol-v2.d.ts +0 -130
- package/src/client/drift/vaults.d.ts +0 -60
- package/src/deser/driftLayouts.d.ts +0 -217
- package/src/utils/drift/index.d.ts +0 -2
- package/src/utils/drift/orderParams.d.ts +0 -28
- package/src/utils/drift/types.d.ts +0 -522
- package/target/idl/ext_drift-staging.json +0 -5442
- package/target/idl/ext_drift.json +0 -4962
- package/target/types/ext_drift-staging.ts +0 -5448
- package/target/types/ext_drift.d.ts +0 -4968
- package/target/types/ext_drift.ts +0 -4968
- package/target/types/ext_offchain.d.ts +0 -1074
|
@@ -8,7 +8,7 @@ export type GlamProtocol = {
|
|
|
8
8
|
"address": "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz",
|
|
9
9
|
"metadata": {
|
|
10
10
|
"name": "glamProtocol",
|
|
11
|
-
"version": "1.0.
|
|
11
|
+
"version": "1.0.4",
|
|
12
12
|
"spec": "0.1.0",
|
|
13
13
|
"description": "Glam Protocol"
|
|
14
14
|
},
|
|
@@ -450,6 +450,149 @@ export type GlamProtocol = {
|
|
|
450
450
|
}
|
|
451
451
|
]
|
|
452
452
|
},
|
|
453
|
+
{
|
|
454
|
+
"name": "jupiterSwapV2",
|
|
455
|
+
"discriminator": [
|
|
456
|
+
28,
|
|
457
|
+
155,
|
|
458
|
+
14,
|
|
459
|
+
63,
|
|
460
|
+
87,
|
|
461
|
+
96,
|
|
462
|
+
62,
|
|
463
|
+
221
|
|
464
|
+
],
|
|
465
|
+
"accounts": [
|
|
466
|
+
{
|
|
467
|
+
"name": "glamState",
|
|
468
|
+
"writable": true
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"name": "glamVault",
|
|
472
|
+
"writable": true,
|
|
473
|
+
"pda": {
|
|
474
|
+
"seeds": [
|
|
475
|
+
{
|
|
476
|
+
"kind": "const",
|
|
477
|
+
"value": [
|
|
478
|
+
118,
|
|
479
|
+
97,
|
|
480
|
+
117,
|
|
481
|
+
108,
|
|
482
|
+
116
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"kind": "account",
|
|
487
|
+
"path": "glamState"
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"name": "glamSigner",
|
|
494
|
+
"writable": true,
|
|
495
|
+
"signer": true
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"name": "cpiProgram",
|
|
499
|
+
"address": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"name": "inputStakePool",
|
|
503
|
+
"optional": true
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"name": "outputStakePool",
|
|
507
|
+
"optional": true
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"name": "glamConfig",
|
|
511
|
+
"optional": true,
|
|
512
|
+
"pda": {
|
|
513
|
+
"seeds": [
|
|
514
|
+
{
|
|
515
|
+
"kind": "const",
|
|
516
|
+
"value": [
|
|
517
|
+
103,
|
|
518
|
+
108,
|
|
519
|
+
111,
|
|
520
|
+
98,
|
|
521
|
+
97,
|
|
522
|
+
108,
|
|
523
|
+
45,
|
|
524
|
+
99,
|
|
525
|
+
111,
|
|
526
|
+
110,
|
|
527
|
+
102,
|
|
528
|
+
105,
|
|
529
|
+
103
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
],
|
|
533
|
+
"program": {
|
|
534
|
+
"kind": "const",
|
|
535
|
+
"value": [
|
|
536
|
+
10,
|
|
537
|
+
11,
|
|
538
|
+
0,
|
|
539
|
+
83,
|
|
540
|
+
72,
|
|
541
|
+
16,
|
|
542
|
+
46,
|
|
543
|
+
144,
|
|
544
|
+
46,
|
|
545
|
+
42,
|
|
546
|
+
79,
|
|
547
|
+
22,
|
|
548
|
+
157,
|
|
549
|
+
123,
|
|
550
|
+
21,
|
|
551
|
+
242,
|
|
552
|
+
192,
|
|
553
|
+
146,
|
|
554
|
+
1,
|
|
555
|
+
78,
|
|
556
|
+
88,
|
|
557
|
+
59,
|
|
558
|
+
102,
|
|
559
|
+
9,
|
|
560
|
+
190,
|
|
561
|
+
226,
|
|
562
|
+
92,
|
|
563
|
+
189,
|
|
564
|
+
187,
|
|
565
|
+
232,
|
|
566
|
+
83,
|
|
567
|
+
220
|
|
568
|
+
]
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"name": "solUsdOracle",
|
|
574
|
+
"optional": true
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"name": "inputTokenOracle",
|
|
578
|
+
"optional": true
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"name": "outputTokenOracle",
|
|
582
|
+
"optional": true
|
|
583
|
+
}
|
|
584
|
+
],
|
|
585
|
+
"args": [
|
|
586
|
+
{
|
|
587
|
+
"name": "skipQuotePriceCheck",
|
|
588
|
+
"type": "bool"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"name": "data",
|
|
592
|
+
"type": "bytes"
|
|
593
|
+
}
|
|
594
|
+
]
|
|
595
|
+
},
|
|
453
596
|
{
|
|
454
597
|
"name": "linkUnlinkMintByMintAuthority",
|
|
455
598
|
"docs": [
|
|
@@ -1002,8 +1145,8 @@ export type GlamProtocol = {
|
|
|
1002
1145
|
},
|
|
1003
1146
|
{
|
|
1004
1147
|
"code": 48010,
|
|
1005
|
-
"name": "
|
|
1006
|
-
"msg": "Account
|
|
1148
|
+
"name": "unexpectedProgramOwner",
|
|
1149
|
+
"msg": "Account is owned by an unexpected program"
|
|
1007
1150
|
},
|
|
1008
1151
|
{
|
|
1009
1152
|
"code": 48011,
|
|
@@ -1032,8 +1175,8 @@ export type GlamProtocol = {
|
|
|
1032
1175
|
},
|
|
1033
1176
|
{
|
|
1034
1177
|
"code": 49004,
|
|
1035
|
-
"name": "
|
|
1036
|
-
"msg": "
|
|
1178
|
+
"name": "invalidAssetsLen",
|
|
1179
|
+
"msg": "Too many assets: max 100"
|
|
1037
1180
|
},
|
|
1038
1181
|
{
|
|
1039
1182
|
"code": 49005,
|
|
@@ -1092,24 +1235,29 @@ export type GlamProtocol = {
|
|
|
1092
1235
|
},
|
|
1093
1236
|
{
|
|
1094
1237
|
"code": 49016,
|
|
1095
|
-
"name": "
|
|
1096
|
-
"msg": "
|
|
1238
|
+
"name": "staleDriftInterest",
|
|
1239
|
+
"msg": "Drift spot market cumulative interest is stale"
|
|
1097
1240
|
},
|
|
1098
1241
|
{
|
|
1099
1242
|
"code": 49017,
|
|
1100
|
-
"name": "delegateAclLimitExceeded",
|
|
1101
|
-
"msg": "Delegate ACL limit exceeded"
|
|
1102
|
-
},
|
|
1103
|
-
{
|
|
1104
|
-
"code": 49018,
|
|
1105
1243
|
"name": "assetBalanceNotZero",
|
|
1106
1244
|
"msg": "Cannot delete asset: vault token account balance is not zero"
|
|
1107
1245
|
},
|
|
1108
1246
|
{
|
|
1109
|
-
"code":
|
|
1247
|
+
"code": 49018,
|
|
1110
1248
|
"name": "cannotDeleteBaseAsset",
|
|
1111
1249
|
"msg": "Cannot delete base asset from allowlist"
|
|
1112
1250
|
},
|
|
1251
|
+
{
|
|
1252
|
+
"code": 49019,
|
|
1253
|
+
"name": "integrationAclLimitExceeded",
|
|
1254
|
+
"msg": "Integration ACL limit exceeded"
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
"code": 49020,
|
|
1258
|
+
"name": "delegateAclLimitExceeded",
|
|
1259
|
+
"msg": "Delegate ACL limit exceeded"
|
|
1260
|
+
},
|
|
1113
1261
|
{
|
|
1114
1262
|
"code": 50000,
|
|
1115
1263
|
"name": "withdrawDenied",
|
|
@@ -1150,6 +1298,11 @@ export type GlamProtocol = {
|
|
|
1150
1298
|
"name": "multipleStakeAccountsDisallowed",
|
|
1151
1299
|
"msg": "Multiple stake accounts disallowed"
|
|
1152
1300
|
},
|
|
1301
|
+
{
|
|
1302
|
+
"code": 50008,
|
|
1303
|
+
"name": "maxDeviationExceeded",
|
|
1304
|
+
"msg": "Max deviation exceeded"
|
|
1305
|
+
},
|
|
1153
1306
|
{
|
|
1154
1307
|
"code": 51000,
|
|
1155
1308
|
"name": "invalidAssetPrice",
|
|
@@ -1188,7 +1341,7 @@ export type GlamProtocol = {
|
|
|
1188
1341
|
{
|
|
1189
1342
|
"code": 51105,
|
|
1190
1343
|
"name": "priceDivergenceTooLarge",
|
|
1191
|
-
"msg": "
|
|
1344
|
+
"msg": "No priced assets found"
|
|
1192
1345
|
},
|
|
1193
1346
|
{
|
|
1194
1347
|
"code": 51106,
|
|
@@ -1197,18 +1350,18 @@ export type GlamProtocol = {
|
|
|
1197
1350
|
},
|
|
1198
1351
|
{
|
|
1199
1352
|
"code": 51107,
|
|
1200
|
-
"name": "
|
|
1201
|
-
"msg": "
|
|
1353
|
+
"name": "mathError",
|
|
1354
|
+
"msg": "Math error"
|
|
1202
1355
|
},
|
|
1203
1356
|
{
|
|
1204
1357
|
"code": 51108,
|
|
1205
|
-
"name": "
|
|
1206
|
-
"msg": "
|
|
1358
|
+
"name": "typeCastingError",
|
|
1359
|
+
"msg": "Type casting error"
|
|
1207
1360
|
},
|
|
1208
1361
|
{
|
|
1209
1362
|
"code": 51109,
|
|
1210
|
-
"name": "
|
|
1211
|
-
"msg": "
|
|
1363
|
+
"name": "baseAssetNotSupported",
|
|
1364
|
+
"msg": "Base asset must have 6 decimals."
|
|
1212
1365
|
},
|
|
1213
1366
|
{
|
|
1214
1367
|
"code": 51110,
|
|
@@ -1227,8 +1380,8 @@ export type GlamProtocol = {
|
|
|
1227
1380
|
},
|
|
1228
1381
|
{
|
|
1229
1382
|
"code": 51113,
|
|
1230
|
-
"name": "
|
|
1231
|
-
"msg": "
|
|
1383
|
+
"name": "unexpectedDiscriminator",
|
|
1384
|
+
"msg": "Invalid account: discriminator mismatch"
|
|
1232
1385
|
},
|
|
1233
1386
|
{
|
|
1234
1387
|
"code": 51114,
|
|
@@ -1240,6 +1393,11 @@ export type GlamProtocol = {
|
|
|
1240
1393
|
"name": "oraclePriceSuspended",
|
|
1241
1394
|
"msg": "Oracle price is suspended"
|
|
1242
1395
|
},
|
|
1396
|
+
{
|
|
1397
|
+
"code": 51116,
|
|
1398
|
+
"name": "assetNotInPricingSet",
|
|
1399
|
+
"msg": "Asset not in pricing set"
|
|
1400
|
+
},
|
|
1243
1401
|
{
|
|
1244
1402
|
"code": 50100,
|
|
1245
1403
|
"name": "transferRateLimitExceeded",
|
|
@@ -1269,6 +1427,16 @@ export type GlamProtocol = {
|
|
|
1269
1427
|
"code": 52003,
|
|
1270
1428
|
"name": "lockUp",
|
|
1271
1429
|
"msg": "Policy violation: lock-up has not expired"
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
"code": 52004,
|
|
1433
|
+
"name": "policyNotSet",
|
|
1434
|
+
"msg": "Protocol policy not set"
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
"code": 52005,
|
|
1438
|
+
"name": "unsupportedOracleSource",
|
|
1439
|
+
"msg": "Oracle source not supported in this context"
|
|
1272
1440
|
}
|
|
1273
1441
|
],
|
|
1274
1442
|
"types": [
|
|
@@ -1358,30 +1526,6 @@ export type GlamProtocol = {
|
|
|
1358
1526
|
]
|
|
1359
1527
|
}
|
|
1360
1528
|
},
|
|
1361
|
-
{
|
|
1362
|
-
"name": "assetRateLimit",
|
|
1363
|
-
"type": {
|
|
1364
|
-
"kind": "struct",
|
|
1365
|
-
"fields": [
|
|
1366
|
-
{
|
|
1367
|
-
"name": "mint",
|
|
1368
|
-
"type": "pubkey"
|
|
1369
|
-
},
|
|
1370
|
-
{
|
|
1371
|
-
"name": "periodType",
|
|
1372
|
-
"type": {
|
|
1373
|
-
"defined": {
|
|
1374
|
-
"name": "periodType"
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
},
|
|
1378
|
-
{
|
|
1379
|
-
"name": "amount",
|
|
1380
|
-
"type": "u64"
|
|
1381
|
-
}
|
|
1382
|
-
]
|
|
1383
|
-
}
|
|
1384
|
-
},
|
|
1385
1529
|
{
|
|
1386
1530
|
"name": "createdModel",
|
|
1387
1531
|
"type": {
|
|
@@ -1433,28 +1577,6 @@ export type GlamProtocol = {
|
|
|
1433
1577
|
]
|
|
1434
1578
|
}
|
|
1435
1579
|
},
|
|
1436
|
-
{
|
|
1437
|
-
"name": "delegateRateLimit",
|
|
1438
|
-
"type": {
|
|
1439
|
-
"kind": "struct",
|
|
1440
|
-
"fields": [
|
|
1441
|
-
{
|
|
1442
|
-
"name": "delegate",
|
|
1443
|
-
"type": "pubkey"
|
|
1444
|
-
},
|
|
1445
|
-
{
|
|
1446
|
-
"name": "limits",
|
|
1447
|
-
"type": {
|
|
1448
|
-
"vec": {
|
|
1449
|
-
"defined": {
|
|
1450
|
-
"name": "assetRateLimit"
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
]
|
|
1456
|
-
}
|
|
1457
|
-
},
|
|
1458
1580
|
{
|
|
1459
1581
|
"name": "emergencyAccessUpdateArgs",
|
|
1460
1582
|
"type": {
|
|
@@ -1963,6 +2085,10 @@ export type GlamProtocol = {
|
|
|
1963
2085
|
"vec": "pubkey"
|
|
1964
2086
|
}
|
|
1965
2087
|
}
|
|
2088
|
+
},
|
|
2089
|
+
{
|
|
2090
|
+
"name": "maxDeviationBps",
|
|
2091
|
+
"type": "i16"
|
|
1966
2092
|
}
|
|
1967
2093
|
]
|
|
1968
2094
|
}
|
|
@@ -2125,26 +2251,6 @@ export type GlamProtocol = {
|
|
|
2125
2251
|
]
|
|
2126
2252
|
}
|
|
2127
2253
|
},
|
|
2128
|
-
{
|
|
2129
|
-
"name": "periodType",
|
|
2130
|
-
"repr": {
|
|
2131
|
-
"kind": "rust"
|
|
2132
|
-
},
|
|
2133
|
-
"type": {
|
|
2134
|
-
"kind": "enum",
|
|
2135
|
-
"variants": [
|
|
2136
|
-
{
|
|
2137
|
-
"name": "day"
|
|
2138
|
-
},
|
|
2139
|
-
{
|
|
2140
|
-
"name": "week"
|
|
2141
|
-
},
|
|
2142
|
-
{
|
|
2143
|
-
"name": "month"
|
|
2144
|
-
}
|
|
2145
|
-
]
|
|
2146
|
-
}
|
|
2147
|
-
},
|
|
2148
2254
|
{
|
|
2149
2255
|
"name": "pricedProtocol",
|
|
2150
2256
|
"type": {
|
|
@@ -2512,34 +2618,6 @@ export type GlamProtocol = {
|
|
|
2512
2618
|
]
|
|
2513
2619
|
}
|
|
2514
2620
|
},
|
|
2515
|
-
{
|
|
2516
|
-
"name": "transferRateLimitPolicy",
|
|
2517
|
-
"type": {
|
|
2518
|
-
"kind": "struct",
|
|
2519
|
-
"fields": [
|
|
2520
|
-
{
|
|
2521
|
-
"name": "vaultDefaults",
|
|
2522
|
-
"type": {
|
|
2523
|
-
"vec": {
|
|
2524
|
-
"defined": {
|
|
2525
|
-
"name": "assetRateLimit"
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
},
|
|
2530
|
-
{
|
|
2531
|
-
"name": "delegateOverrides",
|
|
2532
|
-
"type": {
|
|
2533
|
-
"vec": {
|
|
2534
|
-
"defined": {
|
|
2535
|
-
"name": "delegateRateLimit"
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
]
|
|
2541
|
-
}
|
|
2542
|
-
},
|
|
2543
2621
|
{
|
|
2544
2622
|
"name": "valuationModel",
|
|
2545
2623
|
"type": {
|
|
@@ -2561,6 +2639,16 @@ export type GlamProtocol = {
|
|
|
2561
2639
|
"type": "u16",
|
|
2562
2640
|
"value": "4"
|
|
2563
2641
|
},
|
|
2642
|
+
{
|
|
2643
|
+
"name": "protoJupiterSwapPermSkipQuotePriceCheck",
|
|
2644
|
+
"type": "u64",
|
|
2645
|
+
"value": "32"
|
|
2646
|
+
},
|
|
2647
|
+
{
|
|
2648
|
+
"name": "protoJupiterSwapPermSkipQuotePriceCheckLimited",
|
|
2649
|
+
"type": "u64",
|
|
2650
|
+
"value": "16"
|
|
2651
|
+
},
|
|
2564
2652
|
{
|
|
2565
2653
|
"name": "protoJupiterSwapPermSwapAllowlisted",
|
|
2566
2654
|
"type": "u64",
|
|
@@ -2615,11 +2703,6 @@ export type GlamProtocol = {
|
|
|
2615
2703
|
"name": "protoSystemPermWsol",
|
|
2616
2704
|
"type": "u64",
|
|
2617
2705
|
"value": "1"
|
|
2618
|
-
},
|
|
2619
|
-
{
|
|
2620
|
-
"name": "protoTransferLimit",
|
|
2621
|
-
"type": "u16",
|
|
2622
|
-
"value": "8"
|
|
2623
2706
|
}
|
|
2624
2707
|
]
|
|
2625
2708
|
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, AccountMeta } from "@solana/web3.js";
|
|
3
|
-
import { MarketType, OrderParams, PositionDirection, ModifyOrderParams } from "../../utils/drift/types";
|
|
4
|
-
import { DriftPerpMarket, DriftSpotMarket, DriftUser } from "../../deser/driftLayouts";
|
|
5
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
|
|
6
|
-
import { BN } from "@coral-xyz/anchor";
|
|
7
|
-
import { VaultClient } from "../vault";
|
|
8
|
-
export declare const DRIFT_SIGNER: anchor.web3.PublicKey;
|
|
9
|
-
export declare const DRIFT_MARGIN_PRECISION = 10000;
|
|
10
|
-
export interface OrderConstants {
|
|
11
|
-
perpBaseScale: number;
|
|
12
|
-
quoteScale: number;
|
|
13
|
-
}
|
|
14
|
-
export declare class DriftMarketConfigs {
|
|
15
|
-
readonly orderConstants: OrderConstants;
|
|
16
|
-
readonly perpMarkets: DriftPerpMarket[];
|
|
17
|
-
readonly spotMarkets: DriftSpotMarket[];
|
|
18
|
-
constructor(orderConstants: OrderConstants, perpMarkets: DriftPerpMarket[], spotMarkets: DriftSpotMarket[]);
|
|
19
|
-
getPerp(marketIndex: number): DriftPerpMarket | undefined;
|
|
20
|
-
getSpot(mintOrIndex: PublicKey | number): DriftSpotMarket | undefined;
|
|
21
|
-
}
|
|
22
|
-
declare class TxBuilder extends BaseTxBuilder<DriftProtocolClient> {
|
|
23
|
-
initializeUserStatsIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
24
|
-
initializeUserIx(glamSigner: PublicKey, subAccountId: number): Promise<TransactionInstruction>;
|
|
25
|
-
updateUserPoolIdIx(subAccountId: number, poolId: number): Promise<TransactionInstruction>;
|
|
26
|
-
initializeIxs(subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
27
|
-
initializeTx(subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
28
|
-
depositIxs(amount: anchor.BN, marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
29
|
-
depositTx(amount: anchor.BN, marketIndex: number, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
30
|
-
withdrawIxs(amount: anchor.BN, marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
31
|
-
withdrawTx(amount: anchor.BN, marketIndex: number, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
32
|
-
updateUserCustomMarginRatioIx(maxLeverage: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
33
|
-
updateUserCustomMarginRatioTx(maxLeverage: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
34
|
-
updateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
35
|
-
updateUserMarginTradingEnabledTx(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
36
|
-
updateUserDelegateIx(delegate: PublicKey | string, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
37
|
-
updateUserDelegateTx(delegate: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
38
|
-
deleteUserIx(subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
39
|
-
deleteUserTx(subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
40
|
-
placeOrderIx(orderParams: OrderParams, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
41
|
-
placeOrderTx(orderParams: OrderParams, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
42
|
-
modifyOrderIx(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
43
|
-
modifyOrderTx(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
44
|
-
cancelOrdersIx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
45
|
-
cancelOrdersTx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
46
|
-
cancelOrdersByIdsIx(orderIds: number[], subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
47
|
-
cancelOrdersByIdsTx(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
48
|
-
cancelOrderIx(orderId: number | null, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
49
|
-
cancelOrderTx(orderId: number | null, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
50
|
-
settlePnlIx(marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
51
|
-
settlePnlTx(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
52
|
-
placePerpOrderIx(orderParams: OrderParams, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
53
|
-
placePerpOrderTx(orderParams: OrderParams, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
54
|
-
placeSpotOrderIx(orderParams: OrderParams, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
55
|
-
placeSpotOrderTx(orderParams: OrderParams, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
56
|
-
placeAndTakePerpOrderIx(orderParams: OrderParams, successCondition: number | null, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
57
|
-
placeAndTakePerpOrderTx(orderParams: OrderParams, successCondition: number | null, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
58
|
-
cancelOrderByUserIdIx(userOrderId: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
59
|
-
cancelOrderByUserIdTx(userOrderId: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
60
|
-
modifyOrderByUserIdIx(userOrderId: number, modifyOrderParams: ModifyOrderParams, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
61
|
-
modifyOrderByUserIdTx(userOrderId: number, modifyOrderParams: ModifyOrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
62
|
-
fillPerpOrderIx(orderId: number | null, makerOrderId: number | null, fillerSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
63
|
-
fillPerpOrderTx(orderId: number | null, makerOrderId: number | null, fillerSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
64
|
-
fillSpotOrderIx(orderId: number | null, fulfillmentType: any | null, makerOrderId: number | null, fillerSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
65
|
-
fillSpotOrderTx(orderId: number | null, fulfillmentType: any | null, makerOrderId: number | null, fillerSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
66
|
-
forceCancelOrdersIx(fillerSubAccountId: number, userKey: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
67
|
-
forceCancelOrdersTx(fillerSubAccountId: number, userKey: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
68
|
-
revertFillIx(fillerSubAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
69
|
-
revertFillTx(fillerSubAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
70
|
-
liquidatePerpIx(marketIndex: number, liquidatorMaxBaseAssetAmount: BN, limitPrice: BN | null, liquidatorSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
71
|
-
liquidatePerpTx(marketIndex: number, liquidatorMaxBaseAssetAmount: BN, limitPrice: BN | null, liquidatorSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
72
|
-
liquidateSpotIx(assetMarketIndex: number, liabilityMarketIndex: number, liquidatorMaxLiabilityTransfer: BN, limitPrice: BN | null, liquidatorSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
73
|
-
liquidateSpotTx(assetMarketIndex: number, liabilityMarketIndex: number, liquidatorMaxLiabilityTransfer: BN, limitPrice: BN | null, liquidatorSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
74
|
-
}
|
|
75
|
-
export declare class DriftProtocolClient {
|
|
76
|
-
readonly base: BaseClient;
|
|
77
|
-
readonly vault: VaultClient;
|
|
78
|
-
private spotMarkets;
|
|
79
|
-
private perpMarkets;
|
|
80
|
-
private marketConfigs;
|
|
81
|
-
txBuilder: TxBuilder;
|
|
82
|
-
constructor(base: BaseClient, vault: VaultClient);
|
|
83
|
-
initialize(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
84
|
-
updateUserCustomMarginRatio(maxLeverage: number, subAccountId?: number): Promise<TransactionSignature>;
|
|
85
|
-
updateUserMarginTradingEnabled(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
86
|
-
updateUserDelegate(delegate: PublicKey | string, subAccountId?: number): Promise<TransactionSignature>;
|
|
87
|
-
deleteUser(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
88
|
-
deposit(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
89
|
-
withdraw(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
90
|
-
placeOrder(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
91
|
-
modifyOrder(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
92
|
-
cancelOrder(orderId: number | null, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
93
|
-
cancelOrders(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
94
|
-
cancelOrdersByIds(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
95
|
-
settlePnl(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
96
|
-
placePerpOrder(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
97
|
-
placeSpotOrder(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
98
|
-
placeAndTakePerpOrder(orderParams: OrderParams, successCondition?: number | null, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
99
|
-
cancelOrderByUserId(userOrderId: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
100
|
-
modifyOrderByUserId(userOrderId: number, modifyOrderParams: ModifyOrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
101
|
-
fillPerpOrder(orderId: number | null, makerOrderId: number | null, fillerSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
102
|
-
fillSpotOrder(orderId: number | null, fulfillmentType: any | null, makerOrderId: number | null, fillerSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
103
|
-
forceCancelOrders(fillerSubAccountId: number, userKey: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
104
|
-
revertFill(fillerSubAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
105
|
-
liquidatePerp(marketIndex: number, liquidatorMaxBaseAssetAmount: BN, limitPrice: BN | null, liquidatorSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
106
|
-
liquidateSpot(assetMarketIndex: number, liabilityMarketIndex: number, liquidatorMaxLiabilityTransfer: BN, limitPrice: BN | null, liquidatorSubAccountId: number, userKey: PublicKey, userStatsKey: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
107
|
-
getMarketPda: (marketType: MarketType, marketIndex: number) => anchor.web3.PublicKey;
|
|
108
|
-
getUserPda: (authority: PublicKey, subAccountId?: number) => anchor.web3.PublicKey;
|
|
109
|
-
getUserStatsPda: (authority: PublicKey) => PublicKey;
|
|
110
|
-
getGlamReferrerPdas(): {
|
|
111
|
-
user: PublicKey;
|
|
112
|
-
userStats: PublicKey;
|
|
113
|
-
};
|
|
114
|
-
getDriftUserPdas(subAccountId?: number): {
|
|
115
|
-
user: PublicKey;
|
|
116
|
-
userStats: PublicKey;
|
|
117
|
-
};
|
|
118
|
-
getSubAccountId(driftUser: PublicKey): number;
|
|
119
|
-
get driftStatePda(): PublicKey;
|
|
120
|
-
fetchAndParseSpotMarket(marketIndex: number, skipCache?: boolean): Promise<DriftSpotMarket>;
|
|
121
|
-
fetchAndParseSpotMarkets(marketIndexes: number[], skipCache?: boolean): Promise<DriftSpotMarket[]>;
|
|
122
|
-
fetchAndParsePerpMarket(marketIndex: number, skipCache?: boolean): Promise<DriftPerpMarket>;
|
|
123
|
-
fetchAndParsePerpMarkets(marketIndexes: number[], skipCache?: boolean): Promise<DriftPerpMarket[]>;
|
|
124
|
-
fetchMarketConfigs(skipCache?: boolean): Promise<DriftMarketConfigs>;
|
|
125
|
-
fetchAndParseDriftUser(subAccountId?: number): Promise<DriftUser | null>;
|
|
126
|
-
fetchAndParseDriftUsers(): Promise<DriftUser[]>;
|
|
127
|
-
marketTypeEquals: (a: MarketType | undefined, b: MarketType) => boolean | undefined;
|
|
128
|
-
composeRemainingAccounts(subAccountId: number, marketType?: MarketType, marketIndex?: number): Promise<AccountMeta[]>;
|
|
129
|
-
}
|
|
130
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, AccountMeta, Commitment } from "@solana/web3.js";
|
|
2
|
-
import { DriftVault, PerpPosition, SpotPosition } from "../../deser/driftLayouts";
|
|
3
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
|
|
4
|
-
import { BN } from "@coral-xyz/anchor";
|
|
5
|
-
import { DriftProtocolClient } from "./protocol-v2";
|
|
6
|
-
declare class TxBuilder extends BaseTxBuilder<DriftVaultsClient> {
|
|
7
|
-
initializeVaultDepositorTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
8
|
-
depositTx(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
|
-
requestWithdrawTx(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
10
|
-
cancelWithdrawRequestTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
11
|
-
withdrawTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
12
|
-
}
|
|
13
|
-
export declare class DriftVaultsClient {
|
|
14
|
-
readonly base: BaseClient;
|
|
15
|
-
readonly drift: DriftProtocolClient;
|
|
16
|
-
txBuilder: TxBuilder;
|
|
17
|
-
constructor(base: BaseClient, drift: DriftProtocolClient);
|
|
18
|
-
fetchUserPositions(user: PublicKey): Promise<{
|
|
19
|
-
perpPositions: PerpPosition[];
|
|
20
|
-
spotPositions: SpotPosition[];
|
|
21
|
-
}>;
|
|
22
|
-
getDepositorPda(driftVault: PublicKey): PublicKey;
|
|
23
|
-
parseDriftVaults(driftVaults: PublicKey[]): Promise<DriftVault[]>;
|
|
24
|
-
parseDriftVault(driftVault: PublicKey): Promise<DriftVault>;
|
|
25
|
-
composeRemainingAccounts(user: PublicKey): Promise<AccountMeta[]>;
|
|
26
|
-
parseDepositor(depositor: PublicKey, data: Buffer): {
|
|
27
|
-
address: PublicKey;
|
|
28
|
-
driftVault: PublicKey;
|
|
29
|
-
shares: any;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Finds all drift vault depositors
|
|
33
|
-
*/
|
|
34
|
-
findAndParseVaultDepositors(commitment?: Commitment): Promise<{
|
|
35
|
-
address: PublicKey;
|
|
36
|
-
driftVault: PublicKey;
|
|
37
|
-
shares: any;
|
|
38
|
-
}[]>;
|
|
39
|
-
/**
|
|
40
|
-
* Initialize a vault depositor
|
|
41
|
-
*/
|
|
42
|
-
initializeVaultDepositor(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
43
|
-
/**
|
|
44
|
-
* Deposit to a drift vault
|
|
45
|
-
*/
|
|
46
|
-
deposit(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
47
|
-
/**
|
|
48
|
-
* Request withdrawal from a drift vault
|
|
49
|
-
*/
|
|
50
|
-
requestWithdraw(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
51
|
-
/**
|
|
52
|
-
* Cancel a withdrawal request
|
|
53
|
-
*/
|
|
54
|
-
cancelWithdrawRequest(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
55
|
-
/**
|
|
56
|
-
* Withdraw from a drift vault
|
|
57
|
-
*/
|
|
58
|
-
withdraw(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
|
-
}
|
|
60
|
-
export {};
|