Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crypto/src/jni-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ curve25519-dalek = { version = "2.1.0", default-features = false }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"] }
hex = "0.4.3"

# Pinned transitive dependencies
proc-macro2 = { version = "=1.0.81" }
unicode-ident = { version = "=1.0.12" }
quote = { version = "=1.0.36" }
log = { version = "=0.4.21" }

[dev-dependencies]
hex-literal = "0.2.0"
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.strategyobject.substrateclient.rpc.api;

import com.strategyobject.substrateclient.crypto.ss58.SS58Codec;
import com.strategyobject.substrateclient.rpc.DecoderPair;
import com.strategyobject.substrateclient.rpc.RpcDecoder;
import com.strategyobject.substrateclient.rpc.annotation.AutoRegister;
import com.strategyobject.substrateclient.transport.RpcObject;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@AutoRegister(types = AccountId.class)
public class AccountIdDecoder implements RpcDecoder<AccountId> {

@Override
public AccountId decode(RpcObject value, DecoderPair<?>... decoders) {
if (value.isNull()) { return null; }
if (decoders != null && decoders.length > 0) throw new IllegalArgumentException();

return AccountId.fromBytes(SS58Codec.decode(value.asString()).getAddress());
}

}
Loading