Skip to content

Commit

Permalink
Implemented BumpSequenceOpTest hardware wallet test
Browse files Browse the repository at this point in the history
  • Loading branch information
zulucrypto committed Apr 4, 2018
1 parent 91882a4 commit 663a282
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions tests/HardwareWallet/BumpSequenceOpTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php


namespace ZuluCrypto\StellarSdk\Test\HardwareWallet;


use phpseclib\Math\BigInteger;
use ZuluCrypto\StellarSdk\Keypair;
use ZuluCrypto\StellarSdk\Test\Util\HardwareWalletIntegrationTest;

class BumpSequenceOpTest extends HardwareWalletIntegrationTest
{
/**
* @group requires-hardwarewallet
*/
public function testSimpleBumpSequence()
{
$sourceKeypair = Keypair::newFromMnemonic($this->mnemonic);

$bumpTo = new BigInteger(1234567890);

$transaction = $this->horizonServer
->buildTransaction($sourceKeypair)
->setSequenceNumber(new BigInteger(4294967296))
->bumpSequenceTo($bumpTo);

$knownSignature = $transaction->signWith($this->privateKeySigner);

$this->manualVerificationOutput(join(PHP_EOL, [
' Bump Sequence: basic',
' Source: ' . $sourceKeypair->getPublicKey(),
' Bump To: ' . $bumpTo->toString(),
]));
$hardwareSignature = $transaction->signWith($this->horizonServer->getSigningProvider());

$this->assertEquals($knownSignature->toBase64(), $hardwareSignature->toBase64());
}

/**
* @group requires-hardwarewallet
*/
public function testMaxBumpSequence()
{
$sourceKeypair = Keypair::newFromMnemonic($this->mnemonic);

$bumpTo = new BigInteger('9223372036854775807');

$transaction = $this->horizonServer
->buildTransaction($sourceKeypair)
->setSequenceNumber(new BigInteger(4294967296))
->bumpSequenceTo($bumpTo);

$knownSignature = $transaction->signWith($this->privateKeySigner);

$this->manualVerificationOutput(join(PHP_EOL, [
' Bump Sequence: max',
' Source: ' . $sourceKeypair->getPublicKey(),
' Bump To: ' . $bumpTo->toString(),
]));
$hardwareSignature = $transaction->signWith($this->horizonServer->getSigningProvider());

$this->assertEquals($knownSignature->toBase64(), $hardwareSignature->toBase64());
}
}

0 comments on commit 663a282

Please sign in to comment.