Skip to content

Commit 5ebeaca

Browse files
authored
Merge pull request #2 from starcoinorg/expiration_timestamp_secs
use the node_info.now_seconds to generate expiration_timestamp_secs
2 parents 705681c + 69de59b commit 5ebeaca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/p2p_transfer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ def transfer(cli: client.Client, sender: local_account.LocalAccount, payee: str,
1818
payee_auth_key=payee_auth_key, # assert the payee address has been on chain
1919
amount=amount,
2020
)
21+
node_info = cli.node_info()
22+
now_seconds = int(node_info.get('now_seconds'))
23+
# expired after 12 hours
24+
expiration_timestamp_secs = now_seconds + 43200
2125
raw_txn = types.RawTransaction(
2226
sender=sender.account_address,
2327
sequence_number=seq_num,
2428
payload=script,
2529
max_gas_amount=10000000,
2630
gas_unit_price=1,
2731
gas_token_code="0x1::STC::STC",
28-
expiration_timestamp_secs=int(time.time()) + 300,
32+
expiration_timestamp_secs=expiration_timestamp_secs,
2933
chain_id=types.ChainId(st.uint8(251)),
3034
)
3135

0 commit comments

Comments
 (0)