@europeum-ebsi/cli 0.0.0 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +289 -289
- package/LICENSES.txt +538 -0
- package/README.md +1140 -98
- package/dist/api/client.d.ts +4 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +14 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/fetch.d.ts +13 -0
- package/dist/api/fetch.d.ts.map +1 -0
- package/dist/api/fetch.js +30 -0
- package/dist/api/fetch.js.map +1 -0
- package/dist/api/params.d.ts +4 -0
- package/dist/api/params.d.ts.map +1 -0
- package/dist/api/params.js +9 -0
- package/dist/api/params.js.map +1 -0
- package/dist/auth/dcql.d.ts +5 -0
- package/dist/auth/dcql.d.ts.map +1 -0
- package/dist/auth/dcql.js +41 -0
- package/dist/auth/dcql.js.map +1 -0
- package/dist/auth/presentation.d.ts +30 -0
- package/dist/auth/presentation.d.ts.map +1 -0
- package/dist/auth/presentation.js +99 -0
- package/dist/auth/presentation.js.map +1 -0
- package/dist/auth/token.d.ts +11 -0
- package/dist/auth/token.d.ts.map +1 -0
- package/dist/auth/token.js +116 -0
- package/dist/auth/token.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +96 -10
- package/dist/cli.js.map +1 -1
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +99 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config-cmd.d.ts +3 -0
- package/dist/commands/config-cmd.d.ts.map +1 -0
- package/dist/commands/config-cmd.js +86 -0
- package/dist/commands/config-cmd.js.map +1 -0
- package/dist/commands/contracts-registry.d.ts +3 -0
- package/dist/commands/contracts-registry.d.ts.map +1 -0
- package/dist/commands/contracts-registry.js +132 -0
- package/dist/commands/contracts-registry.js.map +1 -0
- package/dist/commands/did-registry.d.ts +3 -0
- package/dist/commands/did-registry.d.ts.map +1 -0
- package/dist/commands/did-registry.js +110 -0
- package/dist/commands/did-registry.js.map +1 -0
- package/dist/commands/faucet.d.ts +3 -0
- package/dist/commands/faucet.d.ts.map +1 -0
- package/dist/commands/faucet.js +78 -0
- package/dist/commands/faucet.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +20 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/issuers-registry.d.ts +3 -0
- package/dist/commands/issuers-registry.d.ts.map +1 -0
- package/dist/commands/issuers-registry.js +340 -0
- package/dist/commands/issuers-registry.js.map +1 -0
- package/dist/commands/ledger.d.ts +3 -0
- package/dist/commands/ledger.d.ts.map +1 -0
- package/dist/commands/ledger.js +549 -372
- package/dist/commands/ledger.js.map +1 -1
- package/dist/commands/onboarding.d.ts +3 -0
- package/dist/commands/onboarding.d.ts.map +1 -0
- package/dist/commands/onboarding.js +301 -0
- package/dist/commands/onboarding.js.map +1 -0
- package/dist/commands/openapi.d.ts +3 -0
- package/dist/commands/openapi.d.ts.map +1 -0
- package/dist/commands/openapi.js +37 -0
- package/dist/commands/openapi.js.map +1 -0
- package/dist/commands/policies-registry.d.ts +3 -0
- package/dist/commands/policies-registry.d.ts.map +1 -0
- package/dist/commands/policies-registry.js +198 -0
- package/dist/commands/policies-registry.js.map +1 -0
- package/dist/commands/registry.d.ts +27 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +62 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/schemas-registry.d.ts +3 -0
- package/dist/commands/schemas-registry.d.ts.map +1 -0
- package/dist/commands/schemas-registry.js +231 -0
- package/dist/commands/schemas-registry.js.map +1 -0
- package/dist/commands/shared/args.d.ts +2 -0
- package/dist/commands/shared/args.d.ts.map +1 -0
- package/dist/commands/shared/args.js +4 -0
- package/dist/commands/shared/args.js.map +1 -0
- package/dist/commands/shared/wallet-opts.d.ts +9 -0
- package/dist/commands/shared/wallet-opts.d.ts.map +1 -0
- package/dist/commands/shared/wallet-opts.js +44 -0
- package/dist/commands/shared/wallet-opts.js.map +1 -0
- package/dist/commands/timestamp.d.ts +3 -0
- package/dist/commands/timestamp.d.ts.map +1 -0
- package/dist/commands/timestamp.js +250 -0
- package/dist/commands/timestamp.js.map +1 -0
- package/dist/commands/track-and-trace.d.ts +3 -0
- package/dist/commands/track-and-trace.d.ts.map +1 -0
- package/dist/commands/track-and-trace.js +235 -0
- package/dist/commands/track-and-trace.js.map +1 -0
- package/dist/commands/wallet.d.ts +3 -0
- package/dist/commands/wallet.d.ts.map +1 -0
- package/dist/commands/wallet.js +123 -0
- package/dist/commands/wallet.js.map +1 -0
- package/dist/config/config.d.ts +45 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +111 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/ebsi-env.d.ts +4 -0
- package/dist/config/ebsi-env.d.ts.map +1 -0
- package/dist/config/ebsi-env.js +37 -0
- package/dist/config/ebsi-env.js.map +1 -0
- package/dist/crypto/wallet.d.ts +34 -0
- package/dist/crypto/wallet.d.ts.map +1 -0
- package/dist/crypto/wallet.js +100 -0
- package/dist/crypto/wallet.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/ledger/read.d.ts +11 -0
- package/dist/ledger/read.d.ts.map +1 -0
- package/dist/ledger/read.js +24 -0
- package/dist/ledger/read.js.map +1 -0
- package/dist/ledger/registries.d.ts +25 -0
- package/dist/ledger/registries.d.ts.map +1 -0
- package/dist/ledger/registries.js +111 -0
- package/dist/ledger/registries.js.map +1 -0
- package/dist/ledger/write.d.ts +43 -0
- package/dist/ledger/write.d.ts.map +1 -0
- package/dist/ledger/write.js +119 -0
- package/dist/ledger/write.js.map +1 -0
- package/dist/onboarding/vc.d.ts +18 -0
- package/dist/onboarding/vc.d.ts.map +1 -0
- package/dist/onboarding/vc.js +72 -0
- package/dist/onboarding/vc.js.map +1 -0
- package/dist/output/format.d.ts +7 -0
- package/dist/output/format.d.ts.map +1 -0
- package/dist/output/format.js +94 -0
- package/dist/output/format.js.map +1 -0
- package/dist/tui/App.d.ts +3 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +99 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/CommandPalette.d.ts +8 -0
- package/dist/tui/CommandPalette.d.ts.map +1 -0
- package/dist/tui/CommandPalette.js +105 -0
- package/dist/tui/CommandPalette.js.map +1 -0
- package/package.json +66 -108
- package/src/api/client.ts +26 -0
- package/src/api/fetch.ts +53 -0
- package/src/api/params.ts +17 -0
- package/src/auth/dcql.ts +84 -0
- package/src/auth/presentation.ts +255 -0
- package/src/auth/token.ts +244 -0
- package/src/cli.ts +164 -0
- package/src/commands/auth.ts +119 -0
- package/src/commands/config-cmd.ts +122 -0
- package/src/commands/contracts-registry.ts +156 -0
- package/src/commands/did-registry.ts +126 -0
- package/src/commands/faucet.ts +112 -0
- package/src/commands/health.ts +21 -0
- package/src/commands/issuers-registry.ts +385 -0
- package/src/commands/ledger.ts +777 -0
- package/src/commands/onboarding.ts +411 -0
- package/src/commands/openapi.ts +42 -0
- package/src/commands/policies-registry.ts +218 -0
- package/src/commands/registry.ts +152 -0
- package/src/commands/schemas-registry.ts +255 -0
- package/src/commands/shared/args.ts +14 -0
- package/src/commands/shared/wallet-opts.ts +85 -0
- package/src/commands/timestamp.ts +272 -0
- package/src/commands/track-and-trace.ts +263 -0
- package/src/commands/wallet.ts +175 -0
- package/src/config/config.ts +275 -0
- package/src/config/ebsi-env.ts +67 -0
- package/src/crypto/wallet.ts +291 -0
- package/src/index.ts +24 -0
- package/src/ledger/read.ts +70 -0
- package/src/ledger/registries.ts +285 -0
- package/src/ledger/write.ts +381 -0
- package/src/onboarding/vc.ts +205 -0
- package/src/output/format.ts +157 -0
- package/src/tui/App.tsx +282 -0
- package/src/tui/CommandPalette.tsx +223 -0
- package/bin/cli.js +0 -13
- package/dist/abi/pilot/DidRegistry.js +0 -568
- package/dist/abi/pilot/DidRegistry.js.map +0 -1
- package/dist/abi/pilot/Ptr.js +0 -666
- package/dist/abi/pilot/Ptr.js.map +0 -1
- package/dist/abi/pilot/SchemaSCRegistry.js +0 -264
- package/dist/abi/pilot/SchemaSCRegistry.js.map +0 -1
- package/dist/abi/pilot/Tcr.js +0 -715
- package/dist/abi/pilot/Tcr.js.map +0 -1
- package/dist/abi/pilot/Timestamp.js +0 -658
- package/dist/abi/pilot/Timestamp.js.map +0 -1
- package/dist/abi/pilot/Tir.js +0 -428
- package/dist/abi/pilot/Tir.js.map +0 -1
- package/dist/abi/pilot/TnT.js +0 -842
- package/dist/abi/pilot/TnT.js.map +0 -1
- package/dist/abi/pilot/Tpr.js +0 -492
- package/dist/abi/pilot/Tpr.js.map +0 -1
- package/dist/abi/test/DidRegistry.js +0 -568
- package/dist/abi/test/DidRegistry.js.map +0 -1
- package/dist/abi/test/Ptr.js +0 -666
- package/dist/abi/test/Ptr.js.map +0 -1
- package/dist/abi/test/SchemaSCRegistry.js +0 -300
- package/dist/abi/test/SchemaSCRegistry.js.map +0 -1
- package/dist/abi/test/Tcr.js +0 -715
- package/dist/abi/test/Tcr.js.map +0 -1
- package/dist/abi/test/Timestamp.js +0 -658
- package/dist/abi/test/Timestamp.js.map +0 -1
- package/dist/abi/test/Tir.js +0 -428
- package/dist/abi/test/Tir.js.map +0 -1
- package/dist/abi/test/TnT.js +0 -842
- package/dist/abi/test/TnT.js.map +0 -1
- package/dist/abi/test/Tpr.js +0 -492
- package/dist/abi/test/Tpr.js.map +0 -1
- package/dist/app.js +0 -659
- package/dist/app.js.map +0 -1
- package/dist/buildParam/didr.js +0 -374
- package/dist/buildParam/didr.js.map +0 -1
- package/dist/buildParam/index.js +0 -53
- package/dist/buildParam/index.js.map +0 -1
- package/dist/buildParam/ptr.js +0 -80
- package/dist/buildParam/ptr.js.map +0 -1
- package/dist/buildParam/tcr.js +0 -36
- package/dist/buildParam/tcr.js.map +0 -1
- package/dist/buildParam/timestamp.js +0 -350
- package/dist/buildParam/timestamp.js.map +0 -1
- package/dist/buildParam/tir.js +0 -110
- package/dist/buildParam/tir.js.map +0 -1
- package/dist/buildParam/tnt.js +0 -214
- package/dist/buildParam/tnt.js.map +0 -1
- package/dist/buildParam/tpr.js +0 -91
- package/dist/buildParam/tpr.js.map +0 -1
- package/dist/buildParam/tsr.js +0 -115
- package/dist/buildParam/tsr.js.map +0 -1
- package/dist/commands/authorisation.js +0 -144
- package/dist/commands/authorisation.js.map +0 -1
- package/dist/commands/compute.js +0 -680
- package/dist/commands/compute.js.map +0 -1
- package/dist/commands/conformance.js +0 -813
- package/dist/commands/conformance.js.map +0 -1
- package/dist/commands/hardwarewallet.js +0 -41
- package/dist/commands/hardwarewallet.js.map +0 -1
- package/dist/commands/index.js +0 -8
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/ptr.js +0 -54
- package/dist/commands/ptr.js.map +0 -1
- package/dist/commands/tcr.js +0 -50
- package/dist/commands/tcr.js.map +0 -1
- package/dist/commands/tir.js +0 -64
- package/dist/commands/tir.js.map +0 -1
- package/dist/commands/tnl.js +0 -81
- package/dist/commands/tnl.js.map +0 -1
- package/dist/commands/tsr.js +0 -45
- package/dist/commands/tsr.js.map +0 -1
- package/dist/commands/view.js +0 -53
- package/dist/commands/view.js.map +0 -1
- package/dist/config.js +0 -497
- package/dist/config.js.map +0 -1
- package/dist/interfaces/context.js +0 -2
- package/dist/interfaces/context.js.map +0 -1
- package/dist/interfaces/contracts/ProxyFactory.js +0 -2
- package/dist/interfaces/contracts/ProxyFactory.js.map +0 -1
- package/dist/interfaces/contracts/ProxyTemplateRegistry.js +0 -2
- package/dist/interfaces/contracts/ProxyTemplateRegistry.js.map +0 -1
- package/dist/interfaces/contracts/SchemaSCRegistry.js +0 -2
- package/dist/interfaces/contracts/SchemaSCRegistry.js.map +0 -1
- package/dist/interfaces/contracts/common.js +0 -2
- package/dist/interfaces/contracts/common.js.map +0 -1
- package/dist/interfaces/index.js +0 -5
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/jsonrpc.interface.js +0 -2
- package/dist/interfaces/jsonrpc.interface.js.map +0 -1
- package/dist/interfaces/paginated-list.interface.js +0 -2
- package/dist/interfaces/paginated-list.interface.js.map +0 -1
- package/dist/interfaces/unsigned-transaction.interface.js +0 -2
- package/dist/interfaces/unsigned-transaction.interface.js.map +0 -1
- package/dist/interfaces/utils.interface.js +0 -2
- package/dist/interfaces/utils.interface.js.map +0 -1
- package/dist/programs/migrateDid.js +0 -159
- package/dist/programs/migrateDid.js.map +0 -1
- package/dist/programs/migrateDids.js +0 -232
- package/dist/programs/migrateDids.js.map +0 -1
- package/dist/programs/migrateTsr.js +0 -201
- package/dist/programs/migrateTsr.js.map +0 -1
- package/dist/scripts/accreditAndAuthorize/conformance/step1 +0 -34
- package/dist/scripts/accreditAndAuthorize/conformance/step2 +0 -18
- package/dist/scripts/accreditAndAuthorize/conformance/step3 +0 -9
- package/dist/scripts/accreditAndAuthorize/conformance/step4 +0 -27
- package/dist/scripts/accreditAndAuthorize/conformance/step5 +0 -13
- package/dist/scripts/accreditAndAuthorize/conformance/step6 +0 -14
- package/dist/scripts/accreditAndAuthorize/conformance/step7 +0 -7
- package/dist/scripts/accreditAndAuthorize/test/step1 +0 -34
- package/dist/scripts/accreditAndAuthorize/test/step2 +0 -18
- package/dist/scripts/accreditAndAuthorize/test/step3 +0 -9
- package/dist/scripts/accreditAndAuthorize/test/step4 +0 -27
- package/dist/scripts/accreditAndAuthorize/test/step5 +0 -13
- package/dist/scripts/accreditAndAuthorize/test/step6 +0 -14
- package/dist/scripts/accreditAndAuthorize/test/step7 +0 -7
- package/dist/scripts/accreditTI +0 -21
- package/dist/scripts/assets/Nodes.json +0 -27
- package/dist/scripts/assets/vcdm1.1/CTRevocableCredential.json +0 -30
- package/dist/scripts/assets/vcdm1.1/CredentialToAttestVerifiableAuthorisationForTrustChain.json +0 -29
- package/dist/scripts/assets/vcdm1.1/Nodes.json +0 -27
- package/dist/scripts/assets/vcdm1.1/TrustedNodesList.json +0 -35
- package/dist/scripts/assets/vcdm1.1/VerifiableAccreditationToAccredit.json +0 -35
- package/dist/scripts/assets/vcdm1.1/VerifiableAccreditationToAttest.json +0 -33
- package/dist/scripts/assets/vcdm1.1/VerifiableAuthorisationForTrustChain.json +0 -22
- package/dist/scripts/assets/vcdm1.1/VerifiableAuthorisationToInvoke.json +0 -24
- package/dist/scripts/assets/vcdm1.1/VerifiableAuthorisationToOnboard.json +0 -24
- package/dist/scripts/assets/vcdm2.0/CredentialToAttestVerifiableAuthorisationForTrustChain.json +0 -29
- package/dist/scripts/assets/vcdm2.0/TrustedNodesList.json +0 -36
- package/dist/scripts/assets/vcdm2.0/VerifiableAccreditationToAccredit.json +0 -40
- package/dist/scripts/assets/vcdm2.0/VerifiableAccreditationToAttest.json +0 -38
- package/dist/scripts/assets/vcdm2.0/VerifiableAuthorisationForTrustChain.json +0 -30
- package/dist/scripts/assets/vcdm2.0/VerifiableAuthorisationToInvoke.json +0 -24
- package/dist/scripts/assets/vcdm2.0/VerifiableAuthorisationToOnboard.json +0 -23
- package/dist/scripts/bootstrap/0a-loadTPROperator +0 -5
- package/dist/scripts/bootstrap/0b-loadAdmin +0 -8
- package/dist/scripts/bootstrap/1-populateTPR +0 -92
- package/dist/scripts/bootstrap/2-populateDID +0 -6
- package/dist/scripts/bootstrap/3-populateTimestamp +0 -9
- package/dist/scripts/bootstrap/4-populateTIR +0 -8
- package/dist/scripts/bootstrap/5-populateTSR +0 -85
- package/dist/scripts/bootstrap/6-setupConformanceIssuer +0 -35
- package/dist/scripts/bootstrap/README.md +0 -218
- package/dist/scripts/issueVcInvoke +0 -10
- package/dist/scripts/issueVcOnboard +0 -9
- package/dist/scripts/issueVcRootTAO +0 -11
- package/dist/scripts/issueVcTAO +0 -12
- package/dist/scripts/issueVcTI +0 -12
- package/dist/scripts/issueVcTnl +0 -32
- package/dist/scripts/issue_CTRevocableCredential +0 -12
- package/dist/scripts/issue_SelfAttestationSupportOffice +0 -10
- package/dist/scripts/issue_VerifiableAccreditationToAccredit +0 -11
- package/dist/scripts/issue_VerifiableAccreditationToAttest +0 -11
- package/dist/scripts/issue_VerifiableAuthorisationForTrustChain +0 -10
- package/dist/scripts/issue_VerifiableAuthorisationToOnboard +0 -9
- package/dist/scripts/preregisterIssuer +0 -6
- package/dist/scripts/registerDidDocument +0 -15
- package/dist/scripts/registerIssuer +0 -6
- package/dist/scripts/updateVcRootTAO +0 -10
- package/dist/scripts/updateVcTAO +0 -11
- package/dist/scripts/updateVcTI +0 -11
- package/dist/scripts/vcdm2.0/issueSelfAttestationSupportOffice +0 -10
- package/dist/scripts/vcdm2.0/issueVcInvoke +0 -12
- package/dist/scripts/vcdm2.0/issueVcOnboard +0 -11
- package/dist/scripts/vcdm2.0/issueVcRootTAO +0 -14
- package/dist/scripts/vcdm2.0/issueVcTAO +0 -15
- package/dist/scripts/vcdm2.0/issueVcTI +0 -15
- package/dist/scripts/vcdm2.0/issueVcTnl +0 -34
- package/dist/scripts/vcdm2.0/registerDidDocument +0 -15
- package/dist/scripts/vcdm2.0/updateVcRootTAO +0 -13
- package/dist/scripts/vcdm2.0/updateVcTAO +0 -14
- package/dist/scripts/vcdm2.0/updateVcTI +0 -14
- package/dist/scripts/vcdm2.0/verifyVcTnl +0 -10
- package/dist/scripts/verifyVcTnl +0 -10
- package/dist/scripts/wct/accreditAndAuthorize +0 -133
- package/dist/scripts/wct/accreditAndAuthorize2 +0 -89
- package/dist/scripts/wct/holderWallet +0 -39
- package/dist/scripts/wct/holderWallet2 +0 -39
- package/dist/scripts/wct/issueToHolder +0 -38
- package/dist/scripts/wct/issueToHolder2 +0 -38
- package/dist/scripts/wct/pda1 +0 -3
- package/dist/scripts/wct/verifier +0 -8
- package/dist/scripts/wct/verifier2 +0 -7
- package/dist/utils/Client.js +0 -155
- package/dist/utils/Client.js.map +0 -1
- package/dist/utils/HardwareWallet.js +0 -326
- package/dist/utils/HardwareWallet.js.map +0 -1
- package/dist/utils/http.js +0 -132
- package/dist/utils/http.js.map +0 -1
- package/dist/utils/index.js +0 -8
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/jsonrpc.js +0 -38
- package/dist/utils/jsonrpc.js.map +0 -1
- package/dist/utils/print.js +0 -56
- package/dist/utils/print.js.map +0 -1
- package/dist/utils/utils.js +0 -427
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/vcdm.js +0 -47
- package/dist/utils/vcdm.js.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { CommandDescriptor } from "./registry.ts";
|
|
2
|
+
|
|
3
|
+
import { getClient, unwrap } from "../api/fetch.ts";
|
|
4
|
+
import { q } from "../api/params.ts";
|
|
5
|
+
import { contractAddressOption } from "../ledger/registries.ts";
|
|
6
|
+
import { requiredArg } from "./shared/args.ts";
|
|
7
|
+
|
|
8
|
+
const PAGINATION_OPTIONS = [
|
|
9
|
+
{
|
|
10
|
+
description: "Cursor for pagination (page[after])",
|
|
11
|
+
flags: "--page-after <cursor>",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
description: "Maximum number of items per page (page[size])",
|
|
15
|
+
flags: "--page-size <n>",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
// contracts-registry has no local ABI/write path (see src/ledger/registries.ts), so unlike the
|
|
20
|
+
// other domains there's no shared `REGISTRIES[...].addressEnvKey` to reuse here — these mirror
|
|
21
|
+
// the API's own two distinct config keys for this domain
|
|
22
|
+
// (api/src/config/configuration.ts: PROXY_FACTORY_CONTRACT_ADDRESS / PROXY_TEMPLATES_REGISTRY_CONTRACT_ADDRESS).
|
|
23
|
+
const { option: CONTRACTS_ADDRESS_OPTION, resolve: contractsContractAddress } =
|
|
24
|
+
contractAddressOption(
|
|
25
|
+
"PROXY_FACTORY_CONTRACT_ADDRESS",
|
|
26
|
+
`Contract address to query. Defaults to $PROXY_FACTORY_CONTRACT_ADDRESS if set, otherwise the API's configured default.`,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const { option: TEMPLATES_ADDRESS_OPTION, resolve: templatesContractAddress } =
|
|
30
|
+
contractAddressOption(
|
|
31
|
+
"PROXY_TEMPLATES_REGISTRY_CONTRACT_ADDRESS",
|
|
32
|
+
`Contract address to query. Defaults to $PROXY_TEMPLATES_REGISTRY_CONTRACT_ADDRESS if set, otherwise the API's configured default.`,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const contractsRegistryCommands: CommandDescriptor[] = [
|
|
36
|
+
{
|
|
37
|
+
args: [],
|
|
38
|
+
group: "Contracts Registry",
|
|
39
|
+
async handler(_args, opts, config) {
|
|
40
|
+
const client = getClient(config);
|
|
41
|
+
const result = await client.GET("/contracts-registry/contracts", {
|
|
42
|
+
params: {
|
|
43
|
+
query: q({
|
|
44
|
+
contractAddress: contractsContractAddress(opts),
|
|
45
|
+
"page[after]": opts["pageAfter"]
|
|
46
|
+
? Number(opts["pageAfter"])
|
|
47
|
+
: undefined,
|
|
48
|
+
"page[size]": opts["pageSize"]
|
|
49
|
+
? Number(opts["pageSize"])
|
|
50
|
+
: undefined,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
return unwrap(result);
|
|
55
|
+
},
|
|
56
|
+
id: "contracts-registry.contracts.list",
|
|
57
|
+
options: [...PAGINATION_OPTIONS, CONTRACTS_ADDRESS_OPTION],
|
|
58
|
+
segments: ["contracts-registry", "contracts", "list"],
|
|
59
|
+
summary: "List smart contracts registered in the EBSI Contracts Registry",
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
{
|
|
63
|
+
args: [
|
|
64
|
+
{
|
|
65
|
+
description: "Contract address (hex)",
|
|
66
|
+
example: "0x1234abcd...",
|
|
67
|
+
name: "address",
|
|
68
|
+
required: true,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
group: "Contracts Registry",
|
|
72
|
+
async handler(args, opts, config) {
|
|
73
|
+
const client = getClient(config);
|
|
74
|
+
const result = await client.GET(
|
|
75
|
+
"/contracts-registry/contracts/{address}",
|
|
76
|
+
{
|
|
77
|
+
params: {
|
|
78
|
+
path: { address: requiredArg(args, "address") },
|
|
79
|
+
query: q({ contractAddress: contractsContractAddress(opts) }),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
return unwrap(result);
|
|
84
|
+
},
|
|
85
|
+
id: "contracts-registry.contracts.get",
|
|
86
|
+
options: [CONTRACTS_ADDRESS_OPTION],
|
|
87
|
+
segments: ["contracts-registry", "contracts", "get"],
|
|
88
|
+
summary: "Get a smart contract by address",
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
{
|
|
92
|
+
args: [],
|
|
93
|
+
group: "Contracts Registry",
|
|
94
|
+
async handler(_args, opts, config) {
|
|
95
|
+
const client = getClient(config);
|
|
96
|
+
const result = await client.GET("/contracts-registry/templates", {
|
|
97
|
+
params: {
|
|
98
|
+
query: q({
|
|
99
|
+
contractAddress: templatesContractAddress(opts),
|
|
100
|
+
"page[after]": opts["pageAfter"]
|
|
101
|
+
? Number(opts["pageAfter"])
|
|
102
|
+
: undefined,
|
|
103
|
+
"page[size]": opts["pageSize"]
|
|
104
|
+
? Number(opts["pageSize"])
|
|
105
|
+
: undefined,
|
|
106
|
+
}),
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
return unwrap(result);
|
|
110
|
+
},
|
|
111
|
+
id: "contracts-registry.templates.list",
|
|
112
|
+
options: [...PAGINATION_OPTIONS, TEMPLATES_ADDRESS_OPTION],
|
|
113
|
+
segments: ["contracts-registry", "templates", "list"],
|
|
114
|
+
summary: "List contract templates",
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
{
|
|
118
|
+
args: [
|
|
119
|
+
{
|
|
120
|
+
description: "Template ID",
|
|
121
|
+
example: "0x1234...",
|
|
122
|
+
name: "id",
|
|
123
|
+
required: true,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
group: "Contracts Registry",
|
|
127
|
+
async handler(args, opts, config) {
|
|
128
|
+
const client = getClient(config);
|
|
129
|
+
const result = await client.GET("/contracts-registry/templates/{id}", {
|
|
130
|
+
params: {
|
|
131
|
+
path: { id: requiredArg(args, "id") },
|
|
132
|
+
query: q({ contractAddress: templatesContractAddress(opts) }),
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
return unwrap(result);
|
|
136
|
+
},
|
|
137
|
+
id: "contracts-registry.templates.get",
|
|
138
|
+
options: [TEMPLATES_ADDRESS_OPTION],
|
|
139
|
+
segments: ["contracts-registry", "templates", "get"],
|
|
140
|
+
summary: "Get a contract template by ID",
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
{
|
|
144
|
+
args: [],
|
|
145
|
+
group: "Contracts Registry",
|
|
146
|
+
async handler(_args, _opts, config) {
|
|
147
|
+
const client = getClient(config);
|
|
148
|
+
const result = await client.GET("/contracts-registry/abi");
|
|
149
|
+
return unwrap(result);
|
|
150
|
+
},
|
|
151
|
+
id: "contracts-registry.abi",
|
|
152
|
+
options: [],
|
|
153
|
+
segments: ["contracts-registry", "abi"],
|
|
154
|
+
summary: "Get the ABI of the Contracts Registry smart contract",
|
|
155
|
+
},
|
|
156
|
+
];
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { CommandDescriptor } from "./registry.ts";
|
|
2
|
+
|
|
3
|
+
import { getClient, unwrap } from "../api/fetch.ts";
|
|
4
|
+
import { q } from "../api/params.ts";
|
|
5
|
+
import { contractAddressOptionFor } from "../ledger/registries.ts";
|
|
6
|
+
import { requiredArg } from "./shared/args.ts";
|
|
7
|
+
|
|
8
|
+
const PAGINATION_OPTIONS = [
|
|
9
|
+
{
|
|
10
|
+
description: "Cursor for pagination (page[after])",
|
|
11
|
+
flags: "--page-after <cursor>",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
description: "Maximum number of items per page (page[size])",
|
|
15
|
+
flags: "--page-size <n>",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const { option: CONTRACT_ADDRESS_OPTION, resolve: contractAddress } =
|
|
20
|
+
contractAddressOptionFor("did-registry");
|
|
21
|
+
|
|
22
|
+
export const didRegistryCommands: CommandDescriptor[] = [
|
|
23
|
+
{
|
|
24
|
+
args: [],
|
|
25
|
+
group: "DID Registry",
|
|
26
|
+
async handler(_args, opts, config) {
|
|
27
|
+
const client = getClient(config);
|
|
28
|
+
const result = await client.GET("/did-registry/identifiers", {
|
|
29
|
+
params: {
|
|
30
|
+
query: q({
|
|
31
|
+
contractAddress: contractAddress(opts),
|
|
32
|
+
controller: opts["controller"],
|
|
33
|
+
"page[after]": opts["pageAfter"]
|
|
34
|
+
? Number(opts["pageAfter"])
|
|
35
|
+
: undefined,
|
|
36
|
+
"page[size]": opts["pageSize"]
|
|
37
|
+
? Number(opts["pageSize"])
|
|
38
|
+
: undefined,
|
|
39
|
+
"verification-method-id": opts["verificationMethodId"],
|
|
40
|
+
"verification-relationship": opts["verificationRelationship"] as
|
|
41
|
+
| "assertionMethod"
|
|
42
|
+
| "authentication"
|
|
43
|
+
| "capabilityDelegation"
|
|
44
|
+
| "capabilityInvocation"
|
|
45
|
+
| "keyAgreement"
|
|
46
|
+
| undefined,
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return unwrap(result);
|
|
51
|
+
},
|
|
52
|
+
id: "did-registry.identifiers.list",
|
|
53
|
+
options: [
|
|
54
|
+
...PAGINATION_OPTIONS,
|
|
55
|
+
CONTRACT_ADDRESS_OPTION,
|
|
56
|
+
{
|
|
57
|
+
description: "Filter by controller DID",
|
|
58
|
+
flags: "--controller <did>",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
description:
|
|
62
|
+
"Filter by verification method id (e.g. did:ebsi:z...#key-1)",
|
|
63
|
+
flags: "--verification-method-id <id>",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
description:
|
|
67
|
+
"Filter by verification relationship " +
|
|
68
|
+
"(authentication, assertionMethod, keyAgreement, capabilityInvocation, capabilityDelegation)",
|
|
69
|
+
flags: "--verification-relationship <rel>",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
segments: ["did-registry", "identifiers", "list"],
|
|
73
|
+
summary:
|
|
74
|
+
"List all EBSI DIDs. Supports pagination and filtering by controller.",
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
{
|
|
78
|
+
args: [
|
|
79
|
+
{
|
|
80
|
+
description: "The DID to resolve (e.g. did:ebsi:ziDnioxYYLW1a3FDD...)",
|
|
81
|
+
example: "did:ebsi:ziDnioxYYLW1a3FDD",
|
|
82
|
+
name: "did",
|
|
83
|
+
required: true,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
group: "DID Registry",
|
|
87
|
+
async handler(args, opts, config) {
|
|
88
|
+
const client = getClient(config);
|
|
89
|
+
const did = requiredArg(args, "did");
|
|
90
|
+
const result = await client.GET("/did-registry/identifiers/{did}", {
|
|
91
|
+
params: {
|
|
92
|
+
path: { did },
|
|
93
|
+
query: q({
|
|
94
|
+
contractAddress: contractAddress(opts),
|
|
95
|
+
"valid-at": opts["validAt"],
|
|
96
|
+
}),
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
return unwrap(result);
|
|
100
|
+
},
|
|
101
|
+
id: "did-registry.identifiers.get",
|
|
102
|
+
options: [
|
|
103
|
+
CONTRACT_ADDRESS_OPTION,
|
|
104
|
+
{
|
|
105
|
+
description: "Retrieve DID document as of this ISO-8601 date",
|
|
106
|
+
flags: "--valid-at <date>",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
segments: ["did-registry", "identifiers", "get"],
|
|
110
|
+
summary: "Resolve a DID document by DID",
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
args: [],
|
|
115
|
+
group: "DID Registry",
|
|
116
|
+
async handler(_args, _opts, config) {
|
|
117
|
+
const client = getClient(config);
|
|
118
|
+
const result = await client.GET("/did-registry/abi");
|
|
119
|
+
return unwrap(result);
|
|
120
|
+
},
|
|
121
|
+
id: "did-registry.abi",
|
|
122
|
+
options: [],
|
|
123
|
+
segments: ["did-registry", "abi"],
|
|
124
|
+
summary: "Get the ABI of the DID Registry smart contract",
|
|
125
|
+
},
|
|
126
|
+
];
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
|
|
3
|
+
import type { CommandDescriptor } from "./registry.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hardhat's first pre-funded development account, derived from its default
|
|
7
|
+
* "test test … junk" mnemonic. Published in Hardhat's own documentation and
|
|
8
|
+
* identical on every local node, so it is a convenience default, never a
|
|
9
|
+
* secret — which is also why it is only ever useful against a local chain.
|
|
10
|
+
*/
|
|
11
|
+
const HARDHAT_ACCOUNT_2_PRIVATE_KEY =
|
|
12
|
+
"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Default JSON-RPC endpoint, matching `LOCAL_HARDHAT_NETWORK_URL` in
|
|
16
|
+
* `contracts/deploy-toolkit/.env.example`.
|
|
17
|
+
*
|
|
18
|
+
* Unlike every other command, the faucet talks to the node directly rather
|
|
19
|
+
* than through the API's `/ledger` proxy: that proxy requires a Bearer token,
|
|
20
|
+
* and funding an account is usually the step that comes *before* it can
|
|
21
|
+
* obtain one.
|
|
22
|
+
*/
|
|
23
|
+
const DEFAULT_RPC_URL = "http://127.0.0.1:8545";
|
|
24
|
+
|
|
25
|
+
const DEFAULT_AMOUNT_IN_ETH = "1";
|
|
26
|
+
|
|
27
|
+
export const faucetCommands: CommandDescriptor[] = [
|
|
28
|
+
{
|
|
29
|
+
args: [
|
|
30
|
+
{
|
|
31
|
+
description: "Address to fund (0x-prefixed).",
|
|
32
|
+
example: "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
|
|
33
|
+
name: "to",
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
group: "Faucet",
|
|
38
|
+
async handler(args, opts) {
|
|
39
|
+
const to = args["to"] ?? "";
|
|
40
|
+
if (!ethers.isAddress(to)) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Invalid "to" address: ${to === "" ? "(missing)" : to}. ` +
|
|
43
|
+
"Expected a 0x-prefixed 20-byte Ethereum address.",
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const amountInEth = opts["amountInEth"] ?? DEFAULT_AMOUNT_IN_ETH;
|
|
48
|
+
let value: bigint;
|
|
49
|
+
try {
|
|
50
|
+
value = ethers.parseEther(amountInEth);
|
|
51
|
+
} catch {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Invalid --amount-in-eth value: ${amountInEth}. Expected a decimal amount of ETH, e.g. "0.5".`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (value <= 0n) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`Invalid --amount-in-eth value: ${amountInEth}. Expected a positive amount.`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const rpcUrl = opts["rpcUrl"] ?? DEFAULT_RPC_URL;
|
|
63
|
+
const provider = new ethers.JsonRpcProvider(rpcUrl);
|
|
64
|
+
const privateKey = opts["privateKey"] ?? HARDHAT_ACCOUNT_2_PRIVATE_KEY;
|
|
65
|
+
let funder: ethers.Wallet;
|
|
66
|
+
try {
|
|
67
|
+
funder = new ethers.Wallet(privateKey, provider);
|
|
68
|
+
} catch {
|
|
69
|
+
throw new Error(
|
|
70
|
+
"Invalid --private-key: expected a 0x-prefixed secp256k1 private key hex.",
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const transaction = await funder.sendTransaction({ to, value });
|
|
75
|
+
const receipt = await transaction.wait();
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
amountInEth: ethers.formatEther(value),
|
|
79
|
+
blockNumber: receipt?.blockNumber ?? undefined,
|
|
80
|
+
from: funder.address,
|
|
81
|
+
hash: transaction.hash,
|
|
82
|
+
newBalanceInEth: ethers.formatEther(await provider.getBalance(to)),
|
|
83
|
+
to,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
id: "faucet",
|
|
87
|
+
options: [
|
|
88
|
+
{
|
|
89
|
+
description:
|
|
90
|
+
"Private key funding the transfer (0x-prefixed hex). " +
|
|
91
|
+
"Defaults to Hardhat's pre-funded account #0.",
|
|
92
|
+
flags: "--private-key <hex>",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
defaultValue: DEFAULT_AMOUNT_IN_ETH,
|
|
96
|
+
description: 'Amount of ETH to send, e.g. "0.5".',
|
|
97
|
+
flags: "--amount-in-eth <eth>",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
defaultValue: DEFAULT_RPC_URL,
|
|
101
|
+
description:
|
|
102
|
+
"JSON-RPC endpoint of the node to send the transfer to. " +
|
|
103
|
+
"The faucet bypasses the API's /ledger proxy, so this is a node URL, not an API base URL.",
|
|
104
|
+
flags: "--rpc-url <url>",
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
segments: ["faucet"],
|
|
108
|
+
summary:
|
|
109
|
+
"Fund an address with ETH from a local development chain. " +
|
|
110
|
+
"Defaults to sending 1 ETH from Hardhat's account #0 via http://127.0.0.1:8545.",
|
|
111
|
+
},
|
|
112
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CommandDescriptor } from "./registry.ts";
|
|
2
|
+
|
|
3
|
+
export const healthCommands: CommandDescriptor[] = [
|
|
4
|
+
{
|
|
5
|
+
args: [],
|
|
6
|
+
group: "Health",
|
|
7
|
+
async handler(_args, _opts, config) {
|
|
8
|
+
const response = await fetch(`${config.baseUrl}/health`, {
|
|
9
|
+
headers: { Accept: "application/json" },
|
|
10
|
+
});
|
|
11
|
+
if (!response.ok) {
|
|
12
|
+
throw new Error(`Health check failed: HTTP ${String(response.status)}`);
|
|
13
|
+
}
|
|
14
|
+
return response.json();
|
|
15
|
+
},
|
|
16
|
+
id: "health.check",
|
|
17
|
+
options: [],
|
|
18
|
+
segments: ["health"],
|
|
19
|
+
summary: "Check the health of the EBSI API and its blockchain node",
|
|
20
|
+
},
|
|
21
|
+
];
|