Skip to content

Commit 139cb20

Browse files
committed
added expiration time parameter for transaction init
1 parent 29dca49 commit 139cb20

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Tools/Transaction.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ public static function getChainId($chainName)
3434

3535
/**
3636
* @param ConnectorInterface $connector
37+
* @param string $expirationTime is string in DateInterval format, example 'PT2M'
3738
*
3839
* @return CommandQueryData
3940
* @throws \Exception
4041
*/
41-
public static function init(ConnectorInterface $connector)
42+
public static function init(ConnectorInterface $connector, $expirationTime = 'PT2M')
4243
{
4344
$tx = null;
4445
$chainName = $connector->getPlatform();
@@ -80,7 +81,7 @@ public static function init(ConnectorInterface $connector)
8081
[[
8182
'ref_block_num' => $refBlockNum,
8283
'ref_block_prefix' => $buf->readInt32lE(4),
83-
'expiration' => (new \DateTime($properties['time']))->add(new \DateInterval('PT1M'))->format('Y-m-d\TH:i:s\.000'),
84+
'expiration' => (new \DateTime($properties['time']))->add(new \DateInterval($expirationTime))->format('Y-m-d\TH:i:s\.000'),
8485
'operations' => [],
8586
'extensions' => [],
8687
'signatures' => []

0 commit comments

Comments
 (0)