Skip to content

Commit 2793041

Browse files
committed
update existing transfer examples + README
1 parent 0efa2de commit 2793041

File tree

5 files changed

+11
-31
lines changed

5 files changed

+11
-31
lines changed

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ Class | Method | HTTP request | Description
7474
*AccountApi* | [**accounts_by_l1_address**](docs/AccountApi.md#accounts_by_l1_address) | **GET** /api/v1/accountsByL1Address | accountsByL1Address
7575
*AccountApi* | [**apikeys**](docs/AccountApi.md#apikeys) | **GET** /api/v1/apikeys | apikeys
7676
*AccountApi* | [**pnl**](docs/AccountApi.md#pnl) | **GET** /api/v1/pnl | pnl
77-
*AccountApi* | [**public_pools**](docs/AccountApi.md#public_pools) | **GET** /api/v1/publicPools | publicPools
78-
*BlockApi* | [**block**](docs/BlockApi.md#block) | **GET** /api/v1/block | block
79-
*BlockApi* | [**blocks**](docs/BlockApi.md#blocks) | **GET** /api/v1/blocks | blocks
80-
*BlockApi* | [**current_height**](docs/BlockApi.md#current_height) | **GET** /api/v1/currentHeight | currentHeight
81-
*CandlestickApi* | [**candlesticks**](docs/CandlestickApi.md#candlesticks) | **GET** /api/v1/candlesticks | candlesticks
8277
*CandlestickApi* | [**fundings**](docs/CandlestickApi.md#fundings) | **GET** /api/v1/fundings | fundings
8378
*OrderApi* | [**account_inactive_orders**](docs/OrderApi.md#account_inactive_orders) | **GET** /api/v1/accountInactiveOrders | accountInactiveOrders
8479
*OrderApi* | [**exchange_stats**](docs/OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats
@@ -89,13 +84,10 @@ Class | Method | HTTP request | Description
8984
*OrderApi* | [**trades**](docs/OrderApi.md#trades) | **GET** /api/v1/trades | trades
9085
*RootApi* | [**info**](docs/RootApi.md#info) | **GET** /info | info
9186
*RootApi* | [**status**](docs/RootApi.md#status) | **GET** / | status
92-
*TransactionApi* | [**account_txs**](docs/TransactionApi.md#account_txs) | **GET** /api/v1/accountTxs | accountTxs
93-
*TransactionApi* | [**block_txs**](docs/TransactionApi.md#block_txs) | **GET** /api/v1/blockTxs | blockTxs
9487
*TransactionApi* | [**deposit_history**](docs/TransactionApi.md#deposit_history) | **GET** /api/v1/deposit/history | deposit_history
9588
*TransactionApi* | [**next_nonce**](docs/TransactionApi.md#next_nonce) | **GET** /api/v1/nextNonce | nextNonce
9689
*TransactionApi* | [**send_tx**](docs/TransactionApi.md#send_tx) | **POST** /api/v1/sendTx | sendTx
9790
*TransactionApi* | [**send_tx_batch**](docs/TransactionApi.md#send_tx_batch) | **POST** /api/v1/sendTxBatch | sendTxBatch
98-
*TransactionApi* | [**tx**](docs/TransactionApi.md#tx) | **GET** /api/v1/tx | tx
9991
*TransactionApi* | [**tx_from_l1_tx_hash**](docs/TransactionApi.md#tx_from_l1_tx_hash) | **GET** /api/v1/txFromL1TxHash | txFromL1TxHash
10092
*TransactionApi* | [**txs**](docs/TransactionApi.md#txs) | **GET** /api/v1/txs | txs
10193
*TransactionApi* | [**withdraw_history**](docs/TransactionApi.md#withdraw_history) | **GET** /api/v1/withdraw/history | withdraw_history
@@ -111,13 +103,8 @@ Class | Method | HTTP request | Description
111103
- [AccountPosition](docs/AccountPosition.md)
112104
- [AccountStats](docs/AccountStats.md)
113105
- [ApiKey](docs/ApiKey.md)
114-
- [Block](docs/Block.md)
115-
- [Blocks](docs/Blocks.md)
116106
- [BridgeSupportedNetwork](docs/BridgeSupportedNetwork.md)
117-
- [Candlestick](docs/Candlestick.md)
118-
- [Candlesticks](docs/Candlesticks.md)
119107
- [ContractAddress](docs/ContractAddress.md)
120-
- [CurrentHeight](docs/CurrentHeight.md)
121108
- [Cursor](docs/Cursor.md)
122109
- [DepositHistory](docs/DepositHistory.md)
123110
- [DepositHistoryItem](docs/DepositHistoryItem.md)
@@ -181,10 +168,8 @@ Class | Method | HTTP request | Description
181168
- [Ticker](docs/Ticker.md)
182169
- [Trade](docs/Trade.md)
183170
- [Trades](docs/Trades.md)
184-
- [Tx](docs/Tx.md)
185171
- [TxHash](docs/TxHash.md)
186172
- [TxHashes](docs/TxHashes.md)
187-
- [Txs](docs/Txs.md)
188173
- [ValidatorInfo](docs/ValidatorInfo.md)
189174
- [WithdrawHistory](docs/WithdrawHistory.md)
190175
- [WithdrawHistoryItem](docs/WithdrawHistoryItem.md)

examples/spot_self_transfer_perp_spot.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import asyncio
22
from utils import default_example_setup
33

4-
ETH_PRIVATE_KEY = "1234567812345678123456781234567812345678123456781234567812345678"
5-
6-
74
async def main():
85
client, api_client, _ = default_example_setup()
96

@@ -13,8 +10,7 @@ async def main():
1310
return
1411

1512
# You can find more notes on transfers in the README.md file, under `Transfer Notes`
16-
transfer_tx, response, err = await client.transfer(
17-
ETH_PRIVATE_KEY,
13+
transfer_tx, response, err = await client.transfer_same_master_account(
1814
to_account_index=client.account_index,
1915
asset_id=client.ASSET_ID_USDC,
2016
amount=1.234567, # decimals are added by sdk

examples/spot_self_transfer_spot_perp.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import asyncio
22
from utils import default_example_setup
33

4-
ETH_PRIVATE_KEY = "1234567812345678123456781234567812345678123456781234567812345678"
54

65

76
async def main():
@@ -13,8 +12,7 @@ async def main():
1312
return
1413

1514
# You can find more notes on transfers in the README.md file, under `Transfer Notes`
16-
transfer_tx, response, err = await client.transfer(
17-
ETH_PRIVATE_KEY,
15+
transfer_tx, response, err = await client.transfer_same_master_account(
1816
to_account_index=client.account_index,
1917
asset_id=client.ASSET_ID_USDC,
2018
amount=1.234567, # decimals are added by sdk
@@ -30,5 +28,8 @@ async def main():
3028
lev_tx, response, err = await client.update_leverage(4, client.CROSS_MARGIN_MODE, 3)
3129
print(lev_tx, response, err)
3230

31+
await client.close()
32+
await api_client.close()
33+
3334
if __name__ == "__main__":
3435
asyncio.run(main())

examples/sub_account_transfer_eth.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import asyncio
22
from utils import default_example_setup
33

4-
ETH_PRIVATE_KEY = "1234567812345678123456781234567812345678123456781234567812345678"
5-
TO_ACCOUNT_INDEX = 281474976710649
4+
TO_ACCOUNT_INDEX = 281474976710648
65

76
async def main():
87
client, api_client, _ = default_example_setup()
@@ -13,8 +12,7 @@ async def main():
1312
return
1413

1514
# You can find more notes on transfers in the README.md file, under `Transfer Notes`
16-
transfer_tx, response, err = await client.transfer(
17-
ETH_PRIVATE_KEY,
15+
transfer_tx, response, err = await client.transfer_same_master_account(
1816
to_account_index=TO_ACCOUNT_INDEX,
1917
asset_id=client.ASSET_ID_ETH,
2018
amount=0.4, # decimals are added by sdk

examples/sub_account_transfer_usdc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import asyncio
22
from utils import default_example_setup
33

4-
ETH_PRIVATE_KEY = "1234567812345678123456781234567812345678123456781234567812345678"
5-
TO_ACCOUNT_INDEX = 281474976710649
4+
TO_ACCOUNT_INDEX = 281474976710648
65

76
async def main():
87
client, api_client, _ = default_example_setup()
@@ -13,8 +12,7 @@ async def main():
1312
return
1413

1514
# You can find more notes on transfers in the README.md file, under `Transfer Notes`
16-
transfer_tx, response, err = await client.transfer(
17-
ETH_PRIVATE_KEY,
15+
transfer_tx, response, err = await client.transfer_same_master_account(
1816
to_account_index=TO_ACCOUNT_INDEX,
1917
asset_id=client.ASSET_ID_USDC,
2018
amount=100, # decimals are added by sdk
@@ -26,6 +24,8 @@ async def main():
2624
if err is not None:
2725
raise Exception(f"error transferring {err}")
2826
print(transfer_tx, response)
27+
await client.close()
28+
await api_client.close()
2929

3030

3131
if __name__ == "__main__":

0 commit comments

Comments
 (0)