Javasdk
the Java SDK for hyperchain (developing)
Install / Use
/learn @hyperchain/JavasdkREADME
LITESDK
Get started
Install
Maven
<dependency>
<groupId>cn.hyperchain</groupId>
<artifactId>litesdk</artifactId>
<version>x.x.x</version>
</dependency>
Gradle
compile group: 'cn.hyperchain', name: 'litesdk', version: 'x.x.x'
It's better to use latest sdk to send transaction, now it will be compatible with hyperchain 1.0 and 2.0
Usage
1. build provider manager
Provider can be expanded by user, we support default http provider.
Then create provider manager.
String DEFAULT_URL = "localhost:8081";
DefaultHttpProvider defaultHttpProvider = new DefaultHttpProvider.Builder().setUrl(DEFAULT_URL).build();
ProviderManager providerManager = ProviderManager.createManager(defaultHttpProvider);
2. Build service
Create different services by specific provider manager, service will provide some function.
ContractService contractService = ServiceManager.getContractService(providerManager);
AccountService accountService = ServiceManager.getAccountService(providerManager);
3. Create account
Account can be used to sign transaction.
Account account = accountService.genAccount(Algo.SMRAW);
4. Build transaction
Transaction builder can create different transaction by different style of initialization.
// deploy
Transaction transaction = new Transaction.HVMBuilder(account.getAddress()).deploy("hvm-jar/hvmbasic-1.0.0-student.jar").build();
transaction.sign(account);
// invoke
Transaction transaction1 = new Transaction.HVMBuilder(account.getAddress()).invoke(receiptResponse.getContractAddress(), new StudentInvoke()).build();
5. Get response
Service will return a Request, user can use Request to get specific Response by interface.
ReceiptResponse receiptResponse = contractService.deploy(transaction).send().polling();
6. Decode result
Decode result to specific type.
Decoder.decodeHVM(receiptResponse1.getRet(), String.class);
Issue
If you have any suggestions or idea, please submit issue in this project!
Doc
If you want to know more about LiteSDK, you can read manual at here.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
