@bulletxyz/bullet-sdk 0.49.8 → 0.49.10
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/dist/browser/bullet_wasm_bg.wasm +0 -0
- package/dist/browser/index.js +175 -103
- package/dist/browser/index.js.map +7 -6
- package/dist/node/bullet_wasm_bg.wasm +0 -0
- package/dist/node/index.js +175 -103
- package/dist/node/index.js.map +7 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bullet-wasm/wasm-glue.d.ts +4 -4
- package/dist/types/client.d.ts +1 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/rollupTypes.d.ts +4 -4
- package/dist/types/rollupTypes.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/zod-types/rest.d.ts +1822 -473
- package/dist/types/zod-types/rest.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -681,7 +681,7 @@ class BulletWasm {
|
|
|
681
681
|
}
|
|
682
682
|
constructor() {
|
|
683
683
|
let ret = wasm.bulletwasm_new();
|
|
684
|
-
return this.__wbg_ptr = ret
|
|
684
|
+
return this.__wbg_ptr = ret, BulletWasmFinalization.register(this, this.__wbg_ptr, this), this;
|
|
685
685
|
}
|
|
686
686
|
static simulate_cross_margin_estimated_liquidation_price_on_order(market_id, new_order_args, base_asset_id, user_account, risk_engine, orderbook) {
|
|
687
687
|
try {
|
|
@@ -725,7 +725,6 @@ if (Symbol.dispose)
|
|
|
725
725
|
|
|
726
726
|
class MarginMode {
|
|
727
727
|
static __wrap(ptr) {
|
|
728
|
-
ptr = ptr >>> 0;
|
|
729
728
|
let obj = Object.create(MarginMode.prototype);
|
|
730
729
|
return obj.__wbg_ptr = ptr, MarginModeFinalization.register(obj, obj.__wbg_ptr, obj), obj;
|
|
731
730
|
}
|
|
@@ -753,76 +752,76 @@ function __wbg_get_imports() {
|
|
|
753
752
|
__proto__: null,
|
|
754
753
|
"./bullet_wasm_bg.js": {
|
|
755
754
|
__proto__: null,
|
|
756
|
-
|
|
755
|
+
__wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
|
|
757
756
|
let ret = Error(getStringFromWasm0(arg0, arg1));
|
|
758
757
|
return addHeapObject(ret);
|
|
759
758
|
},
|
|
760
|
-
|
|
759
|
+
__wbg_Number_b7972a139bfbfdf0: function(arg0) {
|
|
761
760
|
return Number(getObject(arg0));
|
|
762
761
|
},
|
|
763
762
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
764
763
|
let ret = String(getObject(arg1)), ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2), len1 = WASM_VECTOR_LEN;
|
|
765
764
|
getDataViewMemory0().setInt32(arg0 + 4, len1, !0), getDataViewMemory0().setInt32(arg0 + 0, ptr1, !0);
|
|
766
765
|
},
|
|
767
|
-
|
|
766
|
+
__wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83: function(arg0, arg1) {
|
|
768
767
|
let v = getObject(arg1), ret = typeof v === "bigint" ? v : void 0;
|
|
769
768
|
getDataViewMemory0().setBigInt64(arg0 + 8, isLikeNone(ret) ? BigInt(0) : ret, !0), getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), !0);
|
|
770
769
|
},
|
|
771
|
-
|
|
770
|
+
__wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
|
|
772
771
|
let v = getObject(arg0), ret = typeof v === "boolean" ? v : void 0;
|
|
773
772
|
return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
|
|
774
773
|
},
|
|
775
|
-
|
|
774
|
+
__wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) {
|
|
776
775
|
let ret = debugString(getObject(arg1)), ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2), len1 = WASM_VECTOR_LEN;
|
|
777
776
|
getDataViewMemory0().setInt32(arg0 + 4, len1, !0), getDataViewMemory0().setInt32(arg0 + 0, ptr1, !0);
|
|
778
777
|
},
|
|
779
|
-
|
|
778
|
+
__wbg___wbindgen_in_07056af4f902c445: function(arg0, arg1) {
|
|
780
779
|
return getObject(arg0) in getObject(arg1);
|
|
781
780
|
},
|
|
782
|
-
|
|
781
|
+
__wbg___wbindgen_is_bigint_aeae3893f30ed54e: function(arg0) {
|
|
783
782
|
return typeof getObject(arg0) === "bigint";
|
|
784
783
|
},
|
|
785
|
-
|
|
784
|
+
__wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
|
|
786
785
|
return typeof getObject(arg0) === "function";
|
|
787
786
|
},
|
|
788
|
-
|
|
787
|
+
__wbg___wbindgen_is_object_b4593df85baada48: function(arg0) {
|
|
789
788
|
let val = getObject(arg0);
|
|
790
789
|
return typeof val === "object" && val !== null;
|
|
791
790
|
},
|
|
792
|
-
|
|
791
|
+
__wbg___wbindgen_is_string_dde0fd9020db4434: function(arg0) {
|
|
793
792
|
return typeof getObject(arg0) === "string";
|
|
794
793
|
},
|
|
795
|
-
|
|
794
|
+
__wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
|
|
796
795
|
return getObject(arg0) === void 0;
|
|
797
796
|
},
|
|
798
|
-
|
|
797
|
+
__wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9: function(arg0, arg1) {
|
|
799
798
|
return getObject(arg0) === getObject(arg1);
|
|
800
799
|
},
|
|
801
|
-
|
|
800
|
+
__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c: function(arg0, arg1) {
|
|
802
801
|
return getObject(arg0) == getObject(arg1);
|
|
803
802
|
},
|
|
804
|
-
|
|
803
|
+
__wbg___wbindgen_number_get_f73a1244370fcc2c: function(arg0, arg1) {
|
|
805
804
|
let obj = getObject(arg1), ret = typeof obj === "number" ? obj : void 0;
|
|
806
805
|
getDataViewMemory0().setFloat64(arg0 + 8, isLikeNone(ret) ? 0 : ret, !0), getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), !0);
|
|
807
806
|
},
|
|
808
|
-
|
|
807
|
+
__wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
|
|
809
808
|
let obj = getObject(arg1), ret = typeof obj === "string" ? obj : void 0;
|
|
810
809
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2), len1 = WASM_VECTOR_LEN;
|
|
811
810
|
getDataViewMemory0().setInt32(arg0 + 4, len1, !0), getDataViewMemory0().setInt32(arg0 + 0, ptr1, !0);
|
|
812
811
|
},
|
|
813
|
-
|
|
812
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
814
813
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
815
814
|
},
|
|
816
|
-
|
|
815
|
+
__wbg_call_13665d9f14390edc: function() {
|
|
817
816
|
return handleError(function(arg0, arg1) {
|
|
818
817
|
let ret = getObject(arg0).call(getObject(arg1));
|
|
819
818
|
return addHeapObject(ret);
|
|
820
819
|
}, arguments);
|
|
821
820
|
},
|
|
822
|
-
|
|
821
|
+
__wbg_done_54b8da57023b7ed2: function(arg0) {
|
|
823
822
|
return getObject(arg0).done;
|
|
824
823
|
},
|
|
825
|
-
|
|
824
|
+
__wbg_entries_564a7e8b1e54ede5: function(arg0) {
|
|
826
825
|
let ret = Object.entries(getObject(arg0));
|
|
827
826
|
return addHeapObject(ret);
|
|
828
827
|
},
|
|
@@ -834,17 +833,17 @@ function __wbg_get_imports() {
|
|
|
834
833
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
835
834
|
}
|
|
836
835
|
},
|
|
837
|
-
|
|
836
|
+
__wbg_get_3e9a707ab7d352eb: function() {
|
|
838
837
|
return handleError(function(arg0, arg1) {
|
|
839
838
|
let ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
840
839
|
return addHeapObject(ret);
|
|
841
840
|
}, arguments);
|
|
842
841
|
},
|
|
843
|
-
|
|
842
|
+
__wbg_get_98fdf51d029a75eb: function(arg0, arg1) {
|
|
844
843
|
let ret = getObject(arg0)[arg1 >>> 0];
|
|
845
844
|
return addHeapObject(ret);
|
|
846
845
|
},
|
|
847
|
-
|
|
846
|
+
__wbg_get_unchecked_1dfe6d05ad91d9b7: function(arg0, arg1) {
|
|
848
847
|
let ret = getObject(arg0)[arg1 >>> 0];
|
|
849
848
|
return addHeapObject(ret);
|
|
850
849
|
},
|
|
@@ -852,7 +851,7 @@ function __wbg_get_imports() {
|
|
|
852
851
|
let ret = getObject(arg0)[getObject(arg1)];
|
|
853
852
|
return addHeapObject(ret);
|
|
854
853
|
},
|
|
855
|
-
|
|
854
|
+
__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe: function(arg0) {
|
|
856
855
|
let result;
|
|
857
856
|
try {
|
|
858
857
|
result = getObject(arg0) instanceof ArrayBuffer;
|
|
@@ -861,7 +860,7 @@ function __wbg_get_imports() {
|
|
|
861
860
|
}
|
|
862
861
|
return result;
|
|
863
862
|
},
|
|
864
|
-
|
|
863
|
+
__wbg_instanceof_Map_16f217b9a2a08d8c: function(arg0) {
|
|
865
864
|
let result;
|
|
866
865
|
try {
|
|
867
866
|
result = getObject(arg0) instanceof Map;
|
|
@@ -870,7 +869,7 @@ function __wbg_get_imports() {
|
|
|
870
869
|
}
|
|
871
870
|
return result;
|
|
872
871
|
},
|
|
873
|
-
|
|
872
|
+
__wbg_instanceof_Uint8Array_abd07d4bd221d50b: function(arg0) {
|
|
874
873
|
let result;
|
|
875
874
|
try {
|
|
876
875
|
result = getObject(arg0) instanceof Uint8Array;
|
|
@@ -879,60 +878,60 @@ function __wbg_get_imports() {
|
|
|
879
878
|
}
|
|
880
879
|
return result;
|
|
881
880
|
},
|
|
882
|
-
|
|
881
|
+
__wbg_isArray_94898ed3aad6947b: function(arg0) {
|
|
883
882
|
return Array.isArray(getObject(arg0));
|
|
884
883
|
},
|
|
885
|
-
|
|
884
|
+
__wbg_isSafeInteger_01e964d144ad3a55: function(arg0) {
|
|
886
885
|
return Number.isSafeInteger(getObject(arg0));
|
|
887
886
|
},
|
|
888
|
-
|
|
887
|
+
__wbg_iterator_1441b47f341dc34f: function() {
|
|
889
888
|
return addHeapObject(Symbol.iterator);
|
|
890
889
|
},
|
|
891
|
-
|
|
890
|
+
__wbg_length_2591a0f4f659a55c: function(arg0) {
|
|
892
891
|
return getObject(arg0).length;
|
|
893
892
|
},
|
|
894
|
-
|
|
893
|
+
__wbg_length_56fcd3e2b7e0299d: function(arg0) {
|
|
895
894
|
return getObject(arg0).length;
|
|
896
895
|
},
|
|
897
|
-
|
|
898
|
-
let ret = new
|
|
896
|
+
__wbg_new_02d162bc6cf02f60: function() {
|
|
897
|
+
let ret = new Object;
|
|
899
898
|
return addHeapObject(ret);
|
|
900
899
|
},
|
|
900
|
+
__wbg_new_070df68d66325372: function() {
|
|
901
|
+
return addHeapObject(/* @__PURE__ */ new Map);
|
|
902
|
+
},
|
|
901
903
|
__wbg_new_227d7c05414eb861: function() {
|
|
902
904
|
let ret = new Error;
|
|
903
905
|
return addHeapObject(ret);
|
|
904
906
|
},
|
|
905
|
-
|
|
906
|
-
return addHeapObject(/* @__PURE__ */ new Map);
|
|
907
|
-
},
|
|
908
|
-
__wbg_new_682678e2f47e32bc: function() {
|
|
907
|
+
__wbg_new_310879b66b6e95e1: function() {
|
|
909
908
|
let ret = new Array;
|
|
910
909
|
return addHeapObject(ret);
|
|
911
910
|
},
|
|
912
|
-
|
|
913
|
-
let ret = new
|
|
911
|
+
__wbg_new_7ddec6de44ff8f5d: function(arg0) {
|
|
912
|
+
let ret = new Uint8Array(getObject(arg0));
|
|
913
|
+
return addHeapObject(ret);
|
|
914
|
+
},
|
|
915
|
+
__wbg_next_2a4e19f4f5083b0f: function(arg0) {
|
|
916
|
+
let ret = getObject(arg0).next;
|
|
914
917
|
return addHeapObject(ret);
|
|
915
918
|
},
|
|
916
|
-
|
|
919
|
+
__wbg_next_6429a146bf756f93: function() {
|
|
917
920
|
return handleError(function(arg0) {
|
|
918
921
|
let ret = getObject(arg0).next();
|
|
919
922
|
return addHeapObject(ret);
|
|
920
923
|
}, arguments);
|
|
921
924
|
},
|
|
922
|
-
|
|
923
|
-
let ret = getObject(arg0).next;
|
|
924
|
-
return addHeapObject(ret);
|
|
925
|
-
},
|
|
926
|
-
__wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
|
|
925
|
+
__wbg_prototypesetcall_5f9bdc8d75e07276: function(arg0, arg1, arg2) {
|
|
927
926
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
928
927
|
},
|
|
929
|
-
__wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
|
|
930
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
931
|
-
},
|
|
932
928
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
933
929
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
934
930
|
},
|
|
935
|
-
|
|
931
|
+
__wbg_set_78ea6a19f4818587: function(arg0, arg1, arg2) {
|
|
932
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
933
|
+
},
|
|
934
|
+
__wbg_set_facb7a5914e0fa39: function(arg0, arg1, arg2) {
|
|
936
935
|
let ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
937
936
|
return addHeapObject(ret);
|
|
938
937
|
},
|
|
@@ -940,7 +939,7 @@ function __wbg_get_imports() {
|
|
|
940
939
|
let ret = getObject(arg1).stack, ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2), len1 = WASM_VECTOR_LEN;
|
|
941
940
|
getDataViewMemory0().setInt32(arg0 + 4, len1, !0), getDataViewMemory0().setInt32(arg0 + 0, ptr1, !0);
|
|
942
941
|
},
|
|
943
|
-
|
|
942
|
+
__wbg_value_9cc0518af87a489c: function(arg0) {
|
|
944
943
|
let ret = getObject(arg0).value;
|
|
945
944
|
return addHeapObject(ret);
|
|
946
945
|
},
|
|
@@ -970,9 +969,9 @@ function __wbg_get_imports() {
|
|
|
970
969
|
}
|
|
971
970
|
var __wbindgen_enum_EquityType = ["unweighted", "weighted_initial", "weighted_maintenance"], __wbindgen_enum_MarginType = ["initial", "maintenance"], __wbindgen_enum_OrderType = ["limit", "post_only", "fill_or_kill", "immediate_or_cancel", "post_only_slide", "post_only_front"], __wbindgen_enum_Side = ["bid", "ask"], BulletWasmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
972
971
|
}, unregister: () => {
|
|
973
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_bulletwasm_free(ptr
|
|
972
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_bulletwasm_free(ptr, 1)), MarginModeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
974
973
|
}, unregister: () => {
|
|
975
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_marginmode_free(ptr
|
|
974
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_marginmode_free(ptr, 1));
|
|
976
975
|
function addHeapObject(obj) {
|
|
977
976
|
if (heap_next === heap.length)
|
|
978
977
|
heap.push(heap.length + 1);
|
|
@@ -1042,7 +1041,7 @@ function getDataViewMemory0() {
|
|
|
1042
1041
|
return cachedDataViewMemory0;
|
|
1043
1042
|
}
|
|
1044
1043
|
function getStringFromWasm0(ptr, len) {
|
|
1045
|
-
return ptr
|
|
1044
|
+
return decodeText(ptr >>> 0, len);
|
|
1046
1045
|
}
|
|
1047
1046
|
var cachedUint8ArrayMemory0 = null;
|
|
1048
1047
|
function getUint8ArrayMemory0() {
|
|
@@ -1108,9 +1107,9 @@ if (!("encodeInto" in cachedTextEncoder))
|
|
|
1108
1107
|
written: buf.length
|
|
1109
1108
|
};
|
|
1110
1109
|
};
|
|
1111
|
-
var WASM_VECTOR_LEN = 0, wasmModule, wasm;
|
|
1110
|
+
var WASM_VECTOR_LEN = 0, wasmModule, wasmInstance, wasm;
|
|
1112
1111
|
function __wbg_finalize_init(instance, module) {
|
|
1113
|
-
return wasm = instance.exports, wasmModule = module, cachedDataViewMemory0 = null, cachedUint8ArrayMemory0 = null, wasm;
|
|
1112
|
+
return wasmInstance = instance, wasm = instance.exports, wasmModule = module, cachedDataViewMemory0 = null, cachedUint8ArrayMemory0 = null, wasm;
|
|
1114
1113
|
}
|
|
1115
1114
|
async function __wbg_load(module, imports) {
|
|
1116
1115
|
if (typeof Response === "function" && module instanceof Response) {
|
|
@@ -1563,6 +1562,16 @@ function isAbortError(error) {
|
|
|
1563
1562
|
return !1;
|
|
1564
1563
|
}
|
|
1565
1564
|
|
|
1565
|
+
// src/types.ts
|
|
1566
|
+
var SPOT_MARKET_ID_OFFSET = 1e4, RWA_PERP_MARKET_ID_OFFSET = 20000;
|
|
1567
|
+
function marketKindFromMarketId(marketId) {
|
|
1568
|
+
if (marketId < 1e4)
|
|
1569
|
+
return "perp";
|
|
1570
|
+
if (marketId < 20000)
|
|
1571
|
+
return "spot";
|
|
1572
|
+
return "rwa_perp";
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1566
1575
|
// src/utils.ts
|
|
1567
1576
|
import bs58 from "bs58";
|
|
1568
1577
|
import Decimal from "decimal.js";
|
|
@@ -1942,7 +1951,11 @@ class WebSocketManager {
|
|
|
1942
1951
|
|
|
1943
1952
|
// src/zod-types/rest.ts
|
|
1944
1953
|
import { z as z3 } from "zod";
|
|
1945
|
-
var MARKET_KINDS = [
|
|
1954
|
+
var MARKET_KINDS = [
|
|
1955
|
+
"perp",
|
|
1956
|
+
"spot",
|
|
1957
|
+
"rwa_perp"
|
|
1958
|
+
], SIDES = ["bid", "ask"], TRIGGER_DIRECTIONS = [
|
|
1946
1959
|
"greater_than_or_equal",
|
|
1947
1960
|
"less_than_or_equal"
|
|
1948
1961
|
], TRIGGER_PRICE_CONDITIONS = [
|
|
@@ -1960,11 +1973,19 @@ var MARKET_KINDS = ["perp", "spot"], SIDES = ["bid", "ask"], TRIGGER_DIRECTIONS
|
|
|
1960
1973
|
version: "V0",
|
|
1961
1974
|
data: d.V0
|
|
1962
1975
|
}));
|
|
1963
|
-
var
|
|
1964
|
-
version: "
|
|
1965
|
-
data: d.
|
|
1966
|
-
})), VersionedV1Value = (schema) => z3.object({ V1: schema }).transform((d) => d.V1), UnversionedOrV1 = (schema) => z3.union([schema, VersionedV1Value(schema)])
|
|
1967
|
-
|
|
1976
|
+
var VersionedV3 = (schema) => z3.object({ V3: schema }).transform((d) => ({
|
|
1977
|
+
version: "V3",
|
|
1978
|
+
data: d.V3
|
|
1979
|
+
})), VersionedV1Value = (schema) => z3.object({ V1: schema }).transform((d) => d.V1), UnversionedOrV1 = (schema) => z3.union([schema, VersionedV1Value(schema)]), VersionedV1V0 = (schemas) => z3.union([
|
|
1980
|
+
z3.object({ V0: schemas.V0 }).transform((d) => ({
|
|
1981
|
+
version: "V0",
|
|
1982
|
+
data: d.V0
|
|
1983
|
+
})),
|
|
1984
|
+
z3.object({ V1: schemas.V1 }).transform((d) => ({
|
|
1985
|
+
version: "V1",
|
|
1986
|
+
data: d.V1
|
|
1987
|
+
}))
|
|
1988
|
+
]), StateResponseSchemas = {
|
|
1968
1989
|
RollupSchema: (valueSchema) => createBaseResponse(z3.object({ schema: valueSchema })),
|
|
1969
1990
|
StateValue: (valueSchema) => createBaseResponse(z3.object({ value: valueSchema.nullable() })),
|
|
1970
1991
|
CustomRouteValue: (valueSchema) => createBaseResponse(valueSchema),
|
|
@@ -2176,22 +2197,39 @@ var StateResponseSchemas = {
|
|
|
2176
2197
|
mark_price: MarkPrice,
|
|
2177
2198
|
accum_premium_index: TimeWeightedPremiumIndex,
|
|
2178
2199
|
funding_meta: FundingMeta
|
|
2179
|
-
}),
|
|
2200
|
+
}), RwaPriceConfig = z3.object({
|
|
2201
|
+
reference_price: DecimalSchema.nullable(),
|
|
2202
|
+
oracle_threshold_ratio: DecimalSchema,
|
|
2203
|
+
up_bound_n: U8Schema,
|
|
2204
|
+
down_bound_n: U8Schema,
|
|
2205
|
+
max_bound_n: U8Schema,
|
|
2206
|
+
funding_dampening_multiplier: DecimalSchema,
|
|
2207
|
+
internal_pricing_time_constant: UnixTimestampMicros
|
|
2208
|
+
}), PricingEngineV1 = z3.object({
|
|
2209
|
+
pricing_frequency_seconds: U32Schema,
|
|
2210
|
+
relaxed_pricing_frequency_seconds: U32Schema,
|
|
2211
|
+
oracle_pricing: createJsonMap(AssetId, OraclePrice),
|
|
2212
|
+
perp_pricing: createJsonMap(MarketId, PerpPrice),
|
|
2213
|
+
rwa_pricing_config: createJsonMap(MarketId, RwaPriceConfig)
|
|
2214
|
+
}), PricingEngineV0 = z3.object({
|
|
2180
2215
|
pricing_frequency_seconds: U32Schema,
|
|
2181
2216
|
relaxed_pricing_frequency_seconds: U32Schema,
|
|
2182
2217
|
oracle_pricing: createJsonMap(AssetId, OraclePrice),
|
|
2183
2218
|
perp_pricing: createJsonMap(MarketId, PerpPrice)
|
|
2184
|
-
}),
|
|
2219
|
+
}), PricingEngine = z3.union([
|
|
2220
|
+
z3.object({ V1: PricingEngineV1 }).transform((d) => d.V1),
|
|
2221
|
+
z3.object({ V0: PricingEngineV0 }).transform((d) => d.V0)
|
|
2222
|
+
]), LeverageTable = z3.object({
|
|
2185
2223
|
tiers: createJsonMap(z3.string(), z3.object({
|
|
2186
2224
|
max_leverage: U16Schema,
|
|
2187
2225
|
mmr: DecimalSchema,
|
|
2188
2226
|
maintenance_amount: DecimalSchema
|
|
2189
2227
|
}))
|
|
2190
|
-
}),
|
|
2228
|
+
}), MarginConfigV0 = z3.object({
|
|
2191
2229
|
perp_liquidation_config: PerpLiquidationConfig,
|
|
2192
2230
|
perp_leverage_tables: createJsonMap(MarketId, LeverageTable),
|
|
2193
2231
|
borrow_lend_risk_configs: createJsonMap(AssetId, BorrowLendRiskConfig)
|
|
2194
|
-
}), GlobalConfig = z3.object({
|
|
2232
|
+
}), MarginConfig = z3.object({ V0: MarginConfigV0 }).transform((d) => d.V0), GlobalConfig = z3.object({
|
|
2195
2233
|
max_orders_per_user: U16Schema,
|
|
2196
2234
|
max_trigger_orders_per_user: U16Schema,
|
|
2197
2235
|
max_orders_per_batch_msg: U16Schema,
|
|
@@ -2234,6 +2272,12 @@ var StateResponseSchemas = {
|
|
|
2234
2272
|
decimals: U8Schema,
|
|
2235
2273
|
withdraw_fee: DecimalSchema
|
|
2236
2274
|
}), MarketInfo = z3.object({
|
|
2275
|
+
id: MarketId,
|
|
2276
|
+
base_asset_id: AssetId,
|
|
2277
|
+
quote_asset_id: AssetId,
|
|
2278
|
+
name: z3.string(),
|
|
2279
|
+
trading_mode: TradingMode
|
|
2280
|
+
}), LegacyMarketInfoV0 = z3.object({
|
|
2237
2281
|
id: MarketId,
|
|
2238
2282
|
kind: z3.enum(MARKET_KINDS),
|
|
2239
2283
|
base_asset_id: AssetId,
|
|
@@ -2243,7 +2287,7 @@ var StateResponseSchemas = {
|
|
|
2243
2287
|
user: Base58Address,
|
|
2244
2288
|
shares: DecimalSchema,
|
|
2245
2289
|
timestamp: UnixTimestampMicros
|
|
2246
|
-
}),
|
|
2290
|
+
}), VaultInfoV0 = z3.object({
|
|
2247
2291
|
leader: Base58Address,
|
|
2248
2292
|
name: z3.string(),
|
|
2249
2293
|
description: z3.string(),
|
|
@@ -2264,7 +2308,7 @@ var StateResponseSchemas = {
|
|
|
2264
2308
|
creation_fee_usdc: DecimalSchema,
|
|
2265
2309
|
min_deposit_value: DecimalSchema
|
|
2266
2310
|
}), VaultRegistry = z3.object({
|
|
2267
|
-
vaults: createJsonMap(Base58Address,
|
|
2311
|
+
vaults: createJsonMap(Base58Address, VaultInfoV0),
|
|
2268
2312
|
config: GlobalVaultConfig,
|
|
2269
2313
|
depositor_state: createJsonMap(Base58Address, createJsonMap(Base58Address, DecimalSchema))
|
|
2270
2314
|
}), UsdcPnlPool = z3.object({
|
|
@@ -2329,18 +2373,25 @@ var StateResponseSchemas = {
|
|
|
2329
2373
|
flags: U32Schema
|
|
2330
2374
|
}), Schemas = {
|
|
2331
2375
|
DummyValue: z3.number(),
|
|
2376
|
+
ExchangeInfoV3: z3.object({
|
|
2377
|
+
global_config: GlobalConfig,
|
|
2378
|
+
global_vault_config: GlobalVaultConfig,
|
|
2379
|
+
admins: AdminRegistry,
|
|
2380
|
+
assets: createJsonMap(AssetId, AssetInfo),
|
|
2381
|
+
markets: createJsonMap(MarketId, MarketInfo)
|
|
2382
|
+
}),
|
|
2332
2383
|
ExchangeInfoV2: z3.object({
|
|
2333
2384
|
global_config: GlobalConfig,
|
|
2334
2385
|
admins: AdminRegistry,
|
|
2335
2386
|
assets: createJsonMap(AssetId, AssetInfo),
|
|
2336
|
-
markets: createJsonMap(MarketId,
|
|
2387
|
+
markets: createJsonMap(MarketId, LegacyMarketInfoV0),
|
|
2337
2388
|
vaults: VaultRegistry
|
|
2338
2389
|
}),
|
|
2339
2390
|
ExchangeInfoV1: z3.object({
|
|
2340
2391
|
global_config: LegacyGlobalConfigV0,
|
|
2341
2392
|
admins: AdminRegistry,
|
|
2342
2393
|
assets: createJsonMap(AssetId, LegacyAssetInfoV0),
|
|
2343
|
-
markets: createJsonMap(MarketId,
|
|
2394
|
+
markets: createJsonMap(MarketId, LegacyMarketInfoV0),
|
|
2344
2395
|
vaults: VaultRegistry
|
|
2345
2396
|
}),
|
|
2346
2397
|
ExchangeAssetsV0: z3.object({
|
|
@@ -2382,9 +2433,13 @@ var StateResponseSchemas = {
|
|
|
2382
2433
|
address: Base58Address,
|
|
2383
2434
|
container: DelegateContainer
|
|
2384
2435
|
}),
|
|
2436
|
+
RiskEngineV1: z3.object({
|
|
2437
|
+
margin_config: MarginConfig,
|
|
2438
|
+
pricing_engine: PricingEngine
|
|
2439
|
+
}),
|
|
2385
2440
|
RiskEngineV0: z3.object({
|
|
2386
|
-
|
|
2387
|
-
|
|
2441
|
+
margin_config: MarginConfigV0,
|
|
2442
|
+
pricing_engine: PricingEngineV0
|
|
2388
2443
|
}),
|
|
2389
2444
|
PerpMarketV0: z3.object({
|
|
2390
2445
|
market_id: MarketId,
|
|
@@ -2403,8 +2458,8 @@ var StateResponseSchemas = {
|
|
|
2403
2458
|
SpotMarketV0: z3.object({
|
|
2404
2459
|
market_id: MarketId,
|
|
2405
2460
|
trading_status: MarketTradingStatus,
|
|
2406
|
-
|
|
2407
|
-
|
|
2461
|
+
_base_asset_id: AssetId,
|
|
2462
|
+
_quote_asset_id: AssetId,
|
|
2408
2463
|
config: SpotMarketConfig,
|
|
2409
2464
|
last_trade_price: DecimalSchema.nullable(),
|
|
2410
2465
|
orderbook: z3.object({
|
|
@@ -2426,10 +2481,12 @@ var StateResponseSchemas = {
|
|
|
2426
2481
|
})
|
|
2427
2482
|
}, ResponseSchemas = {
|
|
2428
2483
|
DummyValue: StateResponseSchemas.StateValue(Schemas.DummyValue),
|
|
2429
|
-
|
|
2430
|
-
ExchangeInfo: StateResponseSchemas.StateValue(VersionedV2(Schemas.ExchangeInfoV2)),
|
|
2484
|
+
ExchangeInfo: StateResponseSchemas.StateValue(VersionedV3(Schemas.ExchangeInfoV3)),
|
|
2431
2485
|
ExchangeAssets: StateResponseSchemas.StateValue(VersionedV0(Schemas.ExchangeAssetsV0)),
|
|
2432
|
-
RiskEngine: StateResponseSchemas.StateValue(
|
|
2486
|
+
RiskEngine: StateResponseSchemas.StateValue(VersionedV1V0({
|
|
2487
|
+
V0: Schemas.RiskEngineV0,
|
|
2488
|
+
V1: Schemas.RiskEngineV1
|
|
2489
|
+
})),
|
|
2433
2490
|
ExecutionIds: StateResponseSchemas.StateValue(VersionedV0(Schemas.ExecutionIdsV0)),
|
|
2434
2491
|
OrderbookL2: createBaseResponse(z3.object({
|
|
2435
2492
|
market_id: MarketId,
|
|
@@ -2521,6 +2578,18 @@ function serializeExchangeInfoForWasm(exchangeInfo) {
|
|
|
2521
2578
|
}
|
|
2522
2579
|
});
|
|
2523
2580
|
}
|
|
2581
|
+
function serializeRiskEngineForWasm(riskEngine) {
|
|
2582
|
+
if (riskEngine.version === "V0")
|
|
2583
|
+
return serializeVersioned(riskEngine);
|
|
2584
|
+
let { margin_config, pricing_engine } = riskEngine.data;
|
|
2585
|
+
return serializeVersioned({
|
|
2586
|
+
version: "V1",
|
|
2587
|
+
data: {
|
|
2588
|
+
margin_config: { V0: margin_config },
|
|
2589
|
+
pricing_engine: "rwa_pricing_config" in pricing_engine ? { V1: pricing_engine } : { V0: pricing_engine }
|
|
2590
|
+
}
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2524
2593
|
function wrapVersion(version, data) {
|
|
2525
2594
|
return { [version]: data };
|
|
2526
2595
|
}
|
|
@@ -2608,7 +2677,7 @@ class ReadOnlyClient {
|
|
|
2608
2677
|
if (info && typeof info.name === "string")
|
|
2609
2678
|
this.marketRegistry.set(info.name, {
|
|
2610
2679
|
id: info.id,
|
|
2611
|
-
kind: info.kind,
|
|
2680
|
+
kind: "kind" in info ? info.kind : marketKindFromMarketId(info.id),
|
|
2612
2681
|
baseAssetId: info.base_asset_id,
|
|
2613
2682
|
name: info.name
|
|
2614
2683
|
}), this.marketRegistryReverse.set(info.id, info.name);
|
|
@@ -2785,71 +2854,71 @@ class ReadOnlyClient {
|
|
|
2785
2854
|
return position.cost_of_trades.div(position.size.abs());
|
|
2786
2855
|
}
|
|
2787
2856
|
calculatePerpUnrealizedPnl(marginMode, userAccount, riskEngine) {
|
|
2788
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2857
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_perp_unrealized_pnl(marginMode, userAccountObject, riskEngineObject);
|
|
2789
2858
|
return new Decimal4(result);
|
|
2790
2859
|
}
|
|
2791
2860
|
calculateAccountEquity(marginMode, equityType, conservative, userAccount, riskEngine) {
|
|
2792
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2861
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_account_equity(marginMode, userAccountObject, conservative, equityType, riskEngineObject);
|
|
2793
2862
|
return new Decimal4(result);
|
|
2794
2863
|
}
|
|
2795
2864
|
calculateAccountLeverage(marginMode, userAccount, riskEngine) {
|
|
2796
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2865
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_account_leverage(marginMode, userAccountObject, riskEngineObject);
|
|
2797
2866
|
return new Decimal4(result);
|
|
2798
2867
|
}
|
|
2799
2868
|
calculateAvailableMargin(marginMode, marginType, conservative, userAccount, riskEngine) {
|
|
2800
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2869
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_available_margin(marginMode, userAccountObject, conservative, marginType, riskEngineObject);
|
|
2801
2870
|
return new Decimal4(result);
|
|
2802
2871
|
}
|
|
2803
2872
|
calculateUsedMargin(marginMode, withdrawal, marginType, userAccount, riskEngine) {
|
|
2804
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2873
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_used_margin(marginMode, userAccountObject, withdrawal, marginType, riskEngineObject);
|
|
2805
2874
|
return new Decimal4(result);
|
|
2806
2875
|
}
|
|
2807
2876
|
calculateUsedPerpMargin(marginMode, userAccount, marginType, riskEngine) {
|
|
2808
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2877
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_used_perp_margin(marginMode, userAccountObject, marginType, riskEngineObject);
|
|
2809
2878
|
return new Decimal4(result);
|
|
2810
2879
|
}
|
|
2811
2880
|
calculateUsedBorrowLendMargin(userAccount, marginType, riskEngine) {
|
|
2812
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2881
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_used_borrow_lend_margin(userAccountObject, marginType, riskEngineObject);
|
|
2813
2882
|
return new Decimal4(result);
|
|
2814
2883
|
}
|
|
2815
2884
|
calculateEstimatedLiquidationPrice(marginMode, market, userAccount, riskEngine) {
|
|
2816
|
-
let marketId = this.getMarketId(market), baseAssetId = this.getMarketMeta(market).baseAssetId, userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2885
|
+
let marketId = this.getMarketId(market), baseAssetId = this.getMarketMeta(market).baseAssetId, userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_estimated_liquidation_price(marginMode, userAccountObject, marketId, baseAssetId, riskEngineObject);
|
|
2817
2886
|
return new Decimal4(result);
|
|
2818
2887
|
}
|
|
2819
2888
|
calculateLiquidationRiskPercentage(marginMode, userAccount, riskEngine) {
|
|
2820
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2889
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_liquidation_risk_percentage(marginMode, userAccountObject, riskEngineObject);
|
|
2821
2890
|
return new Decimal4(result);
|
|
2822
2891
|
}
|
|
2823
2892
|
calculateMarginBalance(marginMode, userAccount, riskEngine) {
|
|
2824
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2893
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_margin_balance(marginMode, userAccountObject, riskEngineObject);
|
|
2825
2894
|
return WasmResponseSchemas.MarginBalanceSummarySchema.parse(result);
|
|
2826
2895
|
}
|
|
2827
2896
|
calculatePerpMarginRequirement(marginMode, userAccount, marginType, withdrawal, riskEngine) {
|
|
2828
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2897
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_perp_margin_requirement(marginMode, userAccountObject, marginType, withdrawal, riskEngineObject);
|
|
2829
2898
|
return new Decimal4(result);
|
|
2830
2899
|
}
|
|
2831
2900
|
calculateForceCancelRiskPercentage(marginMode, userAccount, riskEngine) {
|
|
2832
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2901
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_force_cancel_risk_percentage(marginMode, userAccountObject, riskEngineObject);
|
|
2833
2902
|
return new Decimal4(result);
|
|
2834
2903
|
}
|
|
2835
2904
|
calculateMaxBorrowAmount(asset, userAccount, riskEngine) {
|
|
2836
|
-
let assetId = this.getAssetId(asset), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2905
|
+
let assetId = this.getAssetId(asset), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_max_borrow_amount(assetId, userAccountObject, riskEngineObject);
|
|
2837
2906
|
return new Decimal4(result);
|
|
2838
2907
|
}
|
|
2839
2908
|
calculateMaxOrderSize(marginMode, market, price, side, orderType, reduceOnly, userAccount, riskEngine, orderbook, nIterations = 100, errorTolerance = new Decimal4(0.0001)) {
|
|
2840
|
-
let marketId = this.getMarketId(market), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2909
|
+
let marketId = this.getMarketId(market), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), orderbookObject = serialize(orderbook), result = BulletWasm.calculate_max_order_size(marginMode, marketId, price.toFixed(), side, orderType, reduceOnly, userAccountObject, riskEngineObject, orderbookObject, nIterations, errorTolerance.toFixed());
|
|
2841
2910
|
return new Decimal4(result);
|
|
2842
2911
|
}
|
|
2843
2912
|
calculateWithdrawableAmountOfCrossMarginAsset(asset, forTransferSpotCollateral, userAccount, riskEngine, exchangeInfo) {
|
|
2844
|
-
let assetId = this.getAssetId(asset), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2913
|
+
let assetId = this.getAssetId(asset), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), exchangeInfoObject = serializeExchangeInfoForWasm(exchangeInfo), result = BulletWasm.calculate_withdrawable_amount_of_cross_margin_asset(assetId, forTransferSpotCollateral, userAccountObject, riskEngineObject, exchangeInfoObject);
|
|
2845
2914
|
return new Decimal4(result);
|
|
2846
2915
|
}
|
|
2847
2916
|
simulateUsedCrossMarginOnBorrow(asset, borrowAmount, userAccount, marginType, riskEngine) {
|
|
2848
|
-
let assetId = this.getAssetId(asset), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2917
|
+
let assetId = this.getAssetId(asset), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.simulate_used_cross_margin_on_borrow(assetId, borrowAmount.toFixed(), userAccountObject, marginType, riskEngineObject);
|
|
2849
2918
|
return WasmResponseSchemas.SimulationResultSchema.parse(result);
|
|
2850
2919
|
}
|
|
2851
2920
|
simulateUsedCrossMarginOnOrder(market, newOrderArgs, userAccount, riskEngine, orderbook) {
|
|
2852
|
-
let marketId = this.getMarketId(market), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2921
|
+
let marketId = this.getMarketId(market), userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), orderbookObject = serialize(orderbook), result = BulletWasm.simulate_used_cross_margin_on_order(marketId, {
|
|
2853
2922
|
price: newOrderArgs.price.toFixed(),
|
|
2854
2923
|
size: newOrderArgs.size.toFixed(),
|
|
2855
2924
|
side: newOrderArgs.side,
|
|
@@ -2859,7 +2928,7 @@ class ReadOnlyClient {
|
|
|
2859
2928
|
return WasmResponseSchemas.SimulationResultSchema.parse(result);
|
|
2860
2929
|
}
|
|
2861
2930
|
simulateCrossMarginEstimatedLiquidationPriceOnOrder(market, newOrderArgs, userAccount, riskEngine, orderbook) {
|
|
2862
|
-
let marketId = this.getMarketId(market), baseAssetId = this.getMarketMeta(market).baseAssetId, userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2931
|
+
let marketId = this.getMarketId(market), baseAssetId = this.getMarketMeta(market).baseAssetId, userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), orderbookObject = serialize(orderbook), result = BulletWasm.simulate_cross_margin_estimated_liquidation_price_on_order(marketId, {
|
|
2863
2932
|
price: newOrderArgs.price.toFixed(),
|
|
2864
2933
|
size: newOrderArgs.size.toFixed(),
|
|
2865
2934
|
side: newOrderArgs.side,
|
|
@@ -2869,7 +2938,7 @@ class ReadOnlyClient {
|
|
|
2869
2938
|
return WasmResponseSchemas.SimulationResultSchema.parse(result);
|
|
2870
2939
|
}
|
|
2871
2940
|
calculatePositionsAdditionalMetadata(userAccount, riskEngine, exchangeInfo) {
|
|
2872
|
-
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject =
|
|
2941
|
+
let userAccountObject = serializeUserAccountForWasm(userAccount), riskEngineObject = serializeRiskEngineForWasm(riskEngine), exchangeInfoObject = serializeExchangeInfoForWasm(exchangeInfo), result = BulletWasm.calculate_positions_additional_metadata(userAccountObject, riskEngineObject, exchangeInfoObject);
|
|
2873
2942
|
return WasmResponseSchemas.PositionAdditionalMetadataSchema.parse(result);
|
|
2874
2943
|
}
|
|
2875
2944
|
calculateBorrowLendPoolAdditionalMetadata(borrowLendPools, asset) {
|
|
@@ -2877,11 +2946,11 @@ class ReadOnlyClient {
|
|
|
2877
2946
|
return WasmResponseSchemas.BorrowLendMarketAdditionalMetadataSchema.parse(result);
|
|
2878
2947
|
}
|
|
2879
2948
|
calculateCrossMarginAccountSummaryBatch(userAccounts, riskEngine, useWeightedEquity = !0) {
|
|
2880
|
-
let userAccountsObject = userAccounts.map(serializeUserAccountForWasm), riskEngineObject =
|
|
2949
|
+
let userAccountsObject = userAccounts.map(serializeUserAccountForWasm), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.calculate_cross_margin_account_summary_batch(userAccountsObject, riskEngineObject, useWeightedEquity);
|
|
2881
2950
|
return WasmResponseSchemas.AccountSummaryBatchSchema.parse(result);
|
|
2882
2951
|
}
|
|
2883
2952
|
estimateHourlyFundingRate(market, riskEngine) {
|
|
2884
|
-
let marketId = this.getMarketId(market), riskEngineObject =
|
|
2953
|
+
let marketId = this.getMarketId(market), riskEngineObject = serializeRiskEngineForWasm(riskEngine), result = BulletWasm.estimate_hourly_funding_rate(marketId, riskEngineObject);
|
|
2885
2954
|
return new Decimal4(result);
|
|
2886
2955
|
}
|
|
2887
2956
|
getWebSocketManager() {
|
|
@@ -3897,7 +3966,7 @@ class AuthenticatedClient extends ReadOnlyClient {
|
|
|
3897
3966
|
return await this.submitTransaction({
|
|
3898
3967
|
exchange: {
|
|
3899
3968
|
user: {
|
|
3900
|
-
|
|
3969
|
+
delegate_user_v2: {
|
|
3901
3970
|
delegate,
|
|
3902
3971
|
name,
|
|
3903
3972
|
sub_account_index: subAccountIndex,
|
|
@@ -3912,7 +3981,7 @@ class AuthenticatedClient extends ReadOnlyClient {
|
|
|
3912
3981
|
return await this.submitTransaction({
|
|
3913
3982
|
exchange: {
|
|
3914
3983
|
user: {
|
|
3915
|
-
|
|
3984
|
+
revoke_delegation_v1: {
|
|
3916
3985
|
delegate,
|
|
3917
3986
|
sub_account_index: subAccountIndex ?? null
|
|
3918
3987
|
}
|
|
@@ -3924,7 +3993,7 @@ class AuthenticatedClient extends ReadOnlyClient {
|
|
|
3924
3993
|
return await this.submitTransaction({
|
|
3925
3994
|
exchange: {
|
|
3926
3995
|
vault: {
|
|
3927
|
-
|
|
3996
|
+
delegate_vault_user_v1: {
|
|
3928
3997
|
vault_address: vaultAddress,
|
|
3929
3998
|
delegate,
|
|
3930
3999
|
name,
|
|
@@ -4512,6 +4581,7 @@ export {
|
|
|
4512
4581
|
sleep,
|
|
4513
4582
|
serializeVersioned,
|
|
4514
4583
|
serialize,
|
|
4584
|
+
marketKindFromMarketId,
|
|
4515
4585
|
isValidWsUrl,
|
|
4516
4586
|
isValidHttpUrl,
|
|
4517
4587
|
isNode2 as isNode,
|
|
@@ -4535,8 +4605,10 @@ export {
|
|
|
4535
4605
|
Wallet,
|
|
4536
4606
|
StateResponseSchemas,
|
|
4537
4607
|
Schemas,
|
|
4608
|
+
SPOT_MARKET_ID_OFFSET,
|
|
4538
4609
|
ResponseSchemas,
|
|
4539
4610
|
ReadOnlyClient,
|
|
4611
|
+
RWA_PERP_MARKET_ID_OFFSET,
|
|
4540
4612
|
Orderbook,
|
|
4541
4613
|
NodeWallet,
|
|
4542
4614
|
NETWORKS,
|
|
@@ -4551,4 +4623,4 @@ export {
|
|
|
4551
4623
|
AbortError
|
|
4552
4624
|
};
|
|
4553
4625
|
|
|
4554
|
-
//# debugId=
|
|
4626
|
+
//# debugId=3F37AD2526F81EE364756E2164756E21
|