Skip to content

Commit 00d71ea

Browse files
committed
CronSet
1 parent 387d4d6 commit 00d71ea

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

src/TxParticipantExtractor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,9 @@ private function extract_Delegate(\stdClass $data, ?string $context = null)
792792

793793
private function extract_Cron(\stdClass $data, ?string $context = null)
794794
{
795-
//
795+
if(isset($data->Owner)) {
796+
$this->addAccount($data->Owner, 'CRON_OWNER');
797+
}
796798
}
797799

798800
/**

tests/Tx59Test.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace XRPLWin\XRPLTxParticipantExtractor\Tests;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use XRPLWin\XRPLTxParticipantExtractor\TxParticipantExtractor;
7+
8+
/***
9+
* CronSet
10+
* @see 9FDA78896A426B980EEEAE53E4BE551BBF52236064455E7CD99F40DCE04373E6 xahau testnet
11+
*/
12+
final class Tx59Test extends TestCase
13+
{
14+
public function testCronSet()
15+
{
16+
$transaction = file_get_contents(__DIR__.'/fixtures/tx59.json');
17+
$transaction = \json_decode($transaction);
18+
$TxParticipantExtractor = new TxParticipantExtractor($transaction->result);
19+
20+
$parsedTransaction = $TxParticipantExtractor->result();
21+
$this->assertIsArray($parsedTransaction);
22+
$accounts = $TxParticipantExtractor->accounts();
23+
24+
//AMM account
25+
$this->assertEquals([
26+
'INITIATOR',
27+
'TXSIGNER',
28+
'ACCOUNTROOT_ACCOUNT',
29+
'DIRECTORYNODE_OWNER',
30+
'CRON_OWNER'
31+
], $accounts['rsYxnKtb8JBzfG4hp6sVF3WiVNw2broUFo']);
32+
}
33+
}

tests/fixtures/tx59.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"result": {
3+
"Account": "rsYxnKtb8JBzfG4hp6sVF3WiVNw2broUFo",
4+
"DelaySeconds": 3600,
5+
"Fee": "10000",
6+
"Flags": 0,
7+
"LastLedgerSequence": 3345266,
8+
"NetworkID": 21338,
9+
"RepeatCount": 10,
10+
"Sequence": 810225341,
11+
"SigningPubKey": "0343D41B6AF3055918AE9D10379B770C1CCD27BD9354A1FED5CC95821151B27591",
12+
"StartTime": 825241742,
13+
"TransactionType": "CronSet",
14+
"TxnSignature": "304402204DCB5D43A6A4283C36C14B3590BB90955906C1E7920AB821D6F1E32B6F278A6A022029C8AE5CADE5AE8442DF047AAAD2644668857D547C1B0457C4F0885FB9FC0B40",
15+
"ctid": "C0330B600000535A",
16+
"date": 815584732,
17+
"hash": "9FDA78896A426B980EEEAE53E4BE551BBF52236064455E7CD99F40DCE04373E6",
18+
"inLedger": 3345248,
19+
"ledger_index": 3345248,
20+
"meta": {
21+
"AffectedNodes": [
22+
{
23+
"ModifiedNode": {
24+
"FinalFields": {
25+
"Account": "rsYxnKtb8JBzfG4hp6sVF3WiVNw2broUFo",
26+
"AccountIndex": "4c3",
27+
"Balance": "999990000",
28+
"Cron": "F7B645436187CC613130308EBE17CC6E04A82F411CE901F3866AD676D40E0672",
29+
"Flags": 0,
30+
"OwnerCount": 1,
31+
"Sequence": 810225342
32+
},
33+
"LedgerEntryType": "AccountRoot",
34+
"LedgerIndex": "002A224276124D75B9E3D3AFC854CA1869363856C7E8946CC728D258FADF8304",
35+
"PreviousFields": {
36+
"Balance": "1000000000",
37+
"OwnerCount": 0,
38+
"Sequence": 810225341
39+
},
40+
"PreviousTxnID": "07EAE6C1BF2C6F04120B88647A7F665C0F05F8EE9DCD6DE8550E675A2233731D",
41+
"PreviousTxnLgrSeq": 1560790
42+
}
43+
},
44+
{
45+
"CreatedNode": {
46+
"LedgerEntryType": "DirectoryNode",
47+
"LedgerIndex": "1990E625F19AC67A39FB6E824586A2EB362FD770974EB8663CDB33A5388DCF95",
48+
"NewFields": {
49+
"Owner": "rsYxnKtb8JBzfG4hp6sVF3WiVNw2broUFo",
50+
"RootIndex": "1990E625F19AC67A39FB6E824586A2EB362FD770974EB8663CDB33A5388DCF95"
51+
}
52+
}
53+
},
54+
{
55+
"CreatedNode": {
56+
"LedgerEntryType": "Cron",
57+
"LedgerIndex": "F7B645436187CC613130308EBE17CC6E04A82F411CE901F3866AD676D40E0672",
58+
"NewFields": {
59+
"DelaySeconds": 3600,
60+
"Owner": "rsYxnKtb8JBzfG4hp6sVF3WiVNw2broUFo",
61+
"RepeatCount": 10,
62+
"StartTime": 825241742
63+
}
64+
}
65+
}
66+
],
67+
"TransactionIndex": 0,
68+
"TransactionResult": "tesSUCCESS"
69+
},
70+
"status": "success",
71+
"validated": true
72+
}
73+
}

0 commit comments

Comments
 (0)