Skip to content

Commit 34d7b30

Browse files
committed
Add implementation of the typed call method that takes a value
1 parent e18f380 commit 34d7b30

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

unittest/src/main/java/score/Context.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public static BigInteger getBalance(Address address) throws IllegalArgumentExcep
8484

8585
public static<T> T call(Class<T> cls, BigInteger value,
8686
Address targetAddress, String method, Object... params) {
87-
return null;
87+
var caller = stackWalker.getCallerClass();
88+
return cls.cast(sm.call(caller, value, targetAddress, method, params));
8889
}
8990

9091
public static Object call(BigInteger value,

unittest/src/test/java/score/ContextTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@
3030
class ContextTest extends TestBase {
3131
private static final ServiceManager sm = getServiceManager();
3232
private static final Account owner = sm.createAccount();
33-
private static Score echoScore;
3433
private static Score helloScore;
3534

3635
@BeforeEach
3736
void setUp() throws Exception {
38-
echoScore = sm.deploy(owner, Echo.class);
37+
Score echoScore = sm.deploy(owner, Echo.class);
3938
helloScore = sm.deploy(owner, HelloWorld.class, "Alice", echoScore.getAddress());
4039
}
4140

0 commit comments

Comments
 (0)