Skip to content

Commit cb9f550

Browse files
committed
upd examples
1 parent 04e962d commit cb9f550

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

examples/wallets/wallet.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import asyncio
2+
from pytoniq import LiteBalancer
3+
from pytoniq_core import begin_cell, Address
4+
from pytoniq.contract.wallets.wallet import WalletV4R2
5+
6+
7+
async def main():
8+
async with LiteBalancer.from_testnet_config(trust_level=2) as client:
9+
mnemo = []
10+
wallet = await WalletV4R2.from_mnemonic(client, mnemo)
11+
12+
# deploy wallet if needed
13+
await wallet.deploy_via_external()
14+
15+
await wallet.transfer(
16+
destination='EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
17+
body='comment',
18+
amount=1 * 10**8 # 0.1 TON
19+
)
20+
21+
# or create message separately and then sign and send it
22+
message = wallet.create_wallet_internal_message(
23+
destination=Address('EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'),
24+
send_mode=3,
25+
body=begin_cell().store_uint(0, 32).store_snake_string('comment').end_cell(),
26+
value=1 * 10**8 # 0.1 TON
27+
)
28+
29+
await wallet.raw_transfer(msgs=[message])
30+
31+
32+
if __name__ == '__main__':
33+
asyncio.run(main())

0 commit comments

Comments
 (0)