MCPcopy Index your code
hub / github.com/chain/Core / main

Method main

docs/core/examples/java/Keys.java:6–42  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

4
5class Keys {
6 public static void main(String[] args) throws Exception {
7 Client client = new Client();
8
9 // snippet create-key
10 MockHsm.Key key = MockHsm.Key.create(client);
11 // endsnippet
12
13 // snippet signer-add-key
14 HsmSigner.addKey(key, MockHsm.getSignerClient(client));
15 // endsnippet
16
17 new Asset.Builder()
18 .setAlias("gold")
19 .addRootXpub(key.xpub)
20 .setQuorum(1)
21 .create(client);
22
23 new Account.Builder()
24 .setAlias("alice")
25 .addRootXpub(key.xpub)
26 .setQuorum(1)
27 .create(client);
28
29 Transaction.Template unsigned = new Transaction.Builder()
30 .addAction(new Transaction.Action.Issue()
31 .setAssetAlias("gold")
32 .setAmount(100)
33 ).addAction(new Transaction.Action.ControlWithAccount()
34 .setAccountAlias("alice")
35 .setAssetAlias("gold")
36 .setAmount(100)
37 ).build(client);
38
39 // snippet sign-transaction
40 Transaction.Template signed = HsmSigner.sign(unsigned);
41 // endsnippet
42 }
43}

Callers

nothing calls this directly

Calls 12

addKeyMethod · 0.95
getSignerClientMethod · 0.95
signMethod · 0.95
addActionMethod · 0.80
createMethod · 0.65
setQuorumMethod · 0.45
addRootXpubMethod · 0.45
setAliasMethod · 0.45
buildMethod · 0.45
setAmountMethod · 0.45
setAssetAliasMethod · 0.45
setAccountAliasMethod · 0.45

Tested by

no test coverage detected