kalvora.js 0.0.1-alpha.1
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/CHANGELOG.md +162 -0
- package/LICENSE +202 -0
- package/NOTICE +10 -0
- package/README.md +391 -0
- package/dist/LICENSE +202 -0
- package/dist/README.md +391 -0
- package/dist/index.cjs +78254 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +125 -0
- package/dist/proto/generated/google/protobuf/empty_pb.d.ts +63 -0
- package/dist/proto/generated/google/protobuf/empty_pb.js +49 -0
- package/dist/proto/generated/google/protobuf/timestamp_pb.d.ts +163 -0
- package/dist/proto/generated/google/protobuf/timestamp_pb.js +49 -0
- package/dist/proto/generated/guardian_pb.d.ts +1229 -0
- package/dist/proto/generated/guardian_pb.js +255 -0
- package/dist/proto/generated/kal_api_pb.d.ts +1350 -0
- package/dist/proto/generated/kal_api_pb.js +324 -0
- package/dist/proto/generated/txn_pb.d.ts +3653 -0
- package/dist/proto/generated/txn_pb.js +622 -0
- package/dist/proto/generated/validator_pb.d.ts +2385 -0
- package/dist/proto/generated/validator_pb.js +528 -0
- package/dist/proto/guardian.proto +266 -0
- package/dist/proto/kal_api.proto +289 -0
- package/dist/proto/txn.proto +718 -0
- package/dist/proto/validator.proto +469 -0
- package/dist/src/adapter/constants.d.ts +80 -0
- package/dist/src/adapter/constants.d.ts.map +1 -0
- package/dist/src/adapter/constants.js +89 -0
- package/dist/src/adapter/constants.js.map +1 -0
- package/dist/src/adapter/index.d.ts +45 -0
- package/dist/src/adapter/index.d.ts.map +1 -0
- package/dist/src/adapter/index.js +71 -0
- package/dist/src/adapter/index.js.map +1 -0
- package/dist/src/adapter/serialization.d.ts +94 -0
- package/dist/src/adapter/serialization.d.ts.map +1 -0
- package/dist/src/adapter/serialization.js +175 -0
- package/dist/src/adapter/serialization.js.map +1 -0
- package/dist/src/adapter/wallet-adapter.d.ts +230 -0
- package/dist/src/adapter/wallet-adapter.d.ts.map +1 -0
- package/dist/src/adapter/wallet-adapter.js +792 -0
- package/dist/src/adapter/wallet-adapter.js.map +1 -0
- package/dist/src/adapter/wallet-signer.d.ts +115 -0
- package/dist/src/adapter/wallet-signer.d.ts.map +1 -0
- package/dist/src/adapter/wallet-signer.js +357 -0
- package/dist/src/adapter/wallet-signer.js.map +1 -0
- package/dist/src/adapter/walletconnect.d.ts +148 -0
- package/dist/src/adapter/walletconnect.d.ts.map +1 -0
- package/dist/src/adapter/walletconnect.js +188 -0
- package/dist/src/adapter/walletconnect.js.map +1 -0
- package/dist/src/allowance/index.d.ts +2 -0
- package/dist/src/allowance/index.d.ts.map +1 -0
- package/dist/src/allowance/index.js +2 -0
- package/dist/src/allowance/index.js.map +1 -0
- package/dist/src/allowance/transaction.d.ts +227 -0
- package/dist/src/allowance/transaction.d.ts.map +1 -0
- package/dist/src/allowance/transaction.js +296 -0
- package/dist/src/allowance/transaction.js.map +1 -0
- package/dist/src/api/handler/fee-info/service.d.ts +126 -0
- package/dist/src/api/handler/fee-info/service.d.ts.map +1 -0
- package/dist/src/api/handler/fee-info/service.js +255 -0
- package/dist/src/api/handler/fee-info/service.js.map +1 -0
- package/dist/src/api/handler/index.d.ts +10 -0
- package/dist/src/api/handler/index.d.ts.map +1 -0
- package/dist/src/api/handler/index.js +14 -0
- package/dist/src/api/handler/index.js.map +1 -0
- package/dist/src/api/handler/nonce/service.d.ts +37 -0
- package/dist/src/api/handler/nonce/service.d.ts.map +1 -0
- package/dist/src/api/handler/nonce/service.js +64 -0
- package/dist/src/api/handler/nonce/service.js.map +1 -0
- package/dist/src/api/handler/token-info/service.d.ts +123 -0
- package/dist/src/api/handler/token-info/service.d.ts.map +1 -0
- package/dist/src/api/handler/token-info/service.js +218 -0
- package/dist/src/api/handler/token-info/service.js.map +1 -0
- package/dist/src/api/shared/indexer-utils.d.ts +14 -0
- package/dist/src/api/shared/indexer-utils.d.ts.map +1 -0
- package/dist/src/api/shared/indexer-utils.js +19 -0
- package/dist/src/api/shared/indexer-utils.js.map +1 -0
- package/dist/src/api/validator/balance/index.d.ts +8 -0
- package/dist/src/api/validator/balance/index.d.ts.map +1 -0
- package/dist/src/api/validator/balance/index.js +7 -0
- package/dist/src/api/validator/balance/index.js.map +1 -0
- package/dist/src/api/validator/balance/service.d.ts +42 -0
- package/dist/src/api/validator/balance/service.d.ts.map +1 -0
- package/dist/src/api/validator/balance/service.js +93 -0
- package/dist/src/api/validator/balance/service.js.map +1 -0
- package/dist/src/api/validator/base-fee/index.d.ts +8 -0
- package/dist/src/api/validator/base-fee/index.d.ts.map +1 -0
- package/dist/src/api/validator/base-fee/index.js +7 -0
- package/dist/src/api/validator/base-fee/index.js.map +1 -0
- package/dist/src/api/validator/base-fee/service.d.ts +39 -0
- package/dist/src/api/validator/base-fee/service.d.ts.map +1 -0
- package/dist/src/api/validator/base-fee/service.js +45 -0
- package/dist/src/api/validator/base-fee/service.js.map +1 -0
- package/dist/src/api/validator/fee-info/index.d.ts +7 -0
- package/dist/src/api/validator/fee-info/index.d.ts.map +1 -0
- package/dist/src/api/validator/fee-info/index.js +7 -0
- package/dist/src/api/validator/fee-info/index.js.map +1 -0
- package/dist/src/api/validator/fee-info/request.d.ts +25 -0
- package/dist/src/api/validator/fee-info/request.d.ts.map +1 -0
- package/dist/src/api/validator/fee-info/request.js +92 -0
- package/dist/src/api/validator/fee-info/request.js.map +1 -0
- package/dist/src/api/validator/nonce/index.d.ts +7 -0
- package/dist/src/api/validator/nonce/index.d.ts.map +1 -0
- package/dist/src/api/validator/nonce/index.js +7 -0
- package/dist/src/api/validator/nonce/index.js.map +1 -0
- package/dist/src/api/validator/nonce/service.d.ts +18 -0
- package/dist/src/api/validator/nonce/service.d.ts.map +1 -0
- package/dist/src/api/validator/nonce/service.js +51 -0
- package/dist/src/api/validator/nonce/service.js.map +1 -0
- package/dist/src/client/index.d.ts +8 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +8 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/kalvora-client.d.ts +117 -0
- package/dist/src/client/kalvora-client.d.ts.map +1 -0
- package/dist/src/client/kalvora-client.js +112 -0
- package/dist/src/client/kalvora-client.js.map +1 -0
- package/dist/src/client/networks.d.ts +48 -0
- package/dist/src/client/networks.d.ts.map +1 -0
- package/dist/src/client/networks.js +41 -0
- package/dist/src/client/networks.js.map +1 -0
- package/dist/src/coin-txn/index.d.ts +9 -0
- package/dist/src/coin-txn/index.d.ts.map +1 -0
- package/dist/src/coin-txn/index.js +9 -0
- package/dist/src/coin-txn/index.js.map +1 -0
- package/dist/src/coin-txn/transaction.d.ts +94 -0
- package/dist/src/coin-txn/transaction.d.ts.map +1 -0
- package/dist/src/coin-txn/transaction.js +341 -0
- package/dist/src/coin-txn/transaction.js.map +1 -0
- package/dist/src/compliance/index.d.ts +2 -0
- package/dist/src/compliance/index.d.ts.map +1 -0
- package/dist/src/compliance/index.js +2 -0
- package/dist/src/compliance/index.js.map +1 -0
- package/dist/src/compliance/transaction.d.ts +150 -0
- package/dist/src/compliance/transaction.d.ts.map +1 -0
- package/dist/src/compliance/transaction.js +183 -0
- package/dist/src/compliance/transaction.js.map +1 -0
- package/dist/src/contract/create/index.d.ts +8 -0
- package/dist/src/contract/create/index.d.ts.map +1 -0
- package/dist/src/contract/create/index.js +7 -0
- package/dist/src/contract/create/index.js.map +1 -0
- package/dist/src/contract/create/transaction.d.ts +47 -0
- package/dist/src/contract/create/transaction.d.ts.map +1 -0
- package/dist/src/contract/create/transaction.js +137 -0
- package/dist/src/contract/create/transaction.js.map +1 -0
- package/dist/src/contract/index.d.ts +34 -0
- package/dist/src/contract/index.d.ts.map +1 -0
- package/dist/src/contract/index.js +34 -0
- package/dist/src/contract/index.js.map +1 -0
- package/dist/src/contract/shared/index.d.ts +6 -0
- package/dist/src/contract/shared/index.d.ts.map +1 -0
- package/dist/src/contract/shared/index.js +6 -0
- package/dist/src/contract/shared/index.js.map +1 -0
- package/dist/src/contract/shared/types.d.ts +114 -0
- package/dist/src/contract/shared/types.d.ts.map +1 -0
- package/dist/src/contract/shared/types.js +5 -0
- package/dist/src/contract/shared/types.js.map +1 -0
- package/dist/src/contract/shared/utils.d.ts +111 -0
- package/dist/src/contract/shared/utils.d.ts.map +1 -0
- package/dist/src/contract/shared/utils.js +182 -0
- package/dist/src/contract/shared/utils.js.map +1 -0
- package/dist/src/contract/update/index.d.ts +8 -0
- package/dist/src/contract/update/index.d.ts.map +1 -0
- package/dist/src/contract/update/index.js +7 -0
- package/dist/src/contract/update/index.js.map +1 -0
- package/dist/src/contract/update/transaction.d.ts +45 -0
- package/dist/src/contract/update/transaction.d.ts.map +1 -0
- package/dist/src/contract/update/transaction.js +123 -0
- package/dist/src/contract/update/transaction.js.map +1 -0
- package/dist/src/delegated-voting/index.d.ts +2 -0
- package/dist/src/delegated-voting/index.d.ts.map +1 -0
- package/dist/src/delegated-voting/index.js +2 -0
- package/dist/src/delegated-voting/index.js.map +1 -0
- package/dist/src/delegated-voting/transaction.d.ts +127 -0
- package/dist/src/delegated-voting/transaction.d.ts.map +1 -0
- package/dist/src/delegated-voting/transaction.js +195 -0
- package/dist/src/delegated-voting/transaction.js.map +1 -0
- package/dist/src/expense-ratio/index.d.ts +2 -0
- package/dist/src/expense-ratio/index.d.ts.map +1 -0
- package/dist/src/expense-ratio/index.js +2 -0
- package/dist/src/expense-ratio/index.js.map +1 -0
- package/dist/src/expense-ratio/transaction.d.ts +94 -0
- package/dist/src/expense-ratio/transaction.d.ts.map +1 -0
- package/dist/src/expense-ratio/transaction.js +122 -0
- package/dist/src/expense-ratio/transaction.js.map +1 -0
- package/dist/src/grpc/api/validator-api-client.d.ts +32 -0
- package/dist/src/grpc/api/validator-api-client.d.ts.map +1 -0
- package/dist/src/grpc/api/validator-api-client.js +61 -0
- package/dist/src/grpc/api/validator-api-client.js.map +1 -0
- package/dist/src/grpc/client-factory.d.ts +12 -0
- package/dist/src/grpc/client-factory.d.ts.map +1 -0
- package/dist/src/grpc/client-factory.js +248 -0
- package/dist/src/grpc/client-factory.js.map +1 -0
- package/dist/src/grpc/errors.d.ts +79 -0
- package/dist/src/grpc/errors.d.ts.map +1 -0
- package/dist/src/grpc/errors.js +108 -0
- package/dist/src/grpc/errors.js.map +1 -0
- package/dist/src/grpc/index.d.ts +21 -0
- package/dist/src/grpc/index.d.ts.map +1 -0
- package/dist/src/grpc/index.js +20 -0
- package/dist/src/grpc/index.js.map +1 -0
- package/dist/src/grpc/transaction/transaction-client.d.ts +97 -0
- package/dist/src/grpc/transaction/transaction-client.d.ts.map +1 -0
- package/dist/src/grpc/transaction/transaction-client.js +142 -0
- package/dist/src/grpc/transaction/transaction-client.js.map +1 -0
- package/dist/src/grpc/utils/grpc-web-fetch-wrapper.d.ts +2 -0
- package/dist/src/grpc/utils/grpc-web-fetch-wrapper.d.ts.map +1 -0
- package/dist/src/grpc/utils/grpc-web-fetch-wrapper.js +213 -0
- package/dist/src/grpc/utils/grpc-web-fetch-wrapper.js.map +1 -0
- package/dist/src/items/index.d.ts +7 -0
- package/dist/src/items/index.d.ts.map +1 -0
- package/dist/src/items/index.js +7 -0
- package/dist/src/items/index.js.map +1 -0
- package/dist/src/items/transaction.d.ts +132 -0
- package/dist/src/items/transaction.d.ts.map +1 -0
- package/dist/src/items/transaction.js +276 -0
- package/dist/src/items/transaction.js.map +1 -0
- package/dist/src/mint/index.d.ts +2 -0
- package/dist/src/mint/index.d.ts.map +1 -0
- package/dist/src/mint/index.js +2 -0
- package/dist/src/mint/index.js.map +1 -0
- package/dist/src/mint/transaction.d.ts +128 -0
- package/dist/src/mint/transaction.d.ts.map +1 -0
- package/dist/src/mint/transaction.js +118 -0
- package/dist/src/mint/transaction.js.map +1 -0
- package/dist/src/proposal/index.d.ts +3 -0
- package/dist/src/proposal/index.d.ts.map +1 -0
- package/dist/src/proposal/index.js +3 -0
- package/dist/src/proposal/index.js.map +1 -0
- package/dist/src/proposal/transaction.d.ts +95 -0
- package/dist/src/proposal/transaction.d.ts.map +1 -0
- package/dist/src/proposal/transaction.js +321 -0
- package/dist/src/proposal/transaction.js.map +1 -0
- package/dist/src/proposal-cancel/index.d.ts +2 -0
- package/dist/src/proposal-cancel/index.d.ts.map +1 -0
- package/dist/src/proposal-cancel/index.js +2 -0
- package/dist/src/proposal-cancel/index.js.map +1 -0
- package/dist/src/proposal-cancel/transaction.d.ts +31 -0
- package/dist/src/proposal-cancel/transaction.d.ts.map +1 -0
- package/dist/src/proposal-cancel/transaction.js +98 -0
- package/dist/src/proposal-cancel/transaction.js.map +1 -0
- package/dist/src/protocol/guardian-names.d.ts +35 -0
- package/dist/src/protocol/guardian-names.d.ts.map +1 -0
- package/dist/src/protocol/guardian-names.js +25 -0
- package/dist/src/protocol/guardian-names.js.map +1 -0
- package/dist/src/protocol/index.d.ts +36 -0
- package/dist/src/protocol/index.d.ts.map +1 -0
- package/dist/src/protocol/index.js +36 -0
- package/dist/src/protocol/index.js.map +1 -0
- package/dist/src/quash/index.d.ts +2 -0
- package/dist/src/quash/index.d.ts.map +1 -0
- package/dist/src/quash/index.js +2 -0
- package/dist/src/quash/index.js.map +1 -0
- package/dist/src/quash/transaction.d.ts +124 -0
- package/dist/src/quash/transaction.d.ts.map +1 -0
- package/dist/src/quash/transaction.js +118 -0
- package/dist/src/quash/transaction.js.map +1 -0
- package/dist/src/query/api-client.d.ts +368 -0
- package/dist/src/query/api-client.d.ts.map +1 -0
- package/dist/src/query/api-client.js +497 -0
- package/dist/src/query/api-client.js.map +1 -0
- package/dist/src/query/decoders.d.ts +184 -0
- package/dist/src/query/decoders.d.ts.map +1 -0
- package/dist/src/query/decoders.js +257 -0
- package/dist/src/query/decoders.js.map +1 -0
- package/dist/src/query/guardian-client.d.ts +73 -0
- package/dist/src/query/guardian-client.d.ts.map +1 -0
- package/dist/src/query/guardian-client.js +90 -0
- package/dist/src/query/guardian-client.js.map +1 -0
- package/dist/src/query/index.d.ts +16 -0
- package/dist/src/query/index.d.ts.map +1 -0
- package/dist/src/query/index.js +16 -0
- package/dist/src/query/index.js.map +1 -0
- package/dist/src/query/validator-client.d.ts +95 -0
- package/dist/src/query/validator-client.d.ts.map +1 -0
- package/dist/src/query/validator-client.js +116 -0
- package/dist/src/query/validator-client.js.map +1 -0
- package/dist/src/revoke/index.d.ts +2 -0
- package/dist/src/revoke/index.d.ts.map +1 -0
- package/dist/src/revoke/index.js +2 -0
- package/dist/src/revoke/index.js.map +1 -0
- package/dist/src/revoke/transaction.d.ts +123 -0
- package/dist/src/revoke/transaction.d.ts.map +1 -0
- package/dist/src/revoke/transaction.js +125 -0
- package/dist/src/revoke/transaction.js.map +1 -0
- package/dist/src/shared/crypto/address-utils.d.ts +71 -0
- package/dist/src/shared/crypto/address-utils.d.ts.map +1 -0
- package/dist/src/shared/crypto/address-utils.js +305 -0
- package/dist/src/shared/crypto/address-utils.js.map +1 -0
- package/dist/src/shared/crypto/constants.d.ts +29 -0
- package/dist/src/shared/crypto/constants.d.ts.map +1 -0
- package/dist/src/shared/crypto/constants.js +53 -0
- package/dist/src/shared/crypto/constants.js.map +1 -0
- package/dist/src/shared/crypto/signature-utils.d.ts +14 -0
- package/dist/src/shared/crypto/signature-utils.d.ts.map +1 -0
- package/dist/src/shared/crypto/signature-utils.js +40 -0
- package/dist/src/shared/crypto/signature-utils.js.map +1 -0
- package/dist/src/shared/fee-calculators/base-fee-constants.d.ts +33 -0
- package/dist/src/shared/fee-calculators/base-fee-constants.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/base-fee-constants.js +45 -0
- package/dist/src/shared/fee-calculators/base-fee-constants.js.map +1 -0
- package/dist/src/shared/fee-calculators/contract-fee-constants.d.ts +53 -0
- package/dist/src/shared/fee-calculators/contract-fee-constants.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/contract-fee-constants.js +73 -0
- package/dist/src/shared/fee-calculators/contract-fee-constants.js.map +1 -0
- package/dist/src/shared/fee-calculators/contract-fee-service.d.ts +60 -0
- package/dist/src/shared/fee-calculators/contract-fee-service.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/contract-fee-service.js +171 -0
- package/dist/src/shared/fee-calculators/contract-fee-service.js.map +1 -0
- package/dist/src/shared/fee-calculators/denomination-fallback.d.ts +41 -0
- package/dist/src/shared/fee-calculators/denomination-fallback.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/denomination-fallback.js +83 -0
- package/dist/src/shared/fee-calculators/denomination-fallback.js.map +1 -0
- package/dist/src/shared/fee-calculators/exchange-rate-service.d.ts +26 -0
- package/dist/src/shared/fee-calculators/exchange-rate-service.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/exchange-rate-service.js +62 -0
- package/dist/src/shared/fee-calculators/exchange-rate-service.js.map +1 -0
- package/dist/src/shared/fee-calculators/types.d.ts +81 -0
- package/dist/src/shared/fee-calculators/types.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/types.js +7 -0
- package/dist/src/shared/fee-calculators/types.js.map +1 -0
- package/dist/src/shared/fee-calculators/universal-fee-calculator.d.ts +144 -0
- package/dist/src/shared/fee-calculators/universal-fee-calculator.d.ts.map +1 -0
- package/dist/src/shared/fee-calculators/universal-fee-calculator.js +900 -0
- package/dist/src/shared/fee-calculators/universal-fee-calculator.js.map +1 -0
- package/dist/src/shared/monitoring/health-check.d.ts +37 -0
- package/dist/src/shared/monitoring/health-check.d.ts.map +1 -0
- package/dist/src/shared/monitoring/health-check.js +152 -0
- package/dist/src/shared/monitoring/health-check.js.map +1 -0
- package/dist/src/shared/monitoring/index.d.ts +9 -0
- package/dist/src/shared/monitoring/index.d.ts.map +1 -0
- package/dist/src/shared/monitoring/index.js +9 -0
- package/dist/src/shared/monitoring/index.js.map +1 -0
- package/dist/src/shared/monitoring/logger.d.ts +42 -0
- package/dist/src/shared/monitoring/logger.d.ts.map +1 -0
- package/dist/src/shared/monitoring/logger.js +185 -0
- package/dist/src/shared/monitoring/logger.js.map +1 -0
- package/dist/src/shared/monitoring/metrics.d.ts +33 -0
- package/dist/src/shared/monitoring/metrics.d.ts.map +1 -0
- package/dist/src/shared/monitoring/metrics.js +105 -0
- package/dist/src/shared/monitoring/metrics.js.map +1 -0
- package/dist/src/shared/network/constants.d.ts +34 -0
- package/dist/src/shared/network/constants.d.ts.map +1 -0
- package/dist/src/shared/network/constants.js +46 -0
- package/dist/src/shared/network/constants.js.map +1 -0
- package/dist/src/shared/protobuf/index.d.ts +18 -0
- package/dist/src/shared/protobuf/index.d.ts.map +1 -0
- package/dist/src/shared/protobuf/index.js +10 -0
- package/dist/src/shared/protobuf/index.js.map +1 -0
- package/dist/src/shared/tx/base.d.ts +24 -0
- package/dist/src/shared/tx/base.d.ts.map +1 -0
- package/dist/src/shared/tx/base.js +57 -0
- package/dist/src/shared/tx/base.js.map +1 -0
- package/dist/src/shared/tx/standard.d.ts +198 -0
- package/dist/src/shared/tx/standard.d.ts.map +1 -0
- package/dist/src/shared/tx/standard.js +283 -0
- package/dist/src/shared/tx/standard.js.map +1 -0
- package/dist/src/shared/utils/amount-utils.d.ts +110 -0
- package/dist/src/shared/utils/amount-utils.d.ts.map +1 -0
- package/dist/src/shared/utils/amount-utils.js +237 -0
- package/dist/src/shared/utils/amount-utils.js.map +1 -0
- package/dist/src/shared/utils/byte-utils.d.ts +127 -0
- package/dist/src/shared/utils/byte-utils.d.ts.map +1 -0
- package/dist/src/shared/utils/byte-utils.js +220 -0
- package/dist/src/shared/utils/byte-utils.js.map +1 -0
- package/dist/src/shared/utils/error-handler.d.ts +65 -0
- package/dist/src/shared/utils/error-handler.d.ts.map +1 -0
- package/dist/src/shared/utils/error-handler.js +157 -0
- package/dist/src/shared/utils/error-handler.js.map +1 -0
- package/dist/src/shared/utils/formatting.d.ts +133 -0
- package/dist/src/shared/utils/formatting.d.ts.map +1 -0
- package/dist/src/shared/utils/formatting.js +190 -0
- package/dist/src/shared/utils/formatting.js.map +1 -0
- package/dist/src/shared/utils/grpc-config-utils.d.ts +8 -0
- package/dist/src/shared/utils/grpc-config-utils.d.ts.map +1 -0
- package/dist/src/shared/utils/grpc-config-utils.js +11 -0
- package/dist/src/shared/utils/grpc-config-utils.js.map +1 -0
- package/dist/src/shared/utils/performance-benchmark.d.ts +136 -0
- package/dist/src/shared/utils/performance-benchmark.d.ts.map +1 -0
- package/dist/src/shared/utils/performance-benchmark.js +274 -0
- package/dist/src/shared/utils/performance-benchmark.js.map +1 -0
- package/dist/src/shared/utils/protobuf-utils.d.ts +39 -0
- package/dist/src/shared/utils/protobuf-utils.d.ts.map +1 -0
- package/dist/src/shared/utils/protobuf-utils.js +103 -0
- package/dist/src/shared/utils/protobuf-utils.js.map +1 -0
- package/dist/src/shared/utils/testing-defaults/grpc-config.d.ts +12 -0
- package/dist/src/shared/utils/testing-defaults/grpc-config.d.ts.map +1 -0
- package/dist/src/shared/utils/testing-defaults/grpc-config.js +16 -0
- package/dist/src/shared/utils/testing-defaults/grpc-config.js.map +1 -0
- package/dist/src/shared/utils/testing-defaults/index.d.ts +8 -0
- package/dist/src/shared/utils/testing-defaults/index.d.ts.map +1 -0
- package/dist/src/shared/utils/testing-defaults/index.js +8 -0
- package/dist/src/shared/utils/testing-defaults/index.js.map +1 -0
- package/dist/src/shared/utils/token-config.d.ts +31 -0
- package/dist/src/shared/utils/token-config.d.ts.map +1 -0
- package/dist/src/shared/utils/token-config.js +56 -0
- package/dist/src/shared/utils/token-config.js.map +1 -0
- package/dist/src/shared/utils/token-info.d.ts +101 -0
- package/dist/src/shared/utils/token-info.d.ts.map +1 -0
- package/dist/src/shared/utils/token-info.js +203 -0
- package/dist/src/shared/utils/token-info.js.map +1 -0
- package/dist/src/shared/utils/transaction-utils.d.ts +200 -0
- package/dist/src/shared/utils/transaction-utils.d.ts.map +1 -0
- package/dist/src/shared/utils/transaction-utils.js +293 -0
- package/dist/src/shared/utils/transaction-utils.js.map +1 -0
- package/dist/src/shared/utils/unified-amount-conversion.d.ts +65 -0
- package/dist/src/shared/utils/unified-amount-conversion.d.ts.map +1 -0
- package/dist/src/shared/utils/unified-amount-conversion.js +146 -0
- package/dist/src/shared/utils/unified-amount-conversion.js.map +1 -0
- package/dist/src/shared/utils/validation.d.ts +119 -0
- package/dist/src/shared/utils/validation.d.ts.map +1 -0
- package/dist/src/shared/utils/validation.js +540 -0
- package/dist/src/shared/utils/validation.js.map +1 -0
- package/dist/src/sign/finalize.d.ts +82 -0
- package/dist/src/sign/finalize.d.ts.map +1 -0
- package/dist/src/sign/finalize.js +216 -0
- package/dist/src/sign/finalize.js.map +1 -0
- package/dist/src/sign/index.d.ts +19 -0
- package/dist/src/sign/index.d.ts.map +1 -0
- package/dist/src/sign/index.js +21 -0
- package/dist/src/sign/index.js.map +1 -0
- package/dist/src/sign/signer.d.ts +71 -0
- package/dist/src/sign/signer.d.ts.map +1 -0
- package/dist/src/sign/signer.js +65 -0
- package/dist/src/sign/signer.js.map +1 -0
- package/dist/src/smart-contracts/deploy/index.d.ts +5 -0
- package/dist/src/smart-contracts/deploy/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/deploy/index.js +5 -0
- package/dist/src/smart-contracts/deploy/index.js.map +1 -0
- package/dist/src/smart-contracts/deploy/transaction.d.ts +54 -0
- package/dist/src/smart-contracts/deploy/transaction.d.ts.map +1 -0
- package/dist/src/smart-contracts/deploy/transaction.js +116 -0
- package/dist/src/smart-contracts/deploy/transaction.js.map +1 -0
- package/dist/src/smart-contracts/execute/index.d.ts +5 -0
- package/dist/src/smart-contracts/execute/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/execute/index.js +5 -0
- package/dist/src/smart-contracts/execute/index.js.map +1 -0
- package/dist/src/smart-contracts/execute/transaction.d.ts +60 -0
- package/dist/src/smart-contracts/execute/transaction.d.ts.map +1 -0
- package/dist/src/smart-contracts/execute/transaction.js +88 -0
- package/dist/src/smart-contracts/execute/transaction.js.map +1 -0
- package/dist/src/smart-contracts/instantiate/index.d.ts +6 -0
- package/dist/src/smart-contracts/instantiate/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/instantiate/index.js +6 -0
- package/dist/src/smart-contracts/instantiate/index.js.map +1 -0
- package/dist/src/smart-contracts/instantiate/transaction.d.ts +43 -0
- package/dist/src/smart-contracts/instantiate/transaction.d.ts.map +1 -0
- package/dist/src/smart-contracts/instantiate/transaction.js +72 -0
- package/dist/src/smart-contracts/instantiate/transaction.js.map +1 -0
- package/dist/src/smart-contracts/shared/base.d.ts +29 -0
- package/dist/src/smart-contracts/shared/base.d.ts.map +1 -0
- package/dist/src/smart-contracts/shared/base.js +70 -0
- package/dist/src/smart-contracts/shared/base.js.map +1 -0
- package/dist/src/smart-contracts/shared/parameters.d.ts +26 -0
- package/dist/src/smart-contracts/shared/parameters.d.ts.map +1 -0
- package/dist/src/smart-contracts/shared/parameters.js +32 -0
- package/dist/src/smart-contracts/shared/parameters.js.map +1 -0
- package/dist/src/smart-contracts/shared/validation.d.ts +6 -0
- package/dist/src/smart-contracts/shared/validation.d.ts.map +1 -0
- package/dist/src/smart-contracts/shared/validation.js +13 -0
- package/dist/src/smart-contracts/shared/validation.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/index.d.ts +25 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/index.js +30 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/index.d.ts +7 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/index.js +7 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/process-rewards.d.ts +23 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/process-rewards.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/process-rewards.js +39 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/process-rewards.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/stake.d.ts +27 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/stake.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/stake.js +51 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/stake.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/update-wallet.d.ts +22 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/update-wallet.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/update-wallet.js +43 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/transactions/update-wallet.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/types.d.ts +60 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/types.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/types.js +8 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/types.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/utils.d.ts +131 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/utils.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/utils.js +87 -0
- package/dist/src/smart-contracts/use-cases/bootstrapping/utils.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/index.d.ts +49 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/index.js +59 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/vaa.d.ts +150 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/vaa.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/vaa.js +505 -0
- package/dist/src/smart-contracts/use-cases/bridge/guardian/vaa.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/index.d.ts +68 -0
- package/dist/src/smart-contracts/use-cases/bridge/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/index.js +83 -0
- package/dist/src/smart-contracts/use-cases/bridge/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/index.d.ts +36 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/index.js +53 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/index.d.ts +10 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/index.js +17 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/lock.d.ts +65 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/lock.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/lock.js +130 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/lock.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/release.d.ts +81 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/release.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/release.js +187 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/transactions/release.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/types.d.ts +82 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/types.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/types.js +7 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/types.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/utils.d.ts +49 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/utils.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/utils.js +80 -0
- package/dist/src/smart-contracts/use-cases/bridge/kalvora/utils.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/constants.d.ts +84 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/constants.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/constants.js +82 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/constants.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/index.d.ts +58 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/index.js +90 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/burn.d.ts +26 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/burn.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/burn.js +59 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/burn.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/helpers.d.ts +29 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/helpers.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/helpers.js +50 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/helpers.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/index.d.ts +14 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/index.js +31 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/lock.d.ts +70 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/lock.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/lock.js +212 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/lock.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/mint.d.ts +60 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/mint.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/mint.js +288 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/mint.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/registration.d.ts +54 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/registration.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/registration.js +186 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/registration.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/release.d.ts +96 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/release.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/release.js +406 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/release.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/token-type.d.ts +34 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/token-type.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/token-type.js +55 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/transactions/token-type.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/types.d.ts +377 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/types.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/types.js +9 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/types.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/utils.d.ts +121 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/utils.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/utils.js +219 -0
- package/dist/src/smart-contracts/use-cases/bridge/solana/utils.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/index.d.ts +58 -0
- package/dist/src/smart-contracts/use-cases/dex/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/index.js +73 -0
- package/dist/src/smart-contracts/use-cases/dex/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/add-liquidity.d.ts +34 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/add-liquidity.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/add-liquidity.js +68 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/add-liquidity.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/create-pool.d.ts +35 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/create-pool.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/create-pool.js +69 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/create-pool.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/index.d.ts +11 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/index.js +11 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/remove-liquidity.d.ts +40 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/remove-liquidity.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/remove-liquidity.js +76 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/remove-liquidity.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/swap.d.ts +38 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/swap.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/swap.js +70 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/swap.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/unlock-liquidity.d.ts +37 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/unlock-liquidity.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/unlock-liquidity.js +60 -0
- package/dist/src/smart-contracts/use-cases/dex/transactions/unlock-liquidity.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/types.d.ts +130 -0
- package/dist/src/smart-contracts/use-cases/dex/types.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/types.js +11 -0
- package/dist/src/smart-contracts/use-cases/dex/types.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/utils.d.ts +52 -0
- package/dist/src/smart-contracts/use-cases/dex/utils.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/dex/utils.js +79 -0
- package/dist/src/smart-contracts/use-cases/dex/utils.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/index.d.ts +35 -0
- package/dist/src/smart-contracts/use-cases/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/index.js +35 -0
- package/dist/src/smart-contracts/use-cases/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/index.d.ts +67 -0
- package/dist/src/smart-contracts/use-cases/staking/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/index.js +84 -0
- package/dist/src/smart-contracts/use-cases/staking/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/index.d.ts +12 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/index.js +12 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/instant-stake.d.ts +36 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/instant-stake.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/instant-stake.js +57 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/instant-stake.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-instant.d.ts +33 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-instant.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-instant.js +49 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-instant.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-liquid-stake.d.ts +33 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-liquid-stake.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-liquid-stake.js +49 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/release-liquid-stake.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/stake.d.ts +36 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/stake.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/stake.js +59 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/stake.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-instant-wallet.d.ts +36 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-instant-wallet.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-instant-wallet.js +57 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-instant-wallet.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-wallet.d.ts +36 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-wallet.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-wallet.js +57 -0
- package/dist/src/smart-contracts/use-cases/staking/transactions/update-wallet.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/types.d.ts +76 -0
- package/dist/src/smart-contracts/use-cases/staking/types.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/types.js +10 -0
- package/dist/src/smart-contracts/use-cases/staking/types.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/utils.d.ts +27 -0
- package/dist/src/smart-contracts/use-cases/staking/utils.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/staking/utils.js +44 -0
- package/dist/src/smart-contracts/use-cases/staking/utils.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/index.d.ts +26 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/index.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/index.js +107 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/index.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/resolve-indexer.d.ts +18 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/resolve-indexer.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/resolve-indexer.js +37 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/resolve-indexer.js.map +1 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/types.d.ts +126 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/types.d.ts.map +1 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/types.js +10 -0
- package/dist/src/smart-contracts/use-cases/third-party/vision-dynamics/smart-swap/types.js.map +1 -0
- package/dist/src/types/index.d.ts +240 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +110 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/validator-ops/index.d.ts +2 -0
- package/dist/src/validator-ops/index.d.ts.map +1 -0
- package/dist/src/validator-ops/index.js +2 -0
- package/dist/src/validator-ops/index.js.map +1 -0
- package/dist/src/validator-ops/transaction.d.ts +312 -0
- package/dist/src/validator-ops/transaction.d.ts.map +1 -0
- package/dist/src/validator-ops/transaction.js +416 -0
- package/dist/src/validator-ops/transaction.js.map +1 -0
- package/dist/src/vote/index.d.ts +5 -0
- package/dist/src/vote/index.d.ts.map +1 -0
- package/dist/src/vote/index.js +5 -0
- package/dist/src/vote/index.js.map +1 -0
- package/dist/src/vote/transaction.d.ts +70 -0
- package/dist/src/vote/transaction.d.ts.map +1 -0
- package/dist/src/vote/transaction.js +140 -0
- package/dist/src/vote/transaction.js.map +1 -0
- package/dist/src/wallet-creation/constants.d.ts +58 -0
- package/dist/src/wallet-creation/constants.d.ts.map +1 -0
- package/dist/src/wallet-creation/constants.js +113 -0
- package/dist/src/wallet-creation/constants.js.map +1 -0
- package/dist/src/wallet-creation/crypto-core.d.ts +178 -0
- package/dist/src/wallet-creation/crypto-core.d.ts.map +1 -0
- package/dist/src/wallet-creation/crypto-core.js +516 -0
- package/dist/src/wallet-creation/crypto-core.js.map +1 -0
- package/dist/src/wallet-creation/errors.d.ts +58 -0
- package/dist/src/wallet-creation/errors.d.ts.map +1 -0
- package/dist/src/wallet-creation/errors.js +89 -0
- package/dist/src/wallet-creation/errors.js.map +1 -0
- package/dist/src/wallet-creation/hash-utils.d.ts +38 -0
- package/dist/src/wallet-creation/hash-utils.d.ts.map +1 -0
- package/dist/src/wallet-creation/hash-utils.js +147 -0
- package/dist/src/wallet-creation/hash-utils.js.map +1 -0
- package/dist/src/wallet-creation/hd-utils.d.ts +45 -0
- package/dist/src/wallet-creation/hd-utils.d.ts.map +1 -0
- package/dist/src/wallet-creation/hd-utils.js +110 -0
- package/dist/src/wallet-creation/hd-utils.js.map +1 -0
- package/dist/src/wallet-creation/index.d.ts +11 -0
- package/dist/src/wallet-creation/index.d.ts.map +1 -0
- package/dist/src/wallet-creation/index.js +21 -0
- package/dist/src/wallet-creation/index.js.map +1 -0
- package/dist/src/wallet-creation/shared.d.ts +60 -0
- package/dist/src/wallet-creation/shared.d.ts.map +1 -0
- package/dist/src/wallet-creation/shared.js +127 -0
- package/dist/src/wallet-creation/shared.js.map +1 -0
- package/dist/src/wallet-creation/wallet-factory.d.ts +107 -0
- package/dist/src/wallet-creation/wallet-factory.d.ts.map +1 -0
- package/dist/src/wallet-creation/wallet-factory.js +298 -0
- package/dist/src/wallet-creation/wallet-factory.js.map +1 -0
- package/dist/wallet.d.ts +17 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +17 -0
- package/dist/wallet.js.map +1 -0
- package/package.json +129 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
/* global BroadcastChannel, MessageEvent, URLSearchParams */
|
|
2
|
+
/**
|
|
3
|
+
* Kalvora Wallet Adapter
|
|
4
|
+
*
|
|
5
|
+
* Framework-agnostic wallet connection manager for browser dApps. Handles:
|
|
6
|
+
* - Provider detection (the provider a compatible wallet app injects at
|
|
7
|
+
* `window[KALVORA_INJECTED_PROVIDER_KEY]`)
|
|
8
|
+
* - Deep-link redirect strategy for external browsers (Brave, Safari, Chrome)
|
|
9
|
+
* - Connection lifecycle (connect / disconnect / reconnect)
|
|
10
|
+
* - Produces a `KalvoraSigner` for use with `signAndFinalize()`
|
|
11
|
+
* - Event emission (connect, disconnect, error)
|
|
12
|
+
*
|
|
13
|
+
* @module adapter/wallet-adapter
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import {
|
|
18
|
+
* KalvoraWalletAdapter,
|
|
19
|
+
* buildVoteTXN,
|
|
20
|
+
* signAndFinalize,
|
|
21
|
+
* sendVoteTXN
|
|
22
|
+
* } from 'kalvora.js';
|
|
23
|
+
*
|
|
24
|
+
* const adapter = new KalvoraWalletAdapter();
|
|
25
|
+
* await adapter.connect();
|
|
26
|
+
*
|
|
27
|
+
* const txn = await buildVoteTXN(
|
|
28
|
+
* 'KALXvxhUMJERCse4e6b2jeXFkcqqpiUByQQckvPZm4szmF3Ao',
|
|
29
|
+
* proposalHash,
|
|
30
|
+
* adapter.publicKey!,
|
|
31
|
+
* { support: true, grpcConfig }
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* const signed = await signAndFinalize(txn, adapter.signer!);
|
|
35
|
+
* await sendVoteTXN(signed, grpcConfig);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import bs58 from 'bs58';
|
|
39
|
+
import { generateAddressFromPublicKey } from '../shared/crypto/address-utils.js';
|
|
40
|
+
import { KALVORA_ADAPTER_BROADCAST, KALVORA_ADAPTER_STORAGE_KEYS, KALVORA_DEEP_LINK_PARAMS, KALVORA_DEEP_LINK_SCHEME, KALVORA_DEFAULT_DEEP_LINK, KALVORA_INJECTED_PROVIDER_KEY, KALVORA_PROVIDER_FLAG, KALVORA_PROVIDER_METHODS } from './constants.js';
|
|
41
|
+
import { WalletSigner, DeepLinkSigner } from './wallet-signer.js';
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// CONSTANTS
|
|
44
|
+
// ============================================================================
|
|
45
|
+
const STORAGE_KEY = KALVORA_ADAPTER_STORAGE_KEYS.connection;
|
|
46
|
+
const PENDING_KEY = KALVORA_ADAPTER_STORAGE_KEYS.pendingConnect;
|
|
47
|
+
// URL param keys used in deep-link callback
|
|
48
|
+
const PARAM_RESULT = KALVORA_DEEP_LINK_PARAMS.result;
|
|
49
|
+
const PARAM_REQUEST_ID = KALVORA_DEEP_LINK_PARAMS.requestId;
|
|
50
|
+
const PARAM_ERROR = KALVORA_DEEP_LINK_PARAMS.error;
|
|
51
|
+
const PARAM_ADDRESS = KALVORA_DEEP_LINK_PARAMS.address;
|
|
52
|
+
// BroadcastChannel for cross-tab result forwarding
|
|
53
|
+
// When the wallet app redirects back (opening a new browser tab), the new tab
|
|
54
|
+
// broadcasts the result so the original tab can complete the connection.
|
|
55
|
+
const BROADCAST_CHANNEL = KALVORA_ADAPTER_BROADCAST.channel;
|
|
56
|
+
const CONNECT_REQUEST_TTL_MS = 10 * 60 * 1000;
|
|
57
|
+
const MAX_CLOCK_SKEW_MS = 60 * 1000;
|
|
58
|
+
function isValidWalletPublicKey(publicKey) {
|
|
59
|
+
if (typeof publicKey !== 'string')
|
|
60
|
+
return false;
|
|
61
|
+
const match = /^(?:r_)?([AB])_(?:(?:[abc])_)*([1-9A-HJ-NP-Za-km-z]+)$/u.exec(publicKey);
|
|
62
|
+
if (!match)
|
|
63
|
+
return false;
|
|
64
|
+
try {
|
|
65
|
+
const decoded = bs58.decode(match[2]);
|
|
66
|
+
return decoded.length === (match[1] === 'A' ? 32 : 57);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function resolveWalletAddress(publicKey, suppliedAddress) {
|
|
73
|
+
const derivedAddress = generateAddressFromPublicKey(publicKey);
|
|
74
|
+
if (suppliedAddress === undefined || suppliedAddress === null || suppliedAddress === '') {
|
|
75
|
+
return derivedAddress;
|
|
76
|
+
}
|
|
77
|
+
if (typeof suppliedAddress !== 'string' || suppliedAddress !== derivedAddress) {
|
|
78
|
+
throw new Error('Wallet returned an address that does not match its public key');
|
|
79
|
+
}
|
|
80
|
+
return suppliedAddress;
|
|
81
|
+
}
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// ADAPTER
|
|
84
|
+
// ============================================================================
|
|
85
|
+
/**
|
|
86
|
+
* Framework-agnostic wallet adapter for Kalvora dApps.
|
|
87
|
+
*
|
|
88
|
+
* **Two connection strategies:**
|
|
89
|
+
*
|
|
90
|
+
* 1. **Embedded** (wallet dApp browser) — detects the injected provider
|
|
91
|
+
* (`window[KALVORA_INJECTED_PROVIDER_KEY]`), auto-connects,
|
|
92
|
+
* signs via PostMessage bridge. Zero redirects.
|
|
93
|
+
*
|
|
94
|
+
* 2. **Deep-link redirect** (external browser — Brave, Safari, Chrome) — redirects
|
|
95
|
+
* to `<KALVORA_DEFAULT_DEEP_LINK>connect?callback=...`, any compatible wallet
|
|
96
|
+
* app shows approval, then redirects back with the result in the
|
|
97
|
+
* `KALVORA_DEEP_LINK_PARAMS.result` query parameter. Signing also uses
|
|
98
|
+
* deep-link round-trips.
|
|
99
|
+
*
|
|
100
|
+
* Works in any JavaScript framework — React, Vue, Svelte, vanilla JS, etc.
|
|
101
|
+
*/
|
|
102
|
+
export class KalvoraWalletAdapter {
|
|
103
|
+
constructor(config) {
|
|
104
|
+
// ── State ────────────────────────────────────────────────────────────
|
|
105
|
+
this._state = 'disconnected';
|
|
106
|
+
this._publicKey = null;
|
|
107
|
+
this._address = null;
|
|
108
|
+
this._signer = null;
|
|
109
|
+
this._provider = null;
|
|
110
|
+
this._connectionMode = null;
|
|
111
|
+
this._listeners = {};
|
|
112
|
+
this._broadcastChannel = null;
|
|
113
|
+
this._pendingSignResult = null;
|
|
114
|
+
this._config = {
|
|
115
|
+
autoConnect: config?.autoConnect ?? false,
|
|
116
|
+
deepLinkUrl: config?.deepLinkUrl ?? KALVORA_DEFAULT_DEEP_LINK,
|
|
117
|
+
signTimeout: config?.signTimeout ?? 5 * 60 * 1000,
|
|
118
|
+
callbackUrl: config?.callbackUrl ?? ''
|
|
119
|
+
};
|
|
120
|
+
// Check for deep-link callback result on page load
|
|
121
|
+
if (typeof window !== 'undefined') {
|
|
122
|
+
this._handleRedirectResult();
|
|
123
|
+
this._setupBroadcastListener();
|
|
124
|
+
}
|
|
125
|
+
if (this._config.autoConnect && typeof window !== 'undefined') {
|
|
126
|
+
this.connect().catch((err) => {
|
|
127
|
+
this._emit('error', err);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ── Public Getters ───────────────────────────────────────────────────
|
|
132
|
+
/** Current connection state */
|
|
133
|
+
get state() { return this._state; }
|
|
134
|
+
/** Whether the wallet is currently connected */
|
|
135
|
+
get connected() { return this._state === 'connected'; }
|
|
136
|
+
/** Connected wallet's public key (null if disconnected) */
|
|
137
|
+
get publicKey() { return this._publicKey; }
|
|
138
|
+
/** Connected wallet's display address (null if disconnected) */
|
|
139
|
+
get address() { return this._address; }
|
|
140
|
+
/**
|
|
141
|
+
* A `KalvoraSigner` bound to the connected wallet.
|
|
142
|
+
* Pass this to `signAndFinalize(txn, adapter.signer)`.
|
|
143
|
+
* Returns `null` if not connected.
|
|
144
|
+
*/
|
|
145
|
+
get signer() { return this._signer; }
|
|
146
|
+
/** The underlying injected wallet provider (null if using deep-link mode) */
|
|
147
|
+
get provider() { return this._provider; }
|
|
148
|
+
/** Whether connected through a wallet's dApp browser (injected provider) */
|
|
149
|
+
get isEmbedded() {
|
|
150
|
+
return this._connectionMode === 'embedded';
|
|
151
|
+
}
|
|
152
|
+
/** How the wallet is connected: 'embedded', 'deeplink', 'manual', or null */
|
|
153
|
+
get connectionMode() { return this._connectionMode; }
|
|
154
|
+
/**
|
|
155
|
+
* Consume a buffered sign result from a deep-link redirect.
|
|
156
|
+
* Returns the result and clears the buffer. Returns null if no pending result.
|
|
157
|
+
*
|
|
158
|
+
* This handles the timing race where the adapter processes the URL params
|
|
159
|
+
* in its constructor, before React components have mounted their event listeners.
|
|
160
|
+
*/
|
|
161
|
+
consumePendingSignResult() {
|
|
162
|
+
const result = this._pendingSignResult;
|
|
163
|
+
this._pendingSignResult = null;
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
// ── Static Helpers ───────────────────────────────────────────────────
|
|
167
|
+
/**
|
|
168
|
+
* Check if a Kalvora provider is available in the current environment.
|
|
169
|
+
* Returns true if `window[KALVORA_INJECTED_PROVIDER_KEY]` exists and
|
|
170
|
+
* identifies as a Kalvora wallet (`KALVORA_PROVIDER_FLAG` is `true`).
|
|
171
|
+
*/
|
|
172
|
+
static isAvailable() {
|
|
173
|
+
if (typeof window === 'undefined')
|
|
174
|
+
return false;
|
|
175
|
+
const provider = window[KALVORA_INJECTED_PROVIDER_KEY];
|
|
176
|
+
return provider?.[KALVORA_PROVIDER_FLAG] === true;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get a more detailed detection status for UI display.
|
|
180
|
+
*
|
|
181
|
+
* - `'injected'` — Running inside a wallet's dApp browser (injected provider found)
|
|
182
|
+
* - `'available'` — On a mobile device where deep-link connect will work
|
|
183
|
+
* - `'unknown'` — Desktop browser with no injected provider detected
|
|
184
|
+
*/
|
|
185
|
+
static getDetectionStatus() {
|
|
186
|
+
if (typeof window === 'undefined')
|
|
187
|
+
return 'unknown';
|
|
188
|
+
const provider = window[KALVORA_INJECTED_PROVIDER_KEY];
|
|
189
|
+
if (provider?.[KALVORA_PROVIDER_FLAG])
|
|
190
|
+
return 'injected';
|
|
191
|
+
// On mobile, deep link connection is always an option
|
|
192
|
+
if (typeof navigator !== 'undefined' && /android|iphone|ipad|ipod/i.test(navigator.userAgent)) {
|
|
193
|
+
return 'available';
|
|
194
|
+
}
|
|
195
|
+
return 'unknown';
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Truncate a public key for display: `"ed25519:9Xk3a...bY4f"`
|
|
199
|
+
*/
|
|
200
|
+
static truncateKey(key, prefixLen = 6, suffixLen = 4) {
|
|
201
|
+
if (key.length <= prefixLen + suffixLen + 3)
|
|
202
|
+
return key;
|
|
203
|
+
return `${key.slice(0, prefixLen)}...${key.slice(-suffixLen)}`;
|
|
204
|
+
}
|
|
205
|
+
// ── Connection Lifecycle ─────────────────────────────────────────────
|
|
206
|
+
/**
|
|
207
|
+
* Connect to the Kalvora wallet.
|
|
208
|
+
*
|
|
209
|
+
* **Strategy 1 — Embedded (injected provider available):**
|
|
210
|
+
* Calls `KALVORA_PROVIDER_METHODS.requestAccounts`, returns immediately with
|
|
211
|
+
* the public key.
|
|
212
|
+
*
|
|
213
|
+
* **Strategy 2 — Deep-link redirect (external browser):**
|
|
214
|
+
* Saves pending request to `sessionStorage`, navigates to
|
|
215
|
+
* `<deepLinkUrl>connect?callback=...`. The wallet app shows approval, then
|
|
216
|
+
* redirects back with `KALVORA_DEEP_LINK_PARAMS.result` to resolve the
|
|
217
|
+
* connection.
|
|
218
|
+
*
|
|
219
|
+
* **Manual fallback:**
|
|
220
|
+
* Call `connectManual(publicKey)` to connect with a known public key
|
|
221
|
+
* (view-only, signing requires deep-link round-trip).
|
|
222
|
+
*
|
|
223
|
+
* @returns The connected public key
|
|
224
|
+
*/
|
|
225
|
+
async connect() {
|
|
226
|
+
if (this._state === 'connected' && this._publicKey) {
|
|
227
|
+
return this._publicKey;
|
|
228
|
+
}
|
|
229
|
+
this._state = 'connecting';
|
|
230
|
+
// Strategy 1: Embedded (injected) provider
|
|
231
|
+
const provider = this._detectProvider();
|
|
232
|
+
if (provider) {
|
|
233
|
+
return this._connectViaProvider(provider);
|
|
234
|
+
}
|
|
235
|
+
// Strategy 2: Deep-link redirect (iOS, Android, external browsers)
|
|
236
|
+
return this._connectViaDeepLink();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Connect with a known public key (view-only mode).
|
|
240
|
+
* Signing will use deep-link round-trips through a compatible wallet app.
|
|
241
|
+
*/
|
|
242
|
+
connectManual(publicKey) {
|
|
243
|
+
if (!isValidWalletPublicKey(publicKey)) {
|
|
244
|
+
throw new Error('publicKey must be a valid Kalvora public key identifier');
|
|
245
|
+
}
|
|
246
|
+
this._publicKey = publicKey;
|
|
247
|
+
this._address = resolveWalletAddress(publicKey);
|
|
248
|
+
this._connectionMode = 'manual';
|
|
249
|
+
this._signer = new DeepLinkSigner(publicKey, this._config.deepLinkUrl, this._getCallbackUrl());
|
|
250
|
+
this._state = 'connected';
|
|
251
|
+
this._persistConnection();
|
|
252
|
+
this._emit('connect', { publicKey, address: this._address, mode: 'manual' });
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Disconnect from the wallet and clear all state.
|
|
256
|
+
*/
|
|
257
|
+
async disconnect() {
|
|
258
|
+
if (this._provider) {
|
|
259
|
+
try {
|
|
260
|
+
await this._provider.request(KALVORA_PROVIDER_METHODS.disconnect, {});
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
// Ignore disconnect errors
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
this._publicKey = null;
|
|
267
|
+
this._address = null;
|
|
268
|
+
this._signer = null;
|
|
269
|
+
this._provider = null;
|
|
270
|
+
this._connectionMode = null;
|
|
271
|
+
this._state = 'disconnected';
|
|
272
|
+
this._clearPersistence();
|
|
273
|
+
this._emit('disconnect');
|
|
274
|
+
}
|
|
275
|
+
// ── Event Emitter ────────────────────────────────────────────────────
|
|
276
|
+
/** Subscribe to adapter events */
|
|
277
|
+
on(event, handler) {
|
|
278
|
+
const list = this._listeners[event] ?? (this._listeners[event] = []);
|
|
279
|
+
list.push(handler);
|
|
280
|
+
}
|
|
281
|
+
/** Unsubscribe from adapter events */
|
|
282
|
+
off(event, handler) {
|
|
283
|
+
const handlers = this._listeners[event];
|
|
284
|
+
if (!handlers)
|
|
285
|
+
return;
|
|
286
|
+
this._listeners[event] = handlers.filter(h => h !== handler);
|
|
287
|
+
}
|
|
288
|
+
// ── Convenience Methods ──────────────────────────────────────────────
|
|
289
|
+
/**
|
|
290
|
+
* Generate a deep link to open a URL in a compatible wallet's dApp browser.
|
|
291
|
+
*/
|
|
292
|
+
getDeepLink(targetUrl) {
|
|
293
|
+
const url = targetUrl ?? (typeof window !== 'undefined' ? window.location.href : '');
|
|
294
|
+
return `${this._config.deepLinkUrl}browse?url=${encodeURIComponent(url)}`;
|
|
295
|
+
}
|
|
296
|
+
// ── Private: Connection Strategies ───────────────────────────────────
|
|
297
|
+
/** Strategy 1: Connect via the detected injected provider */
|
|
298
|
+
async _connectViaProvider(provider) {
|
|
299
|
+
this._provider = provider;
|
|
300
|
+
this._setupProviderListeners(provider);
|
|
301
|
+
try {
|
|
302
|
+
const result = await provider.request(KALVORA_PROVIDER_METHODS.requestAccounts, {});
|
|
303
|
+
const accounts = Array.isArray(result) ? result : result?.accounts ?? [];
|
|
304
|
+
// Parse optional addresses array (wallet app provides actual wallet address)
|
|
305
|
+
const addresses = !Array.isArray(result) ? result?.addresses ?? [] : [];
|
|
306
|
+
if (!accounts.length) {
|
|
307
|
+
throw new Error('No accounts returned from wallet');
|
|
308
|
+
}
|
|
309
|
+
const publicKey = accounts[0];
|
|
310
|
+
const address = addresses[0];
|
|
311
|
+
if (!isValidWalletPublicKey(publicKey)) {
|
|
312
|
+
throw new Error('Wallet provider returned an invalid Kalvora public key');
|
|
313
|
+
}
|
|
314
|
+
const verifiedAddress = resolveWalletAddress(publicKey, address);
|
|
315
|
+
this._publicKey = publicKey;
|
|
316
|
+
this._address = verifiedAddress;
|
|
317
|
+
this._signer = new WalletSigner(publicKey, provider);
|
|
318
|
+
this._connectionMode = 'embedded';
|
|
319
|
+
this._state = 'connected';
|
|
320
|
+
this._persistConnection();
|
|
321
|
+
this._emit('connect', { publicKey, address: this._address, mode: 'embedded' });
|
|
322
|
+
return publicKey;
|
|
323
|
+
}
|
|
324
|
+
catch (err) {
|
|
325
|
+
this._state = 'disconnected';
|
|
326
|
+
this._emit('error', err);
|
|
327
|
+
throw err;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Helper to format deep links. On Android Chrome, `window.location.href='scheme://'`
|
|
332
|
+
* is often blocked. We must use the `intent://` fallback syntax for reliable routing.
|
|
333
|
+
*/
|
|
334
|
+
_formatDeepLink(action, params) {
|
|
335
|
+
const isAndroid = typeof navigator !== 'undefined' && /android/i.test(navigator.userAgent);
|
|
336
|
+
const base = this._config.deepLinkUrl;
|
|
337
|
+
if (isAndroid && base.startsWith(KALVORA_DEFAULT_DEEP_LINK)) {
|
|
338
|
+
// Adding sdk_redirect_caller_package helps VisionHub bounce back to the same browser on Android
|
|
339
|
+
// Note: In Chrome, we can't reliably read the own package name without native code,
|
|
340
|
+
// but passing "com.android.chrome" as a best-effort default covers 90% of Android users.
|
|
341
|
+
if (!params.has('sdk_redirect_caller_package')) {
|
|
342
|
+
params.append('sdk_redirect_caller_package', 'com.android.chrome');
|
|
343
|
+
}
|
|
344
|
+
return `intent://${action}?${params.toString()}#Intent;scheme=${KALVORA_DEEP_LINK_SCHEME};package=com.visiondynamics.visionhub;end`;
|
|
345
|
+
}
|
|
346
|
+
return `${base}${action}?${params.toString()}`;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Strategy 2: Connect via deep-link redirect to a compatible wallet app.
|
|
350
|
+
*
|
|
351
|
+
* Saves a pending request to sessionStorage and navigates to
|
|
352
|
+
* `<deepLinkUrl>connect?callback=...&requestId=...`.
|
|
353
|
+
*
|
|
354
|
+
* This will cause a full page navigation. When the wallet redirects back,
|
|
355
|
+
* the constructor's `_handleRedirectResult()` reads the params and
|
|
356
|
+
* completes the connection.
|
|
357
|
+
*
|
|
358
|
+
* @returns Never (page navigates away). Throws if sessionStorage unavailable.
|
|
359
|
+
*/
|
|
360
|
+
async _connectViaDeepLink() {
|
|
361
|
+
if (typeof sessionStorage === 'undefined') {
|
|
362
|
+
this._state = 'disconnected';
|
|
363
|
+
throw new Error('No Kalvora wallet provider found and sessionStorage is unavailable. ' +
|
|
364
|
+
'Open this page in a compatible wallet\'s dApp browser.');
|
|
365
|
+
}
|
|
366
|
+
const requestId = this._generateRequestId();
|
|
367
|
+
const callbackUrl = this._getCallbackUrl();
|
|
368
|
+
// Save pending state so we can pick it up when the wallet redirects back
|
|
369
|
+
sessionStorage.setItem(PENDING_KEY, JSON.stringify({
|
|
370
|
+
type: 'connect',
|
|
371
|
+
requestId,
|
|
372
|
+
callbackUrl,
|
|
373
|
+
timestamp: Date.now()
|
|
374
|
+
}));
|
|
375
|
+
// Redirect to wallet app
|
|
376
|
+
const params = new URLSearchParams({
|
|
377
|
+
callback: callbackUrl,
|
|
378
|
+
requestId: requestId
|
|
379
|
+
});
|
|
380
|
+
const deepLink = this._formatDeepLink('connect', params);
|
|
381
|
+
// Use assign for slightly better reliability in some browsers
|
|
382
|
+
window.location.assign(deepLink);
|
|
383
|
+
// This promise never resolves (page navigates away).
|
|
384
|
+
// The connection completes via _handleRedirectResult on the next page load.
|
|
385
|
+
return new Promise(() => { });
|
|
386
|
+
}
|
|
387
|
+
// ── Private: Deep-Link Redirect Handling ─────────────────────────────
|
|
388
|
+
/**
|
|
389
|
+
* Called on page load (constructor). Checks the URL for
|
|
390
|
+
* `KALVORA_DEEP_LINK_PARAMS` values from a wallet deep-link redirect, restores state from
|
|
391
|
+
* sessionStorage, and completes the pending operation.
|
|
392
|
+
*/
|
|
393
|
+
_handleRedirectResult() {
|
|
394
|
+
if (typeof window === 'undefined')
|
|
395
|
+
return;
|
|
396
|
+
const url = new URL(window.location.href);
|
|
397
|
+
const result = url.searchParams.get(PARAM_RESULT);
|
|
398
|
+
const requestId = url.searchParams.get(PARAM_REQUEST_ID);
|
|
399
|
+
const error = url.searchParams.get(PARAM_ERROR);
|
|
400
|
+
// No deep-link result params? Try restoring from persistence.
|
|
401
|
+
if (!result && !error) {
|
|
402
|
+
this._restoreConnection();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const isSignCallback = requestId?.startsWith('zr_sign_') === true
|
|
406
|
+
|| requestId?.startsWith('zr_msg_') === true;
|
|
407
|
+
if (isSignCallback) {
|
|
408
|
+
this._restoreConnection();
|
|
409
|
+
try {
|
|
410
|
+
const signResult = DeepLinkSigner.checkSignResult(this._config.signTimeout);
|
|
411
|
+
if (signResult) {
|
|
412
|
+
this._pendingSignResult = signResult;
|
|
413
|
+
setTimeout(() => this._emit('signResult', signResult), 0);
|
|
414
|
+
}
|
|
415
|
+
else if (requestId && result) {
|
|
416
|
+
// A wallet may open the callback in a new tab. Forward the encoded
|
|
417
|
+
// result; only the tab owning the exact pending request may consume it.
|
|
418
|
+
this._broadcastMessage({ type: KALVORA_ADAPTER_BROADCAST.signResult, encodedResult: result, requestId });
|
|
419
|
+
}
|
|
420
|
+
else if (requestId && error) {
|
|
421
|
+
this._broadcastMessage({ type: KALVORA_ADAPTER_BROADCAST.signError, message: error, requestId });
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
catch (err) {
|
|
425
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
426
|
+
setTimeout(() => this._emit('signError', err), 0);
|
|
427
|
+
this._broadcastMessage({ type: KALVORA_ADAPTER_BROADCAST.signError, message: errMsg, requestId });
|
|
428
|
+
}
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const correlated = this._validatePendingConnectRequest(requestId, false);
|
|
432
|
+
if (!correlated) {
|
|
433
|
+
// New-tab callbacks can only forward a correlated request identifier.
|
|
434
|
+
// The initiating tab independently validates and consumes its pending
|
|
435
|
+
// session record before accepting this message.
|
|
436
|
+
if (requestId && result) {
|
|
437
|
+
const forwardedPublicKey = result;
|
|
438
|
+
if (isValidWalletPublicKey(forwardedPublicKey)) {
|
|
439
|
+
const addressParam = url.searchParams.get(PARAM_ADDRESS);
|
|
440
|
+
const address = addressParam || null;
|
|
441
|
+
this._broadcastMessage({
|
|
442
|
+
type: KALVORA_ADAPTER_BROADCAST.connectResult,
|
|
443
|
+
publicKey: forwardedPublicKey,
|
|
444
|
+
address,
|
|
445
|
+
requestId
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
else if (requestId && error) {
|
|
450
|
+
this._broadcastMessage({ type: KALVORA_ADAPTER_BROADCAST.connectError, message: error, requestId });
|
|
451
|
+
}
|
|
452
|
+
this._cleanUrl();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
// A correlated callback is single-use even if its payload is malformed.
|
|
456
|
+
this._validatePendingConnectRequest(requestId, true);
|
|
457
|
+
this._cleanUrl();
|
|
458
|
+
if (error) {
|
|
459
|
+
const errObj = new Error(error);
|
|
460
|
+
this._emit('error', errObj);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const publicKey = result;
|
|
464
|
+
if (!isValidWalletPublicKey(publicKey)) {
|
|
465
|
+
this._emit('error', new Error('Wallet returned an invalid Kalvora public key'));
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const addressParam = url.searchParams.get(PARAM_ADDRESS);
|
|
469
|
+
const suppliedAddress = addressParam || null;
|
|
470
|
+
let address;
|
|
471
|
+
try {
|
|
472
|
+
address = resolveWalletAddress(publicKey, suppliedAddress);
|
|
473
|
+
}
|
|
474
|
+
catch (err) {
|
|
475
|
+
this._emit('error', err);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this._publicKey = publicKey;
|
|
479
|
+
this._address = address;
|
|
480
|
+
this._connectionMode = 'deeplink';
|
|
481
|
+
this._signer = new DeepLinkSigner(publicKey, this._config.deepLinkUrl, this._getCallbackUrl());
|
|
482
|
+
this._state = 'connected';
|
|
483
|
+
this._persistConnection();
|
|
484
|
+
setTimeout(() => this._emit('connect', { publicKey, address, mode: 'deeplink' }), 0);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Clean the deep-link callback params from the URL without triggering a page reload.
|
|
488
|
+
*/
|
|
489
|
+
_cleanUrl() {
|
|
490
|
+
if (typeof window === 'undefined')
|
|
491
|
+
return;
|
|
492
|
+
const url = new URL(window.location.href);
|
|
493
|
+
url.searchParams.delete(PARAM_RESULT);
|
|
494
|
+
url.searchParams.delete(PARAM_REQUEST_ID);
|
|
495
|
+
url.searchParams.delete(PARAM_ERROR);
|
|
496
|
+
url.searchParams.delete(PARAM_ADDRESS);
|
|
497
|
+
window.history.replaceState({}, '', url.toString());
|
|
498
|
+
}
|
|
499
|
+
// ── Private: Persistence ─────────────────────────────────────────────
|
|
500
|
+
_persistConnection() {
|
|
501
|
+
try {
|
|
502
|
+
if (!this._publicKey)
|
|
503
|
+
return;
|
|
504
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify({
|
|
505
|
+
publicKey: this._publicKey,
|
|
506
|
+
address: this._address,
|
|
507
|
+
mode: this._connectionMode
|
|
508
|
+
}));
|
|
509
|
+
}
|
|
510
|
+
catch { /* localStorage unavailable (iOS WebView) */ }
|
|
511
|
+
}
|
|
512
|
+
_clearPersistence() {
|
|
513
|
+
try {
|
|
514
|
+
localStorage?.removeItem(STORAGE_KEY);
|
|
515
|
+
}
|
|
516
|
+
catch { /* ignore */ }
|
|
517
|
+
try {
|
|
518
|
+
sessionStorage?.removeItem(PENDING_KEY);
|
|
519
|
+
}
|
|
520
|
+
catch { /* ignore */ }
|
|
521
|
+
}
|
|
522
|
+
_restoreConnection() {
|
|
523
|
+
try {
|
|
524
|
+
const stored = localStorage?.getItem(STORAGE_KEY);
|
|
525
|
+
if (!stored)
|
|
526
|
+
return;
|
|
527
|
+
const { publicKey, address, mode } = JSON.parse(stored);
|
|
528
|
+
if (!publicKey)
|
|
529
|
+
return;
|
|
530
|
+
// Reject malformed or non-canonical keys before restoring signer state.
|
|
531
|
+
if (!isValidWalletPublicKey(publicKey)) {
|
|
532
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
let verifiedAddress;
|
|
536
|
+
try {
|
|
537
|
+
verifiedAddress = resolveWalletAddress(publicKey, address);
|
|
538
|
+
}
|
|
539
|
+
catch {
|
|
540
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
this._publicKey = publicKey;
|
|
544
|
+
this._address = verifiedAddress;
|
|
545
|
+
this._connectionMode = mode ?? 'manual';
|
|
546
|
+
// Always try to detect the embedded provider first, regardless of
|
|
547
|
+
// the stored mode. If the page was previously connected via deep-link
|
|
548
|
+
// (because the injected provider wasn't available at connect time, e.g. timing),
|
|
549
|
+
// but it IS available now, upgrade to embedded mode for seamless signing.
|
|
550
|
+
const provider = this._detectProvider();
|
|
551
|
+
if (provider) {
|
|
552
|
+
this._provider = provider;
|
|
553
|
+
this._setupProviderListeners(provider);
|
|
554
|
+
this._connectionMode = 'embedded';
|
|
555
|
+
this._signer = new WalletSigner(publicKey, provider);
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
// No embedded provider — use deep-link signer
|
|
559
|
+
this._connectionMode = mode === 'embedded' ? 'deeplink' : (mode ?? 'manual');
|
|
560
|
+
this._signer = new DeepLinkSigner(publicKey, this._config.deepLinkUrl, this._getCallbackUrl());
|
|
561
|
+
}
|
|
562
|
+
this._state = 'connected';
|
|
563
|
+
this._emit('connect', { publicKey, address: this._address, mode: this._connectionMode });
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
// Corrupt storage or localStorage unavailable — ignore
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
// ── Private: Cross-Tab Bridge ──────────────────────────────────────
|
|
570
|
+
/**
|
|
571
|
+
* Listen for wallet connect results from other tabs.
|
|
572
|
+
* When the wallet app redirects to a NEW tab, the new tab broadcasts the
|
|
573
|
+
* result here so the original tab can complete the connection seamlessly.
|
|
574
|
+
*/
|
|
575
|
+
_setupBroadcastListener() {
|
|
576
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
577
|
+
return;
|
|
578
|
+
try {
|
|
579
|
+
this._broadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL);
|
|
580
|
+
this._broadcastChannel.onmessage = (event) => {
|
|
581
|
+
const data = event.data;
|
|
582
|
+
if (!data)
|
|
583
|
+
return;
|
|
584
|
+
if (data.type === KALVORA_ADAPTER_BROADCAST.connectResult) {
|
|
585
|
+
// Don't process if already connected
|
|
586
|
+
if (this._state === 'connected')
|
|
587
|
+
return;
|
|
588
|
+
const { publicKey, address, requestId } = data;
|
|
589
|
+
if (!isValidWalletPublicKey(publicKey)
|
|
590
|
+
|| typeof requestId !== 'string'
|
|
591
|
+
|| !this._validatePendingConnectRequest(requestId, true))
|
|
592
|
+
return;
|
|
593
|
+
let verifiedAddress;
|
|
594
|
+
try {
|
|
595
|
+
verifiedAddress = resolveWalletAddress(publicKey, address);
|
|
596
|
+
}
|
|
597
|
+
catch {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
this._publicKey = publicKey;
|
|
601
|
+
this._address = verifiedAddress;
|
|
602
|
+
this._connectionMode = 'deeplink';
|
|
603
|
+
this._signer = new DeepLinkSigner(publicKey, this._config.deepLinkUrl, this._getCallbackUrl());
|
|
604
|
+
this._state = 'connected';
|
|
605
|
+
this._persistConnection();
|
|
606
|
+
this._emit('connect', { publicKey, address: verifiedAddress, mode: 'deeplink' });
|
|
607
|
+
}
|
|
608
|
+
else if (data.type === KALVORA_ADAPTER_BROADCAST.connectError) {
|
|
609
|
+
if (this._state === 'connected')
|
|
610
|
+
return;
|
|
611
|
+
const { requestId, message } = data;
|
|
612
|
+
if (typeof requestId !== 'string'
|
|
613
|
+
|| typeof message !== 'string'
|
|
614
|
+
|| !this._validatePendingConnectRequest(requestId, true))
|
|
615
|
+
return;
|
|
616
|
+
this._emit('error', new Error(message));
|
|
617
|
+
}
|
|
618
|
+
else if (data.type === KALVORA_ADAPTER_BROADCAST.signResult) {
|
|
619
|
+
const { encodedResult, requestId } = data;
|
|
620
|
+
if (typeof encodedResult !== 'string' || typeof requestId !== 'string')
|
|
621
|
+
return;
|
|
622
|
+
try {
|
|
623
|
+
const signResult = DeepLinkSigner.consumeBroadcastResult(encodedResult, requestId, this._config.signTimeout);
|
|
624
|
+
if (!signResult)
|
|
625
|
+
return;
|
|
626
|
+
this._pendingSignResult = signResult;
|
|
627
|
+
this._emit('signResult', signResult);
|
|
628
|
+
}
|
|
629
|
+
catch (err) {
|
|
630
|
+
this._emit('signError', err);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else if (data.type === KALVORA_ADAPTER_BROADCAST.signError) {
|
|
634
|
+
const { requestId, message } = data;
|
|
635
|
+
if (typeof requestId !== 'string'
|
|
636
|
+
|| typeof message !== 'string'
|
|
637
|
+
|| !DeepLinkSigner.consumeBroadcastError(requestId, this._config.signTimeout))
|
|
638
|
+
return;
|
|
639
|
+
this._emit('signError', new Error(message));
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
catch {
|
|
644
|
+
// BroadcastChannel not supported — fall back to normal redirect flow
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Broadcast a message to other tabs and attempt to close this
|
|
649
|
+
* (redirect) tab so the user returns to their original tab.
|
|
650
|
+
*/
|
|
651
|
+
_broadcastMessage(msg) {
|
|
652
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
653
|
+
return;
|
|
654
|
+
try {
|
|
655
|
+
const bc = new BroadcastChannel(BROADCAST_CHANNEL);
|
|
656
|
+
bc.postMessage(msg);
|
|
657
|
+
bc.close();
|
|
658
|
+
// Try to close this duplicate tab.
|
|
659
|
+
// window.close() works on mobile Safari/Chrome in most cases when the
|
|
660
|
+
// tab was opened by the OS via deep-link redirect (not user-initiated).
|
|
661
|
+
setTimeout(() => {
|
|
662
|
+
try {
|
|
663
|
+
window.close();
|
|
664
|
+
}
|
|
665
|
+
catch { /* ignore */ }
|
|
666
|
+
}, 300);
|
|
667
|
+
}
|
|
668
|
+
catch {
|
|
669
|
+
// BroadcastChannel not supported — user will just stay in the new tab
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
// ── Private: Helpers ─────────────────────────────────────────────────
|
|
673
|
+
_validatePendingConnectRequest(requestId, consume) {
|
|
674
|
+
if (!requestId)
|
|
675
|
+
return false;
|
|
676
|
+
try {
|
|
677
|
+
const pendingJson = sessionStorage?.getItem(PENDING_KEY);
|
|
678
|
+
if (!pendingJson)
|
|
679
|
+
return false;
|
|
680
|
+
let pending;
|
|
681
|
+
try {
|
|
682
|
+
pending = JSON.parse(pendingJson);
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
sessionStorage.removeItem(PENDING_KEY);
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
const validShape = pending.type === 'connect'
|
|
689
|
+
&& typeof pending.requestId === 'string'
|
|
690
|
+
&& pending.requestId.length > 0
|
|
691
|
+
&& typeof pending.timestamp === 'number'
|
|
692
|
+
&& Number.isFinite(pending.timestamp);
|
|
693
|
+
if (!validShape) {
|
|
694
|
+
sessionStorage.removeItem(PENDING_KEY);
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
const ageMs = Date.now() - pending.timestamp;
|
|
698
|
+
if (ageMs > CONNECT_REQUEST_TTL_MS || ageMs < -MAX_CLOCK_SKEW_MS) {
|
|
699
|
+
sessionStorage.removeItem(PENDING_KEY);
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
if (pending.requestId !== requestId)
|
|
703
|
+
return false;
|
|
704
|
+
if (consume)
|
|
705
|
+
sessionStorage.removeItem(PENDING_KEY);
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
catch {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Bind native event listeners to the injected provider so the adapter React State
|
|
714
|
+
* organically reacts to background disconnections and auto-connections natively.
|
|
715
|
+
*/
|
|
716
|
+
_setupProviderListeners(provider) {
|
|
717
|
+
if (typeof provider.on !== 'function')
|
|
718
|
+
return;
|
|
719
|
+
provider.on('connect', (...args) => {
|
|
720
|
+
const info = args[0];
|
|
721
|
+
if (!info)
|
|
722
|
+
return;
|
|
723
|
+
// Don't emit if already connected to this exact key
|
|
724
|
+
if (this._state === 'connected' && this._publicKey === info.publicKey)
|
|
725
|
+
return;
|
|
726
|
+
if (isValidWalletPublicKey(info.publicKey)) {
|
|
727
|
+
let verifiedAddress;
|
|
728
|
+
try {
|
|
729
|
+
verifiedAddress = resolveWalletAddress(info.publicKey, info.address);
|
|
730
|
+
}
|
|
731
|
+
catch (err) {
|
|
732
|
+
this._emit('error', err);
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
this._publicKey = info.publicKey;
|
|
736
|
+
this._address = verifiedAddress;
|
|
737
|
+
this._connectionMode = 'embedded';
|
|
738
|
+
this._signer = new WalletSigner(info.publicKey, provider);
|
|
739
|
+
this._state = 'connected';
|
|
740
|
+
this._persistConnection();
|
|
741
|
+
this._emit('connect', { publicKey: info.publicKey, address: verifiedAddress, mode: 'embedded' });
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
provider.on('disconnect', () => {
|
|
745
|
+
if (this._state === 'disconnected')
|
|
746
|
+
return;
|
|
747
|
+
this._publicKey = null;
|
|
748
|
+
this._address = null;
|
|
749
|
+
this._signer = null;
|
|
750
|
+
this._connectionMode = null;
|
|
751
|
+
this._state = 'disconnected';
|
|
752
|
+
this._clearPersistence();
|
|
753
|
+
this._emit('disconnect');
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
_detectProvider() {
|
|
757
|
+
if (typeof window === 'undefined')
|
|
758
|
+
return null;
|
|
759
|
+
const win = window;
|
|
760
|
+
const provider = win[KALVORA_INJECTED_PROVIDER_KEY];
|
|
761
|
+
if (provider?.[KALVORA_PROVIDER_FLAG])
|
|
762
|
+
return provider;
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
_getCallbackUrl() {
|
|
766
|
+
if (this._config.callbackUrl)
|
|
767
|
+
return this._config.callbackUrl;
|
|
768
|
+
if (typeof window === 'undefined')
|
|
769
|
+
return '';
|
|
770
|
+
// Strip existing deep-link callback params from current URL
|
|
771
|
+
const url = new URL(window.location.href);
|
|
772
|
+
url.searchParams.delete(PARAM_RESULT);
|
|
773
|
+
url.searchParams.delete(PARAM_REQUEST_ID);
|
|
774
|
+
url.searchParams.delete(PARAM_ERROR);
|
|
775
|
+
return url.toString();
|
|
776
|
+
}
|
|
777
|
+
_generateRequestId() {
|
|
778
|
+
return `zr_${crypto.randomUUID().replace(/-/g, '')}`;
|
|
779
|
+
}
|
|
780
|
+
_emit(event, ...args) {
|
|
781
|
+
const handlers = this._listeners[event];
|
|
782
|
+
if (!handlers)
|
|
783
|
+
return;
|
|
784
|
+
for (const handler of handlers) {
|
|
785
|
+
try {
|
|
786
|
+
handler(...args);
|
|
787
|
+
}
|
|
788
|
+
catch { /* swallow listener errors */ }
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
//# sourceMappingURL=wallet-adapter.js.map
|