@Test public void serializeCustomGroupsScope() throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); BinaryWriter writer = new BinaryWriter(outStream); new Signer.Builder() .account(acctScriptHash) .allowedGroups(groupPubKey1, groupPubKey2) .build() .serialize(writer); byte[] actual = outStream.toByteArray(); byte[] expected = Numeric.hexStringToByteArray("" + Numeric.reverseHexString(acctScriptHash.toString()) + Numeric.toHexStringNoPrefix(WitnessScope.CUSTOM_GROUPS.byteValue()) + "02" + Numeric.toHexStringNoPrefix(groupPubKey1.toArray()) + Numeric.toHexStringNoPrefix(groupPubKey2.toArray())); assertArrayEquals(expected, actual); }
@Override public void serialize(BinaryWriter writer) throws IOException { writer.writeSerializableFixed(this.account); writer.writeByte(WitnessScope.combineScopes(this.scopes)); if (scopes.contains(WitnessScope.CUSTOM_CONTRACTS)) { writer.writeSerializableVariable(this.allowedContracts); } if (scopes.contains(WitnessScope.CUSTOM_GROUPS)) { writer.writeSerializableVariable(this.allowedGroups); } }
Signer extends NeoSerializable { @Override public void serialize(BinaryWriter writer) throws IOException { writer.writeSerializableFixed(this.account); writer.writeByte(WitnessScope.combineScopes(this.scopes)); if (scopes.contains(WitnessScope.CUSTOM_CONTRACTS)) { writer.writeSerializableVariable(this.allowedContracts); } if (scopes.contains(WitnessScope.CUSTOM_GROUPS)) { writer.writeSerializableVariable(this.allowedGroups); } } }
Signer extends NeoSerializable { @Override public void serialize(BinaryWriter writer) throws IOException { writer.writeSerializableFixed(this.account); writer.writeByte(WitnessScope.combineScopes(this.scopes)); if (scopes.contains(WitnessScope.CUSTOM_CONTRACTS)) { writer.writeSerializableVariable(this.allowedContracts); } if (scopes.contains(WitnessScope.CUSTOM_GROUPS)) { writer.writeSerializableVariable(this.allowedGroups); } } Signer(); private  Signer(Builder builder); }
Signer extends NeoSerializable { @Override public void serialize(BinaryWriter writer) throws IOException { writer.writeSerializableFixed(this.account); writer.writeByte(WitnessScope.combineScopes(this.scopes)); if (scopes.contains(WitnessScope.CUSTOM_CONTRACTS)) { writer.writeSerializableVariable(this.allowedContracts); } if (scopes.contains(WitnessScope.CUSTOM_GROUPS)) { writer.writeSerializableVariable(this.allowedGroups); } } Signer(); private  Signer(Builder builder); static Signer feeOnly(ScriptHash account); static Signer calledByEntry(ScriptHash account); static Signer global(ScriptHash account); ScriptHash getScriptHash(); List<WitnessScope> getScopes(); List<ScriptHash> getAllowedContracts(); List<ECKeyPair.ECPublicKey> getAllowedGroups(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override int getSize(); @Override boolean equals(Object o); @Override int hashCode(); }
Signer extends NeoSerializable { @Override public void serialize(BinaryWriter writer) throws IOException { writer.writeSerializableFixed(this.account); writer.writeByte(WitnessScope.combineScopes(this.scopes)); if (scopes.contains(WitnessScope.CUSTOM_CONTRACTS)) { writer.writeSerializableVariable(this.allowedContracts); } if (scopes.contains(WitnessScope.CUSTOM_GROUPS)) { writer.writeSerializableVariable(this.allowedGroups); } } Signer(); private  Signer(Builder builder); static Signer feeOnly(ScriptHash account); static Signer calledByEntry(ScriptHash account); static Signer global(ScriptHash account); ScriptHash getScriptHash(); List<WitnessScope> getScopes(); List<ScriptHash> getAllowedContracts(); List<ECKeyPair.ECPublicKey> getAllowedGroups(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override int getSize(); @Override boolean equals(Object o); @Override int hashCode();  }