API Reference¶
This reference documents the main classes and methods in the Meridian Python SDK.
Client Classes¶
AsyncRESTClient¶
The primary asynchronous client for interacting with the Meridian API via REST endpoints. Recommended for all new applications.
from meridian import AsyncRESTClient
# Create async client (use within async function)
client = await AsyncRESTClient.create({
"base_url": "https://api.meridian.xyz",
"chain_config": {
"rpc_url": "https://rpc.mainnet.chain.robinhood.com",
"private_key": "your_private_key", # optional, required for signing
}
})
# Use the client
products = await client.products()
subaccounts = await client.subaccounts()
# Remember to close when done
await client.close()
meridian.async_rest_client.AsyncRESTClient
¶
Bases: AsyncHTTPClient
Asynchronous REST client for the Meridian API.
Notes for maintainers:
- This client composes endpoint functions from the meridian.rest.* modules
by assigning them as attributes on the class (see below). Each function
expects self to provide get, post, and get_validated from
AsyncHTTPClient and to expose _models for the active network.
- Network-specific models are accessed via self._models which is set based
on the configured network via meridian.models.load_models.
- Use AsyncRESTClient.create(...) to ensure async initialization (RPC
config, optional chain client) happens before use. Remember to await
client.close() to release the underlying httpx.AsyncClient.
- We intentionally avoid “async properties”. For convenience methods that
derive indices (e.g., products by ticker/id), use explicit async methods
like products_by_ticker() or products_by_id() that fetch fresh
data each call to keep behavior lightweight and predictable.
Source code in meridian/async_rest_client.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | |
cancel_orders(order_ids, sender=None, subaccount=None, client_order_ids=[], sign=True, submit=True, **kwargs)
async
¶
Prepares and optionally submits a request to cancel multiple orders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_ids
|
List[str]
|
Order UUIDs to cancel. Required. |
required |
sender
|
str
|
Address initiating the cancellation. Defaults to chain address. |
None
|
subaccount
|
str
|
Hex-encoded subaccount name. Defaults to first subaccount. |
None
|
client_order_ids
|
List[str]
|
Client-generated IDs to cancel. Defaults to empty list. |
[]
|
sign
|
bool
|
If True, sign the payload immediately. Defaults to True. |
True
|
submit
|
bool
|
If True, submit the request to the API. Defaults to True. |
True
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. |
Returns:
| Type | Description |
|---|---|
Union[List[CancelOrderResultDto], CancelOrderDto]
|
Union[List[CancelOrderResultDto], CancelOrderDto]: Cancellation results per order id or prepared cancel payload. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no order IDs or client order IDs provided for cancellation. |
Source code in meridian/async_rest_client.py
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | |
convert_token(from_token_id, to_token_id, amount, subaccount=None, sender=None, nonce=None, signed_at=None, sign=True, submit=True, **kwargs)
async
¶
Prepares, signs, and optionally submits a token conversion.
This is the primary method for converting between tokens. It handles
the complete conversion flow: preparing the conversion payload, signing
it with EIP-712, and submitting to the API. To submit a payload you
already prepared and signed, use submit_convert_token instead.
Example
Convert 100 of one token into another::
result = await client.convert_token(
from_token_id=from_token.id,
to_token_id=to_token.id,
amount=100,
)
Prepare without submitting (for inspection or manual submission)::
payload = await client.convert_token(
from_token_id=from_token.id,
to_token_id=to_token.id,
amount=100,
submit=False,
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
from_token_id
|
UUID
|
UUID of the token to convert from. |
required |
to_token_id
|
UUID
|
UUID of the token to convert to. |
required |
amount
|
int
|
Amount to convert in the token's base units. |
required |
subaccount
|
Optional[str]
|
Hex-encoded subaccount name. If not provided, defaults to the first subaccount associated with the connected wallet. |
None
|
sender
|
Optional[str]
|
Account or linked signer address placing the request. If not provided, defaults to the connected wallet's address. |
None
|
nonce
|
Optional[str]
|
Custom nonce for the EIP-712 signature. If not provided, a random nonce is generated. |
None
|
signed_at
|
Optional[int]
|
Unix timestamp (seconds) for the signature. If not provided, defaults to the current time. |
None
|
sign
|
bool
|
Whether to sign the conversion payload. Defaults to True. |
True
|
submit
|
bool
|
Whether to submit the conversion to the API. Set to False to receive the prepared payload without submitting. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
Union[ConversionDto, InitiateConversionDto]
|
If |
Union[ConversionDto, InitiateConversionDto]
|
record created by the API. If |
Union[ConversionDto, InitiateConversionDto]
|
InitiateConversionDto payload. |
Source code in meridian/async_rest_client.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
create(config={})
async
classmethod
¶
Factory method to create and asynchronously initialize the client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Union[Dict[str, Any], RESTConfig]
|
Configuration dictionary or RESTConfig object. Optional fields include: private_key (str, optional): The private key. base_url (str, optional): Base URL for REST requests. Defaults to testnet. timeout (int, optional): Timeout in seconds for REST requests. verbose (bool, optional): Enables debug logging. Defaults to False. rate_limit_headers (bool, optional): Enables rate limit headers. Defaults to False. chain_config (ChainConfig, optional): Chain configuration for signing transactions. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
AsyncRESTClient |
AsyncRESTClient
|
Fully initialized async client instance. |
Source code in meridian/async_rest_client.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
create_batch_order(instructions, submit=True, **kwargs)
async
¶
Prepare and optionally submit a batch of signed order instructions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instructions
|
List[Union[SubmitOrderDto, CancelOrderDto]]
|
Prepared SubmitOrderDto or prepared CancelOrderDto payloads. |
required |
submit
|
bool
|
If True, submit the batch order. Defaults to True. |
True
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. |
Returns:
| Type | Description |
|---|---|
Union[BatchOrderDto, BatchOrderResponseDto]
|
BatchOrderResponseDto or BatchOrderDto: Batch response or prepared batch payload. |
Source code in meridian/async_rest_client.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | |
create_order(order_type, quantity, side, price=None, ticker=None, product_id=None, client_order_id=None, sender=None, subaccount=None, time_in_force=None, post_only=None, reduce_only=False, close=None, stop_price=None, stop_type=None, expires_at=None, group_id=None, group_contingency_type=None, sign=True, dry_run=False, submit=True)
async
¶
Create and submit an order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_type
|
str
|
'LIMIT' or 'MARKET'. Required. |
required |
quantity
|
float
|
Order size. Required. |
required |
side
|
int
|
0 for buy, 1 for sell. Required. |
required |
price
|
float
|
Limit price for LIMIT orders. |
None
|
ticker
|
str
|
Ticker of the product. |
None
|
product_id
|
str
|
UUID of the product. |
None
|
client_order_id
|
str
|
Subaccount-scoped client-generated id (UUID or <=32 alphanumeric). |
None
|
sender
|
str
|
Address placing the order. Defaults to chain address. |
None
|
subaccount
|
str
|
Hex-encoded subaccount name. Defaults to first subaccount. |
None
|
time_in_force
|
str
|
For LIMIT orders (e.g., 'GTC', 'GTD'). Defaults to 'GTC'. |
None
|
post_only
|
bool
|
For LIMIT orders; rejects if crossing. Defaults to False. |
None
|
reduce_only
|
bool
|
If True, order only reduces position. Defaults to False. |
False
|
close
|
bool
|
For MARKET orders; If True, closes the position. |
None
|
stop_price
|
float
|
Stop trigger price. |
None
|
stop_type
|
int
|
Stop type, either 0 (take-profit) or 1 (stop-loss), requires non-zero stopPrice. |
None
|
expires_at
|
int
|
Expiry timestamp for GTD. |
None
|
group_id
|
str
|
Group Id (UUID) for linking orders together in OCO/OTO relationships. |
None
|
group_contingency_type
|
int
|
Contingency type for order groups: 0=OTO (Order-Triggers-Order), 1=OCO (One-Cancels-Other). |
None
|
sign
|
bool
|
If True, sign the payload immediately. Defaults to True. |
True
|
dry_run
|
bool
|
If True, validate without execution. Defaults to False. |
False
|
submit
|
bool
|
If True, submit the order. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
Union[SubmitOrderCreatedDto, DryRunOrderCreatedDto, SubmitOrderDto]
|
Union[SubmitOrderCreatedDto, DryRunOrderCreatedDto, SubmitOrderDto]: Created order response, dry-run validation result, or prepared order payload. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither product_id nor ticker is provided or if order type is invalid. |
Source code in meridian/async_rest_client.py
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | |
extend_signer(sender=None, sign=True, submit=True, **kwargs)
async
¶
Prepare, sign, and optionally submit an extend-linked-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Address of the linked signer extending itself. Defaults to the client's chain address. |
None
|
sign
|
bool
|
Sign with the client's key. Defaults to True. |
True
|
submit
|
bool
|
Submit to the API. If False, return the prepared DTO. |
True
|
Returns:
| Type | Description |
|---|---|
Union[SignerDto, ExtendLinkedSignerDto]
|
Union[SignerDto, ExtendLinkedSignerDto]: Submitted record or the prepared/signable payload. |
Source code in meridian/async_rest_client.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | |
get_maintenance_margin(subaccount_id, positions=None, products=None, product_ids=None)
async
¶
Calculate the an account's maintenance margin for specified positions or products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
Fetch positions for this subaccount when |
required |
positions
|
List[PositionDto] | List[Dict[str, Any]]
|
Pre-fetched positions to use directly. |
None
|
products
|
List[ProductDto] | List[Dict[str, Any]]
|
Pre-fetched products used to filter the calculation. |
None
|
product_ids
|
List[str] | List[UUID]
|
Filters the calculation to these product IDs. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Decimal |
Decimal
|
Total maintenance margin for the filtered positions. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither positions nor subaccount context is provided, or if any referenced product cannot be resolved. |
Source code in meridian/async_rest_client.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
get_tokens()
async
¶
Return the latest list of tokens (no caching).
Source code in meridian/async_rest_client.py
573 574 575 | |
link_signer(signer, subaccount_id, subaccount=None, sender=None, signer_private_key=None, nonce=None, signed_at=None, sign_sender=True, sign_signer=True, submit=True, **kwargs)
async
¶
Prepare, sign, and optionally submit a linked signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signer
|
str
|
Address being linked as a delegate signer. Required. |
required |
subaccount_id
|
UUID
|
Target subaccount id. Required. |
required |
subaccount
|
str
|
Bytes32 subaccount name. If omitted, fetched by id. |
None
|
sender
|
str
|
Owner address. Defaults to the client's chain address. |
None
|
signer_private_key
|
str
|
Private key for the signer address. |
None
|
nonce
|
str
|
Custom nonce for the signature. |
None
|
signed_at
|
int
|
Seconds since epoch for the signature timestamp. |
None
|
sign_sender
|
bool
|
Sign with the owner key. Defaults to True. |
True
|
sign_signer
|
bool
|
Sign with the signer key. Defaults to True. |
True
|
submit
|
bool
|
Submit to the API. If False, return the prepared DTO. |
True
|
Returns:
| Type | Description |
|---|---|
Union[SignerDto, LinkSignerDto]
|
Union[SignerDto, LinkSignerDto]: Submitted record or the prepared/signable payload. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the subaccount name cannot be resolved or signer signature is missing. |
Source code in meridian/async_rest_client.py
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
products(refresh=False)
async
¶
Get the list of products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh
|
bool
|
If True, bypass cache and fetch fresh data. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
List[ProductDto]
|
List[ProductDto]: List of product objects. |
Source code in meridian/async_rest_client.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
products_by_id(refresh=False)
async
¶
Get the products indexed by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh
|
bool
|
If True, bypass cache and fetch fresh data. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[UUID, ProductDto]
|
Dict[UUID, ProductDto]: Dictionary of products keyed by ID. |
Source code in meridian/async_rest_client.py
459 460 461 462 463 464 465 466 467 468 469 470 471 | |
products_by_ticker(refresh=False)
async
¶
Get the products indexed by ticker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh
|
bool
|
If True, bypass cache and fetch fresh data. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, ProductDto]
|
Dict[str, ProductDto]: Dictionary of products keyed by ticker. |
Source code in meridian/async_rest_client.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
refresh_signer(signer, subaccount_id, subaccount=None, sender=None, sign=True, submit=True, **kwargs)
async
¶
Prepare, sign, and optionally submit a refresh-linked-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signer
|
str
|
Address of the delegate to refresh. Required. |
required |
subaccount_id
|
UUID
|
Target subaccount id. Required. |
required |
subaccount
|
str
|
Bytes32 subaccount name. If omitted, fetched by id. |
None
|
sender
|
str
|
Owner address. Defaults to the client's chain address. |
None
|
sign
|
bool
|
Sign with the owner key. Defaults to True. |
True
|
submit
|
bool
|
Submit to the API. If False, return the prepared DTO. |
True
|
Returns:
| Type | Description |
|---|---|
Union[SignerDto, RefreshLinkedSignerDto]
|
Union[SignerDto, RefreshLinkedSignerDto]: Submitted record or the prepared/signable payload. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the subaccount name cannot be resolved. |
Source code in meridian/async_rest_client.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | |
replace_order(order=None, order_id=None, quantity=None, price=None, time_in_force=None, post_only=None, reduce_only=False)
async
¶
Replace an existing order with new parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
OrderDto
|
Existing order object to replace. |
None
|
order_id
|
str
|
UUID of the order to replace. |
None
|
quantity
|
float
|
New order size. |
None
|
price
|
float
|
New limit price. |
None
|
time_in_force
|
str
|
New time in force. |
None
|
post_only
|
bool
|
New post-only flag. |
None
|
reduce_only
|
bool
|
New reduce-only flag. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Tuple[SubmitOrderCreatedDto, bool]
|
Tuple[SubmitOrderCreatedDto, bool]: Created order response and success flag. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither order nor order_id is provided, or both are provided. |
Source code in meridian/async_rest_client.py
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | |
revoke_signer(signer, subaccount_id, subaccount=None, sender=None, sign=True, submit=True, **kwargs)
async
¶
Prepare, sign, and optionally submit a revoke-linked-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signer
|
str
|
Address of the delegate to revoke. Required. |
required |
subaccount_id
|
UUID
|
Target subaccount id. Required. |
required |
subaccount
|
str
|
Bytes32 subaccount name. If omitted, fetched by id. |
None
|
sender
|
str
|
Owner address. Defaults to the client's chain address. |
None
|
sign
|
bool
|
Sign with the owner key. Defaults to True. |
True
|
submit
|
bool
|
Submit to the API. If False, return the prepared DTO. |
True
|
Returns:
| Type | Description |
|---|---|
Union[SignerDto, RevokeLinkedSignerDto]
|
Union[SignerDto, RevokeLinkedSignerDto]: Submitted record or the prepared/signable payload. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the subaccount name cannot be resolved. |
Source code in meridian/async_rest_client.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | |
subaccounts(refresh=False)
async
¶
Get the list of subaccounts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh
|
bool
|
If True, bypass cache and fetch fresh data. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
List[SubaccountDto]
|
List[SubaccountDto]: List of subaccount objects for the connected wallet address. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client is configured or address is unavailable. |
Source code in meridian/async_rest_client.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
tokens(refresh=False)
async
¶
Get the list of tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh
|
bool
|
If True, bypass cache and fetch fresh data. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
List[TokenDto]
|
List[TokenDto]: List of token objects. |
Source code in meridian/async_rest_client.py
430 431 432 433 434 435 436 437 438 439 440 441 | |
withdraw_token(token_id, amount, destination_address, destination_endpoint, subaccount=None, account=None, nonce=None, signed_at=None, sign=True, submit=True, **kwargs)
async
¶
Prepares, signs, and optionally submits a token withdrawal.
This is the primary method for initiating token withdrawals. It handles
the complete withdrawal flow: preparing the withdrawal payload, signing
it with EIP-712, and submitting to the API. To submit a payload you
already prepared and signed, use submit_withdraw_token instead.
Example
Withdraw 100 USD to the connected wallet::
result = await client.withdraw_token(
token_id=usd_token.id,
amount=100,
destination_address=client.chain.address,
destination_endpoint=0,
)
Prepare without submitting (for inspection or manual submission)::
payload = await client.withdraw_token(
token_id=usd_token.id,
amount=100,
destination_address="0x...",
destination_endpoint=0,
submit=False,
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_id
|
UUID
|
UUID of the token to withdraw. |
required |
amount
|
int
|
Amount to withdraw in the token's base units. |
required |
destination_address
|
str
|
The LayerZero destination address where funds will be sent. Automatically padded to bytes32 format. |
required |
destination_endpoint
|
int
|
LayerZero endpoint ID for the destination chain. Use 0 for same-chain withdrawals. |
required |
subaccount
|
Optional[str]
|
Hex-encoded subaccount name. If not provided, defaults to the first subaccount associated with the connected wallet. |
None
|
account
|
Optional[str]
|
Recipient wallet address. If not provided, defaults to the connected wallet's address. |
None
|
nonce
|
Optional[str]
|
Custom nonce for the EIP-712 signature. If not provided, a random nonce is generated. |
None
|
signed_at
|
Optional[int]
|
Unix timestamp (seconds) for the signature. If not provided, defaults to the current time. |
None
|
sign
|
bool
|
Whether to sign the withdrawal payload. Defaults to True. |
True
|
submit
|
bool
|
Whether to submit the withdrawal to the API. Set to False to receive the prepared payload without submitting. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
Union[WithdrawDto, InitiateWithdrawDto]
|
If |
Union[WithdrawDto, InitiateWithdrawDto]
|
record created by the API. If |
Union[WithdrawDto, InitiateWithdrawDto]
|
InitiateWithdrawDto payload. |
Source code in meridian/async_rest_client.py
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | |
RESTClient¶
Synchronous wrapper around AsyncRESTClient for backward compatibility. Use AsyncRESTClient for new applications.
from meridian import RESTClient
client = RESTClient({
"base_url": "https://api.meridian.xyz",
"chain_config": {
"rpc_url": "https://rpc.mainnet.chain.robinhood.com",
"private_key": "your_private_key", # optional
}
})
# Property access works for convenience
products = client.products
subaccounts = client.subaccounts
# Remember to close when done
client.close()
meridian.rest.rpc
¶
get_rpc_config(self, **kwargs)
async
¶
Gets RPC configuration for EIP-712 signing and contract info.
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
RpcConfigDto |
RpcConfigDto
|
Domain and signature type definitions for signing. |
Source code in meridian/rest/rpc.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
meridian.rest.subaccount
¶
get_subaccount(self, id, **kwargs)
async
¶
Gets a specific subaccount by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SubaccountDto |
SubaccountDto
|
Subaccount details. |
Source code in meridian/rest/subaccount.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
get_subaccount_balance_history(self, **kwargs)
async
¶
Gets historical subaccount balances from the archive API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
start_time |
float
|
Range start time in milliseconds since Unix epoch. Required. |
end_time |
float
|
Range end time in milliseconds since Unix epoch. Optional. |
resolution |
str
|
Data resolution (e.g., 'hour1', 'day1'). Required. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (defaults to 'time'). Optional. |
**kwargs |
Additional query parameters supported by the API. |
Returns:
| Type | Description |
|---|---|
List[BalanceHistoryDto]
|
List[BalanceHistoryDto]: Historical balance records ordered per request parameters. |
Source code in meridian/rest/subaccount.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
get_subaccount_balances(self, **kwargs)
async
¶
Gets token balances for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'tokenName', 'updatedAt', 'amount'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[SubaccountBalanceDto]
|
List[SubaccountBalanceDto]: Balances for the subaccount. |
Source code in meridian/rest/subaccount.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
get_subaccount_funding_history(self, **kwargs)
async
¶
Gets historical funding charges for positions in a subaccount from the archive API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
start_time
|
float
|
Range start time in milliseconds since Unix epoch. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
end_time |
float
|
Range end time in milliseconds since Unix epoch. Optional. |
position_ids |
List[str]
|
Filter by specific position IDs (max 128). Optional. |
product_ids |
List[str]
|
Filter by specific product IDs. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (defaults to 'time'). Optional. |
**kwargs |
Additional query parameters supported by the API. |
Returns:
| Type | Description |
|---|---|
List[PositionFundingHistoryDto]
|
List[PositionFundingHistoryDto]: Historical funding charge records for positions in the subaccount. |
Source code in meridian/rest/subaccount.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
get_subaccount_position_fee_history(self, **kwargs)
async
¶
Gets historical position-fee charges for positions in a subaccount from the archive API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
start_time
|
float
|
Range start time in milliseconds since Unix epoch. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
end_time |
float
|
Range end time in milliseconds since Unix epoch. Optional. |
position_ids |
List[str]
|
Filter by specific position IDs (max 128). Optional. |
product_ids |
List[str]
|
Filter by specific product IDs. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (defaults to 'time'). Optional. |
**kwargs |
Additional query parameters supported by the API. |
Returns:
| Type | Description |
|---|---|
List[PositionFeeHistoryDto]
|
List[PositionFeeHistoryDto]: Historical position-fee charge records for positions in the subaccount. |
Source code in meridian/rest/subaccount.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
get_subaccount_total_volume(self, **kwargs)
async
¶
Gets the total trading volume for a subaccount from the archive API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional query parameters supported by the API. |
Returns:
| Name | Type | Description |
|---|---|---|
TotalSubaccountVolumeDto |
TotalSubaccountVolumeDto
|
Total volume in USD for the subaccount. |
Source code in meridian/rest/subaccount.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
get_subaccount_unrealized_pnl_history(self, **kwargs)
async
¶
Gets historical unrealized PnL for a subaccount from the archive API.
Source code in meridian/rest/subaccount.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get_subaccount_volume_history(self, **kwargs)
async
¶
Gets historical trading volume for a subaccount from the archive API.
Source code in meridian/rest/subaccount.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
list_all_subaccounts(self, **kwargs)
async
¶
Lists all subaccounts.
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[SubaccountDto]
|
List[SubaccountDto]: Subaccount records. |
Source code in meridian/rest/subaccount.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
list_subaccounts(self, **kwargs)
async
¶
Lists subaccounts for a given sender (address).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Wallet address to query subaccounts for. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
name |
str
|
Filter by subaccount name. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[SubaccountDto]
|
List[SubaccountDto]: Subaccount records for the sender. |
Source code in meridian/rest/subaccount.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
meridian.rest.product
¶
get_market_liquidity(self, **kwargs)
async
¶
Gets market liquidity for a product.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_id
|
str
|
Id representing the registered product. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
MarketLiquidityDto |
MarketLiquidityDto
|
Top-of-book and depth liquidity metrics. |
Source code in meridian/rest/product.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
get_product(self, id, **kwargs)
async
¶
Gets a specific product by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID of the product. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
ProductDto |
ProductDto
|
Product configuration for the specified ID. |
Source code in meridian/rest/product.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
list_mark_price_gaps(self, **kwargs)
async
¶
Lists mark price gap windows for one or more products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_ids
|
List[UUID]
|
List of product IDs (1-50). Required. |
required |
start_time
|
float
|
Range start time in milliseconds since Unix epoch. Required. |
required |
end_time
|
float
|
Range end time in milliseconds since Unix epoch. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by, e.g., 'startTime'. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[MarkPriceGapDto]
|
List[MarkPriceGapDto]: Mark price gap windows for the requested products. |
Source code in meridian/rest/product.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
list_market_prices(self, **kwargs)
async
¶
Gets market prices for one or more products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_ids
|
List[str]
|
List of product IDs to query. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[MarketPriceDto]
|
List[MarketPriceDto]: Best bid/ask prices for the requested products. |
Source code in meridian/rest/product.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
list_products(self, **kwargs)
async
¶
Lists all products and their configurations.
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
ticker |
str
|
Filter by product ticker (e.g., 'ETHUSD'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[ProductDto]
|
List[ProductDto]: Product configuration records. |
Source code in meridian/rest/product.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
meridian.rest.position
¶
get_active_position(self, **kwargs)
async
¶
Gets the active position for a subaccount and product.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
product_id
|
str
|
UUID of the product. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
PositionDto |
PositionDto
|
Active position for the subaccount and product. |
Source code in meridian/rest/position.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
get_position(self, id, **kwargs)
async
¶
Gets a specific position by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID of the position. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
PositionDto |
PositionDto
|
Position information for the specified ID. |
Source code in meridian/rest/position.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
list_position_fees(self, **kwargs)
async
¶
Lists historical position-fee charges for a product over a time range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_id
|
str
|
Id representing the registered product. Required. |
required |
start_time
|
float
|
Range start time in milliseconds since Unix epoch. Required. |
required |
end_time
|
float
|
Range end time in milliseconds since Unix epoch. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by, e.g., 'chargedAt'. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[PositionFeeDto]
|
List[PositionFeeDto]: Position-fee charge records for the product. |
Source code in meridian/rest/position.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
list_position_fills(self, **kwargs)
async
¶
Lists fills for a position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position_id
|
str
|
UUID of the position. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[PositionFillDto]
|
List[PositionFillDto]: Fill records for the position. |
Source code in meridian/rest/position.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
list_position_liquidations(self, **kwargs)
async
¶
Lists position liquidations.
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[PositionLiquidationDto]
|
List[PositionLiquidationDto]: List of position liquidation records. |
Source code in meridian/rest/position.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
list_positions(self, **kwargs)
async
¶
Lists positions for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
product_ids |
List[str]
|
UUIDs of products to filter by. Optional. |
open |
bool
|
Filter for open positions. Optional. |
created_after |
float
|
Filter positions created after this timestamp. Optional. |
created_before |
float
|
Filter positions created before this timestamp. Optional. |
side |
int
|
Filter by position side (0 for buy, 1 for sell). Optional. |
is_liquidated |
bool
|
Filter liquidated positions. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by, e.g., 'size', 'createdAt', 'updatedAt', or 'realizedPnl'. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[PositionDto]
|
List[PositionDto]: List of position information for the subaccount. |
Source code in meridian/rest/position.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
list_projected_position_fees(self, **kwargs)
async
¶
Lists projected position-fee rates for multiple products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_ids
|
List[UUID]
|
List of product IDs (1-50). Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[ProjectedPositionFeeDto]
|
List[ProjectedPositionFeeDto]: Projected position-fee rate objects for the products. |
Source code in meridian/rest/position.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
meridian.rest.order
¶
cancel_all_orders(self, subaccount_id, **kwargs)
async
¶
Cancel all open orders for a given subaccount via the cancel-all endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. |
Returns:
| Type | Description |
|---|---|
List[CancelOrderResultDto]
|
List[CancelOrderResultDto]: Cancellation results per order id. |
Source code in meridian/rest/order.py
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | |
dry_run_order(self, order, **kwargs)
async
¶
Submits a prepared order for validation without execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
SubmitOrderDto
|
Prepared order payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
DryRunOrderCreatedDto |
DryRunOrderCreatedDto
|
Dry-run validation result. |
Source code in meridian/rest/order.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
get_order(self, id, **kwargs)
async
¶
Gets a specific order by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID of the order. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
OrderDto |
OrderDto
|
Order details. |
Source code in meridian/rest/order.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
list_fills(self, **kwargs)
async
¶
Lists order fills for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
product_ids |
List[str]
|
Filter by one or more product IDs. Optional. |
created_after |
float
|
Filter fills created after this timestamp. Optional. |
created_before |
float
|
Filter fills created before this timestamp. Optional. |
side |
int
|
Filter by order side (0 for buy, 1 for sell). Optional. |
include_self_trades |
bool
|
Include self trades in results. Defaults to False. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt', 'productId'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[OrderFillDto]
|
List[OrderFillDto]: Fill records for the subaccount. |
Source code in meridian/rest/order.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
list_order_group(self, id, **kwargs)
async
¶
Lists orders in the same contingency group as an order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID of the order. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[OrderDto]
|
List[OrderDto]: Orders in the contingency group. |
Source code in meridian/rest/order.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
list_orders(self, **kwargs)
async
¶
Lists orders for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
product_ids |
List[str]
|
Filter by one or more product IDs. Optional. |
client_order_id |
str
|
Filter by a client-generated order id. Optional. |
statuses |
List[str]
|
Filter by status values. Optional. |
created_after |
float
|
Filter orders created after this timestamp. Optional. |
created_before |
float
|
Filter orders created before this timestamp. Optional. |
side |
int
|
Filter by order side (0 for buy, 1 for sell). Optional. |
close |
bool
|
Filter by close flag. Optional. |
stop_types |
List[int]
|
Filter by stop types (0 for GAIN, 1 for LOSS). Optional. |
is_working |
bool
|
Filter working orders. Optional. |
is_pending |
bool
|
Filter pending orders. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[OrderDto]
|
List[OrderDto]: Order records for the subaccount. |
Source code in meridian/rest/order.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
list_trades(self, **kwargs)
async
¶
Lists trades for a specific product.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_id
|
str
|
Product ID to query trades for. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[TradeDto]
|
List[TradeDto]: Trade records. |
Source code in meridian/rest/order.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
prepare_batch_order(self, instructions)
async
¶
Prepares a batch order payload from signed order and cancel payloads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instructions
|
List[Union[SubmitOrderDto, CancelOrderDto]]
|
Prepared SubmitOrderDto or prepared CancelOrderDto payloads. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BatchOrderDto |
BatchOrderDto
|
Prepared batch order payload. |
Source code in meridian/rest/order.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
prepare_cancel_all_order(self, sender, subaccount, include_signature=False, **kwargs)
async
¶
Prepares the payload for canceling all open orders of a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Address initiating the cancellation. Required. |
required |
subaccount
|
str
|
Hex-encoded subaccount name. Required. |
required |
include_signature
|
bool
|
If True, sign the payload immediately. Optional. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. |
**kwargs |
Additional request parameters accepted by the API. |
Returns:
| Name | Type | Description |
|---|---|---|
CancelAllOrderDto |
CancelAllOrderDto
|
Prepared (and optionally signed) cancel-all payload. |
Source code in meridian/rest/order.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
prepare_cancel_order(self, sender, subaccount, order_ids=[], client_order_ids=[], include_signature=False, **kwargs)
async
¶
Prepares the payload for canceling one or more orders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Address initiating the cancellation. Required. |
required |
subaccount
|
str
|
Hex-encoded subaccount name. Required. |
required |
order_ids
|
List[str]
|
Order UUIDs to cancel. Optional. |
[]
|
client_order_ids
|
List[str]
|
Client-generated IDs to cancel. Optional. |
[]
|
include_signature
|
bool
|
If True, sign the payload immediately. Optional. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. |
**kwargs |
Additional request parameters accepted by the API. |
Returns:
| Name | Type | Description |
|---|---|---|
CancelOrderDto |
CancelOrderDto
|
Prepared (and optionally signed) cancel payload. |
Source code in meridian/rest/order.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | |
prepare_order(self, sender, price=None, quantity=None, side=None, subaccount=None, onchain_id=None, order_type=None, client_order_id=None, time_in_force=None, post_only=False, reduce_only=False, close=None, stop_price=None, stop_type=None, group_id=None, group_contingency_type=None, expires_at=None, include_signature=False, **kwargs)
async
¶
Prepares the payload for an order, optionally including a signature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Address placing the order. Required. |
required |
price
|
Union[str, float, Decimal]
|
Limit price for LIMIT orders. |
None
|
quantity
|
Union[str, float, Decimal]
|
Order size. |
None
|
side
|
int
|
0 for buy, 1 for sell. |
None
|
subaccount
|
str
|
Hex-encoded subaccount name. |
None
|
onchain_id
|
float
|
Product onchain ID. |
None
|
order_type
|
str
|
'LIMIT' or 'MARKET'. |
None
|
client_order_id
|
str
|
Subaccount-scoped client-generated id (UUID or <=32 alphanumeric). |
None
|
time_in_force
|
str
|
For LIMIT orders (e.g., 'GTC', 'GTD'). |
None
|
post_only
|
bool
|
For LIMIT orders; rejects if crossing. |
False
|
reduce_only
|
bool
|
If True, order only reduces position. |
False
|
close
|
bool
|
If True, closes the position. |
None
|
stop_price
|
Union[str, float, Decimal]
|
Stop trigger price. |
None
|
stop_type
|
int
|
Stop type enum value. |
None
|
group_id
|
str
|
Contingency group id. |
None
|
group_contingency_type
|
int
|
Group contingency type. |
None
|
expires_at
|
int
|
Expiry timestamp for GTD. |
None
|
include_signature
|
bool
|
If True, sign the payload immediately. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. |
signed_at |
int
|
Seconds since epoch for signature timestamp. |
**kwargs |
Additional request parameters accepted by the API. |
Returns:
| Name | Type | Description |
|---|---|---|
SubmitOrderDto |
SubmitOrderDto
|
Prepared (and optionally signed) order payload. |
Source code in meridian/rest/order.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
sign_cancel_all_order(self, cancel_all_order, private_key=None)
async
¶
Signs a cancel-all order payload using EIP-712.
The payload is signed with the same CancelOrder primary type used for canceling orders by id; the signed message covers sender, subaccount and nonce only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cancel_all_order
|
CancelAllOrderDto
|
Prepared cancel-all payload. Required. |
required |
private_key
|
str
|
Private key override. Defaults to client's key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CancelAllOrderDto |
CancelAllOrderDto
|
The same DTO with signature populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/order.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
sign_cancel_order(self, order_to_cancel, private_key=None)
async
¶
Signs a cancel order payload using EIP-712.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_to_cancel
|
CancelOrderDto
|
Prepared cancel payload. Required. |
required |
private_key
|
str
|
Private key override. Defaults to client's key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CancelOrderDto |
CancelOrderDto
|
The same DTO with signature populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/order.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
sign_order(self, order, private_key=None)
async
¶
Signs an order payload using EIP-712.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
SubmitOrderDto
|
Prepared order to sign. Required. |
required |
private_key
|
str
|
Private key override. Defaults to client's key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
SubmitOrderDto |
SubmitOrderDto
|
The same DTO with signature populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/order.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
submit_batch_order(self, batch_order, **kwargs)
async
¶
Submits a batch of prepared and signed order instructions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_order
|
BatchOrderDto
|
BatchOrderDto or a dict with an |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
BatchOrderResponseDto |
BatchOrderResponseDto
|
Result for each batch instruction. |
Source code in meridian/rest/order.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
submit_cancel_all_order(self, cancel_all_order, **kwargs)
async
¶
Submits a prepared and signed cancel-all order request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cancel_all_order
|
CancelAllOrderDto
|
Prepared and signed cancel-all payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[CancelOrderResultDto]
|
List[CancelOrderResultDto]: Cancellation results per order id. |
Source code in meridian/rest/order.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
submit_cancel_order(self, order_to_cancel, **kwargs)
async
¶
Submits a prepared and signed cancel order request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_to_cancel
|
CancelOrderDto
|
Prepared and signed cancel payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[CancelOrderResultDto]
|
List[CancelOrderResultDto]: Cancellation results per order id. |
Source code in meridian/rest/order.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
submit_order(self, order, **kwargs)
async
¶
Submits a prepared and signed order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
SubmitOrderDto
|
Prepared and signed order payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SubmitOrderCreatedDto |
SubmitOrderCreatedDto
|
Created order response. |
Source code in meridian/rest/order.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
meridian.rest.funding
¶
list_funding(self, **kwargs)
async
¶
Lists historical funding rates for a product over a specified time range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_id
|
str
|
Id representing the registered product. Required. |
required |
range
|
str
|
Time window to query. One of 'DAY', 'WEEK', or 'MONTH'. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by, e.g., 'createdAt'. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[FundingDto]
|
List[FundingDto]: Funding rate history objects for the product. |
Source code in meridian/rest/funding.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
list_projected_funding(self, **kwargs)
async
¶
Lists projected funding rates for multiple products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_ids
|
List[UUID]
|
List of product IDs (1-10). Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[ProjectedFundingDto]
|
List[ProjectedFundingDto]: Projected funding rate objects for the products. |
Source code in meridian/rest/funding.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
meridian.rest.linked_signer
¶
extend_linked_signer(self, dto, **kwargs)
async
¶
Submits a prepared and signed extend-linked-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
ExtendLinkedSignerDto
|
Prepared and signed extend payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SignerDto |
SignerDto
|
Signer record reflecting the extended expiry. |
Source code in meridian/rest/linked_signer.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
get_signer(self, id, **kwargs)
async
¶
Gets a specific linked signer by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID of the linked signer. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SignerDto |
SignerDto
|
Linked signer details. |
Source code in meridian/rest/linked_signer.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_signer_by_address(self, address, **kwargs)
async
¶
Gets a specific linked signer by address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
Address of the linked signer. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SignerDto |
SignerDto
|
Linked signer details. |
Source code in meridian/rest/linked_signer.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
get_signer_quota(self, **kwargs)
async
¶
Gets the signer quota for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
AccountSignerQuotaDto |
AccountSignerQuotaDto
|
Remaining quota information for the subaccount. |
Source code in meridian/rest/linked_signer.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
link_linked_signer(self, dto, **kwargs)
async
¶
Submits a prepared and signed link-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
LinkSignerDto
|
Prepared and signed link payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SignerDto |
SignerDto
|
Linked signer record after submission. |
Source code in meridian/rest/linked_signer.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
list_signers(self, **kwargs)
async
¶
Lists linked signers for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[SignerDto]
|
List[SignerDto]: Linked signer records. |
Source code in meridian/rest/linked_signer.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
prepare_extend_linked_signer(self, sender, include_signature=False, **kwargs)
async
¶
Prepares the payload for extending a linked signer, optionally signing it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Address of the linked signer extending itself. Required. |
required |
include_signature
|
bool
|
If True, sign with the client's key. Optional. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. Optional. |
signed_at |
int
|
Seconds since epoch for the signature timestamp. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
ExtendLinkedSignerDto |
ExtendLinkedSignerDto
|
Prepared (and optionally signed) extend payload. |
Source code in meridian/rest/linked_signer.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
prepare_linked_signer(self, sender, signer, subaccount, subaccount_id, signer_signature='', include_signature=False, **kwargs)
async
¶
Prepares the payload for linking a signer, optionally including a signature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Owner address initiating the link. Required. |
required |
signer
|
str
|
Address of the signer being linked. Required. |
required |
subaccount
|
str
|
Hex-encoded subaccount name. Required. |
required |
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
signer_signature
|
str
|
Signature from the signer address. Optional. |
''
|
include_signature
|
bool
|
If True, sign with the owner's key as well. Optional. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. Optional. |
signed_at |
int
|
Seconds since epoch for the signature timestamp. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
LinkSignerDto |
LinkSignerDto
|
Prepared (and optionally signed) link payload. |
Source code in meridian/rest/linked_signer.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
prepare_refresh_linked_signer(self, sender, signer, subaccount, subaccount_id, include_signature=False, **kwargs)
async
¶
Prepares the payload for refreshing a linked signer, optionally signing it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Owner address initiating the refresh. Required. |
required |
signer
|
str
|
Signer address being refreshed. Required. |
required |
subaccount
|
str
|
Hex-encoded subaccount name. Required. |
required |
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
include_signature
|
bool
|
If True, sign with the owner's key. Optional. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. Optional. |
signed_at |
int
|
Seconds since epoch for the signature timestamp. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
RefreshLinkedSignerDto |
RefreshLinkedSignerDto
|
Prepared (and optionally signed) refresh payload. |
Source code in meridian/rest/linked_signer.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
prepare_revoke_linked_signer(self, sender, signer, subaccount, subaccount_id, include_signature=False, **kwargs)
async
¶
Prepares the payload for revoking a linked signer, optionally signing it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender
|
str
|
Owner address initiating the revoke. Required. |
required |
signer
|
str
|
Signer address being revoked. Required. |
required |
subaccount
|
str
|
Hex-encoded subaccount name. Required. |
required |
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
include_signature
|
bool
|
If True, sign with the owner's key. Optional. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
nonce |
str
|
Custom nonce for signing. Optional. |
signed_at |
int
|
Seconds since epoch for the signature timestamp. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
RevokeLinkedSignerDto |
RevokeLinkedSignerDto
|
Prepared (and optionally signed) revoke payload. |
Source code in meridian/rest/linked_signer.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
refresh_linked_signer(self, dto, **kwargs)
async
¶
Submits a prepared and signed refresh-linked-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
RefreshLinkedSignerDto
|
Prepared and signed refresh payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SignerDto |
SignerDto
|
Signer record reflecting the refreshed expiry. |
Source code in meridian/rest/linked_signer.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
revoke_linked_signer(self, dto, **kwargs)
async
¶
Submits a prepared and signed revoke-linked-signer payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
RevokeLinkedSignerDto
|
Prepared and signed revoke payload. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SignerDto |
SignerDto
|
Signer record reflecting revocation. |
Source code in meridian/rest/linked_signer.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
sign_extend_linked_signer(self, extend_to_sign, private_key=None)
async
¶
Signs the extend-linked-signer payload with the linked signer's key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extend_to_sign
|
ExtendLinkedSignerDto
|
Prepared extend payload. Required. |
required |
private_key
|
str
|
Private key override. Defaults to client's key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ExtendLinkedSignerDto |
ExtendLinkedSignerDto
|
DTO with signature populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/linked_signer.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | |
sign_linked_signer(self, link_to_sign, signer_private_key=None, private_key=None)
async
¶
Signs the link-signer payload with the signer and/or owner key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link_to_sign
|
LinkSignerDto
|
Prepared link payload. Required. |
required |
signer_private_key
|
str
|
Signer's private key for cosigning. Optional. |
None
|
private_key
|
str
|
Owner's private key override. Optional. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
LinkSignerDto |
LinkSignerDto
|
DTO with signature fields populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/linked_signer.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
sign_refresh_linked_signer(self, refresh_to_sign, private_key=None)
async
¶
Signs the refresh-linked-signer payload with the owner's key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh_to_sign
|
RefreshLinkedSignerDto
|
Prepared refresh payload. Required. |
required |
private_key
|
str
|
Private key override. Defaults to client's key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
RefreshLinkedSignerDto |
RefreshLinkedSignerDto
|
DTO with signature populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/linked_signer.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | |
sign_revoke_linked_signer(self, revoke_to_sign, private_key=None)
async
¶
Signs the revoke-linked-signer payload with the owner's key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
revoke_to_sign
|
RevokeLinkedSignerDto
|
Prepared revoke payload. Required. |
required |
private_key
|
str
|
Private key override. Defaults to client's key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
RevokeLinkedSignerDto |
RevokeLinkedSignerDto
|
DTO with signature populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client or private key is available. |
Source code in meridian/rest/linked_signer.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
meridian.rest.token
¶
get_token(self, id, **kwargs)
async
¶
Gets a specific token by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
UUID for the token. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
TokenDto |
TokenDto
|
Token metadata. |
Source code in meridian/rest/token.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
get_withdraw_digest(self, withdraw_dto)
async
¶
Computes the EIP-712 digest of a withdrawal payload.
This digest identifies the pending withdrawal on-chain and is the value expected by ChainClient.finalize_withdraw once the withdrawal is ready to be claimed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
withdraw_dto
|
InitiateWithdrawDto
|
A prepared withdrawal payload (from |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal digest string prefixed with '0x'. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client is configured on the client. |
Source code in meridian/rest/token.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
list_token_transfers(self, **kwargs)
async
¶
Lists token transfers for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
statuses |
List[str]
|
Filter by transfer status (e.g., 'COMPLETED'). Optional. |
types |
List[str]
|
Filter by transfer type (e.g., 'WITHDRAW'). Optional. |
created_after |
float
|
Filter transfers created after this timestamp. Optional. |
created_before |
float
|
Filter transfers created before this timestamp. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[TransferDto]
|
List[TransferDto]: Transfer records for the subaccount. |
Source code in meridian/rest/token.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
list_token_withdraws(self, **kwargs)
async
¶
Lists token withdrawals for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount_id
|
str
|
UUID of the subaccount. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
is_active |
bool
|
Filter active withdrawals. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[WithdrawDto]
|
List[WithdrawDto]: Withdrawal records for the subaccount. |
Source code in meridian/rest/token.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
list_tokens(self, **kwargs)
async
¶
Lists all supported tokens.
Other Parameters:
| Name | Type | Description |
|---|---|---|
deposit_enabled |
bool
|
Filter tokens with deposits enabled. Optional. |
withdraw_enabled |
bool
|
Filter tokens with withdrawals enabled. Optional. |
order |
str
|
Sort order, 'asc' or 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by (e.g., 'createdAt'). Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[TokenDto]
|
List[TokenDto]: Token metadata. |
Source code in meridian/rest/token.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
prepare_convert_token(self, subaccount, from_token, to_token, amount, sender, include_signature=False, nonce=None, signed_at=None)
async
¶
Prepares a token conversion payload for signing and submission.
Constructs an InitiateConversionDto containing all the data required for a
conversion request. The payload can optionally be signed immediately if
include_signature=True.
For most use cases, prefer the higher-level convert_token() method
on AsyncRESTClient which handles preparation, signing, and submission
in a single call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount
|
str
|
Hex-encoded (bytes32) subaccount name to convert within. |
required |
from_token
|
str
|
Address of the token to convert from (zero address for virtual tokens). |
required |
to_token
|
str
|
Address of the token to convert to (zero address for virtual tokens). |
required |
amount
|
int
|
Amount to convert in the token's base units. |
required |
sender
|
str
|
Account or linked signer address placing the conversion request. |
required |
include_signature
|
bool
|
If True, signs the payload immediately using the client's configured private key. Defaults to False. |
False
|
nonce
|
Optional[str]
|
Custom nonce for the EIP-712 signature. If not provided, a random nonce is generated. |
None
|
signed_at
|
Optional[int]
|
Unix timestamp (seconds) for the signature. If not provided, defaults to the current time. |
None
|
Returns:
| Type | Description |
|---|---|
InitiateConversionDto
|
A prepared conversion payload. If |
InitiateConversionDto
|
signature field will be populated; otherwise it will be empty. |
Source code in meridian/rest/token.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
prepare_withdraw_token(self, subaccount, token, amount, account, destination_address, destination_endpoint, include_signature=False, nonce=None, signed_at=None)
async
¶
Prepares a token withdrawal payload for signing and submission.
Constructs an InitiateWithdrawDto containing all the data required for a
withdrawal request. The payload can optionally be signed immediately if
include_signature=True.
For most use cases, prefer the higher-level withdraw_token() method
on AsyncRESTClient which handles preparation, signing, and submission
in a single call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount
|
str
|
Hex-encoded (bytes32) subaccount name from which to withdraw. |
required |
token
|
str
|
Token contract address on the source chain. |
required |
amount
|
int
|
Amount to withdraw in the token's base units. |
required |
account
|
str
|
Wallet address that owns the subaccount. |
required |
destination_address
|
str
|
LayerZero destination address where funds will be sent. Can be a hex string or bytes; automatically left-padded to bytes32 format. |
required |
destination_endpoint
|
int
|
LayerZero endpoint ID for the destination chain. Use 0 for same-chain withdrawals. |
required |
include_signature
|
bool
|
If True, signs the payload immediately using the client's configured private key. Defaults to False. |
False
|
nonce
|
Optional[str]
|
Custom nonce for the EIP-712 signature. If not provided, a random nonce is generated. |
None
|
signed_at
|
Optional[int]
|
Unix timestamp (seconds) for the signature. If not provided, defaults to the current time. |
None
|
Returns:
| Type | Description |
|---|---|
InitiateWithdrawDto
|
A prepared withdrawal payload. If |
InitiateWithdrawDto
|
signature field will be populated; otherwise it will be empty. |
Source code in meridian/rest/token.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
sign_convert_token(self, conversion_dto, private_key=None)
async
¶
Signs a token conversion payload using EIP-712 typed data signing.
Generates an EIP-712 signature for the conversion payload using either the provided private key or the client's configured chain key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversion_dto
|
InitiateConversionDto
|
A prepared conversion payload (from |
required |
private_key
|
Optional[str]
|
Optional private key to use for signing. If not provided, uses the private key from the client's chain configuration. |
None
|
Returns:
| Type | Description |
|---|---|
InitiateConversionDto
|
The same InitiateConversionDto with the signature field populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client is configured on the client. |
ValueError
|
If no private key is available (neither provided nor configured). |
Source code in meridian/rest/token.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
sign_withdraw_token(self, withdraw_dto, private_key=None)
async
¶
Signs a token withdrawal payload using EIP-712 typed data signing.
Generates an EIP-712 signature for the withdrawal payload using either the provided private key or the client's configured chain key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
withdraw_dto
|
InitiateWithdrawDto
|
A prepared withdrawal payload (from |
required |
private_key
|
Optional[str]
|
Optional private key to use for signing. If not provided, uses the private key from the client's chain configuration. |
None
|
Returns:
| Type | Description |
|---|---|
InitiateWithdrawDto
|
The same InitiateWithdrawDto with the signature field populated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no chain client is configured on the client. |
ValueError
|
If no private key is available (neither provided nor configured). |
Source code in meridian/rest/token.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
submit_convert_token(self, dto, **kwargs)
async
¶
Submits a prepared and signed token conversion request to the API.
This is the low-level submission function that sends a pre-constructed
InitiateConversionDto to the conversion endpoint. For most use cases,
prefer the higher-level convert_token() method on AsyncRESTClient
which handles preparation, signing, and submission in a single call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
InitiateConversionDto
|
A prepared and signed conversion payload containing the conversion details and EIP-712 signature. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters passed to the underlying HTTP client. |
Returns:
| Type | Description |
|---|---|
ConversionDto
|
The conversion record created by the API, containing transaction |
ConversionDto
|
details and status information. |
Source code in meridian/rest/token.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
submit_withdraw_token(self, dto, token_id, **kwargs)
async
¶
Submits a prepared and signed token withdrawal request to the API.
This is the low-level submission function that sends a pre-constructed
InitiateWithdrawDto to the withdrawal endpoint. For most use cases,
prefer the higher-level withdraw_token() method on AsyncRESTClient
which handles preparation, signing, and submission in a single call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
InitiateWithdrawDto
|
A prepared and signed withdrawal payload containing the withdrawal details and EIP-712 signature. |
required |
token_id
|
UUID
|
UUID of the token being withdrawn. Used to construct the API endpoint path. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters passed to the underlying HTTP client. |
Returns:
| Type | Description |
|---|---|
WithdrawDto
|
The withdrawal record created by the API, containing transaction |
WithdrawDto
|
details and status information. |
Source code in meridian/rest/token.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
meridian.rest.referral
¶
get_referral_summary(self, **kwargs)
async
¶
Gets the referral summary for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount
|
str
|
Bytes32 encoded subaccount name (0x prefix, zero padded). |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
ReferralDto |
ReferralDto
|
Referral code and usage information. |
Source code in meridian/rest/referral.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
list_referrals(self, **kwargs)
async
¶
Lists referrals for a subaccount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount
|
str
|
Bytes32 encoded subaccount name (0x prefix, zero padded). |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
order |
str
|
Sort order, 'desc'. Optional. |
limit |
float
|
Maximum number of results to return. Optional. |
cursor |
str
|
Pagination cursor for fetching the next page. Optional. |
order_by |
str
|
Field to order by, e.g., 'createdAt'. Optional. |
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Type | Description |
|---|---|
List[ReferralDto]
|
List[ReferralDto]: Referral objects for the subaccount. |
Source code in meridian/rest/referral.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
meridian.rest.system
¶
get_maintenance_status(self, **kwargs)
async
¶
Gets the maintenance mode status.
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
MaintenanceDto |
MaintenanceDto
|
Whether maintenance mode is enabled. |
Source code in meridian/rest/system.py
9 10 11 12 13 14 15 16 17 18 19 20 | |
get_rate_limit_config(self, **kwargs)
async
¶
Gets rate limit configurations for API endpoints.
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
RateLimitConfigResponseDto |
RateLimitConfigResponseDto
|
Rate limit configurations per endpoint. |
Source code in meridian/rest/system.py
23 24 25 26 27 28 29 30 31 32 33 34 | |
get_system_time(self, **kwargs)
async
¶
Gets the current system time.
Other Parameters:
| Name | Type | Description |
|---|---|---|
**kwargs |
Additional request parameters accepted by the API. Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
SystemTimeDto |
SystemTimeDto
|
Current system timestamp in milliseconds since Unix epoch. |
Source code in meridian/rest/system.py
37 38 39 40 41 42 43 44 45 46 47 48 | |
meridian.rest.tv
¶
get_last_price_config(self, **kwargs)
async
¶
Gets the TradingView UDF configuration for last-price data.
Returns:
| Name | Type | Description |
|---|---|---|
ConfigDto |
ConfigDto
|
UDF configuration including supported resolutions and symbol types. |
Source code in meridian/rest/tv.py
19 20 21 22 23 24 25 26 27 28 29 30 | |
get_last_price_history(self, **kwargs)
async
¶
Gets OHLCV bar history for a symbol using last-price data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Symbol ticker in the format {ticker}-{type} (e.g. 'ETHUSD-Perp'). Required. |
required |
resolution
|
str
|
Bar resolution (e.g. '1', '5', '15', '60', '1D'). Required. |
required |
from_
|
float
|
Start of time range in seconds since Unix epoch. Required. |
required |
to
|
float
|
End of time range in seconds since Unix epoch. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
countback |
int
|
Maximum number of bars to return (1-4000). Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
HistoryResponseDto |
HistoryResponseDto
|
OHLCV bar data with status. |
Source code in meridian/rest/tv.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
get_last_price_symbol(self, **kwargs)
async
¶
Resolves symbol information by ticker for last-price data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Symbol ticker in the format {ticker}-{type} (e.g. 'ETHUSD-Perp'). Required. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SymbolInfoDto |
SymbolInfoDto
|
Detailed symbol information. |
Source code in meridian/rest/tv.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
get_last_price_time(self, **kwargs)
async
¶
Gets the current server time from the last-price data feed.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
Server time response. |
Source code in meridian/rest/tv.py
106 107 108 109 110 111 112 113 114 115 116 | |
get_oracle_price_config(self, **kwargs)
async
¶
Gets the TradingView UDF configuration for oracle-price data.
Returns:
| Name | Type | Description |
|---|---|---|
ConfigDto |
ConfigDto
|
UDF configuration including supported resolutions and symbol types. |
Source code in meridian/rest/tv.py
124 125 126 127 128 129 130 131 132 133 134 135 | |
get_oracle_price_history(self, **kwargs)
async
¶
Gets OHLCV bar history for a symbol using oracle-price data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Symbol ticker in the format {ticker}-{type} (e.g. 'ETHUSD-Perp'). Required. |
required |
resolution
|
str
|
Bar resolution (e.g. '1', '5', '15', '60', '1D'). Required. |
required |
from_
|
float
|
Start of time range in seconds since Unix epoch. Required. |
required |
to
|
float
|
End of time range in seconds since Unix epoch. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
countback |
int
|
Maximum number of bars to return (1-4000). Optional. |
Returns:
| Name | Type | Description |
|---|---|---|
HistoryResponseDto |
HistoryResponseDto
|
OHLCV bar data with status. |
Source code in meridian/rest/tv.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
get_oracle_price_symbol(self, **kwargs)
async
¶
Resolves symbol information by ticker for oracle-price data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Symbol ticker in the format {ticker}-{type} (e.g. 'ETHUSD-Perp'). Required. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SymbolInfoDto |
SymbolInfoDto
|
Detailed symbol information. |
Source code in meridian/rest/tv.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
get_oracle_price_time(self, **kwargs)
async
¶
Gets the current server time from the oracle-price data feed.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
Server time response. |
Source code in meridian/rest/tv.py
211 212 213 214 215 216 217 218 219 220 221 | |
search_last_price_symbols(self, **kwargs)
async
¶
Searches for symbols in the last-price data feed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query string to match against symbol tickers. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
type |
str
|
Filter results by symbol type ('Perp' or 'Spot'). Defaults to 'Perp'. |
limit |
int
|
Maximum number of results (1-50). Optional. |
Returns:
| Type | Description |
|---|---|
List[SymbolSearchResultDto]
|
List[SymbolSearchResultDto]: Matching symbol search results. |
Source code in meridian/rest/tv.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
search_oracle_price_symbols(self, **kwargs)
async
¶
Searches for symbols in the oracle-price data feed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query string to match against symbol tickers. Required. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
type |
str
|
Filter results by symbol type ('Perp' or 'Spot'). Defaults to 'Perp'. |
limit |
int
|
Maximum number of results (1-50). Optional. |
Returns:
| Type | Description |
|---|---|
List[SymbolSearchResultDto]
|
List[SymbolSearchResultDto]: Matching symbol search results. |
Source code in meridian/rest/tv.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
meridian.rest.util
¶
client_order_id_to_bytes32(client_order_id)
¶
Converts client_order_id to appropriate bytes32 format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client_order_id
|
str
|
Client order ID to convert. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Converted client order ID in bytes32 hex format. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If string is longer than 32 characters and not a UUID, or if input is None/empty. |
Source code in meridian/rest/util.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
decode_account_name(hex_name)
¶
Converts hex-encoded subaccount name back to text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hex_name
|
str
|
Hex-encoded name with '0x' prefix. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Decoded text string with null bytes stripped. |
Source code in meridian/rest/util.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
encode_account_name(text)
¶
Converts text to hex-encoded subaccount name format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text to convert to hex name. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Hex-encoded name with '0x' prefix, padded to 32 bytes. |
Source code in meridian/rest/util.py
109 110 111 112 113 114 115 116 117 118 119 120 121 | |
ensure_bytes32(value)
¶
Return a 32-byte representation of value (zero-padded on the left).
Source code in meridian/rest/util.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
ensure_bytes32_hex(value)
¶
Return value as a 0x-prefixed 64-hex-digit string.
Source code in meridian/rest/util.py
28 29 30 | |
generate_nonce()
¶
Generates a timestamp-based nonce.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Current timestamp in nanoseconds as string. |
Source code in meridian/rest/util.py
100 101 102 103 104 105 106 | |
is_uuid(value)
¶
Checks if a string is a valid UUID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
String to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if string is a valid UUID, False otherwise. |
Source code in meridian/rest/util.py
53 54 55 56 57 58 59 60 61 62 63 64 65 | |
uuid_to_bytes32(uuid_str)
¶
Converts UUID string to bytes32 hex format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uuid_str
|
str
|
UUID string to convert. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Bytes32 hex string prefixed with '0x'. |
Source code in meridian/rest/util.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
meridian.async_ws_client.AsyncWSClient
¶
Bases: AsyncWSBase
Meridian async WebSocket client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Union[Dict[str, Any], WSConfig]
|
Configuration dictionary or WSConfig object. - base_url (str): Base URL for websocket requests - verbose (bool): Enables debug logging (default: False) - transport (str): Deprecated; only 'websocket' is accepted |
required |
Source code in meridian/async_ws_client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
subscribe(stream_type, **params)
async
¶
Subscribe to a stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_type
|
str
|
Type of stream (e.g., "L2Book", "Ticker", "OrderFill") |
required |
**params
|
Subscription parameters (snake_case converted to camelCase) - symbol: Product symbol (e.g., "BTCUSD") - subaccount_id: Subaccount ID for account-specific streams - product_id: Product ID |
{}
|
Source code in meridian/async_ws_client.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
unsubscribe(stream_type, **params)
async
¶
Unsubscribe from a stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_type
|
str
|
Type of stream |
required |
**params
|
Unsubscription parameters (snake_case converted to camelCase) |
{}
|
Source code in meridian/async_ws_client.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
meridian.ws_client.WSClient
¶
Bases: WSBase
Meridian WebSocket client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Union[Dict[str, Any], WSConfig]
|
Configuration dictionary or WSConfig object. - base_url (str): Base URL for websocket requests - verbose (bool): Enables debug logging (default: False) - transport (str): Deprecated; only 'websocket' is accepted |
required |
Source code in meridian/ws_client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
subscribe(stream_type, **params)
¶
Subscribe to a stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_type
|
str
|
Type of stream (e.g., "L2Book", "Ticker", "OrderFill") |
required |
**params
|
Subscription parameters (snake_case converted to camelCase) - symbol: Product symbol (e.g., "BTCUSD") - subaccount_id: Subaccount ID for account-specific streams - product_id: Product ID |
{}
|
Source code in meridian/ws_client.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
unsubscribe(stream_type, **params)
¶
Unsubscribe from a stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_type
|
str
|
Type of stream |
required |
**params
|
Unsubscription parameters (snake_case converted to camelCase) |
{}
|
Source code in meridian/ws_client.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
meridian.chain_client.ChainClient
¶
Bases: BaseClient
Client for interacting with the blockchain using Web3 functionality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Union[Dict[str, Any], ChainConfig]
|
Chain configuration |
required |
rpc_config
|
RpcConfigDto
|
RPC configuration. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
Exception
|
If RPC URL or private key is not specified in the configuration |
Source code in meridian/chain_client.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
usd_deposit_token
property
¶
Address of the token deposited as USD collateral.
mUSD is a wrapper token: depositUsd pulls mUSD's underlying wrapped
token from the sender via transferFrom and wraps it. This is the
token to approve and fund when depositing USD, not mUSD itself.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The checksummed address of mUSD's default wrapped token. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no USD (mUSD) token is configured on the client. |
add_gas_fees(tx)
¶
Add gas fee parameters to a transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx
|
TxParams
|
The transaction parameters |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TxParams |
TxParams
|
The transaction parameters with gas fee parameters added |
Source code in meridian/chain_client.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
add_gas_limit(tx)
¶
Add gas limit to a transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx
|
TxParams
|
The transaction parameters |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TxParams |
TxParams
|
The transaction parameters with gas limit added |
Source code in meridian/chain_client.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
approve_token(amount, token_address, spender=None, submit=False)
¶
Approve a spender to transfer tokens on behalf of the account.
Deposits pull tokens from the sender via transferFrom, so the exchange contract must be approved before depositing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount
|
float
|
The amount to approve, in whole token units |
required |
token_address
|
str
|
The token address |
required |
spender
|
str
|
The spender address. Defaults to the exchange contract. |
None
|
submit
|
bool
|
Whether to submit the transaction. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Union[TxParams, str]
|
Union[TxParams, str]: The transaction parameters or transaction hash if submit=True |
Source code in meridian/chain_client.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | |
convert_types(type_string)
¶
Converts type string into EIP-712 field format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type_string
|
str
|
String containing type definitions. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, str]]
|
List[Dict[str, str]]: List of field definitions. |
Source code in meridian/chain_client.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
deposit_token(token_address, amount, account_name='primary', address=None, submit=False, account_name_bytes=None)
¶
Submit a deposit transaction for an arbitrary supported token.
The exchange pulls the tokens via transferFrom, so the exchange contract must hold a sufficient allowance first (see approve_token).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_address
|
str
|
The address of the token to deposit |
required |
amount
|
float
|
The amount to deposit, in whole token units |
required |
address
|
str
|
The address to deposit to. Defaults to None. |
None
|
submit
|
bool
|
Whether to submit the transaction. Defaults to False. |
False
|
account_name
|
str
|
The account name. Defaults to "primary". |
'primary'
|
account_name_bytes
|
str
|
The account name as a hex string (bytes32). Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Union[TxParams, str]
|
Union[TxParams, str]: The transaction parameters or transaction hash if submit=True |
Raises:
| Type | Description |
|---|---|
ValueError
|
If both account_name and account_name_bytes are provided |
ValueError
|
If the exchange allowance is insufficient when submitting |
Source code in meridian/chain_client.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
deposit_usd(amount, account_name='primary', address=None, submit=False, account_name_bytes=None, token_address=None)
¶
Submit a deposit transaction for the default USD token.
The exchange pulls the tokens via transferFrom, so the exchange contract must hold a sufficient allowance first (see approve_token).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount
|
float
|
The amount to deposit, in whole token units |
required |
address
|
str
|
The address to deposit to. Defaults to None. |
None
|
submit
|
bool
|
Whether to submit the transaction. Defaults to False. |
False
|
account_name
|
str
|
The account name. Defaults to "primary". |
'primary'
|
account_name_bytes
|
str
|
The account name as a hex string (bytes32). Defaults to None. |
None
|
token_address
|
str
|
The token to approve and pull, used to resolve decimals and verify the allowance. Defaults to mUSD's underlying wrapped token (the token depositUsd pulls via transferFrom). |
None
|
Returns:
| Type | Description |
|---|---|
Union[TxParams, str]
|
Union[TxParams, str]: The transaction parameters or transaction hash if submit=True |
Raises:
| Type | Description |
|---|---|
ValueError
|
If both account_name and account_name_bytes are provided |
ValueError
|
If the exchange allowance is insufficient when submitting |
Source code in meridian/chain_client.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | |
finalize_withdraw(withdraw_digest, address=None, submit=False, value=0)
¶
Finalize a pending withdrawal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
withdraw_digest
|
str
|
The EIP-712 digest of the signed InitiateWithdraw message identifying the pending withdrawal (see get_typed_data_digest / get_withdraw_digest). |
required |
address
|
str
|
The account address the withdrawal belongs to. Defaults to None. |
None
|
submit
|
bool
|
Whether to submit the transaction. Defaults to False. |
False
|
value
|
int
|
Native value to attach for cross-chain messaging fees. Defaults to 0. |
0
|
Returns:
| Type | Description |
|---|---|
Union[TxParams, str]
|
Union[TxParams, str]: The transaction parameters or transaction hash if submit=True |
Source code in meridian/chain_client.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
get_balance(address)
¶
Get the balance for a given address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The address to get the balance for |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The balance |
Source code in meridian/chain_client.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
get_nonce(address)
¶
Get the nonce for a given address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The address to get the nonce for |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The nonce |
Source code in meridian/chain_client.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
get_signature_types(rpc_config, primary_type)
¶
Gets EIP-712 signature types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rpc_config
|
RpcConfigDto
|
RPC configuration. |
required |
primary_type
|
str
|
Primary type for the signature. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dictionary containing signature type definitions. |
Source code in meridian/chain_client.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
get_token_allowance(owner, token_address, spender=None)
¶
Get the ERC20 allowance granted by an owner to a spender.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
owner
|
str
|
The token owner address |
required |
token_address
|
str
|
The token address |
required |
spender
|
str
|
The spender address. Defaults to the exchange contract. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The allowance in token base units |
Source code in meridian/chain_client.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
get_token_balance(address, token_address)
¶
Get the token balance for a given address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The address to get the token balance for |
required |
token_address
|
str
|
The token address |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The token balance |
Source code in meridian/chain_client.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
get_token_decimals(token_address)
¶
Get the number of decimals for an ERC20 token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_address
|
str
|
The token address |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The token decimals |
Source code in meridian/chain_client.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
get_typed_data_digest(domain, types, primary_type, message)
¶
Compute the EIP-712 digest of a typed data message.
This is the digest the exchange contract uses to identify signed payloads, e.g. the withdraw digest passed to finalizeWithdraw.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
domain
|
dict
|
domain parameters including name, version, chainId, and verifyingContract |
required |
types
|
dict
|
type definitions for the structured data |
required |
primary_type
|
str
|
primary type for the signature |
required |
message
|
dict
|
message data |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the hexadecimal digest string prefixed with '0x' |
Source code in meridian/chain_client.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
sign_message(private_key, domain, types, primary_type, message)
¶
Sign an EIP-712 typed data message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
private_key
|
str
|
private key to sign the message with |
required |
domain
|
dict
|
domain parameters including name, version, chainId, and verifyingContract |
required |
types
|
dict
|
type definitions for the structured data |
required |
primary_type
|
str
|
primary type for the signature |
required |
message
|
dict
|
message data to be signed |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
the hexadecimal signature string prefixed with '0x' |
Source code in meridian/chain_client.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
submit_tx(tx)
¶
Submit a transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx
|
TxParams
|
The transaction parameters |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The transaction hash |
Source code in meridian/chain_client.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
meridian.rest.http_client.HTTPClient
¶
Bases: BaseClient
HTTP client for making API requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Union[Dict[str, Any], HTTPConfig]
|
Client configuration. |
required |
Source code in meridian/rest/http_client.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
delete(url_path, params=None, data=None, **kwargs)
¶
Sends a DELETE request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url_path
|
str
|
The URL path. Required. |
required |
params
|
dict
|
The query parameters. Optional. |
None
|
data
|
dict
|
The request body. Optional. |
None
|
**kwargs
|
Additional arguments to pass to the request. Optional. |
{}
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The response data. |
Source code in meridian/rest/http_client.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
get(url_path, params=None, **kwargs)
¶
Sends a GET request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url_path
|
str
|
The URL path. Required. |
required |
params
|
dict
|
The query parameters. Optional. |
None
|
**kwargs
|
Additional arguments to pass to the request. Optional. |
{}
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The response data. |
Source code in meridian/rest/http_client.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
get_validated(url_path, request_model, response_model, **kwargs)
¶
Sends a GET request including type validation of both the input and output from provided models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url_path
|
str
|
The URL path. Required. |
required |
request_model
|
Type[BaseModel]
|
Pydantic model for request validation. Required. |
required |
response_model
|
Type[BaseModel]
|
Pydantic model for response validation. Required. |
required |
**kwargs
|
Includes all arguments to pass to the request. Optional. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
BaseModel |
BaseModel
|
The response data, validated against the response_model. |
Source code in meridian/rest/http_client.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
post(url_path, params=None, data=None, **kwargs)
¶
Sends a POST request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url_path
|
str
|
The URL path. Required. |
required |
params
|
dict
|
The query parameters. Optional. |
None
|
data
|
dict
|
The request body. Optional. |
None
|
**kwargs
|
Additional arguments to pass to the request. Optional. |
{}
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The response data. |
Source code in meridian/rest/http_client.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
prepare_and_send_request(http_method, url_path, params=None, data=None)
¶
Prepares and sends an HTTP request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_method
|
str
|
The HTTP method. Required. |
required |
url_path
|
str
|
The URL path. Required. |
required |
params
|
dict
|
The query parameters. Optional. |
None
|
data
|
dict
|
The request body. Optional. |
None
|
Returns:
| Type | Description |
|---|---|
|
Dict[str, Any]: The response data. |
Source code in meridian/rest/http_client.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
put(url_path, params=None, data=None, **kwargs)
¶
Sends a PUT request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url_path
|
str
|
The URL path. Required. |
required |
params
|
dict
|
The query parameters. Optional. |
None
|
data
|
dict
|
The request body. Optional. |
None
|
**kwargs
|
Additional arguments to pass to the request. Optional. |
{}
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The response data. |
Source code in meridian/rest/http_client.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
send_request(http_method, url_path, params, headers, data=None)
¶
Sends an HTTP request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_method
|
str
|
The HTTP method. Required. |
required |
url_path
|
str
|
The URL path. Required. |
required |
params
|
dict
|
The query parameters. Required. |
required |
headers
|
dict
|
The request headers. Required. |
required |
data
|
dict
|
The request body. Optional. |
None
|
Returns:
| Type | Description |
|---|---|
|
Dict[str, Any]: The response data. |
Raises:
| Type | Description |
|---|---|
HTTPError
|
If the request fails. |
Source code in meridian/rest/http_client.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
set_headers(method, path)
¶
Sets the request headers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
The HTTP method. Required. |
required |
path
|
str
|
The URL path. Required. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
The request headers. |
Source code in meridian/rest/http_client.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |