(String[] args)
| 6 | |
| 7 | class Accounts { |
| 8 | public static void main(String[] args) throws Exception { |
| 9 | Client client = new Client(); |
| 10 | |
| 11 | MockHsm.Key assetKey = MockHsm.Key.create(client); |
| 12 | HsmSigner.addKey(assetKey, MockHsm.getSignerClient(client)); |
| 13 | |
| 14 | MockHsm.Key aliceKey = MockHsm.Key.create(client); |
| 15 | HsmSigner.addKey(aliceKey, MockHsm.getSignerClient(client)); |
| 16 | |
| 17 | MockHsm.Key bobKey = MockHsm.Key.create(client); |
| 18 | HsmSigner.addKey(bobKey, MockHsm.getSignerClient(client)); |
| 19 | |
| 20 | new Asset.Builder() |
| 21 | .setAlias("gold") |
| 22 | .addRootXpub(assetKey.xpub) |
| 23 | .setQuorum(1) |
| 24 | .create(client); |
| 25 | |
| 26 | new Asset.Builder() |
| 27 | .setAlias("silver") |
| 28 | .addRootXpub(assetKey.xpub) |
| 29 | .setQuorum(1) |
| 30 | .create(client); |
| 31 | |
| 32 | // snippet create-account-alice |
| 33 | new Account.Builder() |
| 34 | .setAlias("alice") |
| 35 | .addRootXpub(aliceKey.xpub) |
| 36 | .setQuorum(1) |
| 37 | .addTag("type", "checking") |
| 38 | .addTag("first_name", "Alice") |
| 39 | .addTag("last_name", "Jones") |
| 40 | .addTag("user_id", "12345") |
| 41 | .create(client); |
| 42 | // endsnippet |
| 43 | |
| 44 | // snippet create-account-bob |
| 45 | new Account.Builder() |
| 46 | .setAlias("bob") |
| 47 | .addRootXpub(bobKey.xpub) |
| 48 | .setQuorum(1) |
| 49 | .addTag("type", "savings") |
| 50 | .addTag("first_name", "Bob") |
| 51 | .addTag("last_name", "Smith") |
| 52 | .addTag("user_id", "67890") |
| 53 | .create(client); |
| 54 | // endsnippet |
| 55 | |
| 56 | // snippet list-accounts-by-tag |
| 57 | Account.Items accounts = new Account.QueryBuilder() |
| 58 | .setFilter("tags.type=$1") |
| 59 | .addFilterParameter("savings") |
| 60 | .execute(client); |
| 61 | |
| 62 | while (accounts.hasNext()) { |
| 63 | Account a = accounts.next(); |
| 64 | System.out.println("Account ID " + a.id + ", alias " + a.alias); |
| 65 | } |
nothing calls this directly
no test coverage detected