From e2781e23e0d86315986f85effe4e9b7a6245e574 Mon Sep 17 00:00:00 2001 From: Jem Mawson Date: Wed, 7 Mar 2018 15:34:47 +1000 Subject: [PATCH] rename verifyingkey to publickey --- .../scala/stellar/sdk/DomainMatchersIT.scala | 8 ++-- src/main/scala/stellar/sdk/Asset.scala | 10 ++-- src/main/scala/stellar/sdk/KeyPair.scala | 28 +++++------ .../stellar/sdk/op/AllowTrustOperation.scala | 4 +- .../scala/stellar/sdk/ArbitraryInput.scala | 46 +++++++++---------- .../scala/stellar/sdk/DomainMatchers.scala | 8 ++-- src/test/scala/stellar/sdk/KeyPairSpec.scala | 4 +- .../sdk/resp/AccountEffectRespSpec.scala | 18 ++++---- .../sdk/resp/SignerEffectRespSpec.scala | 6 +-- .../resp/TrustLineAuthEffectRespSpec.scala | 4 +- .../sdk/resp/TrustLineEffectRespSpec.scala | 6 +-- 11 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/it/scala/stellar/sdk/DomainMatchersIT.scala b/src/it/scala/stellar/sdk/DomainMatchersIT.scala index b9b98204..a7191c41 100644 --- a/src/it/scala/stellar/sdk/DomainMatchersIT.scala +++ b/src/it/scala/stellar/sdk/DomainMatchersIT.scala @@ -2,7 +2,7 @@ package stellar.sdk import org.apache.commons.codec.binary.Hex import org.specs2.matcher.{AnyMatchers, Matcher, MustExpectations, OptionMatchers, SequenceMatchersCreation} -import org.stellar.sdk.xdr.{DecoratedSignature, Hash, PublicKey, SignerKey, Uint64, Memo => XDRMemo, Operation => XDROperation} +import org.stellar.sdk.xdr.{DecoratedSignature, Hash, PublicKey => XDRPublicKey, SignerKey, Uint64, Memo => XDRMemo, Operation => XDROperation} import stellar.sdk.op._ trait DomainMatchersIT extends AnyMatchers with MustExpectations with SequenceMatchersCreation with OptionMatchers { @@ -41,8 +41,8 @@ trait DomainMatchersIT extends AnyMatchers with MustExpectations with SequenceMa signer.getEd25519.getUint256.toSeq mustEqual other.getEd25519.getUint256.toSeq } - def beEquivalentTo(other: VerifyingKey): Matcher[VerifyingKey] = beLike[VerifyingKey] { - case VerifyingKey(pk) => + def beEquivalentTo(other: PublicKey): Matcher[PublicKey] = beLike[PublicKey] { + case PublicKey(pk) => Hex.encodeHex(pk.getAbyte) mustEqual Hex.encodeHex(other.pk.getAbyte) } @@ -67,7 +67,7 @@ trait DomainMatchersIT extends AnyMatchers with MustExpectations with SequenceMa memo.getText mustEqual other.getText } - def beEquivalentTo(other: PublicKey): Matcher[PublicKey] = beLike[PublicKey] { + def beEquivalentTo(other: XDRPublicKey): Matcher[XDRPublicKey] = beLike[XDRPublicKey] { case pk => pk.getDiscriminant mustEqual other.getDiscriminant pk.getEd25519.getUint256.toSeq mustEqual other.getEd25519.getUint256.toSeq diff --git a/src/main/scala/stellar/sdk/Asset.scala b/src/main/scala/stellar/sdk/Asset.scala index f4b8452f..583d2c3c 100644 --- a/src/main/scala/stellar/sdk/Asset.scala +++ b/src/main/scala/stellar/sdk/Asset.scala @@ -39,7 +39,7 @@ case object NativeAsset extends Asset { trait NonNativeAsset extends Asset { val code: String - val issuer: VerifyingKey + val issuer: PublicKey val typeString: String } @@ -48,7 +48,7 @@ trait NonNativeAsset extends Asset { * * @see Assets */ -case class AssetTypeCreditAlphaNum4(code: String, issuer: VerifyingKey) extends NonNativeAsset { +case class AssetTypeCreditAlphaNum4(code: String, issuer: PublicKey) extends NonNativeAsset { assert(code.nonEmpty, s"Asset's code '$code' cannot be empty") assert(code.length <= 4, s"Asset's code '$code' should have length no greater than 4") @@ -69,7 +69,7 @@ case class AssetTypeCreditAlphaNum4(code: String, issuer: VerifyingKey) extends object AssetTypeCreditAlphaNum4 { def apply(code: String, keyPair: PublicKeyOps): AssetTypeCreditAlphaNum4 = - AssetTypeCreditAlphaNum4(code, keyPair.asVerifyingKey) + AssetTypeCreditAlphaNum4(code, keyPair.asPublicKey) } @@ -78,7 +78,7 @@ object AssetTypeCreditAlphaNum4 { * * @see Assets */ -case class AssetTypeCreditAlphaNum12(code: String, issuer: VerifyingKey) extends NonNativeAsset { +case class AssetTypeCreditAlphaNum12(code: String, issuer: PublicKey) extends NonNativeAsset { assert(code.length >= 5 && code.length <= 12, s"Asset's code '$code' should have length between 5 & 12 inclusive") override def toXDR: XDRAsset = { @@ -98,5 +98,5 @@ case class AssetTypeCreditAlphaNum12(code: String, issuer: VerifyingKey) extends object AssetTypeCreditAlphaNum12 { def apply(code: String, keyPair: PublicKeyOps): AssetTypeCreditAlphaNum12 = - AssetTypeCreditAlphaNum12(code, keyPair.asVerifyingKey) + AssetTypeCreditAlphaNum12(code, keyPair.asPublicKey) } diff --git a/src/main/scala/stellar/sdk/KeyPair.scala b/src/main/scala/stellar/sdk/KeyPair.scala index ce89d091..596a899b 100644 --- a/src/main/scala/stellar/sdk/KeyPair.scala +++ b/src/main/scala/stellar/sdk/KeyPair.scala @@ -6,7 +6,7 @@ import java.util import net.i2p.crypto.eddsa._ import net.i2p.crypto.eddsa.spec._ -import org.stellar.sdk.xdr._ +import org.stellar.sdk.xdr.{PublicKey => XDRPublicKey, _} import scala.util.Try @@ -54,7 +54,7 @@ case class KeyPair(pk: EdDSAPublicKey, sk: EdDSAPrivateKey) extends PublicKeyOps } } -case class VerifyingKey(pk: EdDSAPublicKey) extends PublicKeyOps { +case class PublicKey(pk: EdDSAPublicKey) extends PublicKeyOps { override def hashCode(): Int = accountId.hashCode() @@ -63,7 +63,7 @@ case class VerifyingKey(pk: EdDSAPublicKey) extends PublicKeyOps { case _ => false } - override def toString: String = s"VerifyingKey($accountId)" + override def toString: String = s"PublicKey($accountId)" } @@ -93,8 +93,8 @@ trait PublicKeyOps { case _: SignatureException => false }.get - def getXDRPublicKey: PublicKey = { - val publicKey = new PublicKey + def getXDRPublicKey: XDRPublicKey = { + val publicKey = new XDRPublicKey publicKey.setDiscriminant(PublicKeyType.PUBLIC_KEY_TYPE_ED25519) val uint256 = new Uint256 uint256.setUint256(pk.getAbyte) @@ -114,7 +114,7 @@ trait PublicKeyOps { /** * This key pair or verifying key without the private key. */ - def asVerifyingKey = VerifyingKey(pk) + def asPublicKey = PublicKey(pk) /** @@ -123,7 +123,7 @@ trait PublicKeyOps { val signatureHint: Try[SignatureHint] = Try { val pkStream = new ByteArrayOutputStream val os = new XdrDataOutputStream(pkStream) - PublicKey.encode(os, getXDRPublicKey) + XDRPublicKey.encode(os, getXDRPublicKey) val pkBytes = pkStream.toByteArray val hintBytes = util.Arrays.copyOfRange(pkBytes, pkBytes.length - 4, pkBytes.length) val hint = new SignatureHint @@ -181,21 +181,21 @@ object KeyPair { * Creates a new Stellar verifying key from a 32 byte address. * * @param publicKey The 32 byte public key. - * @return { @link VerifyingKey} + * @return { @link PublicKey } */ - def fromPublicKey(publicKey: Array[Byte]): VerifyingKey = { - VerifyingKey(new EdDSAPublicKey(new EdDSAPublicKeySpec(publicKey, ed25519))) + def fromPublicKey(publicKey: Array[Byte]): PublicKey = { + PublicKey(new EdDSAPublicKey(new EdDSAPublicKeySpec(publicKey, ed25519))) } /** - * Creates a new Stellar VerifyingKey from a strkey encoded Stellar account ID. + * Creates a new Stellar PublicKey from a strkey encoded Stellar account ID. * * @param accountId The strkey encoded Stellar account ID. - * @return { @link VerifyingKey} + * @return { @link PublicKey} */ - def fromAccountId(accountId: String): VerifyingKey = fromPublicKey(StrKey.decodeStellarAccountId(accountId)) + def fromAccountId(accountId: String): PublicKey = fromPublicKey(StrKey.decodeStellarAccountId(accountId)) - def fromXDRPublicKey(key: PublicKey) = fromPublicKey(key.getEd25519.getUint256) + def fromXDRPublicKey(key: XDRPublicKey) = fromPublicKey(key.getEd25519.getUint256) /** * Generates a random Stellar keypair. diff --git a/src/main/scala/stellar/sdk/op/AllowTrustOperation.scala b/src/main/scala/stellar/sdk/op/AllowTrustOperation.scala index 2945f470..631e20ce 100644 --- a/src/main/scala/stellar/sdk/op/AllowTrustOperation.scala +++ b/src/main/scala/stellar/sdk/op/AllowTrustOperation.scala @@ -5,11 +5,11 @@ import org.stellar.sdk.xdr.Operation.OperationBody import org.stellar.sdk.xdr.OperationType._ import org.stellar.sdk.xdr.{AccountID, AllowTrustOp} import stellar.sdk._ -import stellar.sdk.{ByteArrays, KeyPair, VerifyingKey} +import stellar.sdk.{ByteArrays, KeyPair, PublicKey} import scala.util.Try -case class AllowTrustOperation(trustor: VerifyingKey, +case class AllowTrustOperation(trustor: PublicKey, assetCode: String, authorize: Boolean, sourceAccount: Option[PublicKeyOps] = None) extends Operation with ByteArrays { diff --git a/src/test/scala/stellar/sdk/ArbitraryInput.scala b/src/test/scala/stellar/sdk/ArbitraryInput.scala index 4b6eef28..c6092828 100644 --- a/src/test/scala/stellar/sdk/ArbitraryInput.scala +++ b/src/test/scala/stellar/sdk/ArbitraryInput.scala @@ -19,7 +19,7 @@ trait ArbitraryInput extends ScalaCheck { implicit def arbKeyPair: Arbitrary[KeyPair] = Arbitrary(genKeyPair) - implicit def arbVerifyingKey: Arbitrary[VerifyingKey] = Arbitrary(genVerifyingKey) + implicit def arbPublicKey: Arbitrary[PublicKey] = Arbitrary(genPublicKey) implicit def arbAccount: Arbitrary[Account] = Arbitrary(genAccount) @@ -34,25 +34,25 @@ trait ArbitraryInput extends ScalaCheck { implicit def arbNonNativeAsset: Arbitrary[NonNativeAsset] = Arbitrary(genNonNativeAsset) implicit def arbAccountMergeOperation: Arbitrary[AccountMergeOperation] = Arbitrary(genAccountMergeOperation) - + implicit def arbAllowTrustOperation: Arbitrary[AllowTrustOperation] = Arbitrary(genAllowTrustOperation) - + implicit def arbChangeTrustOperation: Arbitrary[ChangeTrustOperation] = Arbitrary(genChangeTrustOperation) - + implicit def arbCreateAccountOperation: Arbitrary[CreateAccountOperation] = Arbitrary(genCreateAccountOperation) - + implicit def arbCreatePassiveOfferOperation: Arbitrary[CreatePassiveOfferOperation] = Arbitrary(genCreatePassiveOfferOperation) - + implicit def arbWriteDataOperation: Arbitrary[WriteDataOperation] = Arbitrary(genWriteDataOperation) - + implicit def arbDeleteDataOperation: Arbitrary[DeleteDataOperation] = Arbitrary(genDeleteDataOperation) - + implicit def arbCreateOfferOperation: Arbitrary[CreateOfferOperation] = Arbitrary(genCreateOfferOperation) - + implicit def arbDeleteOfferOperation: Arbitrary[DeleteOfferOperation] = Arbitrary(genDeleteOfferOperation) - + implicit def arbUpdateOfferOperation: Arbitrary[UpdateOfferOperation] = Arbitrary(genUpdateOfferOperation) - + implicit def arbPathPaymentOperation: Arbitrary[PathPaymentOperation] = Arbitrary(genPathPaymentOperation) implicit def arbPaymentOperation: Arbitrary[PaymentOperation] = Arbitrary(genPaymentOperation) @@ -87,7 +87,7 @@ trait ArbitraryInput extends ScalaCheck { def genSignerKey: Gen[SignerKey] = genKeyPair.map(_.getXDRSignerKey) - def genVerifyingKey: Gen[VerifyingKey] = genKeyPair.map(kp => VerifyingKey(kp.pk)) + def genPublicKey: Gen[PublicKey] = genKeyPair.map(kp => PublicKey(kp.pk)) def genAccount: Gen[Account] = for { kp <- genKeyPair @@ -145,11 +145,11 @@ trait ArbitraryInput extends ScalaCheck { Gen.oneOf(AuthorizationRequiredFlag, AuthorizationRevocableFlag, AuthorizationImmutableFlag) def genAccountMergeOperation: Gen[AccountMergeOperation] = for { - destination <- genVerifyingKey + destination <- genPublicKey } yield AccountMergeOperation(destination) def genAllowTrustOperation = for { - trustor <- genVerifyingKey + trustor <- genPublicKey assetCode <- Gen.identifier.map(_.take(12)) authorise <- Gen.oneOf(true, false) } yield AllowTrustOperation(trustor, assetCode, authorise) @@ -159,7 +159,7 @@ trait ArbitraryInput extends ScalaCheck { } yield ChangeTrustOperation(limit) def genCreateAccountOperation = for { - destination <- genVerifyingKey + destination <- genPublicKey startingBalance <- genNativeAmount } yield CreateAccountOperation(destination, startingBalance) @@ -206,18 +206,18 @@ trait ArbitraryInput extends ScalaCheck { def genPathPaymentOperation = for { sendMax <- genAmount - destAccount <- genVerifyingKey + destAccount <- genPublicKey destAmount <- genAmount path <- Gen.listOf(genAsset) } yield PathPaymentOperation(sendMax, destAccount, destAmount, path) def genPaymentOperation = for { - destAccount <- genVerifyingKey + destAccount <- genPublicKey amount <- genAmount } yield PaymentOperation(destAccount, amount) def genSetOptionsOperation: Gen[SetOptionsOperation] = for { - inflationDestination <- Gen.option(genVerifyingKey) + inflationDestination <- Gen.option(genPublicKey) clearFlags <- Gen.option(Gen.nonEmptyContainerOf[Set, IssuerFlag](genIssuerFlag)) setFlags <- Gen.option(Gen.nonEmptyContainerOf[Set, IssuerFlag](genIssuerFlag)) masterKeyWeight <- Gen.option(Gen.choose(0, 255)) @@ -226,7 +226,7 @@ trait ArbitraryInput extends ScalaCheck { highThreshold <- Gen.option(Gen.choose(0, 255)) homeDomain <- Gen.option(Gen.identifier) signer <- Gen.option{ for { - accn <- genVerifyingKey + accn <- genPublicKey weight <- Gen.choose(0, 255) } yield AccountSigner(accn, weight)} } yield SetOptionsOperation(inflationDestination, clearFlags, setFlags, masterKeyWeight, lowThreshold, medThreshold, @@ -309,7 +309,7 @@ trait ArbitraryInput extends ScalaCheck { def genOfferResp: Gen[OfferResp] = for { id <- Gen.posNum[Long] - seller <- genVerifyingKey + seller <- genPublicKey selling <- genAmount buying <- genAsset price <- genPrice @@ -318,7 +318,7 @@ trait ArbitraryInput extends ScalaCheck { def genTransacted[O <: Operation](genOp: Gen[O]): Gen[Transacted[O]] = for { id <- Gen.posNum[Long] hash <- genHash - source <- genVerifyingKey + source <- genPublicKey createdAt <- genZonedDateTime op <- genOp } yield Transacted(id, hash, source, createdAt, op) @@ -341,9 +341,9 @@ trait ArbitraryInput extends ScalaCheck { id <- Gen.identifier ledgerCloseTime <- genZonedDateTime offerId <- Gen.posNum[Long] - baseAccount <- genVerifyingKey + baseAccount <- genPublicKey baseAmount <- genAmount - counterAccount <- genVerifyingKey + counterAccount <- genPublicKey counterAmount <- genAmount baseIsSeller <- Gen.oneOf(true, false) } yield Trade(id, ledgerCloseTime, offerId, baseAccount, baseAmount, counterAccount, counterAmount, baseIsSeller) diff --git a/src/test/scala/stellar/sdk/DomainMatchers.scala b/src/test/scala/stellar/sdk/DomainMatchers.scala index 6622c34c..c36d9cdb 100644 --- a/src/test/scala/stellar/sdk/DomainMatchers.scala +++ b/src/test/scala/stellar/sdk/DomainMatchers.scala @@ -5,7 +5,7 @@ import java.time.format.DateTimeFormatter import org.apache.commons.codec.binary.Hex import org.specs2.matcher.{AnyMatchers, Matcher, MustExpectations, OptionMatchers, SequenceMatchersCreation} -import org.stellar.sdk.xdr.{DecoratedSignature, Hash, PublicKey, SignerKey, Uint64, Memo => XDRMemo, Operation => XDROperation} +import org.stellar.sdk.xdr.{DecoratedSignature, Hash, PublicKey => XDRPublicKey, SignerKey, Uint64, Memo => XDRMemo, Operation => XDROperation} import stellar.sdk._ import stellar.sdk.op._ @@ -45,8 +45,8 @@ trait DomainMatchers extends AnyMatchers with MustExpectations with SequenceMatc signer.getEd25519.getUint256.toSeq mustEqual other.getEd25519.getUint256.toSeq } - def beEquivalentTo(other: VerifyingKey): Matcher[VerifyingKey] = beLike[VerifyingKey] { - case VerifyingKey(pk) => + def beEquivalentTo(other: PublicKey): Matcher[PublicKey] = beLike[PublicKey] { + case PublicKey(pk) => Hex.encodeHex(pk.getAbyte) mustEqual Hex.encodeHex(other.pk.getAbyte) } @@ -71,7 +71,7 @@ trait DomainMatchers extends AnyMatchers with MustExpectations with SequenceMatc memo.getText mustEqual other.getText } - def beEquivalentTo(other: PublicKey): Matcher[PublicKey] = beLike[PublicKey] { + def beEquivalentTo(other: XDRPublicKey): Matcher[XDRPublicKey] = beLike[XDRPublicKey] { case pk => pk.getDiscriminant mustEqual other.getDiscriminant pk.getEd25519.getUint256.toSeq mustEqual other.getEd25519.getUint256.toSeq diff --git a/src/test/scala/stellar/sdk/KeyPairSpec.scala b/src/test/scala/stellar/sdk/KeyPairSpec.scala index 28264247..a7d0a7fb 100644 --- a/src/test/scala/stellar/sdk/KeyPairSpec.scala +++ b/src/test/scala/stellar/sdk/KeyPairSpec.scala @@ -40,10 +40,10 @@ class KeyPairSpec extends Specification with ArbitraryInput with DomainMatchers "report its account id and secret seed and be reconstituted from these" >> prop { kp: KeyPair => kp.accountId.toCharArray must haveLength(56) kp.accountId must startWith("G") - KeyPair.fromPublicKey(kp.publicKey) must beEquivalentTo(kp.asVerifyingKey) + KeyPair.fromPublicKey(kp.publicKey) must beEquivalentTo(kp.asPublicKey) KeyPair.fromSecretSeed(kp.secretSeed) must beEquivalentTo(kp) KeyPair.fromSecretSeed(kp.secretSeed.mkString) must beEquivalentTo(kp) - KeyPair.fromAccountId(kp.accountId) must beEquivalentTo(kp.asVerifyingKey) + KeyPair.fromAccountId(kp.accountId) must beEquivalentTo(kp.asPublicKey) } } } diff --git a/src/test/scala/stellar/sdk/resp/AccountEffectRespSpec.scala b/src/test/scala/stellar/sdk/resp/AccountEffectRespSpec.scala index bf9251af..ff70a61e 100644 --- a/src/test/scala/stellar/sdk/resp/AccountEffectRespSpec.scala +++ b/src/test/scala/stellar/sdk/resp/AccountEffectRespSpec.scala @@ -14,7 +14,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { "a create account effect document" should { "parse to a create account effect" >> prop { (id: String, accn: KeyPair, amount: NativeAmount) => parse(doc(id, accn, "account_created", "starting_balance" -> amountString(amount))) - .extract[EffectResp] mustEqual EffectAccountCreated(id, accn.asVerifyingKey, amount) + .extract[EffectResp] mustEqual EffectAccountCreated(id, accn.asPublicKey, amount) }.setGen1(Gen.identifier) } @@ -23,7 +23,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { val json = doc(id, accn, "account_debited", "asset_type" -> "native", "amount" -> amountString(amount)) - parse(json).extract[EffectResp] mustEqual EffectAccountDebited(id, accn.asVerifyingKey, amount) + parse(json).extract[EffectResp] mustEqual EffectAccountDebited(id, accn.asPublicKey, amount) }.setGen1(Gen.identifier) "parse to a debit account effect with non-native amount" >> prop { (id: String, accn: KeyPair, amount: IssuedAmount) => @@ -35,7 +35,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { "asset_code" -> amount.asset.code, "asset_issuer" -> amount.asset.issuer.accountId, "amount" -> amountString(amount)) - parse(json).extract[EffectResp] mustEqual EffectAccountDebited(id, accn.asVerifyingKey, amount) + parse(json).extract[EffectResp] mustEqual EffectAccountDebited(id, accn.asPublicKey, amount) }.setGen1(Gen.identifier) } @@ -44,7 +44,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { val json = doc(id, accn, "account_credited", "asset_type" -> "native", "amount" -> amountString(amount)) - parse(json).extract[EffectResp] mustEqual EffectAccountCredited(id, accn.asVerifyingKey, amount) + parse(json).extract[EffectResp] mustEqual EffectAccountCredited(id, accn.asPublicKey, amount) }.setGen1(Gen.identifier) "parse to a credit account effect with non-native amount" >> prop { (id: String, accn: KeyPair, amount: IssuedAmount) => @@ -56,14 +56,14 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { "asset_code" -> amount.asset.code, "asset_issuer" -> amount.asset.issuer.accountId, "amount" -> amountString(amount)) - parse(json).extract[EffectResp] mustEqual EffectAccountCredited(id, accn.asVerifyingKey, amount) + parse(json).extract[EffectResp] mustEqual EffectAccountCredited(id, accn.asPublicKey, amount) }.setGen1(Gen.identifier) } "an account removed effect document" should { "parse to an account removed effect" >> prop { (id: String, accn: KeyPair) => val json = doc(id, accn, "account_removed") - parse(json).extract[EffectResp] mustEqual EffectAccountRemoved(id, accn.asVerifyingKey) + parse(json).extract[EffectResp] mustEqual EffectAccountRemoved(id, accn.asPublicKey) }.setGen1(Gen.identifier) } @@ -73,7 +73,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { "low_threshold" -> thresholds.low, "med_threshold" -> thresholds.med, "high_threshold" -> thresholds.high) - parse(json).extract[EffectResp] mustEqual EffectAccountThresholdsUpdated(id, accn.asVerifyingKey, thresholds) + parse(json).extract[EffectResp] mustEqual EffectAccountThresholdsUpdated(id, accn.asPublicKey, thresholds) }.setGen1(Gen.identifier) } @@ -81,7 +81,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { "parse to an account home domain updated effect" >> prop { (id : String, accn: KeyPair, domain: String) => val json = doc(id, accn, "account_home_domain_updated", "home_domain" -> domain) - parse(json).extract[EffectResp] mustEqual EffectAccountHomeDomainUpdated(id, accn.asVerifyingKey, domain) + parse(json).extract[EffectResp] mustEqual EffectAccountHomeDomainUpdated(id, accn.asPublicKey, domain) }.setGen1(Gen.identifier).setGen3(Gen.identifier) } @@ -89,7 +89,7 @@ class AccountEffectRespSpec extends Specification with ArbitraryInput { "parse to an account flags updated effect" >> prop { (id : String, accn: KeyPair, authRequired: Boolean) => // todo - support all 3 flags, when behaviour is known. https://stellar.stackexchange.com/questions/429/confusing-effects-after-set-options-transaction val json = doc(id, accn, "account_flags_updated", "auth_required_flag" -> authRequired) - parse(json).extract[EffectResp] mustEqual EffectAccountFlagsUpdated(id, accn.asVerifyingKey, authRequired) + parse(json).extract[EffectResp] mustEqual EffectAccountFlagsUpdated(id, accn.asPublicKey, authRequired) }.setGen1(Gen.identifier) } diff --git a/src/test/scala/stellar/sdk/resp/SignerEffectRespSpec.scala b/src/test/scala/stellar/sdk/resp/SignerEffectRespSpec.scala index 55a0556f..f049a51f 100644 --- a/src/test/scala/stellar/sdk/resp/SignerEffectRespSpec.scala +++ b/src/test/scala/stellar/sdk/resp/SignerEffectRespSpec.scala @@ -14,21 +14,21 @@ class SignerEffectRespSpec extends Specification with ArbitraryInput { "a signer created effect document" should { "parse to a signer created effect" >> prop { (id : String, kp: KeyPair, weight: Short, pubKey: String) => val json = doc(id, kp, "signer_created", weight, "public_key" -> pubKey) - parse(json).extract[EffectResp] mustEqual EffectSignerCreated(id, kp.asVerifyingKey, weight, pubKey) + parse(json).extract[EffectResp] mustEqual EffectSignerCreated(id, kp.asPublicKey, weight, pubKey) }.setGen1(Gen.identifier).setGen4(Gen.identifier) } "a signer updated effect document" should { "parse to a signer updated effect" >> prop { (id : String, kp: KeyPair, weight: Short, pubKey: String) => val json = doc(id, kp, "signer_updated", weight, "public_key" -> pubKey) - parse(json).extract[EffectResp] mustEqual EffectSignerUpdated(id, kp.asVerifyingKey, weight, pubKey) + parse(json).extract[EffectResp] mustEqual EffectSignerUpdated(id, kp.asPublicKey, weight, pubKey) }.setGen1(Gen.identifier).setGen4(Gen.identifier) } "a signer removed effect document" should { "parse to a signer removed effect" >> prop { (id : String, kp: KeyPair, pubKey: String) => val json = doc(id, kp, "signer_removed", 0, "public_key" -> pubKey) - parse(json).extract[EffectResp] mustEqual EffectSignerRemoved(id, kp.asVerifyingKey, pubKey) + parse(json).extract[EffectResp] mustEqual EffectSignerRemoved(id, kp.asPublicKey, pubKey) }.setGen1(Gen.identifier).setGen3(Gen.identifier) } diff --git a/src/test/scala/stellar/sdk/resp/TrustLineAuthEffectRespSpec.scala b/src/test/scala/stellar/sdk/resp/TrustLineAuthEffectRespSpec.scala index e96209f6..c6acba2e 100644 --- a/src/test/scala/stellar/sdk/resp/TrustLineAuthEffectRespSpec.scala +++ b/src/test/scala/stellar/sdk/resp/TrustLineAuthEffectRespSpec.scala @@ -14,14 +14,14 @@ class TrustLineAuthEffectRespSpec extends Specification with ArbitraryInput { "an authorize trustline effect document" should { "parse to an authorize trustline effect" >> prop { (id : String, accn: KeyPair, asset: NonNativeAsset) => val json = doc(id, "trustline_authorized", accn, asset, 0.0) - parse(json).extract[EffectResp] mustEqual EffectTrustLineAuthorized(id, accn.asVerifyingKey, asset) + parse(json).extract[EffectResp] mustEqual EffectTrustLineAuthorized(id, accn.asPublicKey, asset) }.setGen1(Gen.identifier) } "a deauthorize trustline effect document" should { "parse to a deauthorize trustline effect" >> prop { (id : String, accn: KeyPair, asset: NonNativeAsset) => val json = doc(id, "trustline_deauthorized", accn, asset, 0.0) - parse(json).extract[EffectResp] mustEqual EffectTrustLineDeauthorized(id, accn.asVerifyingKey, asset) + parse(json).extract[EffectResp] mustEqual EffectTrustLineDeauthorized(id, accn.asPublicKey, asset) }.setGen1(Gen.identifier) } diff --git a/src/test/scala/stellar/sdk/resp/TrustLineEffectRespSpec.scala b/src/test/scala/stellar/sdk/resp/TrustLineEffectRespSpec.scala index 97d4d274..1fdb12a5 100644 --- a/src/test/scala/stellar/sdk/resp/TrustLineEffectRespSpec.scala +++ b/src/test/scala/stellar/sdk/resp/TrustLineEffectRespSpec.scala @@ -15,7 +15,7 @@ class TrustLineEffectRespSpec extends Specification with ArbitraryInput { "parse to a trustline created effect" >> prop { (id : String, accn: KeyPair, asset: NonNativeAsset, limit: Double) => val json = doc(id, "trustline_created", accn, asset, limit) - parse(json).extract[EffectResp] mustEqual EffectTrustLineCreated(id, accn.asVerifyingKey, asset, limit) + parse(json).extract[EffectResp] mustEqual EffectTrustLineCreated(id, accn.asPublicKey, asset, limit) }.setGen1(Gen.identifier).setGen4(Gen.posNum[Double]) } @@ -23,14 +23,14 @@ class TrustLineEffectRespSpec extends Specification with ArbitraryInput { "parse to a trustline updated effect" >> prop { (id : String, accn: KeyPair, asset: NonNativeAsset, limit: Double) => val json = doc(id, "trustline_updated", accn, asset, limit) - parse(json).extract[EffectResp] mustEqual EffectTrustLineUpdated(id, accn.asVerifyingKey, asset, limit) + parse(json).extract[EffectResp] mustEqual EffectTrustLineUpdated(id, accn.asPublicKey, asset, limit) }.setGen1(Gen.identifier).setGen4(Gen.posNum[Double]) } "a trustline removed effect document" should { "parse to a trustline removed effect" >> prop { (id : String, accn: KeyPair, asset: NonNativeAsset) => val json = doc(id, "trustline_removed", accn, asset, 0.0) - parse(json).extract[EffectResp] mustEqual EffectTrustLineRemoved(id, accn.asVerifyingKey, asset) + parse(json).extract[EffectResp] mustEqual EffectTrustLineRemoved(id, accn.asPublicKey, asset) }.setGen1(Gen.identifier) }