@velocity-exchange/sdk 0.7.0 → 0.9.0
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/lib/browser/adminClient.d.ts +35 -12
- package/lib/browser/adminClient.js +75 -22
- package/lib/browser/core/VelocityCore.d.ts +2 -0
- package/lib/browser/core/VelocityCore.js +1 -0
- package/lib/browser/core/instructions/trigger.d.ts +4 -0
- package/lib/browser/core/instructions/trigger.js +4 -0
- package/lib/browser/decode/user.js +3 -1
- package/lib/browser/equityFloorManager.d.ts +150 -0
- package/lib/browser/equityFloorManager.js +279 -0
- package/lib/browser/idl/velocity.d.ts +307 -43
- package/lib/browser/idl/velocity.json +308 -44
- package/lib/browser/index.d.ts +2 -0
- package/lib/browser/index.js +2 -0
- package/lib/browser/jupiter/jupiterClient.js +24 -3
- package/lib/browser/math/liquidation.d.ts +37 -2
- package/lib/browser/math/liquidation.js +44 -3
- package/lib/browser/math/margin.d.ts +26 -0
- package/lib/browser/math/margin.js +41 -1
- package/lib/browser/math/spotBalance.d.ts +13 -0
- package/lib/browser/math/spotBalance.js +43 -2
- package/lib/browser/swap/UnifiedSwapClient.js +17 -3
- package/lib/browser/titan/titanClient.d.ts +6 -0
- package/lib/browser/titan/titanClient.js +44 -13
- package/lib/browser/types.d.ts +15 -2
- package/lib/browser/types.js +2 -0
- package/lib/browser/user.d.ts +38 -11
- package/lib/browser/user.js +84 -33
- package/lib/browser/velocityClient.d.ts +37 -24
- package/lib/browser/velocityClient.js +56 -35
- package/lib/node/adminClient.d.ts +35 -12
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +75 -22
- package/lib/node/core/VelocityCore.d.ts +2 -0
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/VelocityCore.js +1 -0
- package/lib/node/core/instructions/trigger.d.ts +4 -0
- package/lib/node/core/instructions/trigger.d.ts.map +1 -1
- package/lib/node/core/instructions/trigger.js +4 -0
- package/lib/node/decode/user.d.ts.map +1 -1
- package/lib/node/decode/user.js +3 -1
- package/lib/node/equityFloorManager.d.ts +151 -0
- package/lib/node/equityFloorManager.d.ts.map +1 -0
- package/lib/node/equityFloorManager.js +279 -0
- package/lib/node/idl/velocity.d.ts +307 -43
- package/lib/node/idl/velocity.d.ts.map +1 -1
- package/lib/node/idl/velocity.json +308 -44
- package/lib/node/index.d.ts +2 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +2 -0
- package/lib/node/jupiter/jupiterClient.d.ts.map +1 -1
- package/lib/node/jupiter/jupiterClient.js +24 -3
- package/lib/node/math/liquidation.d.ts +37 -2
- package/lib/node/math/liquidation.d.ts.map +1 -1
- package/lib/node/math/liquidation.js +44 -3
- package/lib/node/math/margin.d.ts +26 -0
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +41 -1
- package/lib/node/math/spotBalance.d.ts +13 -0
- package/lib/node/math/spotBalance.d.ts.map +1 -1
- package/lib/node/math/spotBalance.js +43 -2
- package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -1
- package/lib/node/swap/UnifiedSwapClient.js +17 -3
- package/lib/node/titan/titanClient.d.ts +6 -0
- package/lib/node/titan/titanClient.d.ts.map +1 -1
- package/lib/node/titan/titanClient.js +44 -13
- package/lib/node/types.d.ts +15 -2
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +2 -0
- package/lib/node/user.d.ts +38 -11
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +84 -33
- package/lib/node/velocityClient.d.ts +37 -24
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +56 -35
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"address": "vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "velocity",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.164.0",
|
|
6
6
|
"spec": "0.1.0",
|
|
7
7
|
"description": "Created with Anchor"
|
|
8
8
|
},
|
|
@@ -4420,6 +4420,9 @@
|
|
|
4420
4420
|
"name": "liquidator",
|
|
4421
4421
|
"writable": true
|
|
4422
4422
|
},
|
|
4423
|
+
{
|
|
4424
|
+
"name": "liquidator_stats"
|
|
4425
|
+
},
|
|
4423
4426
|
{
|
|
4424
4427
|
"name": "user",
|
|
4425
4428
|
"writable": true
|
|
@@ -6283,6 +6286,9 @@
|
|
|
6283
6286
|
52
|
|
6284
6287
|
],
|
|
6285
6288
|
"accounts": [
|
|
6289
|
+
{
|
|
6290
|
+
"name": "state"
|
|
6291
|
+
},
|
|
6286
6292
|
{
|
|
6287
6293
|
"name": "spot_market",
|
|
6288
6294
|
"writable": true,
|
|
@@ -6327,6 +6333,40 @@
|
|
|
6327
6333
|
"user_stats"
|
|
6328
6334
|
]
|
|
6329
6335
|
},
|
|
6336
|
+
{
|
|
6337
|
+
"name": "spot_market_vault",
|
|
6338
|
+
"writable": true,
|
|
6339
|
+
"pda": {
|
|
6340
|
+
"seeds": [
|
|
6341
|
+
{
|
|
6342
|
+
"kind": "const",
|
|
6343
|
+
"value": [
|
|
6344
|
+
115,
|
|
6345
|
+
112,
|
|
6346
|
+
111,
|
|
6347
|
+
116,
|
|
6348
|
+
95,
|
|
6349
|
+
109,
|
|
6350
|
+
97,
|
|
6351
|
+
114,
|
|
6352
|
+
107,
|
|
6353
|
+
101,
|
|
6354
|
+
116,
|
|
6355
|
+
95,
|
|
6356
|
+
118,
|
|
6357
|
+
97,
|
|
6358
|
+
117,
|
|
6359
|
+
108,
|
|
6360
|
+
116
|
|
6361
|
+
]
|
|
6362
|
+
},
|
|
6363
|
+
{
|
|
6364
|
+
"kind": "arg",
|
|
6365
|
+
"path": "market_index"
|
|
6366
|
+
}
|
|
6367
|
+
]
|
|
6368
|
+
}
|
|
6369
|
+
},
|
|
6330
6370
|
{
|
|
6331
6371
|
"name": "insurance_fund_vault",
|
|
6332
6372
|
"writable": true,
|
|
@@ -6363,6 +6403,12 @@
|
|
|
6363
6403
|
}
|
|
6364
6404
|
]
|
|
6365
6405
|
}
|
|
6406
|
+
},
|
|
6407
|
+
{
|
|
6408
|
+
"name": "velocity_signer"
|
|
6409
|
+
},
|
|
6410
|
+
{
|
|
6411
|
+
"name": "token_program"
|
|
6366
6412
|
}
|
|
6367
6413
|
],
|
|
6368
6414
|
"args": [
|
|
@@ -6537,13 +6583,7 @@
|
|
|
6537
6583
|
}
|
|
6538
6584
|
},
|
|
6539
6585
|
{
|
|
6540
|
-
"name": "authority"
|
|
6541
|
-
"relations": [
|
|
6542
|
-
"user"
|
|
6543
|
-
]
|
|
6544
|
-
},
|
|
6545
|
-
{
|
|
6546
|
-
"name": "user"
|
|
6586
|
+
"name": "authority"
|
|
6547
6587
|
},
|
|
6548
6588
|
{
|
|
6549
6589
|
"name": "payer",
|
|
@@ -8238,6 +8278,9 @@
|
|
|
8238
8278
|
{
|
|
8239
8279
|
"name": "user",
|
|
8240
8280
|
"writable": true
|
|
8281
|
+
},
|
|
8282
|
+
{
|
|
8283
|
+
"name": "user_stats"
|
|
8241
8284
|
}
|
|
8242
8285
|
],
|
|
8243
8286
|
"args": [
|
|
@@ -11431,6 +11474,42 @@
|
|
|
11431
11474
|
],
|
|
11432
11475
|
"args": []
|
|
11433
11476
|
},
|
|
11477
|
+
{
|
|
11478
|
+
"name": "update_spot_market_deposit_cap",
|
|
11479
|
+
"discriminator": [
|
|
11480
|
+
76,
|
|
11481
|
+
21,
|
|
11482
|
+
179,
|
|
11483
|
+
154,
|
|
11484
|
+
28,
|
|
11485
|
+
161,
|
|
11486
|
+
174,
|
|
11487
|
+
107
|
|
11488
|
+
],
|
|
11489
|
+
"accounts": [
|
|
11490
|
+
{
|
|
11491
|
+
"name": "admin",
|
|
11492
|
+
"signer": true
|
|
11493
|
+
},
|
|
11494
|
+
{
|
|
11495
|
+
"name": "state"
|
|
11496
|
+
},
|
|
11497
|
+
{
|
|
11498
|
+
"name": "spot_market",
|
|
11499
|
+
"writable": true
|
|
11500
|
+
}
|
|
11501
|
+
],
|
|
11502
|
+
"args": [
|
|
11503
|
+
{
|
|
11504
|
+
"name": "deposit_guard_threshold",
|
|
11505
|
+
"type": "u64"
|
|
11506
|
+
},
|
|
11507
|
+
{
|
|
11508
|
+
"name": "max_deposit_bps_per_day",
|
|
11509
|
+
"type": "u16"
|
|
11510
|
+
}
|
|
11511
|
+
]
|
|
11512
|
+
},
|
|
11434
11513
|
{
|
|
11435
11514
|
"name": "update_spot_market_expiry",
|
|
11436
11515
|
"discriminator": [
|
|
@@ -12070,6 +12149,38 @@
|
|
|
12070
12149
|
}
|
|
12071
12150
|
]
|
|
12072
12151
|
},
|
|
12152
|
+
{
|
|
12153
|
+
"name": "update_spot_market_withdraw_circuit_breaker",
|
|
12154
|
+
"discriminator": [
|
|
12155
|
+
2,
|
|
12156
|
+
97,
|
|
12157
|
+
135,
|
|
12158
|
+
97,
|
|
12159
|
+
117,
|
|
12160
|
+
169,
|
|
12161
|
+
65,
|
|
12162
|
+
223
|
|
12163
|
+
],
|
|
12164
|
+
"accounts": [
|
|
12165
|
+
{
|
|
12166
|
+
"name": "admin",
|
|
12167
|
+
"signer": true
|
|
12168
|
+
},
|
|
12169
|
+
{
|
|
12170
|
+
"name": "state"
|
|
12171
|
+
},
|
|
12172
|
+
{
|
|
12173
|
+
"name": "spot_market",
|
|
12174
|
+
"writable": true
|
|
12175
|
+
}
|
|
12176
|
+
],
|
|
12177
|
+
"args": [
|
|
12178
|
+
{
|
|
12179
|
+
"name": "withdraw_circuit_breaker_bps",
|
|
12180
|
+
"type": "u16"
|
|
12181
|
+
}
|
|
12182
|
+
]
|
|
12183
|
+
},
|
|
12073
12184
|
{
|
|
12074
12185
|
"name": "update_state_max_initialize_user_fee",
|
|
12075
12186
|
"discriminator": [
|
|
@@ -12349,6 +12460,10 @@
|
|
|
12349
12460
|
{
|
|
12350
12461
|
"name": "equity_floor",
|
|
12351
12462
|
"type": "u64"
|
|
12463
|
+
},
|
|
12464
|
+
{
|
|
12465
|
+
"name": "equity_floor_buffer",
|
|
12466
|
+
"type": "u64"
|
|
12352
12467
|
}
|
|
12353
12468
|
]
|
|
12354
12469
|
},
|
|
@@ -12770,6 +12885,63 @@
|
|
|
12770
12885
|
],
|
|
12771
12886
|
"args": []
|
|
12772
12887
|
},
|
|
12888
|
+
{
|
|
12889
|
+
"name": "update_user_vault_owned",
|
|
12890
|
+
"docs": [
|
|
12891
|
+
"Mark a User as vault-owned (its authority is a vault PDA and its equity",
|
|
12892
|
+
"prices vault depositor shares). Set-only and authority-gated: only the",
|
|
12893
|
+
"User's authority may call it, and it is CPI'd by the vaults program at",
|
|
12894
|
+
"vault init. A vault-owned User is skipped by the revenue-share sweep so a",
|
|
12895
|
+
"builder/referral reward can never enter vault NAV (OtterSec #91/#92/#93)."
|
|
12896
|
+
],
|
|
12897
|
+
"discriminator": [
|
|
12898
|
+
50,
|
|
12899
|
+
156,
|
|
12900
|
+
218,
|
|
12901
|
+
143,
|
|
12902
|
+
216,
|
|
12903
|
+
94,
|
|
12904
|
+
68,
|
|
12905
|
+
93
|
|
12906
|
+
],
|
|
12907
|
+
"accounts": [
|
|
12908
|
+
{
|
|
12909
|
+
"name": "user",
|
|
12910
|
+
"writable": true,
|
|
12911
|
+
"pda": {
|
|
12912
|
+
"seeds": [
|
|
12913
|
+
{
|
|
12914
|
+
"kind": "const",
|
|
12915
|
+
"value": [
|
|
12916
|
+
117,
|
|
12917
|
+
115,
|
|
12918
|
+
101,
|
|
12919
|
+
114
|
|
12920
|
+
]
|
|
12921
|
+
},
|
|
12922
|
+
{
|
|
12923
|
+
"kind": "account",
|
|
12924
|
+
"path": "authority"
|
|
12925
|
+
},
|
|
12926
|
+
{
|
|
12927
|
+
"kind": "arg",
|
|
12928
|
+
"path": "sub_account_id"
|
|
12929
|
+
}
|
|
12930
|
+
]
|
|
12931
|
+
}
|
|
12932
|
+
},
|
|
12933
|
+
{
|
|
12934
|
+
"name": "authority",
|
|
12935
|
+
"signer": true
|
|
12936
|
+
}
|
|
12937
|
+
],
|
|
12938
|
+
"args": [
|
|
12939
|
+
{
|
|
12940
|
+
"name": "_sub_account_id",
|
|
12941
|
+
"type": "u16"
|
|
12942
|
+
}
|
|
12943
|
+
]
|
|
12944
|
+
},
|
|
12773
12945
|
{
|
|
12774
12946
|
"name": "update_warm_admin",
|
|
12775
12947
|
"discriminator": [
|
|
@@ -16157,6 +16329,41 @@
|
|
|
16157
16329
|
"code": 6359,
|
|
16158
16330
|
"name": "InvalidEquityFloorTransfer",
|
|
16159
16331
|
"msg": "Invalid equity floor transfer between subaccounts"
|
|
16332
|
+
},
|
|
16333
|
+
{
|
|
16334
|
+
"code": 6360,
|
|
16335
|
+
"name": "IFDepositMintsZeroShares",
|
|
16336
|
+
"msg": "Insurance fund deposit would mint zero shares"
|
|
16337
|
+
},
|
|
16338
|
+
{
|
|
16339
|
+
"code": 6361,
|
|
16340
|
+
"name": "LiquidationWorsensAccountHealth",
|
|
16341
|
+
"msg": "Liquidation would worsen the account's margin shortage"
|
|
16342
|
+
},
|
|
16343
|
+
{
|
|
16344
|
+
"code": 6362,
|
|
16345
|
+
"name": "PerpBankruptcyMustPrecedeSpot",
|
|
16346
|
+
"msg": "Perp bankruptcies must be resolved before spot bankruptcies"
|
|
16347
|
+
},
|
|
16348
|
+
{
|
|
16349
|
+
"code": 6363,
|
|
16350
|
+
"name": "InvalidRevenueShareRecipient",
|
|
16351
|
+
"msg": "Revenue share recipient user must be sub_account_id 0"
|
|
16352
|
+
},
|
|
16353
|
+
{
|
|
16354
|
+
"code": 6364,
|
|
16355
|
+
"name": "DailyDepositLimit",
|
|
16356
|
+
"msg": "Spot market daily deposit limit hit"
|
|
16357
|
+
},
|
|
16358
|
+
{
|
|
16359
|
+
"code": 6365,
|
|
16360
|
+
"name": "ReservedSpotMarketName",
|
|
16361
|
+
"msg": "The name 'USDT' is reserved for the quote spot market (index 0)"
|
|
16362
|
+
},
|
|
16363
|
+
{
|
|
16364
|
+
"code": 6366,
|
|
16365
|
+
"name": "CannotModifyBuilderOrder",
|
|
16366
|
+
"msg": "Cannot modify a builder-coded order; cancel and re-place instead"
|
|
16160
16367
|
}
|
|
16161
16368
|
],
|
|
16162
16369
|
"types": [
|
|
@@ -21204,19 +21411,24 @@
|
|
|
21204
21411
|
}
|
|
21205
21412
|
},
|
|
21206
21413
|
{
|
|
21207
|
-
"name": "
|
|
21414
|
+
"name": "pending_revenue_share",
|
|
21208
21415
|
"docs": [
|
|
21209
|
-
"
|
|
21210
|
-
"
|
|
21211
|
-
"
|
|
21212
|
-
"
|
|
21416
|
+
"Aggregate accrued builder/referrer revenue-share owed out of this",
|
|
21417
|
+
"market's `pnl_pool` but not yet paid: incremented as builder and",
|
|
21418
|
+
"referrer fees accrue on fills (mirrors the per-order",
|
|
21419
|
+
"`RevenueShareOrder.fees_accrued` writes) and decremented as",
|
|
21420
|
+
"`sweep_completed_revenue_share_for_market` pays them. The",
|
|
21421
|
+
"permissionless fee sweep reserves it (like `max(net_user_pnl, 0)` and",
|
|
21422
|
+
"the floored IF tranche) so a protocol-fee drain can't move the tokens",
|
|
21423
|
+
"backing already-owed revenue share out of the pnl pool and leave those",
|
|
21424
|
+
"claims temporarily unpayable. precision: QUOTE_PRECISION.",
|
|
21425
|
+
"",
|
|
21426
|
+
"Occupies the 8 bytes Rust naturally inserts to 16-align AMM's leading",
|
|
21427
|
+
"u128 (formerly explicit `_padding_align_amm`): a u64 at the same",
|
|
21428
|
+
"8-aligned offset keeps every downstream byte offset and the total size",
|
|
21429
|
+
"unchanged, so legacy accounts read 0 (nothing owed) until fees accrue."
|
|
21213
21430
|
],
|
|
21214
|
-
"type":
|
|
21215
|
-
"array": [
|
|
21216
|
-
"u8",
|
|
21217
|
-
8
|
|
21218
|
-
]
|
|
21219
|
-
}
|
|
21431
|
+
"type": "u64"
|
|
21220
21432
|
},
|
|
21221
21433
|
{
|
|
21222
21434
|
"name": "amm",
|
|
@@ -22998,15 +23210,44 @@
|
|
|
22998
23210
|
{
|
|
22999
23211
|
"name": "_padding_align_pfp",
|
|
23000
23212
|
"docs": [
|
|
23001
|
-
"
|
|
23002
|
-
"
|
|
23213
|
+
"Explicit filler carved from the alignment gap before `protocol_fee_pool`",
|
|
23214
|
+
"(which must stay at struct offset 752 so host/SBF layouts agree and the",
|
|
23215
|
+
"borsh/IDL packed offset matches). The gap is 13 bytes; the three",
|
|
23216
|
+
"configurable-limit fields below plus this 1-byte filler fill it exactly,",
|
|
23217
|
+
"so `protocol_fee_pool` and every field after it keep their offsets and the",
|
|
23218
|
+
"account size is unchanged. Reads 0 on markets created before these fields",
|
|
23219
|
+
"existed. Every byte is explicit so no implicit `#[repr(C)]` pad desyncs",
|
|
23220
|
+
"off-chain borsh decoders. Do not reorder or resize."
|
|
23003
23221
|
],
|
|
23004
|
-
"type":
|
|
23005
|
-
|
|
23006
|
-
|
|
23007
|
-
|
|
23008
|
-
|
|
23009
|
-
|
|
23222
|
+
"type": "u8"
|
|
23223
|
+
},
|
|
23224
|
+
{
|
|
23225
|
+
"name": "withdraw_circuit_breaker_bps",
|
|
23226
|
+
"docs": [
|
|
23227
|
+
"Daily withdraw circuit-breaker size: the max fraction of the 24h deposit",
|
|
23228
|
+
"TWAP that may be withdrawn per 24h window. `0` is treated as the default",
|
|
23229
|
+
"(2500 bps = 25%) so markets created before this field existed keep prior",
|
|
23230
|
+
"behavior. precision: basis points (10_000 = 100%)"
|
|
23231
|
+
],
|
|
23232
|
+
"type": "u16"
|
|
23233
|
+
},
|
|
23234
|
+
{
|
|
23235
|
+
"name": "max_deposit_bps_per_day",
|
|
23236
|
+
"docs": [
|
|
23237
|
+
"Daily deposit rate limit: the max fraction above the 24h deposit TWAP that",
|
|
23238
|
+
"resulting deposits may reach per 24h window. Disabled when `0`.",
|
|
23239
|
+
"precision: basis points (10_000 = 100%)"
|
|
23240
|
+
],
|
|
23241
|
+
"type": "u16"
|
|
23242
|
+
},
|
|
23243
|
+
{
|
|
23244
|
+
"name": "deposit_guard_threshold",
|
|
23245
|
+
"docs": [
|
|
23246
|
+
"No deposit rate limit when resulting deposits are below this threshold.",
|
|
23247
|
+
"Mirrors `withdraw_guard_threshold` on the deposit side.",
|
|
23248
|
+
"precision: token mint precision"
|
|
23249
|
+
],
|
|
23250
|
+
"type": "u64"
|
|
23010
23251
|
},
|
|
23011
23252
|
{
|
|
23012
23253
|
"name": "protocol_fee_pool",
|
|
@@ -23042,13 +23283,33 @@
|
|
|
23042
23283
|
"type": "u32"
|
|
23043
23284
|
},
|
|
23044
23285
|
{
|
|
23045
|
-
"name": "
|
|
23046
|
-
"
|
|
23047
|
-
"
|
|
23048
|
-
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
23286
|
+
"name": "if_last_settle_vault_amount",
|
|
23287
|
+
"docs": [
|
|
23288
|
+
"Donation-proof accounted balance of the insurance-fund vault. It is moved",
|
|
23289
|
+
"by the same signed delta as the real SPL vault on *every* instruction that",
|
|
23290
|
+
"moves the vault, so it stays a faithful shadow of the vault minus raw",
|
|
23291
|
+
"donations. Inflows grow it: staker deposits (`add_insurance_fund_stake`)",
|
|
23292
|
+
"and settled revenue (`settle_revenue_to_insurance_fund`). Outflows/draws",
|
|
23293
|
+
"shrink it (saturating at 0): staker withdrawals",
|
|
23294
|
+
"(`remove_insurance_fund_stake`) and every IF draw that covers a loss —",
|
|
23295
|
+
"`resolve_perp_pnl_deficit`, `resolve_perp_bankruptcy`,",
|
|
23296
|
+
"`resolve_spot_bankruptcy`. The one movement deliberately *excluded* is a",
|
|
23297
|
+
"raw SPL transfer straight into the vault: it runs no instruction, so it",
|
|
23298
|
+
"never enters this balance — that is exactly the donation the shadow must",
|
|
23299
|
+
"not see. Consumed by the per-period revenue-settle APR cap in",
|
|
23300
|
+
"`settle_revenue_to_insurance_fund`, sized off `min(live_if_vault, this)`,",
|
|
23301
|
+
"so a donation spiked into the live vault right before a settle cannot",
|
|
23302
|
+
"inflate the cap while legitimate stakes and real settled revenue (which",
|
|
23303
|
+
"this balance tracks) still do. (The unstake-cancel share forfeiture is",
|
|
23304
|
+
"donation-proofed differently — by withdraw-and-restake at the active share",
|
|
23305
|
+
"price — and does *not* read this field.) Repurposed from trailing padding —",
|
|
23306
|
+
"layout/size unchanged; `0` means \"uninitialized\" (existing account",
|
|
23307
|
+
"pre-upgrade, or an accounted balance legitimately drained to empty — an",
|
|
23308
|
+
"empty IF vault has no user shares, so this is safe), and is seeded from the",
|
|
23309
|
+
"live balance on the next add/settle and treated as \"fall back to live\" by",
|
|
23310
|
+
"the consumers."
|
|
23311
|
+
],
|
|
23312
|
+
"type": "u64"
|
|
23052
23313
|
}
|
|
23053
23314
|
]
|
|
23054
23315
|
}
|
|
@@ -23869,21 +24130,24 @@
|
|
|
23869
24130
|
{
|
|
23870
24131
|
"name": "equity_floor",
|
|
23871
24132
|
"docs": [
|
|
23872
|
-
"Minimum account equity (cross-margin total collateral)
|
|
23873
|
-
"
|
|
23874
|
-
"
|
|
24133
|
+
"Minimum account equity (cross-margin total collateral). Below this the",
|
|
24134
|
+
"permissionless breaker can trip. Risk-increasing orders, fills,",
|
|
24135
|
+
"withdrawals and deposit transfers must clear `equity_floor +",
|
|
24136
|
+
"equity_floor_buffer`. Settable only by the warm/cold admin; 0 disables",
|
|
24137
|
+
"both checks.",
|
|
23875
24138
|
"precision: QUOTE_PRECISION"
|
|
23876
24139
|
],
|
|
23877
24140
|
"type": "u64"
|
|
23878
24141
|
},
|
|
23879
24142
|
{
|
|
23880
|
-
"name": "
|
|
23881
|
-
"
|
|
23882
|
-
"
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
24143
|
+
"name": "equity_floor_buffer",
|
|
24144
|
+
"docs": [
|
|
24145
|
+
"Extra headroom above `equity_floor` required by risk-increasing",
|
|
24146
|
+
"actions, so an account cannot legally end an action at the trip",
|
|
24147
|
+
"threshold. No effect while `equity_floor` is 0.",
|
|
24148
|
+
"precision: QUOTE_PRECISION"
|
|
24149
|
+
],
|
|
24150
|
+
"type": "u64"
|
|
23887
24151
|
}
|
|
23888
24152
|
]
|
|
23889
24153
|
}
|
package/lib/node/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from './adminClient';
|
|
|
45
45
|
export * from './assert/assert';
|
|
46
46
|
export { PythLazerSubscriber, type PythLazerPriceFeedArray, type PriceUpdateAccount, } from './pyth';
|
|
47
47
|
export * from './testClient';
|
|
48
|
+
export * from './equityFloorManager';
|
|
48
49
|
export * from './user';
|
|
49
50
|
export * from './userConfig';
|
|
50
51
|
export * from './userStats';
|
|
@@ -109,6 +110,7 @@ export * from './tx/priorityFeeCalculator';
|
|
|
109
110
|
export * from './tx/types';
|
|
110
111
|
export * from './tx/txHandler';
|
|
111
112
|
export * from './tx/txParamProcessor';
|
|
113
|
+
export * from './tx/utils';
|
|
112
114
|
export * from './util/computeUnits';
|
|
113
115
|
export * from './util/digest';
|
|
114
116
|
export * from './util/promiseTimeout';
|
package/lib/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,IAAI,MAAM,qBAAqB,CAAC;AAEvC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,qDAAqD,CAAC;AACpE,cAAc,yDAAyD,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,iCAAiC,EAAE,MAAM,8CAA8C,CAAC;AACj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B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,aAAa,CAAC;AAC5B,cAAc,iCAAiC,CAAC;AAChD,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC"}
|
package/lib/node/index.js
CHANGED
|
@@ -75,6 +75,7 @@ __exportStar(require("./assert/assert"), exports);
|
|
|
75
75
|
var pyth_1 = require("./pyth");
|
|
76
76
|
Object.defineProperty(exports, "PythLazerSubscriber", { enumerable: true, get: function () { return pyth_1.PythLazerSubscriber; } });
|
|
77
77
|
__exportStar(require("./testClient"), exports);
|
|
78
|
+
__exportStar(require("./equityFloorManager"), exports);
|
|
78
79
|
__exportStar(require("./user"), exports);
|
|
79
80
|
__exportStar(require("./userConfig"), exports);
|
|
80
81
|
__exportStar(require("./userStats"), exports);
|
|
@@ -140,6 +141,7 @@ __exportStar(require("./tx/priorityFeeCalculator"), exports);
|
|
|
140
141
|
__exportStar(require("./tx/types"), exports);
|
|
141
142
|
__exportStar(require("./tx/txHandler"), exports);
|
|
142
143
|
__exportStar(require("./tx/txParamProcessor"), exports);
|
|
144
|
+
__exportStar(require("./tx/utils"), exports);
|
|
143
145
|
__exportStar(require("./util/computeUnits"), exports);
|
|
144
146
|
__exportStar(require("./util/digest"), exports);
|
|
145
147
|
__exportStar(require("./util/promiseTimeout"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jupiterClient.d.ts","sourceRoot":"","sources":["../../../src/jupiter/jupiterClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,UAAU,EACV,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,GAAG;IACnB,MAAM,EAAE,M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ACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,aAAa,CAAC;IA0E1B;;;;;OAKG;IACU,OAAO,CAAC,EACpB,KAAK,EACL,aAAa,EACb,WAAgB,GAChB,EAAE;QACF,KAAK,EAAE,aAAa,CAAC;QACrB,aAAa,EAAE,SAAS,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuCjC;;;OAGG;IACU,oCAAoC,CAAC,EACjD,WAAW,GACX,EAAE;QACF,WAAW,EAAE,oBAAoB,CAAC;KAClC,GAAG,OAAO,CAAC;QACX,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,YAAY,EAAE,yBAAyB,EAAE,CAAC;KAC1C,CAAC;IAsBI,cAAc,CACnB,UAAU,EAAE,SAAS,GACnB,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;IAqBjD;;;;;OAKG;IACI,sBAAsB,CAAC,EAC7B,kBAAkB,EAClB,SAAS,EACT,UAAU,GACV,EAAE;QACF,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,SAAS,EAAE,SAAS,CAAC;QACrB,UAAU,EAAE,SAAS,CAAC;KACtB,GAAG,sBAAsB,EAAE;CAmC5B"}
|
|
@@ -47,6 +47,7 @@ class JupiterClient {
|
|
|
47
47
|
*/
|
|
48
48
|
async getQuote({ inputMint, outputMint, amount, maxAccounts = 50, // 50 is an estimated amount with buffer
|
|
49
49
|
slippageBps = 50, swapMode = 'ExactIn', onlyDirectRoutes = false, excludeDexes, autoSlippage = false, maxAutoSlippageBps, usdEstimate, }) {
|
|
50
|
+
var _a;
|
|
50
51
|
if (autoSlippage && maxAutoSlippageBps === undefined) {
|
|
51
52
|
throw new Error('JupiterClient.getQuote: maxAutoSlippageBps is required when autoSlippage is enabled');
|
|
52
53
|
}
|
|
@@ -78,7 +79,21 @@ class JupiterClient {
|
|
|
78
79
|
: '';
|
|
79
80
|
const headers = this.getHeaders();
|
|
80
81
|
const fetchOptions = Object.keys(headers).length > 0 ? { headers } : {};
|
|
81
|
-
const
|
|
82
|
+
const response = await (0, node_fetch_1.default)(`${this.url}${apiVersionParam}/quote?${params.toString()}`, fetchOptions);
|
|
83
|
+
const quote = (await response.json().catch(() => undefined));
|
|
84
|
+
// A failed quote still returns parseable JSON — an `{ error, errorCode }`
|
|
85
|
+
// body with no mints or amounts. Returning it unchecked pushes the failure
|
|
86
|
+
// downstream to /swap, which rejects it with an opaque deserialization
|
|
87
|
+
// error ("missing field `inputMint`") that hides the real cause.
|
|
88
|
+
if (!response.ok || !quote) {
|
|
89
|
+
throw new Error(`Jupiter quote failed: ${response.status} ${(quote === null || quote === void 0 ? void 0 : quote.error) || (quote === null || quote === void 0 ? void 0 : quote.errorCode) || response.statusText}`);
|
|
90
|
+
}
|
|
91
|
+
if (quote.error || quote.errorCode) {
|
|
92
|
+
throw new Error(`Jupiter quote failed: ${(_a = quote.error) !== null && _a !== void 0 ? _a : quote.errorCode}`);
|
|
93
|
+
}
|
|
94
|
+
if (!quote.inputMint || !quote.outputMint || !quote.outAmount) {
|
|
95
|
+
throw new Error('Jupiter quote failed: response is missing route fields');
|
|
96
|
+
}
|
|
82
97
|
return quote;
|
|
83
98
|
}
|
|
84
99
|
/**
|
|
@@ -134,12 +149,18 @@ class JupiterClient {
|
|
|
134
149
|
};
|
|
135
150
|
}
|
|
136
151
|
async getLookupTable(accountKey) {
|
|
137
|
-
var _a;
|
|
138
152
|
const cached = this.lookupTableCahce.get(accountKey.toString());
|
|
139
153
|
if (cached !== undefined) {
|
|
140
154
|
return cached;
|
|
141
155
|
}
|
|
142
|
-
|
|
156
|
+
const lookupTable = (await this.connection.getAddressLookupTable(accountKey)).value;
|
|
157
|
+
if (!lookupTable) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
// Populate the cache — without this every route re-fetches the same tables,
|
|
161
|
+
// which is a large share of the RPC calls a swap makes.
|
|
162
|
+
this.lookupTableCahce.set(accountKey.toString(), lookupTable);
|
|
163
|
+
return lookupTable;
|
|
143
164
|
}
|
|
144
165
|
/**
|
|
145
166
|
* Get the jupiter instructions from transaction by filtering out instructions to compute budget and associated token programs
|
|
@@ -85,6 +85,37 @@ export declare function calculatePerpIfFee(marginShortage: BN, userBaseAssetAmou
|
|
|
85
85
|
* `liabilityLiquidationMultiplier` is zero.
|
|
86
86
|
*/
|
|
87
87
|
export declare function calculateSpotIfFee(marginShortage: BN, tokenAmount: BN, assetWeight: number, assetLiquidationMultiplier: number, liabilityWeight: number, liabilityLiquidationMultiplier: number, liabilityDecimals: number, liabilityPrice: BN, maxIfFee: number): number;
|
|
88
|
+
/**
|
|
89
|
+
* User-protective price at which a collateral (deposit) asset is seized when its oracle is
|
|
90
|
+
* margin-invalid (`StaleForMargin`/`TooUncertain`) but still acceptable for
|
|
91
|
+
* `VelocityAction::Liquidate`, mirroring `calculate_user_protective_asset_price` in
|
|
92
|
+
* `programs/velocity/src/math/liquidation.rs`. The program sizes the asset-conversion leg
|
|
93
|
+
* of spot and pnl-vs-spot liquidations (and the swap-liquidation worst-case price) with this
|
|
94
|
+
* instead of the raw oracle price whenever the deposit oracle fails the margin-calc validity
|
|
95
|
+
* gate — a stale or uncertain oracle can make an account liquidatable but cannot cheapen its
|
|
96
|
+
* collateral. Pass the result as `assetPrice` to `calculateAssetTransferForLiabilityTransfer`
|
|
97
|
+
* to predict on-chain transfer amounts in that case.
|
|
98
|
+
* @param oraclePrice Raw oracle price of the asset, PRICE_PRECISION (1e6).
|
|
99
|
+
* @param oracleConfidence Oracle confidence interval, PRICE_PRECISION (1e6).
|
|
100
|
+
* @param lastOraclePriceTwap5Min The asset spot market's `historicalOracleData.lastOraclePriceTwap5Min`, PRICE_PRECISION (1e6).
|
|
101
|
+
* @returns `max(oraclePrice, lastOraclePriceTwap5Min, oraclePrice + oracleConfidence)`, PRICE_PRECISION (1e6).
|
|
102
|
+
*/
|
|
103
|
+
export declare function calculateUserProtectiveAssetPrice(oraclePrice: BN, oracleConfidence: BN, lastOraclePriceTwap5Min: BN): BN;
|
|
104
|
+
/**
|
|
105
|
+
* Liability-side counterpart of `calculateUserProtectiveAssetPrice`, mirroring
|
|
106
|
+
* `calculate_user_protective_liability_price` in
|
|
107
|
+
* `programs/velocity/src/math/liquidation.rs`. When the borrow (liability) oracle is
|
|
108
|
+
* margin-invalid, the program prices the repayment leg of spot and pnl-vs-spot liquidations
|
|
109
|
+
* (and the swap-liquidation worst-case price) at this instead of the raw oracle price, so an
|
|
110
|
+
* inflated stale/uncertain debt price cannot cheapen the collateral (or pnl) exchanged for
|
|
111
|
+
* it. Pass the result as `liabilityPrice` to `calculateAssetTransferForLiabilityTransfer` to
|
|
112
|
+
* predict on-chain transfer amounts in that case.
|
|
113
|
+
* @param oraclePrice Raw oracle price of the liability, PRICE_PRECISION (1e6).
|
|
114
|
+
* @param oracleConfidence Oracle confidence interval, PRICE_PRECISION (1e6).
|
|
115
|
+
* @param lastOraclePriceTwap5Min The liability spot market's `historicalOracleData.lastOraclePriceTwap5Min`, PRICE_PRECISION (1e6).
|
|
116
|
+
* @returns `min(oraclePrice, lastOraclePriceTwap5Min, oraclePrice - oracleConfidence)`, floored at 1, PRICE_PRECISION (1e6).
|
|
117
|
+
*/
|
|
118
|
+
export declare function calculateUserProtectiveLiabilityPrice(oraclePrice: BN, oracleConfidence: BN, lastOraclePriceTwap5Min: BN): BN;
|
|
88
119
|
/**
|
|
89
120
|
* Calculates how much of a liquidated user's collateral asset a liquidator receives in
|
|
90
121
|
* exchange for repaying `liabilityAmount` of a liability, mirroring
|
|
@@ -97,11 +128,15 @@ export declare function calculateSpotIfFee(marginShortage: BN, tokenAmount: BN,
|
|
|
97
128
|
* @param assetAmount User's available balance of the asset being transferred, asset spot market's own token precision.
|
|
98
129
|
* @param assetLiquidationMultiplier Liquidation-time discount multiplier on the asset side, LIQUIDATION_FEE_PRECISION (1e6).
|
|
99
130
|
* @param assetDecimals Asset spot market's token decimals.
|
|
100
|
-
* @param assetPrice Oracle price of the asset, PRICE_PRECISION (1e6).
|
|
131
|
+
* @param assetPrice Oracle price of the asset, PRICE_PRECISION (1e6). When the asset oracle
|
|
132
|
+
* is margin-invalid, the program prices the seizure protectively — pass
|
|
133
|
+
* `calculateUserProtectiveAssetPrice(...)` instead of the raw oracle price to match.
|
|
101
134
|
* @param liabilityAmount Liability amount being repaid, liability spot market's own token precision.
|
|
102
135
|
* @param liabilityLiquidationMultiplier Liquidation-time premium multiplier on the liability side, LIQUIDATION_FEE_PRECISION (1e6).
|
|
103
136
|
* @param liabilityDecimals Liability spot market's token decimals.
|
|
104
|
-
* @param liabilityPrice Oracle price of the liability asset, PRICE_PRECISION (1e6).
|
|
137
|
+
* @param liabilityPrice Oracle price of the liability asset, PRICE_PRECISION (1e6). When the
|
|
138
|
+
* liability oracle is margin-invalid, the program prices the repayment protectively — pass
|
|
139
|
+
* `calculateUserProtectiveLiabilityPrice(...)` instead of the raw oracle price to match.
|
|
105
140
|
* @returns Asset amount to transfer to the liquidator, asset spot market's own token precision (floored at 1).
|
|
106
141
|
*/
|
|
107
142
|
export declare function calculateAssetTransferForLiabilityTransfer(assetAmount: BN, assetLiquidationMultiplier: number, assetDecimals: number, assetPrice: BN, liabilityAmount: BN, liabilityLiquidationMultiplier: number, liabilityDecimals: number, liabilityPrice: BN): BN | undefined;
|