@hsuite/native-connect-angular 2.1.1 → 2.1.3
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 +146 -0
- package/dist/fesm2022/hsuite-native-connect-angular.mjs +321 -619
- package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -1
- package/dist/index.d.ts +5 -235
- package/package.json +37 -15
- package/USAGE_EXAMPLES.md +0 -476
- package/assets/wallets/extension.svg +0 -7
- package/assets/wallets/hashpack.svg +0 -6
- package/assets/wallets/hsuite.svg +0 -11
- package/assets/wallets/kabila.svg +0 -11
- package/assets/wallets/walletconnect.svg +0 -13
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/coverage-summary.json +0 -54
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -476
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -476
- package/coverage/lcov-report/lib/components/account-selector/account-actions/account-actions.component.ts.html +0 -868
- package/coverage/lcov-report/lib/components/account-selector/account-actions/index.html +0 -116
- package/coverage/lcov-report/lib/components/account-selector/account-filter/account-filter.component.ts.html +0 -1288
- package/coverage/lcov-report/lib/components/account-selector/account-filter/index.html +0 -116
- package/coverage/lcov-report/lib/components/account-selector/account-formatting.service.ts.html +0 -679
- package/coverage/lcov-report/lib/components/account-selector/account-grouping.service.ts.html +0 -766
- package/coverage/lcov-report/lib/components/account-selector/account-list/account-list.component.ts.html +0 -1495
- package/coverage/lcov-report/lib/components/account-selector/account-list/index.html +0 -116
- package/coverage/lcov-report/lib/components/account-selector/account-selector.component.ts.html +0 -1495
- package/coverage/lcov-report/lib/components/account-selector/account-selector.service.ts.html +0 -1588
- package/coverage/lcov-report/lib/components/account-selector/index.html +0 -161
- package/coverage/lcov-report/lib/components/wallet-account-display/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-account-display/wallet-account-display.component.ts.html +0 -505
- package/coverage/lcov-report/lib/components/wallet-connect-button/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +0 -829
- package/coverage/lcov-report/lib/components/wallet-connect-prompt/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +0 -409
- package/coverage/lcov-report/lib/components/wallet-connected-guard/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +0 -304
- package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +0 -436
- package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-connection-modal/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +0 -2287
- package/coverage/lcov-report/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +0 -2518
- package/coverage/lcov-report/lib/components/wallet-session-display/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-session-display/wallet-session-display.component.ts.html +0 -676
- package/coverage/lcov-report/lib/components/wallet-transaction-status/index.html +0 -116
- package/coverage/lcov-report/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +0 -703
- package/coverage/lcov-report/lib/directives/index.html +0 -146
- package/coverage/lcov-report/lib/directives/wallet-connected.directive.ts.html +0 -670
- package/coverage/lcov-report/lib/directives/wallet-context.directive.ts.html +0 -547
- package/coverage/lcov-report/lib/directives/wallet-events.directive.ts.html +0 -781
- package/coverage/lcov-report/lib/hsuite-wallet.module.ts.html +0 -715
- package/coverage/lcov-report/lib/index.html +0 -116
- package/coverage/lcov-report/lib/models/connection-config.model.ts.html +0 -280
- package/coverage/lcov-report/lib/models/index.html +0 -131
- package/coverage/lcov-report/lib/models/provider-types.ts.html +0 -583
- package/coverage/lcov-report/lib/providers/base-wallet-provider.ts.html +0 -1138
- package/coverage/lcov-report/lib/providers/hsuite-native/channel-client.service.ts.html +0 -2674
- package/coverage/lcov-report/lib/providers/hsuite-native/index.html +0 -116
- package/coverage/lcov-report/lib/providers/hsuite-native-provider.ts.html +0 -2347
- package/coverage/lcov-report/lib/providers/index.html +0 -146
- package/coverage/lcov-report/lib/providers/p2p-native/index.html +0 -131
- package/coverage/lcov-report/lib/providers/p2p-native/p2p-native.provider.ts.html +0 -2254
- package/coverage/lcov-report/lib/providers/p2p-native/p2p-session-manager.ts.html +0 -2173
- package/coverage/lcov-report/lib/providers/wallet-error-handler.ts.html +0 -1132
- package/coverage/lcov-report/lib/providers/walletconnect/core/index.html +0 -176
- package/coverage/lcov-report/lib/providers/walletconnect/core/session-health.ts.html +0 -673
- package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +0 -1177
- package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-provider.ts.html +0 -2566
- package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +0 -904
- package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +0 -982
- package/coverage/lcov-report/lib/providers/walletconnect/signers/hedera-signer.ts.html +0 -1915
- package/coverage/lcov-report/lib/providers/walletconnect/signers/index.html +0 -146
- package/coverage/lcov-report/lib/providers/walletconnect/signers/signer-factory.ts.html +0 -445
- package/coverage/lcov-report/lib/providers/walletconnect/signers/xrpl-signer.ts.html +0 -1519
- package/coverage/lcov-report/lib/services/hsuite-auth.interceptor.ts.html +0 -568
- package/coverage/lcov-report/lib/services/index.html +0 -221
- package/coverage/lcov-report/lib/services/logger.service.ts.html +0 -463
- package/coverage/lcov-report/lib/services/smart-session.service.ts.html +0 -1264
- package/coverage/lcov-report/lib/services/transaction-builders/active-account-source.ts.html +0 -250
- package/coverage/lcov-report/lib/services/transaction-builders/base-transaction-builder.service.ts.html +0 -1840
- package/coverage/lcov-report/lib/services/transaction-builders/hedera-amount-utils.ts.html +0 -337
- package/coverage/lcov-report/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +0 -3940
- package/coverage/lcov-report/lib/services/transaction-builders/index.html +0 -176
- package/coverage/lcov-report/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +0 -2581
- package/coverage/lcov-report/lib/services/transaction.service.ts.html +0 -1120
- package/coverage/lcov-report/lib/services/unified-wallet.service.ts.html +0 -2638
- package/coverage/lcov-report/lib/services/wallet-context.service.ts.html +0 -637
- package/coverage/lcov-report/lib/services/wallet-event-bus.service.ts.html +0 -643
- package/coverage/lcov-report/lib/services/wallet-providers.service.ts.html +0 -493
- package/coverage/lcov-report/lib/transports/chrome-extension-transport.ts.html +0 -823
- package/coverage/lcov-report/lib/transports/index.html +0 -116
- package/coverage/lcov-report/lib/utils/index.html +0 -131
- package/coverage/lcov-report/lib/utils/ledger-icons.util.ts.html +0 -412
- package/coverage/lcov-report/lib/utils/ledger-ui-registry.ts.html +0 -676
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -20366
- package/coverage/lib/components/account-selector/account-actions/account-actions.component.ts.html +0 -868
- package/coverage/lib/components/account-selector/account-actions/index.html +0 -116
- package/coverage/lib/components/account-selector/account-filter/account-filter.component.ts.html +0 -1288
- package/coverage/lib/components/account-selector/account-filter/index.html +0 -116
- package/coverage/lib/components/account-selector/account-formatting.service.ts.html +0 -679
- package/coverage/lib/components/account-selector/account-grouping.service.ts.html +0 -766
- package/coverage/lib/components/account-selector/account-list/account-list.component.ts.html +0 -1495
- package/coverage/lib/components/account-selector/account-list/index.html +0 -116
- package/coverage/lib/components/account-selector/account-selector.component.ts.html +0 -1495
- package/coverage/lib/components/account-selector/account-selector.service.ts.html +0 -1588
- package/coverage/lib/components/account-selector/index.html +0 -161
- package/coverage/lib/components/wallet-account-display/index.html +0 -116
- package/coverage/lib/components/wallet-account-display/wallet-account-display.component.ts.html +0 -505
- package/coverage/lib/components/wallet-connect-button/index.html +0 -116
- package/coverage/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +0 -829
- package/coverage/lib/components/wallet-connect-prompt/index.html +0 -116
- package/coverage/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +0 -409
- package/coverage/lib/components/wallet-connected-guard/index.html +0 -116
- package/coverage/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +0 -304
- package/coverage/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +0 -436
- package/coverage/lib/components/wallet-connection-modal/connection-method-step/index.html +0 -116
- package/coverage/lib/components/wallet-connection-modal/index.html +0 -116
- package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/index.html +0 -116
- package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +0 -2287
- package/coverage/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +0 -2518
- package/coverage/lib/components/wallet-session-display/index.html +0 -116
- package/coverage/lib/components/wallet-session-display/wallet-session-display.component.ts.html +0 -676
- package/coverage/lib/components/wallet-transaction-status/index.html +0 -116
- package/coverage/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +0 -703
- package/coverage/lib/directives/index.html +0 -146
- package/coverage/lib/directives/wallet-connected.directive.ts.html +0 -670
- package/coverage/lib/directives/wallet-context.directive.ts.html +0 -547
- package/coverage/lib/directives/wallet-events.directive.ts.html +0 -781
- package/coverage/lib/hsuite-wallet.module.ts.html +0 -715
- package/coverage/lib/index.html +0 -116
- package/coverage/lib/models/connection-config.model.ts.html +0 -280
- package/coverage/lib/models/index.html +0 -131
- package/coverage/lib/models/provider-types.ts.html +0 -583
- package/coverage/lib/providers/base-wallet-provider.ts.html +0 -1138
- package/coverage/lib/providers/hsuite-native/channel-client.service.ts.html +0 -2674
- package/coverage/lib/providers/hsuite-native/index.html +0 -116
- package/coverage/lib/providers/hsuite-native-provider.ts.html +0 -2347
- package/coverage/lib/providers/index.html +0 -146
- package/coverage/lib/providers/p2p-native/index.html +0 -131
- package/coverage/lib/providers/p2p-native/p2p-native.provider.ts.html +0 -2254
- package/coverage/lib/providers/p2p-native/p2p-session-manager.ts.html +0 -2173
- package/coverage/lib/providers/wallet-error-handler.ts.html +0 -1132
- package/coverage/lib/providers/walletconnect/core/index.html +0 -176
- package/coverage/lib/providers/walletconnect/core/session-health.ts.html +0 -673
- package/coverage/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +0 -1177
- package/coverage/lib/providers/walletconnect/core/walletconnect-provider.ts.html +0 -2566
- package/coverage/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +0 -904
- package/coverage/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +0 -982
- package/coverage/lib/providers/walletconnect/signers/hedera-signer.ts.html +0 -1915
- package/coverage/lib/providers/walletconnect/signers/index.html +0 -146
- package/coverage/lib/providers/walletconnect/signers/signer-factory.ts.html +0 -445
- package/coverage/lib/providers/walletconnect/signers/xrpl-signer.ts.html +0 -1519
- package/coverage/lib/services/hsuite-auth.interceptor.ts.html +0 -568
- package/coverage/lib/services/index.html +0 -221
- package/coverage/lib/services/logger.service.ts.html +0 -463
- package/coverage/lib/services/smart-session.service.ts.html +0 -1264
- package/coverage/lib/services/transaction-builders/active-account-source.ts.html +0 -250
- package/coverage/lib/services/transaction-builders/base-transaction-builder.service.ts.html +0 -1840
- package/coverage/lib/services/transaction-builders/hedera-amount-utils.ts.html +0 -337
- package/coverage/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +0 -3940
- package/coverage/lib/services/transaction-builders/index.html +0 -176
- package/coverage/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +0 -2581
- package/coverage/lib/services/transaction.service.ts.html +0 -1120
- package/coverage/lib/services/unified-wallet.service.ts.html +0 -2638
- package/coverage/lib/services/wallet-context.service.ts.html +0 -637
- package/coverage/lib/services/wallet-event-bus.service.ts.html +0 -643
- package/coverage/lib/services/wallet-providers.service.ts.html +0 -493
- package/coverage/lib/transports/chrome-extension-transport.ts.html +0 -823
- package/coverage/lib/transports/index.html +0 -116
- package/coverage/lib/utils/index.html +0 -131
- package/coverage/lib/utils/ledger-icons.util.ts.html +0 -412
- package/coverage/lib/utils/ledger-ui-registry.ts.html +0 -676
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/examples/minimal-connect.ts +0 -178
- package/examples/multi-protocol.ts +0 -495
- package/examples/transaction-signing.ts +0 -361
- package/jest.config.json +0 -45
- package/karma.conf.js +0 -42
- package/ng-package.json +0 -20
- package/src/index.ts +0 -229
- package/src/lib/components/account-selector/account-actions/account-actions.component.ts +0 -261
- package/src/lib/components/account-selector/account-filter/account-filter.component.ts +0 -401
- package/src/lib/components/account-selector/account-formatting.service.ts +0 -198
- package/src/lib/components/account-selector/account-grouping.service.ts +0 -227
- package/src/lib/components/account-selector/account-list/account-list.component.ts +0 -470
- package/src/lib/components/account-selector/account-selector.component.html +0 -135
- package/src/lib/components/account-selector/account-selector.component.scss +0 -2039
- package/src/lib/components/account-selector/account-selector.component.ts +0 -470
- package/src/lib/components/account-selector/account-selector.service.ts +0 -501
- package/src/lib/components/wallet-account-display/wallet-account-display.component.html +0 -34
- package/src/lib/components/wallet-account-display/wallet-account-display.component.scss +0 -99
- package/src/lib/components/wallet-account-display/wallet-account-display.component.ts +0 -140
- package/src/lib/components/wallet-connect-button/wallet-connect-button.component.html +0 -14
- package/src/lib/components/wallet-connect-button/wallet-connect-button.component.scss +0 -272
- package/src/lib/components/wallet-connect-button/wallet-connect-button.component.spec.ts +0 -89
- package/src/lib/components/wallet-connect-button/wallet-connect-button.component.ts +0 -248
- package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.html +0 -24
- package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.scss +0 -50
- package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts +0 -108
- package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.html +0 -24
- package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts +0 -73
- package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.html +0 -56
- package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.scss +0 -218
- package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts +0 -117
- package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.html +0 -94
- package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.scss +0 -272
- package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts +0 -734
- package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.html +0 -192
- package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.scss +0 -678
- package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.spec.ts +0 -173
- package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts +0 -811
- package/src/lib/components/wallet-session-display/wallet-session-display.component.html +0 -110
- package/src/lib/components/wallet-session-display/wallet-session-display.component.scss +0 -179
- package/src/lib/components/wallet-session-display/wallet-session-display.component.ts +0 -197
- package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.html +0 -65
- package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.scss +0 -254
- package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts +0 -206
- package/src/lib/directives/wallet-connected.directive.ts +0 -195
- package/src/lib/directives/wallet-context.directive.ts +0 -154
- package/src/lib/directives/wallet-events.directive.ts +0 -232
- package/src/lib/hsuite-wallet.module.ts +0 -210
- package/src/lib/models/connection-config.model.ts +0 -65
- package/src/lib/models/provider-types.ts +0 -166
- package/src/lib/models/unified-account.model.ts +0 -79
- package/src/lib/models/wallet-context.model.ts +0 -121
- package/src/lib/models/wallet-events.model.ts +0 -158
- package/src/lib/providers/base-wallet-provider.ts +0 -351
- package/src/lib/providers/hsuite-native/channel-client.service.spec.ts +0 -73
- package/src/lib/providers/hsuite-native/channel-client.service.ts +0 -863
- package/src/lib/providers/hsuite-native/index.ts +0 -8
- package/src/lib/providers/hsuite-native-provider.ts +0 -754
- package/src/lib/providers/mobile-native/mobile-native.provider.spec.ts +0 -19
- package/src/lib/providers/p2p-native/index.ts +0 -30
- package/src/lib/providers/p2p-native/p2p-native.provider.spec.ts +0 -523
- package/src/lib/providers/p2p-native/p2p-native.provider.ts +0 -723
- package/src/lib/providers/p2p-native/p2p-session-manager.ts +0 -696
- package/src/lib/providers/wallet-error-handler.ts +0 -349
- package/src/lib/providers/walletconnect/core/base-signer.interface.ts +0 -122
- package/src/lib/providers/walletconnect/core/session-health.ts +0 -196
- package/src/lib/providers/walletconnect/core/walletconnect-client-manager.ts +0 -364
- package/src/lib/providers/walletconnect/core/walletconnect-provider.integration.spec.ts +0 -348
- package/src/lib/providers/walletconnect/core/walletconnect-provider.ts +0 -827
- package/src/lib/providers/walletconnect/core/walletconnect-session-store.ts +0 -273
- package/src/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts +0 -299
- package/src/lib/providers/walletconnect/core/walletconnect-types.ts +0 -48
- package/src/lib/providers/walletconnect/index.ts +0 -33
- package/src/lib/providers/walletconnect/signers/hedera-signer.spec.ts +0 -367
- package/src/lib/providers/walletconnect/signers/hedera-signer.ts +0 -610
- package/src/lib/providers/walletconnect/signers/signer-factory.spec.ts +0 -62
- package/src/lib/providers/walletconnect/signers/signer-factory.ts +0 -120
- package/src/lib/providers/walletconnect/signers/xrpl-signer.spec.ts +0 -296
- package/src/lib/providers/walletconnect/signers/xrpl-signer.ts +0 -478
- package/src/lib/services/hsuite-auth.interceptor.ts +0 -159
- package/src/lib/services/logger.service.ts +0 -126
- package/src/lib/services/smart-session.service.ts +0 -378
- package/src/lib/services/transaction-builders/active-account-source.spec.ts +0 -75
- package/src/lib/services/transaction-builders/active-account-source.ts +0 -55
- package/src/lib/services/transaction-builders/base-transaction-builder.service.ts +0 -585
- package/src/lib/services/transaction-builders/hedera-amount-utils.ts +0 -84
- package/src/lib/services/transaction-builders/hedera-transaction-builder.service.spec.ts +0 -741
- package/src/lib/services/transaction-builders/hedera-transaction-builder.service.ts +0 -1285
- package/src/lib/services/transaction-builders/index.ts +0 -55
- package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.spec.ts +0 -937
- package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.ts +0 -832
- package/src/lib/services/transaction.service.ts +0 -349
- package/src/lib/services/unified-wallet.service.spec.ts +0 -1382
- package/src/lib/services/unified-wallet.service.ts +0 -851
- package/src/lib/services/wallet-context.service.ts +0 -184
- package/src/lib/services/wallet-event-bus.service.ts +0 -186
- package/src/lib/services/wallet-providers.service.ts +0 -136
- package/src/lib/transports/chrome-extension-transport.ts +0 -246
- package/src/lib/utils/index.ts +0 -15
- package/src/lib/utils/ledger-icons.util.ts +0 -109
- package/src/lib/utils/ledger-ui-registry.ts +0 -197
- package/test/test-setup.ts +0 -21
- package/test-setup.ts +0 -63
- package/tsconfig.build.json +0 -11
- package/tsconfig.json +0 -29
- package/tsconfig.spec.json +0 -15
- package/vitest.config.ts +0 -48
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file multi-protocol.ts
|
|
3
|
-
* @description Example of using both HSuite Native and WalletConnect protocols
|
|
4
|
-
*
|
|
5
|
-
* This example demonstrates:
|
|
6
|
-
* - Connecting via HSuite Native protocol (direct, fast)
|
|
7
|
-
* - Connecting via WalletConnect v2 (QR code, interoperable)
|
|
8
|
-
* - Unified account management across protocols
|
|
9
|
-
* - Switching between connected providers
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Component, inject, signal } from '@angular/core';
|
|
13
|
-
import { UnifiedWalletService, WalletEventBus } from '@hsuite/native-connect-angular';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Connection method selection
|
|
17
|
-
*/
|
|
18
|
-
type ConnectionMethod = 'native' | 'walletconnect' | null;
|
|
19
|
-
|
|
20
|
-
@Component({
|
|
21
|
-
selector: 'app-multi-protocol',
|
|
22
|
-
template: `
|
|
23
|
-
<div class="protocol-demo">
|
|
24
|
-
<h2>Connect to Hedera Wallet</h2>
|
|
25
|
-
|
|
26
|
-
<!-- Connection Method Selector -->
|
|
27
|
-
@if (!isConnected()) {
|
|
28
|
-
<div class="connection-options">
|
|
29
|
-
<h3>Choose Connection Method</h3>
|
|
30
|
-
|
|
31
|
-
<!-- HSuite Native Option -->
|
|
32
|
-
<button
|
|
33
|
-
class="connection-option"
|
|
34
|
-
[class.selected]="selectedMethod() === 'native'"
|
|
35
|
-
(click)="selectMethod('native')"
|
|
36
|
-
>
|
|
37
|
-
<div class="option-icon">🔗</div>
|
|
38
|
-
<div class="option-info">
|
|
39
|
-
<h4>HSuite Native</h4>
|
|
40
|
-
<p>Direct connection to HSuite Wallet</p>
|
|
41
|
-
<ul>
|
|
42
|
-
<li>✓ Fastest connection</li>
|
|
43
|
-
<li>✓ No QR code needed</li>
|
|
44
|
-
<li>✓ Browser extension support</li>
|
|
45
|
-
</ul>
|
|
46
|
-
</div>
|
|
47
|
-
</button>
|
|
48
|
-
|
|
49
|
-
<!-- WalletConnect Option -->
|
|
50
|
-
<button
|
|
51
|
-
class="connection-option"
|
|
52
|
-
[class.selected]="selectedMethod() === 'walletconnect'"
|
|
53
|
-
(click)="selectMethod('walletconnect')"
|
|
54
|
-
>
|
|
55
|
-
<div class="option-icon">📱</div>
|
|
56
|
-
<div class="option-info">
|
|
57
|
-
<h4>WalletConnect</h4>
|
|
58
|
-
<p>Connect with any WalletConnect wallet</p>
|
|
59
|
-
<ul>
|
|
60
|
-
<li>✓ Mobile wallet support</li>
|
|
61
|
-
<li>✓ HashPack, Blade, etc.</li>
|
|
62
|
-
<li>✓ QR code pairing</li>
|
|
63
|
-
</ul>
|
|
64
|
-
</div>
|
|
65
|
-
</button>
|
|
66
|
-
|
|
67
|
-
<!-- Connect Button -->
|
|
68
|
-
@if (selectedMethod()) {
|
|
69
|
-
<div class="connect-action">
|
|
70
|
-
<button class="primary" (click)="connect()" [disabled]="isConnecting()">
|
|
71
|
-
@if (isConnecting()) {
|
|
72
|
-
Connecting...
|
|
73
|
-
} @else {
|
|
74
|
-
Connect with
|
|
75
|
-
{{ selectedMethod() === 'native' ? 'HSuite Wallet' : 'WalletConnect' }}
|
|
76
|
-
}
|
|
77
|
-
</button>
|
|
78
|
-
</div>
|
|
79
|
-
}
|
|
80
|
-
</div>
|
|
81
|
-
} @else {
|
|
82
|
-
<!-- Connected State -->
|
|
83
|
-
<div class="connected-state">
|
|
84
|
-
<div class="connection-badge">
|
|
85
|
-
<span class="protocol-badge">
|
|
86
|
-
{{ activeProvider() }}
|
|
87
|
-
</span>
|
|
88
|
-
Connected
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<!-- Active Account -->
|
|
92
|
-
<div class="account-card">
|
|
93
|
-
<h4>Active Account</h4>
|
|
94
|
-
<p class="address">{{ activeAccount()?.address }}</p>
|
|
95
|
-
<p class="network">{{ activeAccount()?.networkId }}</p>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<!-- Account Switcher (if multiple accounts) -->
|
|
99
|
-
@if (allAccounts().length > 1) {
|
|
100
|
-
<div class="account-switcher">
|
|
101
|
-
<h4>Switch Account</h4>
|
|
102
|
-
@for (account of allAccounts(); track account.address) {
|
|
103
|
-
<button
|
|
104
|
-
class="account-option"
|
|
105
|
-
[class.active]="account.address === activeAccount()?.address"
|
|
106
|
-
(click)="switchAccount(account.address)"
|
|
107
|
-
>
|
|
108
|
-
{{ account.address }}
|
|
109
|
-
</button>
|
|
110
|
-
}
|
|
111
|
-
</div>
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
<!-- Multiple Providers -->
|
|
115
|
-
@if (connectedProviders().length > 1) {
|
|
116
|
-
<div class="provider-switcher">
|
|
117
|
-
<h4>Connected Providers</h4>
|
|
118
|
-
@for (provider of connectedProviders(); track provider) {
|
|
119
|
-
<span class="provider-tag">{{ provider }}</span>
|
|
120
|
-
}
|
|
121
|
-
</div>
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
<button class="disconnect" (click)="disconnect()">Disconnect</button>
|
|
125
|
-
</div>
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
<!-- Events Log -->
|
|
129
|
-
<div class="events-log">
|
|
130
|
-
<h3>Recent Events</h3>
|
|
131
|
-
@for (event of recentEvents(); track $index) {
|
|
132
|
-
<div class="event-item">
|
|
133
|
-
<span class="event-type">{{ event.type }}</span>
|
|
134
|
-
<span class="event-time">{{ event.time }}</span>
|
|
135
|
-
</div>
|
|
136
|
-
} @empty {
|
|
137
|
-
<p class="no-events">No events yet</p>
|
|
138
|
-
}
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
`,
|
|
142
|
-
styles: [
|
|
143
|
-
`
|
|
144
|
-
.protocol-demo {
|
|
145
|
-
padding: 20px;
|
|
146
|
-
max-width: 600px;
|
|
147
|
-
margin: 0 auto;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.connection-options {
|
|
151
|
-
margin-top: 20px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.connection-option {
|
|
155
|
-
display: flex;
|
|
156
|
-
align-items: flex-start;
|
|
157
|
-
gap: 16px;
|
|
158
|
-
width: 100%;
|
|
159
|
-
padding: 16px;
|
|
160
|
-
margin-bottom: 12px;
|
|
161
|
-
background: var(--ion-color-light, #f4f4f4);
|
|
162
|
-
border: 2px solid transparent;
|
|
163
|
-
border-radius: 12px;
|
|
164
|
-
text-align: left;
|
|
165
|
-
cursor: pointer;
|
|
166
|
-
transition: all 0.2s;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.connection-option:hover {
|
|
170
|
-
background: var(--ion-color-light-shade, #e8e8e8);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.connection-option.selected {
|
|
174
|
-
border-color: var(--ion-color-primary, #3880ff);
|
|
175
|
-
background: var(--ion-color-primary-tint, #e8f0ff);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.option-icon {
|
|
179
|
-
font-size: 32px;
|
|
180
|
-
line-height: 1;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.option-info h4 {
|
|
184
|
-
margin: 0 0 4px;
|
|
185
|
-
font-size: 18px;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.option-info p {
|
|
189
|
-
margin: 0 0 8px;
|
|
190
|
-
color: var(--ion-color-medium, #666);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.option-info ul {
|
|
194
|
-
margin: 0;
|
|
195
|
-
padding: 0;
|
|
196
|
-
list-style: none;
|
|
197
|
-
font-size: 14px;
|
|
198
|
-
color: var(--ion-color-medium, #666);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.option-info li {
|
|
202
|
-
margin: 2px 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.connect-action {
|
|
206
|
-
margin-top: 20px;
|
|
207
|
-
text-align: center;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
button.primary {
|
|
211
|
-
padding: 16px 32px;
|
|
212
|
-
font-size: 18px;
|
|
213
|
-
background: var(--ion-color-primary, #3880ff);
|
|
214
|
-
color: white;
|
|
215
|
-
border: none;
|
|
216
|
-
border-radius: 8px;
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
button.primary:disabled {
|
|
221
|
-
opacity: 0.6;
|
|
222
|
-
cursor: not-allowed;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.connected-state {
|
|
226
|
-
margin-top: 20px;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.connection-badge {
|
|
230
|
-
display: flex;
|
|
231
|
-
align-items: center;
|
|
232
|
-
gap: 8px;
|
|
233
|
-
font-size: 18px;
|
|
234
|
-
margin-bottom: 16px;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.protocol-badge {
|
|
238
|
-
padding: 4px 12px;
|
|
239
|
-
background: var(--ion-color-success, green);
|
|
240
|
-
color: white;
|
|
241
|
-
border-radius: 4px;
|
|
242
|
-
font-size: 12px;
|
|
243
|
-
text-transform: uppercase;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.account-card {
|
|
247
|
-
padding: 16px;
|
|
248
|
-
background: var(--ion-color-light, #f4f4f4);
|
|
249
|
-
border-radius: 12px;
|
|
250
|
-
margin-bottom: 16px;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.account-card h4 {
|
|
254
|
-
margin: 0 0 8px;
|
|
255
|
-
font-size: 14px;
|
|
256
|
-
color: var(--ion-color-medium, #666);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.account-card .address {
|
|
260
|
-
margin: 0;
|
|
261
|
-
font-family: monospace;
|
|
262
|
-
font-size: 16px;
|
|
263
|
-
word-break: break-all;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.account-card .network {
|
|
267
|
-
margin: 4px 0 0;
|
|
268
|
-
font-size: 14px;
|
|
269
|
-
color: var(--ion-color-medium, #666);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.account-switcher,
|
|
273
|
-
.provider-switcher {
|
|
274
|
-
margin-bottom: 16px;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.account-option {
|
|
278
|
-
display: block;
|
|
279
|
-
width: 100%;
|
|
280
|
-
padding: 12px;
|
|
281
|
-
margin-bottom: 8px;
|
|
282
|
-
background: var(--ion-color-light, #f4f4f4);
|
|
283
|
-
border: 1px solid transparent;
|
|
284
|
-
border-radius: 8px;
|
|
285
|
-
text-align: left;
|
|
286
|
-
font-family: monospace;
|
|
287
|
-
cursor: pointer;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.account-option.active {
|
|
291
|
-
border-color: var(--ion-color-primary, #3880ff);
|
|
292
|
-
background: var(--ion-color-primary-tint, #e8f0ff);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.provider-tag {
|
|
296
|
-
display: inline-block;
|
|
297
|
-
padding: 4px 12px;
|
|
298
|
-
margin-right: 8px;
|
|
299
|
-
background: var(--ion-color-tertiary, #7044ff);
|
|
300
|
-
color: white;
|
|
301
|
-
border-radius: 16px;
|
|
302
|
-
font-size: 12px;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
button.disconnect {
|
|
306
|
-
width: 100%;
|
|
307
|
-
padding: 12px;
|
|
308
|
-
background: var(--ion-color-danger, #eb445a);
|
|
309
|
-
color: white;
|
|
310
|
-
border: none;
|
|
311
|
-
border-radius: 8px;
|
|
312
|
-
cursor: pointer;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.events-log {
|
|
316
|
-
margin-top: 24px;
|
|
317
|
-
padding: 16px;
|
|
318
|
-
background: var(--ion-color-dark, #222);
|
|
319
|
-
color: var(--ion-color-light, #fff);
|
|
320
|
-
border-radius: 8px;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.events-log h3 {
|
|
324
|
-
margin: 0 0 12px;
|
|
325
|
-
font-size: 14px;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.event-item {
|
|
329
|
-
display: flex;
|
|
330
|
-
justify-content: space-between;
|
|
331
|
-
padding: 4px 0;
|
|
332
|
-
font-size: 12px;
|
|
333
|
-
font-family: monospace;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.event-type {
|
|
337
|
-
color: var(--ion-color-success, #2dd36f);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.event-time {
|
|
341
|
-
color: var(--ion-color-medium, #92949c);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.no-events {
|
|
345
|
-
color: var(--ion-color-medium, #92949c);
|
|
346
|
-
font-size: 12px;
|
|
347
|
-
}
|
|
348
|
-
`,
|
|
349
|
-
],
|
|
350
|
-
})
|
|
351
|
-
export class MultiProtocolComponent {
|
|
352
|
-
private readonly wallet = inject(UnifiedWalletService);
|
|
353
|
-
private readonly eventBus = inject(WalletEventBus);
|
|
354
|
-
|
|
355
|
-
// UI State
|
|
356
|
-
readonly selectedMethod = signal<ConnectionMethod>(null);
|
|
357
|
-
readonly isConnecting = signal(false);
|
|
358
|
-
readonly recentEvents = signal<Array<{ type: string; time: string }>>([]);
|
|
359
|
-
|
|
360
|
-
// Wallet State
|
|
361
|
-
readonly isConnected = this.wallet.isConnected;
|
|
362
|
-
readonly activeAccount = this.wallet.activeAccount;
|
|
363
|
-
readonly allAccounts = this.wallet.allAccounts;
|
|
364
|
-
readonly connectedProviders = this.wallet.connectedProviders;
|
|
365
|
-
readonly activeProvider = this.wallet.activeProvider;
|
|
366
|
-
|
|
367
|
-
constructor() {
|
|
368
|
-
// Subscribe to wallet events for logging
|
|
369
|
-
this.subscribeToEvents();
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Subscribe to wallet events
|
|
374
|
-
*/
|
|
375
|
-
private subscribeToEvents(): void {
|
|
376
|
-
this.eventBus.connected.subscribe((_event) => {
|
|
377
|
-
this.addEvent('connected');
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
this.eventBus.disconnected.subscribe((_event) => {
|
|
381
|
-
this.addEvent('disconnected');
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
this.eventBus.accountChanged.subscribe((_event) => {
|
|
385
|
-
this.addEvent('account_changed');
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
this.eventBus.sessionCreated.subscribe((_event) => {
|
|
389
|
-
this.addEvent('session_created');
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Add event to log
|
|
395
|
-
*/
|
|
396
|
-
private addEvent(type: string): void {
|
|
397
|
-
const time = new Date().toLocaleTimeString();
|
|
398
|
-
this.recentEvents.update((events) => [{ type, time }, ...events.slice(0, 9)]);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Select connection method
|
|
403
|
-
*/
|
|
404
|
-
selectMethod(method: ConnectionMethod): void {
|
|
405
|
-
this.selectedMethod.set(method);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Connect using selected method
|
|
410
|
-
*/
|
|
411
|
-
async connect(): Promise<void> {
|
|
412
|
-
const method = this.selectedMethod();
|
|
413
|
-
if (!method) return;
|
|
414
|
-
|
|
415
|
-
this.isConnecting.set(true);
|
|
416
|
-
|
|
417
|
-
try {
|
|
418
|
-
if (method === 'native') {
|
|
419
|
-
// HSuite Native Connection
|
|
420
|
-
await this.wallet.connectNative({
|
|
421
|
-
walletUrl: 'http://localhost:8100',
|
|
422
|
-
appId: 'multi-protocol-demo',
|
|
423
|
-
appName: 'Multi-Protocol Demo',
|
|
424
|
-
ledgerId: 'hedera',
|
|
425
|
-
networkId: 'hedera:testnet',
|
|
426
|
-
});
|
|
427
|
-
} else {
|
|
428
|
-
// WalletConnect Connection
|
|
429
|
-
await this.wallet.connectWalletConnect({
|
|
430
|
-
projectId: 'YOUR_WALLETCONNECT_PROJECT_ID', // Get from cloud.walletconnect.com
|
|
431
|
-
ledgerId: 'hedera',
|
|
432
|
-
networkId: 'hedera:testnet',
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
this.addEvent(`connected_${method}`);
|
|
437
|
-
} catch (error) {
|
|
438
|
-
console.error('Connection failed:', error);
|
|
439
|
-
this.addEvent('connection_error');
|
|
440
|
-
} finally {
|
|
441
|
-
this.isConnecting.set(false);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Switch active account
|
|
447
|
-
*/
|
|
448
|
-
switchAccount(address: string): void {
|
|
449
|
-
const account = this.allAccounts().find((a) => a.address === address);
|
|
450
|
-
if (account) {
|
|
451
|
-
this.wallet.setActiveAccount(account);
|
|
452
|
-
this.addEvent('account_switched');
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Disconnect from wallet
|
|
458
|
-
*/
|
|
459
|
-
async disconnect(): Promise<void> {
|
|
460
|
-
await this.wallet.disconnect();
|
|
461
|
-
this.selectedMethod.set(null);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Configuration for WalletConnect:
|
|
467
|
-
*
|
|
468
|
-
* 1. Get a Project ID from https://cloud.walletconnect.com
|
|
469
|
-
* 2. Add your dApp metadata (name, description, url, icons)
|
|
470
|
-
* 3. Configure supported chains (hedera, xrpl)
|
|
471
|
-
*
|
|
472
|
-
* Example environment.ts:
|
|
473
|
-
*
|
|
474
|
-
* export const environment = {
|
|
475
|
-
* walletConnectProjectId: 'abc123...',
|
|
476
|
-
* walletConnectMetadata: {
|
|
477
|
-
* name: 'My dApp',
|
|
478
|
-
* description: 'A cool Hedera dApp',
|
|
479
|
-
* url: 'https://mydapp.com',
|
|
480
|
-
* icons: ['https://mydapp.com/icon.png']
|
|
481
|
-
* }
|
|
482
|
-
* };
|
|
483
|
-
*/
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Provider Types:
|
|
487
|
-
*
|
|
488
|
-
* - 'hsuite-native': Direct connection to HSuite Wallet
|
|
489
|
-
* - 'walletconnect-v2': WalletConnect v2 protocol
|
|
490
|
-
*
|
|
491
|
-
* The UnifiedWalletService manages both providers and provides:
|
|
492
|
-
* - Unified account list from all providers
|
|
493
|
-
* - Single active account selection
|
|
494
|
-
* - Provider-agnostic signing
|
|
495
|
-
*/
|