pub struct Exchange {Show 119 fields
pub id: Value,
pub name: Value,
pub countries: Value,
pub version: Value,
pub alias: Value,
pub certified: Value,
pub pro: Value,
pub hostname: Value,
pub apiKey: Value,
pub secret: Value,
pub password: Value,
pub uid: Value,
pub walletAddress: Value,
pub privateKey: Value,
pub twofa: Value,
pub token: Value,
pub login: Value,
pub accountId: Value,
pub requiredCredentials: Value,
pub timeout: Value,
pub rateLimit: Value,
pub enableRateLimit: Value,
pub rateLimiterAlgorithm: Value,
pub rollingWindowSize: Value,
pub tokenBucket: Value,
pub userConfig: Value,
pub verbose: Value,
pub isSandboxModeEnabled: Value,
pub proxy: Value,
pub proxyUrl: Value,
pub proxy_url: Value,
pub proxyUrlCallback: Value,
pub proxy_url_callback: Value,
pub httpProxy: Value,
pub http_proxy: Value,
pub httpProxyCallback: Value,
pub http_proxy_callback: Value,
pub httpsProxy: Value,
pub https_proxy: Value,
pub httpsProxyCallback: Value,
pub https_proxy_callback: Value,
pub socksProxy: Value,
pub socks_proxy: Value,
pub socksProxyCallback: Value,
pub socks_proxy_callback: Value,
pub wsProxy: Value,
pub ws_proxy: Value,
pub wssProxy: Value,
pub wss_proxy: Value,
pub wsSocksProxy: Value,
pub ws_socks_proxy: Value,
pub markets: Value,
pub markets_by_id: Value,
pub currencies: Value,
pub currencies_by_id: Value,
pub commonCurrencies: Value,
pub baseCurrencies: Value,
pub quoteCurrencies: Value,
pub symbols: Value,
pub ids: Value,
pub codes: Value,
pub timeframes: Value,
pub precision: Value,
pub limits: Value,
pub fees: Value,
pub features: Value,
pub has: Value,
pub exceptions: Value,
pub urls: Value,
pub api: Value,
pub options: Value,
pub headers: Value,
pub accounts: Value,
pub accountsById: Value,
pub orderbooks: Value,
pub orders: Value,
pub trades: Value,
pub myTrades: Value,
pub positions: Value,
pub newUpdates: Value,
pub tickers: Value,
pub bidsasks: Value,
pub ohlcvs: Value,
pub clients: Value,
pub balance: Value,
pub liquidations: Value,
pub myLiquidations: Value,
pub fundingRates: Value,
pub triggerOrders: Value,
pub transactions: Value,
pub reloadingMarkets: Value,
pub marketsLoading: Value,
pub last_request_url: Value,
pub last_request_headers: Value,
pub last_request_body: Value,
pub last_http_response: Value,
pub last_response_headers: Value,
pub mock_response: Value,
pub mock_response_by_url: Value,
pub last_json_response: Value,
pub lastRestRequestTimestamp: Value,
pub fetchHistoryCache: Value,
pub fetchHistoryCacheSize: Value,
pub paddingMode: Value,
pub precisionMode: Value,
pub substituteCommonCurrencyCodes: Value,
pub reduceFees: Value,
pub minFundingAddressLength: Value,
pub networkAliases: Value,
pub MAX_VALUE: Value,
pub returnResponseHeaders: Value,
pub httpExceptions: Value,
pub status: Value,
pub userAgent: Value,
pub user_agent: Value,
pub userAgents: Value,
pub describe_data: Value,
pub derived_describe: Option<Arc<dyn Fn() -> Value + Sync + Send>>,
pub internals: Internals,
}Fields§
§id: Value§name: Value§countries: Value§version: Value§alias: Value§certified: Value§pro: Value§hostname: Value§apiKey: Value§secret: Value§password: Value§uid: Value§walletAddress: Value§privateKey: Value§twofa: Value§token: Value§login: Value§accountId: Value§requiredCredentials: Value§timeout: Value§rateLimit: Value§enableRateLimit: Value§rateLimiterAlgorithm: Value§rollingWindowSize: Value§tokenBucket: Value§userConfig: ValueThe raw constructor config, kept so initialize_properties can merge it
over describe() the way Go’s InitParent does
(deepExtend(describe, userConfig)) instead of relying on per-field
precedence guards in each Core’s generated init().
verbose: Value§isSandboxModeEnabled: Value§proxy: Value§proxyUrl: Value§proxy_url: Value§proxyUrlCallback: Value§proxy_url_callback: Value§httpProxy: Value§http_proxy: Value§httpProxyCallback: Value§http_proxy_callback: Value§httpsProxy: Value§https_proxy: Value§httpsProxyCallback: Value§https_proxy_callback: Value§socksProxy: Value§socks_proxy: Value§socksProxyCallback: Value§socks_proxy_callback: Value§wsProxy: Value§ws_proxy: Value§wssProxy: Value§wss_proxy: Value§wsSocksProxy: Value§ws_socks_proxy: Value§markets: ValuePlain dict-or-null container – see PLAIN_DICT_FIELDS.
markets_by_id: Value§currencies: Value§currencies_by_id: Value§commonCurrencies: Value§baseCurrencies: Value§quoteCurrencies: Value§symbols: Value§ids: Value§codes: Value§timeframes: Value§precision: Value§limits: Value§fees: Value§features: Value§has: Value§exceptions: Value§urls: Value§api: Value§options: ValuePlain dict-or-null container – see PLAIN_DICT_FIELDS.
headers: Value§accounts: Value§accountsById: Value§orderbooks: Value§orders: Value§trades: Value§myTrades: Value§positions: Value§newUpdates: Value§tickers: Value§bidsasks: Value§ohlcvs: Value§clients: Value§balance: ValuePlain dict-or-null container – see PLAIN_DICT_FIELDS.
liquidations: Value§myLiquidations: Value§fundingRates: Value§triggerOrders: Value§transactions: Value§reloadingMarkets: Value§marketsLoading: Value§last_request_url: Value§last_request_headers: Value§last_request_body: Value§last_http_response: Value§last_response_headers: Value§mock_response: ValueCanned HTTP response for static response tests — when set,
fetch_typed returns it without hitting the network so the
exchange’s parser runs against fixture data. Mirrors Go’s
MockResponse field. Reused for all requests in a fixture; the test
dispatcher replaces or clears it before the next REST dispatch.
mock_response_by_url: ValueResponse-test mock keyed by url fragment, for methods that call several
endpoints: one shared body cannot cover two endpoints of different
declared shapes. Consulted before mock_response.
last_json_response: Value§lastRestRequestTimestamp: Value§fetchHistoryCache: ValueRolling cache of recent fetch results, capped at
fetchHistoryCacheSize. Mirrors Exchange.ts fetchHistoryCache
/ fetchHistoryCacheSize (hand-written, above the transpile marker).
fetchHistoryCacheSize: Value§paddingMode: Value§precisionMode: Value§substituteCommonCurrencyCodes: Value§reduceFees: Value§minFundingAddressLength: Value§networkAliases: Value§MAX_VALUE: Value§returnResponseHeaders: Value§httpExceptions: Value§status: Value§userAgent: Value§user_agent: Value§userAgents: Value§describe_data: Value§derived_describe: Option<Arc<dyn Fn() -> Value + Sync + Send>>§internals: InternalsImplementations§
Source§impl Exchange
impl Exchange
pub fn new(config: Option<Value>) -> Exchange
Sourcepub fn initialize_properties(&mut self, described: Value)
pub fn initialize_properties(&mut self, described: Value)
Apply a merged describe() + constructor-config map onto the typed
fields. The Rust counterpart of Go’s initializeProperties
(go/v4/exchange_options.go) and of the TS constructor’s
deepExtend(this, describe(), userConfig) — which Rust cannot do
directly because Exchange is a struct, not a dynamic object.
Each Core’s generated init() used to inline ~84 lines of this, which
is why every field carried its own precedence guard: config was applied
in new() BEFORE describe() ran, so describe() had to be stopped
from clobbering it. Here the config is merged over describe() first
(Go’s deepExtend(describe, userConfig)), so last-write-wins is the
precedence rule and no guards are needed.
Absent keys leave the base default in place — the equivalent of Go’s
SafeString(props, key, default).
pub fn urlencode_kv(&self, params: &Value) -> String
pub fn implode_params(&self, path: Value, params: Value) -> Value
pub fn json_str(&self, v: &Value) -> String
pub fn hmac( &self, data: Value, secret: Value, hash: Value, optional_args: &[Value], ) -> Value
pub fn hmac_typed( &self, data: &[u8], secret: &[u8], hash: &str, digest: &str, ) -> Result<String, ExchangeError>
pub fn hash(&self, data: Value, algo: Value, optional_args: &[Value]) -> Value
pub fn hash_typed(&self, data: &[u8], algo: &str, digest: &str) -> String
pub fn binary_to_base64(&self, data: Value, _optional_args: &[Value]) -> Value
pub fn base64_to_binary(&self, s: Value, _optional_args: &[Value]) -> Value
pub fn binary_to_base16(&self, data: Value, _optional_args: &[Value]) -> Value
pub fn base16_to_binary(&self, s: Value, _optional_args: &[Value]) -> Value
pub fn milliseconds(&self) -> Value
pub fn seconds(&self) -> Value
pub fn microseconds(&self) -> Value
pub fn iso8601(&self, ts: Value) -> Value
pub fn parse8601(&self, s: Value) -> Value
Source§impl Exchange
impl Exchange
Sourcepub fn dispatch_guard_enter(&mut self, method: &str) -> bool
pub fn dispatch_guard_enter(&mut self, method: &str) -> bool
Enter the guard for method. Returns false if method is already on
the dispatch stack (re-entry — caller should fall through to the base
body); otherwise pushes it and returns true.
Sourcepub fn dispatch_guard_exit(&mut self)
pub fn dispatch_guard_exit(&mut self)
Leave the guard (pop the most-recently entered method).
Source§impl Exchange
impl Exchange
Sourcepub fn build_implicit_api(&mut self)
pub fn build_implicit_api(&mut self)
Builds the name → (path, scope, verb) dispatch table by walking
the self.api Value::Map. Called lazily on first dynamic call.
The api block layout is:
{ get/post/put/delete/patch (any case). All path components
before the verb concatenate into the scope (joined by _).
Source§impl Exchange
impl Exchange
Sourcepub fn exception_message(&self, exc: Value, _optional_args: &[Value]) -> Value
pub fn exception_message(&self, exc: Value, _optional_args: &[Value]) -> Value
Coerce a caught panic payload into the [ClassName] message
shape TS uses (see Exchange.exceptionMessage). Truncates to
100k chars to match. Rust panics carry just a string in Value,
so we trust it as the formatted message and trim it. Used by
exchanges that re-throw with a contextual prefix in their
catch arms (grvt.transfer is the canonical case).
Sourcepub fn get_ccxt_version(&self) -> Value
pub fn get_ccxt_version(&self) -> Value
Port of Exchange.getCcxtVersion(). The TS reads the static
Exchange.ccxtVersion (a class member the release process bumps); the
transpiler can’t lower that (Exchange as any).ccxtVersion static access,
so getCcxtVersion is dropped from exchange_generated.rs and lives here
as a hand-written stub instead. Value mirrors ts/src/base/Exchange.ts’s
static ccxtVersion (== package.json “version”); only foxbit consumes it
(the X-FB-CLIENT-VERSION request header), and no static fixture asserts
the header, so a version bump can’t break the suites.
pub fn safe_value_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
pub fn safe_string_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
Sourcepub fn safe_string_k_opt(
&self,
obj: Value,
key: &str,
optional_args: &[Value],
) -> Option<String>
pub fn safe_string_k_opt( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Option<String>
safe_string_k without the box: same lookup, empty-string and default
rules, None where the boxed helper yields Value::Null.
Sourcepub fn safe_string_opt(
&self,
obj: Value,
key: Value,
optional_args: &[Value],
) -> Option<String>
pub fn safe_string_opt( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Option<String>
safe_string without the box (Value key): same lookup and default rules.
pub fn safe_integer_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
pub fn safe_float_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
pub fn safe_number_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
Sourcepub fn safe_bool_k_opt(
&self,
obj: Value,
key: &str,
_optional_args: &[Value],
) -> Option<bool>
pub fn safe_bool_k_opt( &self, obj: Value, key: &str, _optional_args: &[Value], ) -> Option<bool>
safe_bool_k without the box: Some only for an actual boolean, else None.
Sourcepub fn safe_bool_opt(
&self,
obj: Value,
key: Value,
_optional_args: &[Value],
) -> Option<bool>
pub fn safe_bool_opt( &self, obj: Value, key: Value, _optional_args: &[Value], ) -> Option<bool>
safe_bool without the box (Value key): same lookup rule as safe_bool_k_opt.
Sourcepub fn safe_bool2_opt(
&self,
obj: Value,
k1: Value,
k2: Value,
_optional_args: &[Value],
) -> Option<bool>
pub fn safe_bool2_opt( &self, obj: Value, k1: Value, k2: Value, _optional_args: &[Value], ) -> Option<bool>
safe_bool2 without the box: first key holding a real boolean wins, else None.
Sourcepub fn safe_bool_n_opt(
&self,
obj: Value,
keys: Value,
_optional_args: &[Value],
) -> Option<bool>
pub fn safe_bool_n_opt( &self, obj: Value, keys: Value, _optional_args: &[Value], ) -> Option<bool>
safe_bool_n without the box: Some only for an actual boolean, else None.
Sourcepub fn safe_string2_opt(
&self,
obj: Value,
k1: Value,
k2: Value,
optional_args: &[Value],
) -> Option<String>
pub fn safe_string2_opt( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Option<String>
safe_string2 without the box: first key whose safe_string is non-null, then the
default; None where the boxed helper yields Value::Null.
Sourcepub fn safe_string_n_opt(
&self,
obj: Value,
keys: Value,
optional_args: &[Value],
) -> Option<String>
pub fn safe_string_n_opt( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Option<String>
safe_string_n without the box: first key whose safe_string is non-null, then the
default; None where the boxed helper yields Value::Null.
Sourcepub fn safe_number2_opt(
&self,
obj: Value,
k1: Value,
k2: Value,
_optional_args: &[Value],
) -> Option<f64>
pub fn safe_number2_opt( &self, obj: Value, k1: Value, k2: Value, _optional_args: &[Value], ) -> Option<f64>
safe_number2 without the box (no default): first key whose string form parses as f64.
pub fn safe_bool_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
pub fn safe_dict_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
pub fn safe_list_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
pub fn safe_value( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
pub fn safe_value2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
pub fn safe_value_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
pub fn safe_string( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
pub fn safe_string2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
pub fn safe_string_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
pub fn safe_string_upper( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
Sourcepub fn safe_string_upper_k(
&self,
obj: Value,
key: &str,
optional_args: &[Value],
) -> Value
pub fn safe_string_upper_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
safe_string_upper with a &str key — the safe_*_k twin.
Sourcepub fn safe_string_upper_k_opt(
&self,
obj: Value,
key: &str,
optional_args: &[Value],
) -> Option<String>
pub fn safe_string_upper_k_opt( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Option<String>
safe_string_upper_k without the box: the found value is upper-cased, a
default is returned verbatim (None where the boxed helper yields Null).
pub fn safe_string_lower_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
pub fn safe_string_upper_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
pub fn safe_string_lower( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
Sourcepub fn safe_string_lower_k(
&self,
obj: Value,
key: &str,
optional_args: &[Value],
) -> Value
pub fn safe_string_lower_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
safe_string_lower with a &str key — the safe_*_k twin of the
lookup above (same get_value_k path as the rest of the family).
Sourcepub fn safe_string_lower_k_opt(
&self,
obj: Value,
key: &str,
optional_args: &[Value],
) -> Option<String>
pub fn safe_string_lower_k_opt( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Option<String>
safe_string_lower_k without the box: the found value is lower-cased, a
default is returned verbatim (None where the boxed helper yields Null).
pub fn safe_string_lower2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
pub fn safe_string_upper2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
Sourcepub fn super_currency(&self, _code: Value) -> Value
pub fn super_currency(&self, _code: Value) -> Value
super.X(...) from derived exchanges — routes back to the base
Exchange impl. These stubs return Value::Null; they exist so
transpiled self.super_X() calls type-check.
pub fn super_handle_errors( &self, _code: Value, _reason: Value, _url: Value, _method: Value, _headers: Value, _body: Value, _response: Value, _request_headers: Value, _request_body: Value, ) -> Value
pub fn set_last_rest_request_timestamp(&self)
pub fn set_last_request(&self, request: Value)
pub fn get_fetch_cache(&self) -> Value
pub fn add_fetch_cache(&self, data: Value)
pub fn client(&mut self, args: &[Value]) -> Value
pub fn spawn(&self, args: &[Value]) -> Value
pub async fn delay(&mut self, ms: Value, args: &[Value]) -> Value
pub fn order_book(&self, args: &[Value]) -> Value
pub fn indexed_order_book(&self, args: &[Value]) -> Value
pub fn counted_order_book(&self, args: &[Value]) -> Value
pub fn safe_order_tracker(&self, _args: &[Value]) -> Value
pub async fn un_watch(&mut self, _topic: Value, _args: &[Value]) -> Value
pub fn send(&self, _payload: Value) -> Value
pub fn lock_id(&self, _args: &[Value]) -> Value
pub fn unlock_id(&self, _args: &[Value]) -> Value
pub fn lock_last_nonce(&self, _args: &[Value]) -> Value
pub fn unlock_last_nonce(&self, _args: &[Value]) -> Value
pub fn extend_exchange_options(&self, _args: &[Value]) -> Value
pub fn on_error(&self, _args: &[Value]) -> Value
pub fn on_close(&self, _args: &[Value]) -> Value
pub fn on_pong(&self, _args: &[Value]) -> Value
Sourcepub fn crc32(&self, args: &[Value]) -> Value
pub fn crc32(&self, args: &[Value]) -> Value
CRC-32 checksum — used by a few WS order-book reconcilers (bitget, bitfinex, independentreserve). Stub returns 0; will be replaced with the real algorithm when those order books need it.
Sourcepub fn decode_proto_msg(&self, args: &[Value]) -> Value
pub fn decode_proto_msg(&self, args: &[Value]) -> Value
decode_proto_msg(message) — exchange-specific protobuf decoder
(mexc). message is the binary frame carried as a byte array; decode
it into mexc’s PushDataV3ApiWrapper shape (matching protobufjs
.toJSON()) so the ported handlers consume it unchanged.
Sourcepub async fn load_order_book(&mut self, _args: &[Value]) -> Value
pub async fn load_order_book(&mut self, _args: &[Value]) -> Value
loadOrderBook — WS helper used by some bookkeeping methods.
Stubbed identically to the unwatch flow.
Sourcepub fn remove0x_prefix(&self, hex_data: Value) -> Value
pub fn remove0x_prefix(&self, hex_data: Value) -> Value
remove0xPrefix(hexData) — strips a leading 0x/0X if present.
Sourcepub fn handle_http_status_code(
&self,
code: Value,
reason: Value,
url: Value,
method: Value,
body: Value,
)
pub fn handle_http_status_code( &self, code: Value, reason: Value, url: Value, method: Value, body: Value, )
handleHttpStatusCode(code, reason, url, method, body) — throws the
httpExceptions class for the status; a status outside the table passes.
Sourcepub fn check_required_dependencies(&self) -> Value
pub fn check_required_dependencies(&self) -> Value
checkRequiredDependencies() — a no-op in Rust; all crypto deps are
compiled in.
Sourcepub fn rand_number(&self, size: Value) -> Value
pub fn rand_number(&self, size: Value) -> Value
randNumber(size) — a random integer with size decimal digits.
Sourcepub fn random_bytes(&self, length: Value) -> Value
pub fn random_bytes(&self, length: Value) -> Value
randomBytes(length) — length random bytes as a hex string.
Sourcepub fn convert_to_big_int(&self, value: Value) -> Value
pub fn convert_to_big_int(&self, value: Value) -> Value
convertToBigInt(value) — the Value-bag has no distinct bigint type,
so coerce to a 64-bit integer.
Sourcepub fn fix_stringified_json_members(&self, content: Value) -> Value
pub fn fix_stringified_json_members(&self, content: Value) -> Value
fixStringifiedJsonMembers(content) — un-escapes a JSON string whose
members are themselves stringified JSON (used by bingx).
Sourcepub fn binary_concat_array(&self, arr: Value) -> Value
pub fn binary_concat_array(&self, arr: Value) -> Value
binaryConcatArray(arrayOfChunks) — concatenates hex-string chunks.
Sourcepub fn uuid5(&self, namespace: Value, name: Value) -> Value
pub fn uuid5(&self, namespace: Value, name: Value) -> Value
uuid5(namespace, name) — RFC-4122 v5 (SHA-1 based) UUID.
Sourcepub fn eth_abi_encode(&self, types: Value, values: Value) -> Value
pub fn eth_abi_encode(&self, types: Value, values: Value) -> Value
ethAbiEncode(types, values) — Solidity abi.encode of a head-only
(all-static) tuple: every element becomes one 32-byte word. Supports the
static types the callers use (address, bytesN, uint*/int*, bool). Dynamic
types (bytes, string, arrays) are not needed (polymarket ERC-7739) and
return Null. Values arrive as: bytesN → binary Value::Arr (or 0x-hex
string); uint/int → Value::Int or a decimal/0x-hex string (big uint256
like tokenId exceed i64, so string form is preserved by convert_to_big_int);
address → 0x-hex string. Result is a binary Value::Arr that hash(...)
consumes via value_to_bytes.
Sourcepub fn set_property(&self, _property: Value, _optional_args: &[Value]) -> Value
pub fn set_property(&self, _property: Value, _optional_args: &[Value]) -> Value
setProperty(this, key, value) — dynamic field setter. The typed
Exchange struct has no Value-shaped dynamic field store, so this
is currently a no-op (the receiver arg is dropped by the transpiler).
Sourcepub fn axolotl(
&self,
_payload: Value,
_hex_key: Value,
_ed25519: Value,
) -> Value
pub fn axolotl( &self, _payload: Value, _hex_key: Value, _ed25519: Value, ) -> Value
axolotl(payload, hexKey, ed25519) — curve25519 signing (Waves exchange).
Sourcepub fn retrieve_stark_account(
&self,
_signature: Value,
_class_hash: Value,
_proxy_hash: Value,
) -> Value
pub fn retrieve_stark_account( &self, _signature: Value, _class_hash: Value, _proxy_hash: Value, ) -> Value
retrieveStarkAccount(signature, accountClassHash, accountProxyClassHash).
Sourcepub fn starknet_encode_structured_data(
&self,
_domain: Value,
_types: Value,
_data: Value,
_address: Value,
) -> Value
pub fn starknet_encode_structured_data( &self, _domain: Value, _types: Value, _data: Value, _address: Value, ) -> Value
starknetEncodeStructuredData(domain, messageTypes, messageData, address).
Sourcepub fn starknet_sign(&self, _msg_hash: Value, _pri: Value) -> Value
pub fn starknet_sign(&self, _msg_hash: Value, _pri: Value) -> Value
starknetSign(msgHash, pri).
Sourcepub fn extended_starknet_sign(&self, _msg_hash: Value, _pri: Value) -> Value
pub fn extended_starknet_sign(&self, _msg_hash: Value, _pri: Value) -> Value
extendedStarknetSign(msgHash, pri) — starknet-curve signing for the
extended exchange. Stub: starknet crypto (poseidon/stark-curve) is
not ported to Rust yet, matching starknet_sign above.
Sourcepub fn extended_starknet_get_selector_from_name(&self, _name: Value) -> Value
pub fn extended_starknet_get_selector_from_name(&self, _name: Value) -> Value
extendedStarknetGetSelectorFromName(name).
Sourcepub fn extended_starknet_compute_poseidon_hash_on_elements(
&self,
_data: Value,
) -> Value
pub fn extended_starknet_compute_poseidon_hash_on_elements( &self, _data: Value, ) -> Value
extendedStarknetComputePoseidonHashOnElements(data).
Sourcepub fn to_dydx_long(&self, _num_str: Value) -> Value
pub fn to_dydx_long(&self, _num_str: Value) -> Value
toDydxLong(numStr).
Sourcepub fn retrieve_dydx_credentials(&self, _entropy: Value) -> Value
pub fn retrieve_dydx_credentials(&self, _entropy: Value) -> Value
retrieveDydxCredentials(entropy).
Sourcepub async fn load_dydx_protos(&self) -> Value
pub async fn load_dydx_protos(&self) -> Value
loadDydxProtos().
Sourcepub fn encode_dydx_tx_raw(&self, _sign_doc: Value, _signature: Value) -> Value
pub fn encode_dydx_tx_raw(&self, _sign_doc: Value, _signature: Value) -> Value
encodeDydxTxRaw(signDoc, signature).
Sourcepub fn encode_dydx_tx_for_simulation(
&self,
_message: Value,
_memo: Value,
_sequence: Value,
_public_key: Value,
) -> Value
pub fn encode_dydx_tx_for_simulation( &self, _message: Value, _memo: Value, _sequence: Value, _public_key: Value, ) -> Value
encodeDydxTxForSimulation(message, memo, sequence, publicKey).
Sourcepub fn encode_dydx_tx_for_signing(
&self,
_message: Value,
_memo: Value,
_chain_id: Value,
_account: Value,
_authenticators: Value,
_optional_args: &[Value],
) -> Value
pub fn encode_dydx_tx_for_signing( &self, _message: Value, _memo: Value, _chain_id: Value, _account: Value, _authenticators: Value, _optional_args: &[Value], ) -> Value
encodeDydxTxForSigning(message, memo, chainId, account, authenticators, fee?).
Sourcepub async fn load_lighter_library(
&self,
_library_path: Value,
_chain_id: Value,
_private_key: Value,
_api_key_index: Value,
_account_index: Value,
_optional_args: &[Value],
) -> Value
pub async fn load_lighter_library( &self, _library_path: Value, _chain_id: Value, _private_key: Value, _api_key_index: Value, _account_index: Value, _optional_args: &[Value], ) -> Value
loadLighterLibrary(libraryPath, chainId, privateKey, apiKeyIndex, accountIndex, createClient?).
Sourcepub fn lighter_create_client(
&self,
_signer: Value,
_chain_id: Value,
_private_key: Value,
_api_key_index: Value,
_account_index: Value,
) -> Value
pub fn lighter_create_client( &self, _signer: Value, _chain_id: Value, _private_key: Value, _api_key_index: Value, _account_index: Value, ) -> Value
lighterCreateClient(signer, chainId, privateKey, apiKeyIndex, accountIndex).
Sourcepub fn lighter_generate_api_key(&self, _signer: Value) -> Value
pub fn lighter_generate_api_key(&self, _signer: Value) -> Value
lighterGenerateApiKey(signer).
Sourcepub async fn get_zk_transfer_signature_obj(
&self,
_seeds: Value,
_optional_args: &[Value],
) -> Value
pub async fn get_zk_transfer_signature_obj( &self, _seeds: Value, _optional_args: &[Value], ) -> Value
getZKTransferSignatureObj(seeds, order) — apex StarkEx signing.
Sourcepub async fn get_zk_contract_signature_obj(
&self,
_seeds: Value,
_optional_args: &[Value],
) -> Value
pub async fn get_zk_contract_signature_obj( &self, _seeds: Value, _optional_args: &[Value], ) -> Value
getZKContractSignatureObj(seeds, order) — apex StarkEx signing.
Sourcepub async fn futures_transfer(
&self,
_code: Value,
_amount: Value,
_transfer_type: Value,
_optional_args: &[Value],
) -> Value
pub async fn futures_transfer( &self, _code: Value, _amount: Value, _transfer_type: Value, _optional_args: &[Value], ) -> Value
futuresTransfer(code, amount, type, params?) — binance futures
wallet transfer; inherited by binancecoinm / binanceusdm.
Sourcepub fn lighter_sign_create_order(
&self,
_signer: Value,
_request: Value,
) -> Value
pub fn lighter_sign_create_order( &self, _signer: Value, _request: Value, ) -> Value
lighterSign*(signer, request) — lighter zk-proof signing helpers.
pub fn lighter_sign_create_grouped_orders( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_cancel_order( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_cancel_all_orders( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_withdraw(&self, _signer: Value, _request: Value) -> Value
pub fn lighter_sign_create_sub_account( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_modify_order( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_transfer(&self, _signer: Value, _request: Value) -> Value
pub fn lighter_sign_update_leverage( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_update_margin( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_approve_integrator( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_sign_change_pubkey( &self, _signer: Value, _request: Value, ) -> Value
pub fn lighter_create_auth_token( &self, _signer: Value, _request: Value, ) -> Value
Sourcepub fn urlencode_with_array_repeat(&self, params: Value) -> Value
pub fn urlencode_with_array_repeat(&self, params: Value) -> Value
urlencodeWithArrayRepeat(params) — qs.stringify(object, { arrayFormat: 'repeat' }):
array values repeat the key (a=1&a=2); scalars encode normally.
pub fn safe_integer( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
pub fn safe_integer2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
pub fn safe_integer_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
Sourcepub fn safe_integer2_opt(
&self,
obj: Value,
k1: Value,
k2: Value,
_optional_args: &[Value],
) -> Option<i64>
pub fn safe_integer2_opt( &self, obj: Value, k1: Value, k2: Value, _optional_args: &[Value], ) -> Option<i64>
safe_integer2 without the box (no default): first key yielding an integer.
Sourcepub fn safe_integer_n_opt(
&self,
obj: Value,
keys: Value,
_optional_args: &[Value],
) -> Option<i64>
pub fn safe_integer_n_opt( &self, obj: Value, keys: Value, _optional_args: &[Value], ) -> Option<i64>
safe_integer_n without the box (no default): first key in keys yielding an integer.
Sourcepub fn safe_integer_product(
&self,
obj: Value,
key: Value,
factor: Value,
optional_args: &[Value],
) -> Value
pub fn safe_integer_product( &self, obj: Value, key: Value, factor: Value, optional_args: &[Value], ) -> Value
Reads obj[key] as a number, multiplies by factor, and casts
to i64. Used to convert seconds → milliseconds for timestamps.
Sourcepub fn safe_integer_product_k(
&self,
obj: Value,
key: &str,
factor: Value,
optional_args: &[Value],
) -> Value
pub fn safe_integer_product_k( &self, obj: Value, key: &str, factor: Value, optional_args: &[Value], ) -> Value
safe_integer_product with a &str key — the safe_*_k twin.
pub fn safe_integer_product2( &self, obj: Value, k1: Value, k2: Value, factor: Value, optional_args: &[Value], ) -> Value
pub fn safe_integer_product_n( &self, obj: Value, keys: Value, factor: Value, optional_args: &[Value], ) -> Value
pub fn safe_timestamp2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
pub fn safe_timestamp_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
pub fn safe_float( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
Sourcepub fn safe_timestamp(
&self,
obj: Value,
key: Value,
optional_args: &[Value],
) -> Value
pub fn safe_timestamp( &self, obj: Value, key: Value, optional_args: &[Value], ) -> Value
safeTimestamp(o, k) — parseInt(asFloat(value) * 1000). The
value is read as a float (seconds, possibly fractional) and
converted to integer milliseconds.
Sourcepub fn safe_timestamp_k(
&self,
obj: Value,
key: &str,
optional_args: &[Value],
) -> Value
pub fn safe_timestamp_k( &self, obj: Value, key: &str, optional_args: &[Value], ) -> Value
safe_timestamp with a &str key — the safe_*_k twin.
Sourcepub fn is_empty(&self, v: Value) -> Value
pub fn is_empty(&self, v: Value) -> Value
isEmpty(value) — true when an array/dict is empty, or the
value is null/undefined. Scalars (strings, numbers, bools) are
never considered empty — mirrors functions/generic.ts.
pub fn value_is_defined(&self, v: Value) -> Value
pub fn extend(&self, a: Value, optional_args: &[Value]) -> Value
pub fn deep_extend(&self, a: Value, optional_args: &[Value]) -> Value
pub fn omit(&self, obj: Value, keys: Value, _optional_args: &[Value]) -> Value
pub fn omit_zero(&self, v: Value) -> Value
pub fn to_array(&self, v: Value) -> Value
pub fn array_concat(&self, a: Value, b: Value) -> Value
pub fn array_slice( &self, v: Value, start: Value, optional_args: &[Value], ) -> Value
pub fn in_array(&self, needle: Value, haystack: Value) -> Value
pub fn unique(&self, v: Value) -> Value
pub fn index_by(&self, arr: Value, key: Value) -> Value
pub fn index_by_safe(&self, arr: Value, key: Value) -> Value
pub fn group_by( &self, arr: Value, key: Value, _optional_args: &[Value], ) -> Value
pub fn filter_by( &self, arr: Value, key: Value, value: Value, _optional_args: &[Value], ) -> Value
Sourcepub fn sort_by(&self, arr: Value, key: Value, optional_args: &[Value]) -> Value
pub fn sort_by(&self, arr: Value, key: Value, optional_args: &[Value]) -> Value
sortBy(array, key, descending=false) — stable sort of an array
of objects by obj[key]. Mirrors functions/generic.ts.
Sourcepub fn sort_by2(
&self,
arr: Value,
k1: Value,
k2: Value,
optional_args: &[Value],
) -> Value
pub fn sort_by2( &self, arr: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
sortBy2(array, key1, key2, descending=false) — sort by key1,
then key2 as a tiebreaker. Mirrors functions/generic.ts.
pub fn keysort(&self, obj: Value, _optional_args: &[Value]) -> Value
Sourcepub fn aggregate(&self, arr: Value) -> Value
pub fn aggregate(&self, arr: Value) -> Value
aggregate(bidasks) — groups [price, volume] rows by price,
summing volume and dropping zero-volume rows. Preserves the
first-occurrence order of prices. Mirrors functions/misc.ts.
pub fn map_to_safe_map(&self, v: Value) -> Value
pub fn create_safe_dictionary(&self, _optional_args: &[Value]) -> Value
pub fn check_option_string( &self, _method_name: Value, _option_name: Value, value: Value, ) -> Value
pub fn check_option_bool( &self, method_name: Value, option_name: Value, value: Value, ) -> Value
pub fn check_option_integer( &self, _method_name: Value, _option_name: Value, value: Value, ) -> Value
Sourcepub fn clone_value(&self, v: Value) -> Value
pub fn clone_value(&self, v: Value) -> Value
clone(value) — CCXT’s deep clone, distinct from Rust’s Clone trait.
We disambiguate by name; the transpiler emits self.clone(x).
Sourcepub fn sum(&self, optional_args: &[Value]) -> Value
pub fn sum(&self, optional_args: &[Value]) -> Value
sum(...) — variadic numeric sum. Pure variadic (0 fixed
args) so single-arg sum(x) (e.g. from test.sum) also works.
Sourcepub fn parse_json_value(&self, v: Value) -> Value
pub fn parse_json_value(&self, v: Value) -> Value
parse_json(text) — JSON parse. Mirrors CCXT parseJson, which
runs onJsonResponse first: when quoteJsonNumbers is on
(default), every object number VALUE is wrapped in quotes before
parsing so big integer ids (e.g. bingx’s 18-digit orderId) and
precise decimals survive as strings instead of lossy f64/i64.
Sourcepub fn clone_self(&self) -> Exchange
pub fn clone_self(&self) -> Exchange
Test helper: tests sometimes call exchange.clone() to deep-copy
state. We don’t implement structural clone (the trait pointer
can’t be cloned safely) — return a fresh empty Exchange so the
call compiles and tests can move on.
No-arg exchange.clone() form — a structural copy of every
Value field. The copy gets a fresh Internals (no shared http
client / derived pointers), which is all the transpiled tests need.
Sourcepub fn clone(&self, v: Value) -> Value
pub fn clone(&self, v: Value) -> Value
clone(v) — deep-clone a Value. Matches TS exchange.clone(x).
Note: keep this name even though it shadows the (manual) clone_self,
because the transpiled tests call exchange.clone(value). Empty-arg
calls exchange.clone() get post-processed to clone_self().
Sourcepub fn prop(&self, key: &Value) -> Value
pub fn prop(&self, key: &Value) -> Value
Dynamic-property lookup for transpiled base tests. The TS code
does exchange['options'], exchange['markets'], etc. — this
reads from the unified to_value() view so both access paths
(exchange.prop(k) and testSharedMethods.exchangeProp) agree.
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
Full Value::Map snapshot of every transpiler-visible field —
the Rust analogue of indexing a JS object by property name.
Used by prop() and by the base-test exchangeProp shim.
pub fn base16ToBinary(&self, hex: Value, optional_args: &[Value]) -> Value
pub fn base58_to_binary(&self, s: Value, _optional_args: &[Value]) -> Value
pub fn binary_to_base58(&self, b: Value, _optional_args: &[Value]) -> Value
pub fn binary_length(&self, b: Value, _optional_args: &[Value]) -> Value
Sourcepub fn is_binary_message(&self, v: Value, _optional_args: &[Value]) -> Value
pub fn is_binary_message(&self, v: Value, _optional_args: &[Value]) -> Value
isBinaryMessage — in this port a binary buffer is a
Value::Array of byte-valued ints (see base16_to_binary,
string_to_binary). instanceof Uint8Array can’t transpile.
Sourcepub fn number_to_be(&self, n: Value, optional_args: &[Value]) -> Value
pub fn number_to_be(&self, n: Value, optional_args: &[Value]) -> Value
numberToBE(n, padding) — big-endian byte array of width padding.
Sourcepub fn parse_date(&self, s: Value, _optional_args: &[Value]) -> Value
pub fn parse_date(&self, s: Value, _optional_args: &[Value]) -> Value
parseDate(x) — ports functions/time.ts. Parses an ISO-8601
timestamp (with T/Z or a plain YYYY-MM-DD HH:MM:SS form,
treated as UTC) into epoch milliseconds. Invalid → Null.
pub fn is_binary_message_var(&self, v: Value, _optional_args: &[Value]) -> Value
Sourcepub fn ymd(&self, ts: Value, optional_args: &[Value]) -> Value
pub fn ymd(&self, ts: Value, optional_args: &[Value]) -> Value
ymd(timestamp, infix='') — like yyyymmdd but the infix
defaults to empty (TS functions/time.ts).
pub fn safe_float_n( &self, obj: Value, keys: Value, optional_args: &[Value], ) -> Value
pub fn safe_float2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
pub fn safeString2( &self, obj: Value, k1: Value, k2: Value, optional_args: &[Value], ) -> Value
Sourcepub fn binary_concat(&self, first: Value, optional_args: &[Value]) -> Value
pub fn binary_concat(&self, first: Value, optional_args: &[Value]) -> Value
binaryConcat(a, b, ...) — concatenates byte buffers. The
variadic call-site wrap folds the tail args into optional_args.
pub fn stringToBase64(&self, s: Value, optional_args: &[Value]) -> Value
Sourcepub fn binary_to_string(&self, b: Value, _optional_args: &[Value]) -> Value
pub fn binary_to_string(&self, b: Value, _optional_args: &[Value]) -> Value
binaryToString(buffer) — decodes a byte buffer as UTF-8.
pub fn string_to_binary(&self, s: Value, _optional_args: &[Value]) -> Value
Sourcepub fn urlencode_base64(&self, v: Value, _optional_args: &[Value]) -> Value
pub fn urlencode_base64(&self, v: Value, _optional_args: &[Value]) -> Value
urlencodeBase64(payload) — url-safe base64 with +/ → -_
and trailing = padding stripped. Accepts a string or a byte
buffer (Value::Array).
Sourcepub fn urlencode_nested(&self, v: Value, _optional_args: &[Value]) -> Value
pub fn urlencode_nested(&self, v: Value, _optional_args: &[Value]) -> Value
urlencodeNested(object) — qs.stringify(object, { encodeValuesOnly: true }):
nested maps → parent[child], arrays → parent[index], only
values are percent-encoded.
pub fn is_json_encoded_object(&self, optional_args: &[Value]) -> Value
pub fn strip(&self, s: Value, _optional_args: &[Value]) -> Value
pub fn sort(&self, v: Value, _optional_args: &[Value]) -> Value
Sourcepub fn round_timeframe(&self, tf: Value, ts: Value, direction: Value) -> Value
pub fn round_timeframe(&self, tf: Value, ts: Value, direction: Value) -> Value
roundTimeframe(timeframe, timestamp, direction) — snap a
timestamp to the timeframe boundary (down by default, up for
ROUND_UP).
pub async fn sleep(&self, ms: Value) -> Value
Sourcepub fn eth_get_address_from_private_key(
&self,
pk: Value,
_optional_args: &[Value],
) -> Value
pub fn eth_get_address_from_private_key( &self, pk: Value, _optional_args: &[Value], ) -> Value
ethGetAddressFromPrivateKey(pk) — derive the Ethereum address
(keccak256 of the uncompressed secp256k1 public key, last 20 bytes).
Sourcepub fn ensure_whitelisted_file(&self, p: &Value)
pub fn ensure_whitelisted_file(&self, p: &Value)
ensures the file path has a whitelisted extension, so users are safeguarded from arbitrary file access
pub fn exists_file(&self, p: Value) -> Value
pub fn read_file(&self, p: Value) -> Value
pub fn write_file(&self, p: Value, content: Value) -> Value
pub fn get_temp_dir(&self) -> Value
pub fn get_property(&self, obj: Value, key: Value) -> Value
pub fn yymmdd(&self, ts: Value, optional_args: &[Value]) -> Value
pub fn yyyymmdd(&self, ts: Value, optional_args: &[Value]) -> Value
Sourcepub fn ymdhms(&self, ts: Value, optional_args: &[Value]) -> Value
pub fn ymdhms(&self, ts: Value, optional_args: &[Value]) -> Value
ymdhms(timestamp, infix=' ') — UTC YYYY-MM-DD<infix>HH:MM:SS.
Sourcepub fn rawencode(&self, params: Value, _optional_args: &[Value]) -> Value
pub fn rawencode(&self, params: Value, _optional_args: &[Value]) -> Value
rawencode(params, [doSeq]) — URL-encode without sorting.
rawencode(object) — qs.stringify(object, { encode: false }):
flat key=value pairs with no percent-encoding.
Sourcepub fn int_to_base16(&self, n: Value, _optional_args: &[Value]) -> Value
pub fn int_to_base16(&self, n: Value, _optional_args: &[Value]) -> Value
intToBase16(n) — int → lowercase hex string.
Sourcepub fn packb(&self, action: Value, _optional_args: &[Value]) -> Value
pub fn packb(&self, action: Value, _optional_args: &[Value]) -> Value
packb(action) — MessagePack pack stub. Hyperliquid signs the
packed bytes of an action. Returning empty bytes here is enough
to make the call compile; live signing won’t be correct.
packb(value) — MessagePack-encode a Value into a byte array.
Sourcepub fn eth_encode_structured_data(
&self,
domain: Value,
types: Value,
message: Value,
) -> Value
pub fn eth_encode_structured_data( &self, domain: Value, types: Value, message: Value, ) -> Value
ethEncodeStructuredData(domain, types, message) — EIP-712
encoding: returns the \x19\x01 || domainSeparator || structHash
preimage that the caller keccak-hashes before signing.
Sourcepub fn uuid22(&self, _optional_args: &[Value]) -> Value
pub fn uuid22(&self, _optional_args: &[Value]) -> Value
uuid22() — pseudo-random 22-char hex id.
Sourcepub fn uuid16(&self, _optional_args: &[Value]) -> Value
pub fn uuid16(&self, _optional_args: &[Value]) -> Value
uuid16() — pseudo-random 16-char hex id.
Sourcepub fn uuid(&self, _optional_args: &[Value]) -> Value
pub fn uuid(&self, _optional_args: &[Value]) -> Value
uuid() — pseudo-random UUID v4: xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx.
Sourcepub fn urlencode(&self, params: Value, _optional_args: &[Value]) -> Value
pub fn urlencode(&self, params: Value, _optional_args: &[Value]) -> Value
urlencode(params) — wraps the typed urlencode_kv for Value args.
Sourcepub fn encode(&self, s: Value) -> Value
pub fn encode(&self, s: Value) -> Value
encode(s) — UTF-8 encode string to bytes (as Value::Array of ints).
pub fn number_to_string(&self, n: Value) -> Value
pub fn parse_number(&self, v: Value, optional_args: &[Value]) -> Value
pub fn parse_timeframe(&self, tf: Value) -> Value
Sourcepub fn precision_from_string(&self, s: Value) -> Value
pub fn precision_from_string(&self, s: Value) -> Value
precisionFromString(str) — ports functions/number.ts.
Scientific notation (1e-4 → 4, 1e4 → -4); otherwise the
number of fractional digits after stripping trailing zeros.
Sourcepub fn decimal_to_precision(
&self,
n: Value,
rounding: Value,
precision: Value,
optional_args: &[Value],
) -> Value
pub fn decimal_to_precision( &self, n: Value, rounding: Value, precision: Value, optional_args: &[Value], ) -> Value
decimalToPrecision(n, roundingMode, numPrecisionDigits, [countingMode], [paddingMode])
— faithful port of _decimalToPrecision from functions/number.ts.
pub fn capitalize(&self, s: Value) -> Value
pub fn encode_uri_component(&self, s: Value) -> Value
pub fn string_to_chars_array(&self, s: Value) -> Value
pub fn string_to_base64(&self, s: Value, _optional_args: &[Value]) -> Value
Sourcepub fn extract_params(&self, path: Value) -> Value
pub fn extract_params(&self, path: Value) -> Value
extract_params(path) — pulls {name} placeholders from a URL
template. Returns a Value::Array of names.
pub fn proxy_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn proxy_url_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn http_proxy_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn https_proxy_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn socks_proxy_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn ws_proxy_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn wss_proxy_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn ws_socks_proxy_callback_fn( &self, _url: Value, _method: Value, _headers: Value, _body: Value, ) -> Value
pub fn init_throttler(&mut self)
Sourcepub async fn throttle(&self, cost: &[Value]) -> Value
pub async fn throttle(&self, cost: &[Value]) -> Value
Leaky-bucket rate limiter, mirroring ts/src/base/functions/throttle.ts.
rateLimit is milliseconds-per-token, so refillRate = 1/rateLimit
tokens/ms; tokens may go negative (a request proceeds when tokens >= 0
and then subtracts its cost), and the next request waits until the bucket
refills back to zero. The bucket is owned by one task, so concurrent calls
on one instance serialize by queuing there (the TS single queue).
A no-op when enableRateLimit is false or the rate is effectively
unlimited.