-
Notifications
You must be signed in to change notification settings - Fork 4
PLT/Protocol 9 update #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
30e6d96
Switch concordium-base to the PLT branch
Radiokot d579ff4
Update Rust
Radiokot 7bb2606
Add tokens to AccountInfo
Radiokot b256d6b
Add PLT transaction reject reasons
Radiokot ef985ca
Add PLT update transaction result
Radiokot 65ca3f1
Add Protocol version 9 enum case
Radiokot 3f0a78e
Add PLT creation to AuthorizationsV1
Radiokot e4741b3
Add missing ValidatorScoreParameters update to ChainUpdateDetails
Radiokot 8db18f0
Add PLT creation updates to Summary
Radiokot 4de5bd7
Remove misleading comment
Radiokot c951432
Add token creation case for Summary details
Radiokot 51bf67c
Add token update transaction stub
Radiokot 124b306
Add token operation stub
Radiokot e5ab134
WIP Add transfer token operation with CBOR
Radiokot 7bb1bb6
Fix token operation amount serialization
Radiokot 249fdf9
Fix token holder account serialization
Radiokot cb0e13d
Fix transfer token op serialization
Radiokot c6b5856
Fix broken CBOR arrays
Radiokot 1b422e5
Add tagged token holder account test
Radiokot d153c90
Make CBOR memo serialization match JS SDK
Radiokot d161e50
Do not include null fields to CBOR
Radiokot 370b52c
Add CBOR serializer for UInt32
Radiokot 594d81b
Add token transfer example
Radiokot 0f1e5ea
Fix type issue in AuthorizationsV1
Radiokot fde905c
Add tests for token update transaction
Radiokot ecf4b62
Make symbol in token update tx a plain string
Radiokot 45bb6c3
Add auto TLS config to the readme
Radiokot 71ae4ad
Declare dependencies versions in the parent POM
Radiokot 528c84e
Exclude examples from the parent module list
Radiokot 0e5b095
Update Jackson to 2.19.1
Radiokot dcdb8c9
Update GRPC to 1.73.0
Radiokot 7bfbc8d
Update Commons
Radiokot 2cb1926
Remove null checks from CBOR serializers
Radiokot ab40125
Add plus method to UInt32 and UInt64
Radiokot ae98049
Prettify the example
Radiokot ee5dc13
Update the version to 11.0.0-plt.1
Radiokot 62c862a
Make examples use PLT release
Radiokot 909bdd6
Update concordium-base to f69906f
Radiokot 1e2926b
Fix switched types of token tx reject reasons
Radiokot 210133a
Update the changelog
Radiokot 7230229
Fix missing break in ChainUpdateDetails
Radiokot 7f052b2
Fix missing break in Summary
Radiokot c0fc925
Report possible reflection error with more details
Radiokot 5ebaf1d
Fix typo
Radiokot c2111d5
Remove impossible PLT creation chain update
Radiokot 70338e2
Fix typo
Radiokot ebe1176
Fix outdated term
Radiokot 7fca43d
Add upper bound check for token op amount decimals
Radiokot 2024857
Fix transitive lombok
Radiokot ccd5568
Update the version to 11.0.0
Radiokot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule concordium-base
updated
130 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
concordium-sdk-examples/src/main/java/com/concordium/sdk/examples/SendTokenTransfer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.concordium.sdk.examples; | ||
|
||
import com.concordium.sdk.ClientV2; | ||
import com.concordium.sdk.Connection; | ||
import com.concordium.sdk.TLSConfig; | ||
import com.concordium.sdk.crypto.ed25519.ED25519SecretKey; | ||
import com.concordium.sdk.exceptions.ClientInitializationException; | ||
import com.concordium.sdk.requests.AccountQuery; | ||
import com.concordium.sdk.requests.BlockQuery; | ||
import com.concordium.sdk.responses.blockitemstatus.FinalizedBlockItem; | ||
import com.concordium.sdk.transactions.*; | ||
import com.concordium.sdk.transactions.tokens.CborMemo; | ||
import com.concordium.sdk.transactions.tokens.TaggedTokenHolderAccount; | ||
import com.concordium.sdk.transactions.tokens.TokenOperationAmount; | ||
import com.concordium.sdk.transactions.tokens.TransferTokenOperation; | ||
import com.concordium.sdk.types.AccountAddress; | ||
import lombok.var; | ||
import picocli.CommandLine; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Option; | ||
|
||
import java.math.BigDecimal; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.Optional; | ||
import java.util.concurrent.Callable; | ||
|
||
@Command(name = "SendTokenTransfer", mixinStandardHelpOptions = true) | ||
public class SendTokenTransfer implements Callable<Integer> { | ||
@Option( | ||
names = {"--endpoint"}, | ||
description = "GRPC interface of the node.", | ||
defaultValue = "https://grpc.devnet-plt-beta.concordium.com:20000") | ||
private String endpoint; | ||
|
||
@Option( | ||
names = {"--timeout"}, | ||
description = "GRPC request timeout in milliseconds.", | ||
defaultValue = "100000") | ||
private int timeout; | ||
|
||
@Override | ||
public Integer call() throws MalformedURLException, ClientInitializationException { | ||
var endpointUrl = new URL(this.endpoint); | ||
|
||
Connection connection = Connection.newBuilder() | ||
.host(endpointUrl.getHost()) | ||
.port(endpointUrl.getPort()) | ||
.useTLS(TLSConfig.auto()) | ||
.build(); | ||
|
||
String tokenSymbol = "TestLists"; | ||
TokenOperationAmount amount = new TokenOperationAmount( | ||
new BigDecimal("0.01"), | ||
10 | ||
); | ||
AccountAddress sender = AccountAddress.from("4m9AzH7oeq2LNZpmBu3uW9KJEimevgBMD79PhTMxJeYVmtRdxR"); | ||
AccountAddress receiver = AccountAddress.from("386L81BpBVrm2cDrnjEqpaGcuveC8FgiH5ZBxSVdvto4ydVFLX"); | ||
Expiry expiry = Expiry.createNew().addMinutes(5); | ||
|
||
TransactionSigner signer = TransactionSigner.from( | ||
SignerEntry.from(Index.from(0), Index.from(0), | ||
ED25519SecretKey | ||
.from("ad42d4f5122f4cc758c27b9c776f2d7635f30e55acb8697bb7a97edb3d7f0d88"))); | ||
|
||
var client = ClientV2.from(connection); | ||
var senderInfo = client.getAccountInfo(BlockQuery.BEST, AccountQuery.from(sender)); | ||
var nonce = senderInfo.getNonce(); | ||
var txnHash = client.sendTransaction( | ||
TransactionFactory | ||
.newTokenUpdate() | ||
.sender(sender) | ||
.payload( | ||
TokenUpdate | ||
.builder() | ||
.tokenSymbol(tokenSymbol) | ||
.operation( | ||
TransferTokenOperation | ||
.builder() | ||
.recipient(new TaggedTokenHolderAccount(receiver)) | ||
.amount(amount) | ||
.memo(CborMemo.from("You must see a multi-byte white woman scientist emoji: 👩🏻🔬")) | ||
.build() | ||
) | ||
.build() | ||
) | ||
.nonce(nonce) | ||
.expiry(expiry) | ||
.signer(signer) | ||
.build() | ||
); | ||
System.out.println(txnHash); | ||
Optional<FinalizedBlockItem> finalizedBlockItem = client.waitUntilFinalized(txnHash, this.timeout); | ||
System.out.println(finalizedBlockItem); | ||
return 0; | ||
} | ||
|
||
public static void main(String[] args) { | ||
int exitCode = new CommandLine(new SendTokenTransfer()).execute(args); | ||
System.exit(exitCode); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.