-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
195 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from hyperliquid.utils import constants | ||
import example_utils | ||
|
||
|
||
def main(): | ||
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True) | ||
|
||
if exchange.account_address != exchange.wallet.address: | ||
raise Exception("Agents do not have permission to convert to multi-sig signer") | ||
|
||
# the user owning this signer (either the user itself or agent's user) should already be registered as authorized user for the multi-sig user | ||
signer = "0x0000000000000000000000000000000000000000" | ||
multi_sig_user = "0x0000000000000000000000000000000000000001" | ||
convert_result = exchange.convert_to_multi_sig_signer(signer, multi_sig_user) | ||
print(convert_result) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from hyperliquid.utils import constants | ||
import example_utils | ||
|
||
|
||
def main(): | ||
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True) | ||
|
||
if exchange.account_address != exchange.wallet.address: | ||
raise Exception("Agents do not have permission to convert to multi-sig user") | ||
|
||
# authorized users are the users for which one can themselves or agents use as signers | ||
# for multi-sig actions | ||
authorized_user_1 = "0x0000000000000000000000000000000000000000" | ||
authorized_user_2 = "0x0000000000000000000000000000000000000001" | ||
threshold = 1 | ||
convert_result = exchange.convert_to_multi_sig_user([authorized_user_1, authorized_user_2], threshold) | ||
print(convert_result) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from hyperliquid.utils import constants | ||
from hyperliquid.utils.signing import sign_usd_transfer_action, get_timestamp_ms | ||
from hyperliquid.utils.types import Any, List | ||
import example_utils | ||
|
||
|
||
def main(): | ||
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True) | ||
multi_sig_wallets = example_utils.setup_multi_sig_wallets() | ||
|
||
multi_sig_user = "0x0000000000000000000000000000000000000005" | ||
|
||
timestamp = get_timestamp_ms() | ||
action = { | ||
"type": "usdSend", | ||
"signatureChainId": "0x66eee", | ||
"hyperliquidChain": "Testnet", | ||
"destination": "0x0000000000000000000000000000000000000000", | ||
"amount": "100.0", | ||
"time": timestamp, | ||
} | ||
signatures: List[Any] = [] | ||
for wallet in multi_sig_wallets: | ||
signature = sign_usd_transfer_action(wallet, action, False) | ||
signatures.append(signature) | ||
|
||
multi_sig_result = exchange.multi_sig(multi_sig_user, action, signatures, timestamp) | ||
print(multi_sig_result) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"comment": "signer 1", | ||
"secret_key": "", | ||
"account_address": "" | ||
}, | ||
{ | ||
"comment": "signer 2", | ||
"secret_key": "", | ||
"account_address": "" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "hyperliquid-python-sdk" | ||
version = "0.7.1" | ||
version = "0.8.0" | ||
description = "SDK for Hyperliquid API trading with Python." | ||
readme = "README.md" | ||
authors = ["Hyperliquid <[email protected]>"] | ||
|