@glamsystems/glam-sdk 1.0.12-alpha.3 → 1.0.13-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1 -1
  3. package/index.cjs.js +1 -57320
  4. package/index.esm.js +1 -57081
  5. package/package.json +26 -15
  6. package/src/assets.d.ts +10 -17
  7. package/src/client/access.d.ts +13 -0
  8. package/src/client/base.d.ts +30 -7
  9. package/src/client/bridge.d.ts +183 -0
  10. package/src/client/bridgeRegistry.d.ts +32 -0
  11. package/src/client/epi.d.ts +78 -0
  12. package/src/client/fees.d.ts +4 -0
  13. package/src/client/invest.d.ts +1 -1
  14. package/src/client/jupiter.d.ts +27 -20
  15. package/src/client/loopscale.d.ts +84 -0
  16. package/src/client/mint.d.ts +54 -1
  17. package/src/client/price.d.ts +26 -39
  18. package/src/client.d.ts +9 -5
  19. package/src/constants.d.ts +11 -7
  20. package/src/deser/index.d.ts +1 -1
  21. package/src/deser/integrationPolicies.d.ts +30 -20
  22. package/src/deser/tokenAclLayouts.d.ts +67 -0
  23. package/src/error.d.ts +2 -1
  24. package/src/glamExports.d.ts +1351 -1546
  25. package/src/globalConfig.d.ts +27 -0
  26. package/src/index.d.ts +5 -1
  27. package/src/models/state.d.ts +2 -0
  28. package/src/utils/accounts.d.ts +9 -1
  29. package/src/utils/bitmask.d.ts +3 -0
  30. package/src/utils/common.d.ts +2 -0
  31. package/src/utils/glamPDAs.d.ts +6 -0
  32. package/src/utils/index.d.ts +0 -1
  33. package/src/utils/pkmap.d.ts +23 -18
  34. package/src/utils/positionCategorizer.d.ts +3 -21
  35. package/target/idl/ext_bridge-staging.json +2379 -0
  36. package/target/idl/ext_bridge.json +2379 -0
  37. package/target/idl/ext_cctp.json +1 -1
  38. package/target/idl/ext_drift.json +1613 -142
  39. package/target/idl/ext_epi-staging.json +2169 -0
  40. package/target/idl/ext_epi.json +2169 -0
  41. package/target/idl/ext_kamino-staging.json +1 -1
  42. package/target/idl/ext_kamino.json +109 -1
  43. package/target/idl/{ext_drift-staging.json → ext_loopscale-staging.json} +986 -1438
  44. package/target/idl/ext_loopscale.json +3541 -0
  45. package/target/idl/ext_marinade-staging.json +1587 -0
  46. package/target/idl/ext_spl-staging.json +1 -1
  47. package/target/idl/ext_spl.json +1 -1
  48. package/target/idl/glam_config.json +78 -9
  49. package/target/idl/glam_mint-staging.json +3002 -1244
  50. package/target/idl/glam_mint.json +239 -8
  51. package/target/idl/glam_policies.json +2 -7
  52. package/target/idl/glam_protocol-staging.json +187 -266
  53. package/target/idl/glam_protocol.json +217 -114
  54. package/target/idl/mock_layerzero_endpoint.json +144 -0
  55. package/target/idl/mock_layerzero_oft.json +155 -0
  56. package/target/types/ext_bridge-staging.d.ts +2385 -0
  57. package/target/types/ext_bridge-staging.ts +2385 -0
  58. package/target/types/ext_bridge.d.ts +2385 -0
  59. package/target/types/ext_bridge.ts +2385 -0
  60. package/target/types/ext_cctp.d.ts +1 -1
  61. package/target/types/ext_cctp.ts +1 -1
  62. package/target/types/ext_drift.d.ts +1609 -138
  63. package/target/types/ext_drift.ts +1613 -142
  64. package/target/types/ext_epi-staging.d.ts +2175 -0
  65. package/target/types/ext_epi-staging.ts +2175 -0
  66. package/target/types/ext_epi.d.ts +2175 -0
  67. package/target/types/ext_epi.ts +2175 -0
  68. package/target/types/ext_kamino-staging.d.ts +3433 -0
  69. package/target/types/ext_kamino-staging.ts +1 -1
  70. package/target/types/ext_kamino.d.ts +109 -1
  71. package/target/types/ext_kamino.ts +109 -1
  72. package/target/types/ext_loopscale-staging.d.ts +3547 -0
  73. package/target/types/{ext_drift-staging.ts → ext_loopscale-staging.ts} +988 -1440
  74. package/target/types/ext_loopscale.d.ts +3547 -0
  75. package/target/types/ext_loopscale.ts +3547 -0
  76. package/target/types/ext_marinade-staging.d.ts +1593 -0
  77. package/target/types/ext_marinade-staging.ts +1593 -0
  78. package/target/types/{ext_offchain.d.ts → ext_spl-staging.d.ts} +219 -19
  79. package/target/types/ext_spl-staging.ts +1 -1
  80. package/target/types/ext_spl.d.ts +1 -1
  81. package/target/types/ext_spl.ts +1 -1
  82. package/target/types/ext_stake_pool-staging.d.ts +1622 -0
  83. package/target/types/glam_config.d.ts +78 -9
  84. package/target/types/glam_config.ts +78 -9
  85. package/target/types/glam_mint-staging.d.ts +7856 -0
  86. package/target/types/glam_mint-staging.ts +3002 -1244
  87. package/target/types/glam_mint.d.ts +239 -8
  88. package/target/types/glam_mint.ts +239 -8
  89. package/target/types/glam_policies.d.ts +477 -0
  90. package/target/types/glam_policies.ts +2 -7
  91. package/target/types/glam_protocol-staging.d.ts +3292 -0
  92. package/target/types/glam_protocol-staging.ts +187 -266
  93. package/target/types/glam_protocol.d.ts +217 -114
  94. package/target/types/glam_protocol.ts +217 -114
  95. package/target/types/mock_layerzero_endpoint.d.ts +150 -0
  96. package/target/types/mock_layerzero_endpoint.ts +150 -0
  97. package/target/types/mock_layerzero_oft.d.ts +161 -0
  98. package/target/types/mock_layerzero_oft.ts +161 -0
  99. package/src/client/drift/index.d.ts +0 -2
  100. package/src/client/drift/protocol-v2.d.ts +0 -93
  101. package/src/client/drift/vaults.d.ts +0 -60
  102. package/src/deser/driftLayouts.d.ts +0 -217
  103. package/src/react/cluster-provider.d.ts +0 -22
  104. package/src/react/glam.d.ts +0 -51
  105. package/src/react/index.d.ts +0 -5
  106. package/src/react/query-keys.d.ts +0 -40
  107. package/src/react/useVaultBalanceSubscription.d.ts +0 -17
  108. package/src/utils/drift/index.d.ts +0 -2
  109. package/src/utils/drift/orderParams.d.ts +0 -28
  110. package/src/utils/drift/types.d.ts +0 -522
@@ -8,7 +8,7 @@ export type GlamProtocol = {
8
8
  "address": "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz",
9
9
  "metadata": {
10
10
  "name": "glamProtocol",
11
- "version": "1.0.3",
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": "invalidAccountOwner",
1006
- "msg": "Account owner does not match expected program"
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": "invalidIndex",
1036
- "msg": "Invalid index"
1178
+ "name": "invalidAssetsLen",
1179
+ "msg": "Too many assets: max 100"
1037
1180
  },
1038
1181
  {
1039
1182
  "code": 49005,
@@ -1092,14 +1235,34 @@ export type GlamProtocol = {
1092
1235
  },
1093
1236
  {
1094
1237
  "code": 49016,
1238
+ "name": "staleDriftInterest",
1239
+ "msg": "Drift spot market cumulative interest is stale"
1240
+ },
1241
+ {
1242
+ "code": 49017,
1243
+ "name": "assetBalanceNotZero",
1244
+ "msg": "Cannot delete asset: vault token account balance is not zero"
1245
+ },
1246
+ {
1247
+ "code": 49018,
1248
+ "name": "cannotDeleteBaseAsset",
1249
+ "msg": "Cannot delete base asset from allowlist"
1250
+ },
1251
+ {
1252
+ "code": 49019,
1095
1253
  "name": "integrationAclLimitExceeded",
1096
1254
  "msg": "Integration ACL limit exceeded"
1097
1255
  },
1098
1256
  {
1099
- "code": 49017,
1257
+ "code": 49020,
1100
1258
  "name": "delegateAclLimitExceeded",
1101
1259
  "msg": "Delegate ACL limit exceeded"
1102
1260
  },
1261
+ {
1262
+ "code": 49021,
1263
+ "name": "invalidFeeStructure",
1264
+ "msg": "Invalid fee structure"
1265
+ },
1103
1266
  {
1104
1267
  "code": 50000,
1105
1268
  "name": "withdrawDenied",
@@ -1140,6 +1303,11 @@ export type GlamProtocol = {
1140
1303
  "name": "multipleStakeAccountsDisallowed",
1141
1304
  "msg": "Multiple stake accounts disallowed"
1142
1305
  },
1306
+ {
1307
+ "code": 50008,
1308
+ "name": "maxDeviationExceeded",
1309
+ "msg": "Max deviation exceeded"
1310
+ },
1143
1311
  {
1144
1312
  "code": 51000,
1145
1313
  "name": "invalidAssetPrice",
@@ -1178,7 +1346,7 @@ export type GlamProtocol = {
1178
1346
  {
1179
1347
  "code": 51105,
1180
1348
  "name": "priceDivergenceTooLarge",
1181
- "msg": "Price confidence interval too wide"
1349
+ "msg": "No priced assets found"
1182
1350
  },
1183
1351
  {
1184
1352
  "code": 51106,
@@ -1187,18 +1355,18 @@ export type GlamProtocol = {
1187
1355
  },
1188
1356
  {
1189
1357
  "code": 51107,
1190
- "name": "invalidSharesRebase",
1191
- "msg": "Invalid shares rebase: new base must be greater than current"
1358
+ "name": "mathError",
1359
+ "msg": "Math error"
1192
1360
  },
1193
1361
  {
1194
1362
  "code": 51108,
1195
- "name": "duplicatePosition",
1196
- "msg": "Duplicate position already priced"
1363
+ "name": "typeCastingError",
1364
+ "msg": "Type casting error"
1197
1365
  },
1198
1366
  {
1199
1367
  "code": 51109,
1200
- "name": "unsupportedVaultState",
1201
- "msg": "Vault protocol or pending fee update not supported for pricing"
1368
+ "name": "baseAssetNotSupported",
1369
+ "msg": "Base asset must have 6 decimals."
1202
1370
  },
1203
1371
  {
1204
1372
  "code": 51110,
@@ -1217,14 +1385,24 @@ export type GlamProtocol = {
1217
1385
  },
1218
1386
  {
1219
1387
  "code": 51113,
1220
- "name": "invalidDiscriminator",
1221
- "msg": "Account discriminator does not match expected value"
1388
+ "name": "unexpectedDiscriminator",
1389
+ "msg": "Invalid account: discriminator mismatch"
1222
1390
  },
1223
1391
  {
1224
1392
  "code": 51114,
1225
1393
  "name": "invalidAccountData",
1226
1394
  "msg": "Invalid account data"
1227
1395
  },
1396
+ {
1397
+ "code": 51115,
1398
+ "name": "oraclePriceSuspended",
1399
+ "msg": "Oracle price is suspended"
1400
+ },
1401
+ {
1402
+ "code": 51116,
1403
+ "name": "assetNotInPricingSet",
1404
+ "msg": "Asset not in pricing set"
1405
+ },
1228
1406
  {
1229
1407
  "code": 50100,
1230
1408
  "name": "transferRateLimitExceeded",
@@ -1254,6 +1432,16 @@ export type GlamProtocol = {
1254
1432
  "code": 52003,
1255
1433
  "name": "lockUp",
1256
1434
  "msg": "Policy violation: lock-up has not expired"
1435
+ },
1436
+ {
1437
+ "code": 52004,
1438
+ "name": "policyNotSet",
1439
+ "msg": "Protocol policy not set"
1440
+ },
1441
+ {
1442
+ "code": 52005,
1443
+ "name": "unsupportedOracleSource",
1444
+ "msg": "Oracle source not supported in this context"
1257
1445
  }
1258
1446
  ],
1259
1447
  "types": [
@@ -1343,30 +1531,6 @@ export type GlamProtocol = {
1343
1531
  ]
1344
1532
  }
1345
1533
  },
1346
- {
1347
- "name": "assetRateLimit",
1348
- "type": {
1349
- "kind": "struct",
1350
- "fields": [
1351
- {
1352
- "name": "mint",
1353
- "type": "pubkey"
1354
- },
1355
- {
1356
- "name": "periodType",
1357
- "type": {
1358
- "defined": {
1359
- "name": "periodType"
1360
- }
1361
- }
1362
- },
1363
- {
1364
- "name": "amount",
1365
- "type": "u64"
1366
- }
1367
- ]
1368
- }
1369
- },
1370
1534
  {
1371
1535
  "name": "createdModel",
1372
1536
  "type": {
@@ -1418,28 +1582,6 @@ export type GlamProtocol = {
1418
1582
  ]
1419
1583
  }
1420
1584
  },
1421
- {
1422
- "name": "delegateRateLimit",
1423
- "type": {
1424
- "kind": "struct",
1425
- "fields": [
1426
- {
1427
- "name": "delegate",
1428
- "type": "pubkey"
1429
- },
1430
- {
1431
- "name": "limits",
1432
- "type": {
1433
- "vec": {
1434
- "defined": {
1435
- "name": "assetRateLimit"
1436
- }
1437
- }
1438
- }
1439
- }
1440
- ]
1441
- }
1442
- },
1443
1585
  {
1444
1586
  "name": "emergencyAccessUpdateArgs",
1445
1587
  "type": {
@@ -1948,6 +2090,10 @@ export type GlamProtocol = {
1948
2090
  "vec": "pubkey"
1949
2091
  }
1950
2092
  }
2093
+ },
2094
+ {
2095
+ "name": "maxDeviationBps",
2096
+ "type": "i16"
1951
2097
  }
1952
2098
  ]
1953
2099
  }
@@ -2110,26 +2256,6 @@ export type GlamProtocol = {
2110
2256
  ]
2111
2257
  }
2112
2258
  },
2113
- {
2114
- "name": "periodType",
2115
- "repr": {
2116
- "kind": "rust"
2117
- },
2118
- "type": {
2119
- "kind": "enum",
2120
- "variants": [
2121
- {
2122
- "name": "day"
2123
- },
2124
- {
2125
- "name": "week"
2126
- },
2127
- {
2128
- "name": "month"
2129
- }
2130
- ]
2131
- }
2132
- },
2133
2259
  {
2134
2260
  "name": "pricedProtocol",
2135
2261
  "type": {
@@ -2497,34 +2623,6 @@ export type GlamProtocol = {
2497
2623
  ]
2498
2624
  }
2499
2625
  },
2500
- {
2501
- "name": "transferRateLimitPolicy",
2502
- "type": {
2503
- "kind": "struct",
2504
- "fields": [
2505
- {
2506
- "name": "vaultDefaults",
2507
- "type": {
2508
- "vec": {
2509
- "defined": {
2510
- "name": "assetRateLimit"
2511
- }
2512
- }
2513
- }
2514
- },
2515
- {
2516
- "name": "delegateOverrides",
2517
- "type": {
2518
- "vec": {
2519
- "defined": {
2520
- "name": "delegateRateLimit"
2521
- }
2522
- }
2523
- }
2524
- }
2525
- ]
2526
- }
2527
- },
2528
2626
  {
2529
2627
  "name": "valuationModel",
2530
2628
  "type": {
@@ -2546,6 +2644,16 @@ export type GlamProtocol = {
2546
2644
  "type": "u16",
2547
2645
  "value": "4"
2548
2646
  },
2647
+ {
2648
+ "name": "protoJupiterSwapPermSkipQuotePriceCheck",
2649
+ "type": "u64",
2650
+ "value": "32"
2651
+ },
2652
+ {
2653
+ "name": "protoJupiterSwapPermSkipQuotePriceCheckLimited",
2654
+ "type": "u64",
2655
+ "value": "16"
2656
+ },
2549
2657
  {
2550
2658
  "name": "protoJupiterSwapPermSwapAllowlisted",
2551
2659
  "type": "u64",
@@ -2600,11 +2708,6 @@ export type GlamProtocol = {
2600
2708
  "name": "protoSystemPermWsol",
2601
2709
  "type": "u64",
2602
2710
  "value": "1"
2603
- },
2604
- {
2605
- "name": "protoTransferLimit",
2606
- "type": "u16",
2607
- "value": "8"
2608
2711
  }
2609
2712
  ]
2610
2713
  };
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Program IDL in camelCase format in order to be used in JS/TS.
3
+ *
4
+ * Note that this is only a type helper and is not the actual IDL. The original
5
+ * IDL can be found at `target/idl/mock_layerzero_endpoint.json`.
6
+ */
7
+ export type MockLayerzeroEndpoint = {
8
+ "address": "7VCSNNGUmS4f1qDE73PmkSWbV3kBhRPJko1g7t9YTSbM";
9
+ "metadata": {
10
+ "name": "mockLayerzeroEndpoint";
11
+ "version": "1.0.0";
12
+ "spec": "0.1.0";
13
+ };
14
+ "instructions": [
15
+ {
16
+ "name": "advanceNonce";
17
+ "discriminator": [
18
+ 20,
19
+ 17,
20
+ 71,
21
+ 131,
22
+ 103,
23
+ 35,
24
+ 92,
25
+ 6
26
+ ];
27
+ "accounts": [
28
+ {
29
+ "name": "nonce";
30
+ "writable": true;
31
+ "pda": {
32
+ "seeds": [
33
+ {
34
+ "kind": "const";
35
+ "value": [
36
+ 78,
37
+ 111,
38
+ 110,
39
+ 99,
40
+ 101
41
+ ];
42
+ },
43
+ {
44
+ "kind": "arg";
45
+ "path": "sender";
46
+ },
47
+ {
48
+ "kind": "arg";
49
+ "path": "dstEid";
50
+ },
51
+ {
52
+ "kind": "arg";
53
+ "path": "receiver";
54
+ }
55
+ ];
56
+ };
57
+ }
58
+ ];
59
+ "args": [
60
+ {
61
+ "name": "sender";
62
+ "type": "pubkey";
63
+ },
64
+ {
65
+ "name": "dstEid";
66
+ "type": "u32";
67
+ },
68
+ {
69
+ "name": "receiver";
70
+ "type": "pubkey";
71
+ }
72
+ ];
73
+ },
74
+ {
75
+ "name": "initializeNonce";
76
+ "discriminator": [
77
+ 64,
78
+ 206,
79
+ 214,
80
+ 231,
81
+ 20,
82
+ 15,
83
+ 231,
84
+ 41
85
+ ];
86
+ "accounts": [
87
+ {
88
+ "name": "payer";
89
+ "writable": true;
90
+ "signer": true;
91
+ },
92
+ {
93
+ "name": "nonce";
94
+ "writable": true;
95
+ "pda": {
96
+ "seeds": [
97
+ {
98
+ "kind": "const";
99
+ "value": [
100
+ 78,
101
+ 111,
102
+ 110,
103
+ 99,
104
+ 101
105
+ ];
106
+ },
107
+ {
108
+ "kind": "arg";
109
+ "path": "sender";
110
+ },
111
+ {
112
+ "kind": "arg";
113
+ "path": "dstEid";
114
+ },
115
+ {
116
+ "kind": "arg";
117
+ "path": "receiver";
118
+ }
119
+ ];
120
+ };
121
+ },
122
+ {
123
+ "name": "systemProgram";
124
+ "address": "11111111111111111111111111111111";
125
+ }
126
+ ];
127
+ "args": [
128
+ {
129
+ "name": "sender";
130
+ "type": "pubkey";
131
+ },
132
+ {
133
+ "name": "dstEid";
134
+ "type": "u32";
135
+ },
136
+ {
137
+ "name": "receiver";
138
+ "type": "pubkey";
139
+ }
140
+ ];
141
+ }
142
+ ];
143
+ "errors": [
144
+ {
145
+ "code": 6000;
146
+ "name": "invalidNonceAccount";
147
+ "msg": "The nonce account layout is invalid";
148
+ }
149
+ ];
150
+ };