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,416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction Module - Validator Operator Transactions
|
|
3
|
+
*
|
|
4
|
+
* Builds, signs, and submits the two transactions a validator *operator*
|
|
5
|
+
* sends to the network about their own node:
|
|
6
|
+
*
|
|
7
|
+
* - `ValidatorRegistration` — register (or deregister) a validator node.
|
|
8
|
+
* Carries the node's {@link Validator} record plus a second, node-generated
|
|
9
|
+
* key pair that co-signs the transaction hash.
|
|
10
|
+
* - `ValidatorHeartbeat` — periodic liveness/version report.
|
|
11
|
+
*
|
|
12
|
+
* Unlike most transactions these are **not** submitted through `TXNService`;
|
|
13
|
+
* they go to `kal_validator.ValidatorService` (rpcs `ValidatorRegistration`
|
|
14
|
+
* and `ValidatorHeartbeat`).
|
|
15
|
+
*
|
|
16
|
+
* Envelope handling (nonce, `BaseTXN`, fee) is delegated to the shared
|
|
17
|
+
* standard transaction pipeline in `shared/tx/standard`.
|
|
18
|
+
*
|
|
19
|
+
* ## Generated-key signature — protocol assumption
|
|
20
|
+
*
|
|
21
|
+
* The proto comment for `ValidatorRegistration.generated_signature` reads
|
|
22
|
+
* "signature of the generated public key (signing txn hash)". This module
|
|
23
|
+
* therefore computes it **after** the operator has signed, as
|
|
24
|
+
* `sign(generatedPrivateKey, base.hash)`, where `base.hash` is the SHA3-256
|
|
25
|
+
* hash produced by operator signing (with `generated_signature` still empty).
|
|
26
|
+
* `generated_signature` is consequently **not** covered by `base.signature`
|
|
27
|
+
* or `base.hash`.
|
|
28
|
+
*
|
|
29
|
+
* The exact verification order used by validators has not been verified
|
|
30
|
+
* against the node implementation. If it differs, use the lower-level
|
|
31
|
+
* {@link buildValidatorRegistrationTXN} + `signWithKey` +
|
|
32
|
+
* {@link attachGeneratedSignature} (or your own signing) to adapt.
|
|
33
|
+
*
|
|
34
|
+
* @module validator-ops/transaction
|
|
35
|
+
*/
|
|
36
|
+
import { create } from '@bufbuild/protobuf';
|
|
37
|
+
import { PublicKeySchema, ValidatorHeartbeatSchema, ValidatorRegistrationSchema, ValidatorSchema } from '../../proto/generated/txn_pb.js';
|
|
38
|
+
import { ValidatorService } from '../../proto/generated/validator_pb.js';
|
|
39
|
+
import { createClient } from '../grpc/client-factory.js';
|
|
40
|
+
import { getKeyTypeFromPublicKey, getPublicKeyBytes, isValidPublicKeyIdentifier } from '../shared/crypto/address-utils.js';
|
|
41
|
+
import { KEY_TYPE } from '../shared/crypto/constants.js';
|
|
42
|
+
import { signTransactionData } from '../shared/crypto/signature-utils.js';
|
|
43
|
+
import { buildStandardTransaction, parseUint64, toTimestampInit } from '../shared/tx/standard.js';
|
|
44
|
+
import { bytesEqual, bytesToHex } from '../shared/utils/byte-utils.js';
|
|
45
|
+
import { signWithKey } from '../sign/finalize.js';
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// VALIDATION HELPERS
|
|
48
|
+
// ============================================================================
|
|
49
|
+
const UINT32_MAX = 4294967295;
|
|
50
|
+
function requireObject(value, message) {
|
|
51
|
+
if (value === null || typeof value !== 'object') {
|
|
52
|
+
throw new Error(message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function requireBoolean(value, field) {
|
|
56
|
+
if (typeof value !== 'boolean') {
|
|
57
|
+
throw new Error(`${field} must be a boolean`);
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function parseHost(value) {
|
|
62
|
+
if (typeof value !== 'string' || !/^\S+$/u.test(value)) {
|
|
63
|
+
throw new Error('validator.host must be a non-empty string without whitespace');
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
function parsePort(value, field) {
|
|
68
|
+
let digits;
|
|
69
|
+
if (typeof value === 'number' && Number.isInteger(value))
|
|
70
|
+
digits = String(value);
|
|
71
|
+
else if (typeof value === 'string' && /^\d{1,5}$/u.test(value))
|
|
72
|
+
digits = value;
|
|
73
|
+
const port = digits === undefined ? Number.NaN : Number(digits);
|
|
74
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
75
|
+
throw new Error(`${field} must be a port number between 1 and 65535`);
|
|
76
|
+
}
|
|
77
|
+
return String(port);
|
|
78
|
+
}
|
|
79
|
+
function parseUint32(value, field) {
|
|
80
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 0 || value > UINT32_MAX) {
|
|
81
|
+
throw new Error(`${field} must be an unsigned 32-bit integer`);
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
function rejectStakedContractIds(value) {
|
|
86
|
+
if (value !== undefined) {
|
|
87
|
+
throw new Error('validator.stakedContractIds is no longer part of the Kalvora protocol ' +
|
|
88
|
+
'(Validator field 5 is reserved; staking is KALV-only) - remove it');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function requirePublicKeyId(value, field) {
|
|
92
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
93
|
+
throw new Error(`${field} identifier is required`);
|
|
94
|
+
}
|
|
95
|
+
if (!isValidPublicKeyIdentifier(value)) {
|
|
96
|
+
throw new Error(`${field} is not a valid Kalvora public key identifier`);
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
function requirePrivateKey(value, field) {
|
|
101
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
102
|
+
throw new Error(`${field} is required`);
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
function buildValidatorRecord(input, operatorPublicKey) {
|
|
107
|
+
requireObject(input, 'validator object is required');
|
|
108
|
+
const publicKeyId = requirePublicKeyId(input.publicKey ?? operatorPublicKey, 'validator.publicKey');
|
|
109
|
+
rejectStakedContractIds(input.stakedContractIds);
|
|
110
|
+
return create(ValidatorSchema, {
|
|
111
|
+
publicKey: { single: getPublicKeyBytes(publicKeyId) },
|
|
112
|
+
host: parseHost(input.host),
|
|
113
|
+
clientPort: parsePort(input.clientPort, 'validator.clientPort'),
|
|
114
|
+
validatorPort: parsePort(input.validatorPort, 'validator.validatorPort'),
|
|
115
|
+
benchmark: input.benchmark === undefined ? 0n : parseUint64(input.benchmark, 'validator.benchmark'),
|
|
116
|
+
timestamp: toTimestampInit(input.timestamp ?? new Date(), 'validator.timestamp'),
|
|
117
|
+
lite: input.lite === undefined ? false : requireBoolean(input.lite, 'validator.lite'),
|
|
118
|
+
online: input.online === undefined ? false : requireBoolean(input.online, 'validator.online'),
|
|
119
|
+
version: input.version === undefined ? 0 : parseUint32(input.version, 'validator.version'),
|
|
120
|
+
lastHeartbeat: input.lastHeartbeat === undefined
|
|
121
|
+
? 0n
|
|
122
|
+
: parseUint64(input.lastHeartbeat, 'validator.lastHeartbeat')
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function requireSigned(txn) {
|
|
126
|
+
const base = txn?.base;
|
|
127
|
+
if (!base?.signature || base.signature.length === 0 || !base.hash || base.hash.length === 0) {
|
|
128
|
+
throw new Error('Transaction must be signed before submission (missing signature or hash)');
|
|
129
|
+
}
|
|
130
|
+
return base;
|
|
131
|
+
}
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// VALIDATOR REGISTRATION
|
|
134
|
+
// ============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Build an **unsigned** {@link ValidatorRegistration}.
|
|
137
|
+
*
|
|
138
|
+
* `generated_public_key` is populated from `input.generatedPublicKey`;
|
|
139
|
+
* `generated_signature` is left empty (see {@link attachGeneratedSignature}).
|
|
140
|
+
*
|
|
141
|
+
* Unless both `options.nonce` and `options.feeAmountParts` are set, this
|
|
142
|
+
* function queries the network for the operator's next nonce and the base fee.
|
|
143
|
+
* The automatic fee includes the size of the 64/114-byte `generated_signature`
|
|
144
|
+
* (a zero-filled placeholder reserves it during fee calculation).
|
|
145
|
+
*
|
|
146
|
+
* @param input - Registration parameters (see {@link ValidatorRegistrationInput})
|
|
147
|
+
* @param options - Shared standard transaction options
|
|
148
|
+
* @returns The unsigned protobuf `ValidatorRegistration`
|
|
149
|
+
*
|
|
150
|
+
* @throws Error when `publicKey` / `generatedPublicKey` are missing or invalid,
|
|
151
|
+
* `register` is not a boolean, `validator.host` is empty, a port is not in
|
|
152
|
+
* `1`–`65535`, a staked contract ID is invalid or duplicated, `benchmark` /
|
|
153
|
+
* `lastHeartbeat` are not uint64, `version` is not uint32, or any shared
|
|
154
|
+
* option is invalid.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* import { buildValidatorRegistrationTXN, signWithKey, attachGeneratedSignature } from 'kalvora.js';
|
|
159
|
+
*
|
|
160
|
+
* const txn = await buildValidatorRegistrationTXN(
|
|
161
|
+
* {
|
|
162
|
+
* publicKey: 'A_<operator public key>',
|
|
163
|
+
* generatedPublicKey: 'A_<node generated public key>',
|
|
164
|
+
* register: true,
|
|
165
|
+
* validator: { host: 'node1.example.com', clientPort: '50052', validatorPort: '50051', version: 100 }
|
|
166
|
+
* },
|
|
167
|
+
* { nonce: 3, feeAmountParts: '1000' } // offline + deterministic
|
|
168
|
+
* );
|
|
169
|
+
* signWithKey(txn, operatorPrivateKey, 'A_<operator public key>');
|
|
170
|
+
* attachGeneratedSignature(txn, generatedPrivateKey, 'A_<node generated public key>');
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export async function buildValidatorRegistrationTXN(input, options = {}) {
|
|
174
|
+
requireObject(input, 'buildValidatorRegistrationTXN: input object is required');
|
|
175
|
+
const operatorPublicKey = requirePublicKeyId(input.publicKey, 'publicKey');
|
|
176
|
+
const generatedPublicKey = requirePublicKeyId(input.generatedPublicKey, 'generatedPublicKey');
|
|
177
|
+
const register = requireBoolean(input.register, 'register');
|
|
178
|
+
const validator = buildValidatorRecord(input.validator, operatorPublicKey);
|
|
179
|
+
// The generated-key signature is attached after operator signing, but it is
|
|
180
|
+
// part of the transaction the network prices. Reserve its size with a
|
|
181
|
+
// zero-filled placeholder while fees are calculated, then clear it.
|
|
182
|
+
const txn = await buildStandardTransaction({
|
|
183
|
+
operation: 'buildValidatorRegistrationTXN',
|
|
184
|
+
schema: ValidatorRegistrationSchema,
|
|
185
|
+
publicKeyId: operatorPublicKey,
|
|
186
|
+
contractId: undefined,
|
|
187
|
+
fields: {
|
|
188
|
+
validator,
|
|
189
|
+
register,
|
|
190
|
+
generatedPublicKey: create(PublicKeySchema, { single: getPublicKeyBytes(generatedPublicKey) }),
|
|
191
|
+
generatedSignature: new Uint8Array(signatureLength(generatedPublicKey))
|
|
192
|
+
},
|
|
193
|
+
options
|
|
194
|
+
});
|
|
195
|
+
txn.generatedSignature = new Uint8Array(0);
|
|
196
|
+
return txn;
|
|
197
|
+
}
|
|
198
|
+
/** Raw signature length for a key identifier: Ed25519 = 64 bytes, Ed448 = 114 bytes. */
|
|
199
|
+
function signatureLength(publicKeyId) {
|
|
200
|
+
return getKeyTypeFromPublicKey(publicKeyId) === KEY_TYPE.ED448 ? 114 : 64;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Set `generated_signature` on an operator-signed {@link ValidatorRegistration}.
|
|
204
|
+
*
|
|
205
|
+
* Computes `generated_signature = sign(generatedPrivateKey, base.hash)`, per
|
|
206
|
+
* the proto comment "signature of the generated public key (signing txn
|
|
207
|
+
* hash)". The transaction must already carry `base.signature` and `base.hash`
|
|
208
|
+
* (i.e. be signed by the operator), and its `generated_public_key` must match
|
|
209
|
+
* `generatedPublicKey`.
|
|
210
|
+
*
|
|
211
|
+
* **Assumption:** validators verify `generated_signature` over the final
|
|
212
|
+
* `base.hash` (computed with `generated_signature` empty). This ordering has
|
|
213
|
+
* not been verified against the node implementation. Because
|
|
214
|
+
* `generated_signature` is set after hashing, it is not covered by
|
|
215
|
+
* `base.signature` / `base.hash`, and calling this does not invalidate the
|
|
216
|
+
* operator signature. Calling it again replaces the previous value.
|
|
217
|
+
*
|
|
218
|
+
* @param txn - Operator-signed registration (mutated in place)
|
|
219
|
+
* @param generatedPrivateKey - Base58 private key of the node-generated key
|
|
220
|
+
* @param generatedPublicKey - Base58 public key identifier of the node-generated key
|
|
221
|
+
* @returns The same transaction, with `generatedSignature` populated
|
|
222
|
+
*
|
|
223
|
+
* @throws Error when the transaction is not operator-signed, a key is missing,
|
|
224
|
+
* or `generatedPublicKey` does not match `txn.generatedPublicKey`.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* signWithKey(txn, operatorPrivateKey, operatorPublicKey);
|
|
229
|
+
* attachGeneratedSignature(txn, node.privateKey, node.publicKey);
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
export function attachGeneratedSignature(txn, generatedPrivateKey, generatedPublicKey) {
|
|
233
|
+
requireObject(txn, 'attachGeneratedSignature: transaction is required');
|
|
234
|
+
const privateKey = requirePrivateKey(generatedPrivateKey, 'generatedPrivateKey');
|
|
235
|
+
const publicKeyId = requirePublicKeyId(generatedPublicKey, 'generatedPublicKey');
|
|
236
|
+
const base = txn.base;
|
|
237
|
+
if (!base?.signature || base.signature.length === 0 || !base.hash || base.hash.length === 0) {
|
|
238
|
+
throw new Error('attachGeneratedSignature: transaction must be signed by the operator first (missing base.signature or base.hash)');
|
|
239
|
+
}
|
|
240
|
+
const embedded = txn.generatedPublicKey?.single;
|
|
241
|
+
if (!embedded || !bytesEqual(embedded, getPublicKeyBytes(publicKeyId))) {
|
|
242
|
+
throw new Error('attachGeneratedSignature: generatedPublicKey does not match the transaction\'s generated_public_key');
|
|
243
|
+
}
|
|
244
|
+
txn.generatedSignature = signTransactionData(base.hash, privateKey, publicKeyId);
|
|
245
|
+
return txn;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Build and fully sign a {@link ValidatorRegistration}.
|
|
249
|
+
*
|
|
250
|
+
* Steps, in order:
|
|
251
|
+
* 1. {@link buildValidatorRegistrationTXN} with `generated_public_key` set to
|
|
252
|
+
* `generatedKeyPair.publicKey` (and `generated_signature` empty).
|
|
253
|
+
* 2. Operator signing via `signWithKey` — sets `base.signature`, then
|
|
254
|
+
* `base.hash = SHA3-256(serialized signed txn)`.
|
|
255
|
+
* 3. {@link attachGeneratedSignature} — `generated_signature =
|
|
256
|
+
* sign(generatedKeyPair.privateKey, base.hash)`.
|
|
257
|
+
*
|
|
258
|
+
* **Assumption:** step 3 follows the proto comment "signature of the generated
|
|
259
|
+
* public key (signing txn hash)"; the validator-side verification order is
|
|
260
|
+
* unverified. See {@link attachGeneratedSignature}.
|
|
261
|
+
*
|
|
262
|
+
* @param input - Registration parameters; `generatedPublicKey` may be omitted
|
|
263
|
+
* @param operatorPrivateKey - Operator's base58 private key (matching `input.publicKey`)
|
|
264
|
+
* @param generatedKeyPair - The node-generated key pair
|
|
265
|
+
* @param options - Shared standard transaction options
|
|
266
|
+
* @returns The signed registration, ready for {@link sendValidatorRegistrationTXN}
|
|
267
|
+
*
|
|
268
|
+
* @throws Error when a key is missing, `input.generatedPublicKey` differs from
|
|
269
|
+
* `generatedKeyPair.publicKey`, on any validation error from
|
|
270
|
+
* {@link buildValidatorRegistrationTXN}, or when signing fails.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```typescript
|
|
274
|
+
* const signed = await createValidatorRegistrationTXN(
|
|
275
|
+
* {
|
|
276
|
+
* publicKey: operator.publicKey,
|
|
277
|
+
* register: true,
|
|
278
|
+
* validator: {
|
|
279
|
+
* host: 'node1.example.com',
|
|
280
|
+
* clientPort: '50052',
|
|
281
|
+
* validatorPort: '50051',
|
|
282
|
+
* version: 100
|
|
283
|
+
* }
|
|
284
|
+
* },
|
|
285
|
+
* operator.privateKey,
|
|
286
|
+
* { publicKey: node.publicKey, privateKey: node.privateKey }
|
|
287
|
+
* );
|
|
288
|
+
* const hash = await sendValidatorRegistrationTXN(signed);
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
export async function createValidatorRegistrationTXN(input, operatorPrivateKey, generatedKeyPair, options = {}) {
|
|
292
|
+
requireObject(input, 'createValidatorRegistrationTXN: input object is required');
|
|
293
|
+
requirePrivateKey(operatorPrivateKey, 'operatorPrivateKey');
|
|
294
|
+
requireObject(generatedKeyPair, 'generatedKeyPair is required');
|
|
295
|
+
const generatedPrivateKey = requirePrivateKey(generatedKeyPair.privateKey, 'generatedKeyPair.privateKey');
|
|
296
|
+
const generatedPublicKey = requirePublicKeyId(generatedKeyPair.publicKey, 'generatedKeyPair.publicKey');
|
|
297
|
+
if (input.generatedPublicKey !== undefined && input.generatedPublicKey !== generatedPublicKey) {
|
|
298
|
+
throw new Error('input.generatedPublicKey does not match generatedKeyPair.publicKey');
|
|
299
|
+
}
|
|
300
|
+
const txn = await buildValidatorRegistrationTXN({ ...input, generatedPublicKey }, options);
|
|
301
|
+
signWithKey(txn, operatorPrivateKey, input.publicKey);
|
|
302
|
+
return attachGeneratedSignature(txn, generatedPrivateKey, generatedPublicKey);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Submit a signed {@link ValidatorRegistration} to
|
|
306
|
+
* `ValidatorService.ValidatorRegistration`.
|
|
307
|
+
*
|
|
308
|
+
* @param txn - Signed registration (from {@link createValidatorRegistrationTXN})
|
|
309
|
+
* @param grpcConfig - Endpoint configuration (defaults to SDK defaults);
|
|
310
|
+
* `grpcConfig.transport` overrides the transport entirely
|
|
311
|
+
* @returns Hex transaction hash (`base.hash`)
|
|
312
|
+
*
|
|
313
|
+
* @throws Error when the transaction is missing `base.signature`,
|
|
314
|
+
* `base.hash`, or `generated_signature`, or the network rejects it
|
|
315
|
+
* (as a `KalvoraRpcError`).
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const hash = await sendValidatorRegistrationTXN(signed, { host: 'validator.example.com' });
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
export async function sendValidatorRegistrationTXN(txn, grpcConfig = {}) {
|
|
323
|
+
const base = requireSigned(txn);
|
|
324
|
+
if (!txn.generatedSignature || txn.generatedSignature.length === 0) {
|
|
325
|
+
throw new Error('ValidatorRegistration is missing generated_signature (see attachGeneratedSignature)');
|
|
326
|
+
}
|
|
327
|
+
const client = createClient(ValidatorService, grpcConfig);
|
|
328
|
+
await client.validatorRegistration(txn);
|
|
329
|
+
return bytesToHex(base.hash);
|
|
330
|
+
}
|
|
331
|
+
// ============================================================================
|
|
332
|
+
// VALIDATOR HEARTBEAT
|
|
333
|
+
// ============================================================================
|
|
334
|
+
/**
|
|
335
|
+
* Build an **unsigned** {@link ValidatorHeartbeat}.
|
|
336
|
+
*
|
|
337
|
+
* Unless both `options.nonce` and `options.feeAmountParts` are set, this
|
|
338
|
+
* function queries the network for the operator's next nonce and the base fee.
|
|
339
|
+
*
|
|
340
|
+
* @param input - Heartbeat parameters (see {@link ValidatorHeartbeatInput})
|
|
341
|
+
* @param options - Shared standard transaction options
|
|
342
|
+
* @returns The unsigned protobuf `ValidatorHeartbeat`
|
|
343
|
+
*
|
|
344
|
+
* @throws Error when `publicKey` is missing/invalid, `online` is not a
|
|
345
|
+
* boolean, `version` is not a uint32, or any shared option is invalid.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* const txn = await buildValidatorHeartbeatTXN(
|
|
350
|
+
* { publicKey: 'A_<operator public key>', online: true, version: 100 },
|
|
351
|
+
* { nonce: 4, feeAmountParts: '1000' }
|
|
352
|
+
* );
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
export async function buildValidatorHeartbeatTXN(input, options = {}) {
|
|
356
|
+
requireObject(input, 'buildValidatorHeartbeatTXN: input object is required');
|
|
357
|
+
const operatorPublicKey = requirePublicKeyId(input.publicKey, 'publicKey');
|
|
358
|
+
const online = requireBoolean(input.online, 'online');
|
|
359
|
+
const version = parseUint32(input.version, 'version');
|
|
360
|
+
return buildStandardTransaction({
|
|
361
|
+
operation: 'buildValidatorHeartbeatTXN',
|
|
362
|
+
schema: ValidatorHeartbeatSchema,
|
|
363
|
+
publicKeyId: operatorPublicKey,
|
|
364
|
+
contractId: undefined,
|
|
365
|
+
fields: { online, version },
|
|
366
|
+
options
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Build and sign a {@link ValidatorHeartbeat} with the operator's private key.
|
|
371
|
+
*
|
|
372
|
+
* @param input - Heartbeat parameters
|
|
373
|
+
* @param privateKey - Operator's base58 private key (matching `input.publicKey`)
|
|
374
|
+
* @param options - Shared standard transaction options
|
|
375
|
+
* @returns The signed heartbeat, ready for {@link sendValidatorHeartbeatTXN}
|
|
376
|
+
*
|
|
377
|
+
* @throws Error when `privateKey` is missing, on any validation error from
|
|
378
|
+
* {@link buildValidatorHeartbeatTXN}, or when signing fails.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```typescript
|
|
382
|
+
* const signed = await createValidatorHeartbeatTXN(
|
|
383
|
+
* { publicKey: operator.publicKey, online: true, version: 100 },
|
|
384
|
+
* operator.privateKey
|
|
385
|
+
* );
|
|
386
|
+
* const hash = await sendValidatorHeartbeatTXN(signed);
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
export async function createValidatorHeartbeatTXN(input, privateKey, options = {}) {
|
|
390
|
+
requirePrivateKey(privateKey, 'privateKey');
|
|
391
|
+
const txn = await buildValidatorHeartbeatTXN(input, options);
|
|
392
|
+
return signWithKey(txn, privateKey, input.publicKey);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Submit a signed {@link ValidatorHeartbeat} to
|
|
396
|
+
* `ValidatorService.ValidatorHeartbeat`.
|
|
397
|
+
*
|
|
398
|
+
* @param txn - Signed heartbeat (from {@link createValidatorHeartbeatTXN})
|
|
399
|
+
* @param grpcConfig - Endpoint configuration (defaults to SDK defaults);
|
|
400
|
+
* `grpcConfig.transport` overrides the transport entirely
|
|
401
|
+
* @returns Hex transaction hash (`base.hash`)
|
|
402
|
+
*
|
|
403
|
+
* @throws Error when the transaction is unsigned or the network rejects it.
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```typescript
|
|
407
|
+
* const hash = await sendValidatorHeartbeatTXN(signed);
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
export async function sendValidatorHeartbeatTXN(txn, grpcConfig = {}) {
|
|
411
|
+
const base = requireSigned(txn);
|
|
412
|
+
const client = createClient(ValidatorService, grpcConfig);
|
|
413
|
+
await client.validatorHeartbeat(txn);
|
|
414
|
+
return bytesToHex(base.hash);
|
|
415
|
+
}
|
|
416
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/validator-ops/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAC3B,eAAe,EAKhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BA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BAA4B;QACvC,MAAM,EAAE,wBAAwB;QAChC,WAAW,EAAE,iBAAiB;QAC9B,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;QAC3B,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,KAA8B,EAC9B,UAAkB,EAClB,UAAkC,EAAE;IAEpC,iBAAiB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,MAAM,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7D,OAAO,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,GAAuB,EACvB,aAAyB,EAAE;IAE3B,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC1D,MAAM,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vote/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vote/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EAGZ,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction Module - Governance VoteTXN
|
|
3
|
+
*
|
|
4
|
+
* Creates, builds, and submits GovernanceVote transactions.
|
|
5
|
+
*
|
|
6
|
+
* `buildVoteTXN()` constructs an unsigned transaction (no private keys needed).
|
|
7
|
+
* `createVoteTXN()` is a convenience wrapper: build + sign with private key.
|
|
8
|
+
*/
|
|
9
|
+
import type { GovernanceVote } from '../../proto/generated/txn_pb.js';
|
|
10
|
+
import type { GRPCConfig } from '../types/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Options for building an unsigned GovernanceVote transaction.
|
|
13
|
+
*/
|
|
14
|
+
export interface BuildVoteTXNOptions {
|
|
15
|
+
/** Whether to support the proposal (for binary yes/no votes) */
|
|
16
|
+
support?: boolean;
|
|
17
|
+
/** The option index to support (for multi-option votes) */
|
|
18
|
+
supportOption?: number;
|
|
19
|
+
/** Optional memo */
|
|
20
|
+
memo?: string;
|
|
21
|
+
/** gRPC configuration */
|
|
22
|
+
grpcConfig?: GRPCConfig;
|
|
23
|
+
/** Overestimate percentage for fee (defaults to 5.0%) */
|
|
24
|
+
overestimatePercent?: number;
|
|
25
|
+
/** Optional nonce override */
|
|
26
|
+
nonce?: string | number | bigint;
|
|
27
|
+
/** Fee ID (defaults to `KALVORA_NATIVE_TOKEN`) */
|
|
28
|
+
feeId?: string;
|
|
29
|
+
/** Manual fee amount in parts */
|
|
30
|
+
feeAmountParts?: string;
|
|
31
|
+
/** Deterministic timestamp override for reviewed transaction vectors */
|
|
32
|
+
timestamp?: Date;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for creating a GovernanceVote transaction (includes private key).
|
|
36
|
+
*/
|
|
37
|
+
export type CreateVoteTXNOptions = BuildVoteTXNOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Build an unsigned GovernanceVote transaction.
|
|
40
|
+
*
|
|
41
|
+
* Performs validation, nonce fetching, and fee calculation but **stops before signing**.
|
|
42
|
+
* The returned transaction has no signature and no hash.
|
|
43
|
+
*
|
|
44
|
+
* @param contractId - Contract ID for the governance token
|
|
45
|
+
* @param proposalIdHex - Hex-encoded proposal ID
|
|
46
|
+
* @param publicKeyBase58Identifier - Public key identifier (no private key needed)
|
|
47
|
+
* @param options - Vote options (support/supportOption, memo, fees, etc.)
|
|
48
|
+
* @returns An unsigned `GovernanceVote` protobuf
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const unsigned = await buildVoteTXN(
|
|
53
|
+
* 'KALXvxhUMJERCse4e6b2jeXFkcqqpiUByQQckvPZm4szmF3Ao', 'aabbccdd...', 'A_9Xk3...',
|
|
54
|
+
* { support: true }
|
|
55
|
+
* );
|
|
56
|
+
* const signed = await signAndFinalize(unsigned, signer);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildVoteTXN(contractId: string, proposalIdHex: string, publicKeyBase58Identifier: string, options?: BuildVoteTXNOptions): Promise<GovernanceVote>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a GovernanceVote transaction.
|
|
62
|
+
*
|
|
63
|
+
* Convenience wrapper: builds with `buildVoteTXN()` then signs with the provided private key.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createVoteTXN(contractId: string, proposalIdHex: string, publicKeyBase58Identifier: string, privateKeyBase58: string, options?: CreateVoteTXNOptions): Promise<GovernanceVote>;
|
|
66
|
+
/**
|
|
67
|
+
* Submit a GovernanceVote to the network via gRPC.
|
|
68
|
+
*/
|
|
69
|
+
export declare function sendVoteTXN(vote: GovernanceVote, grpcConfig?: GRPCConfig): Promise<string>;
|
|
70
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/vote/transaction.ts"],"names":[],"mappings":"AAAA;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
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction Module - Governance VoteTXN
|
|
3
|
+
*
|
|
4
|
+
* Creates, builds, and submits GovernanceVote transactions.
|
|
5
|
+
*
|
|
6
|
+
* `buildVoteTXN()` constructs an unsigned transaction (no private keys needed).
|
|
7
|
+
* `createVoteTXN()` is a convenience wrapper: build + sign with private key.
|
|
8
|
+
*/
|
|
9
|
+
import { protoInt64, create } from '@bufbuild/protobuf';
|
|
10
|
+
import { GovernanceVoteSchema } from '../../proto/generated/txn_pb.js';
|
|
11
|
+
import { UniversalFeeCalculator } from '../shared/fee-calculators/universal-fee-calculator.js';
|
|
12
|
+
import { logger } from '../shared/monitoring/index.js';
|
|
13
|
+
import { KALVORA_NATIVE_TOKEN } from '../shared/network/constants.js';
|
|
14
|
+
import { buildStandardBaseTXN, getAddressAndNonce } from '../shared/tx/base.js';
|
|
15
|
+
import { hexToBytes } from '../shared/utils/byte-utils.js';
|
|
16
|
+
import { PROTONET_GRPC_CONFIG } from '../shared/utils/testing-defaults/index.js';
|
|
17
|
+
import { isValidContractId } from '../shared/utils/validation.js';
|
|
18
|
+
import { signWithKey } from '../sign/finalize.js';
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// PUBLIC API — BUILD UNSIGNED
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Build an unsigned GovernanceVote transaction.
|
|
24
|
+
*
|
|
25
|
+
* Performs validation, nonce fetching, and fee calculation but **stops before signing**.
|
|
26
|
+
* The returned transaction has no signature and no hash.
|
|
27
|
+
*
|
|
28
|
+
* @param contractId - Contract ID for the governance token
|
|
29
|
+
* @param proposalIdHex - Hex-encoded proposal ID
|
|
30
|
+
* @param publicKeyBase58Identifier - Public key identifier (no private key needed)
|
|
31
|
+
* @param options - Vote options (support/supportOption, memo, fees, etc.)
|
|
32
|
+
* @returns An unsigned `GovernanceVote` protobuf
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const unsigned = await buildVoteTXN(
|
|
37
|
+
* 'KALXvxhUMJERCse4e6b2jeXFkcqqpiUByQQckvPZm4szmF3Ao', 'aabbccdd...', 'A_9Xk3...',
|
|
38
|
+
* { support: true }
|
|
39
|
+
* );
|
|
40
|
+
* const signed = await signAndFinalize(unsigned, signer);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export async function buildVoteTXN(contractId, proposalIdHex, publicKeyBase58Identifier, options = {}) {
|
|
44
|
+
if (!isValidContractId(contractId)) {
|
|
45
|
+
throw new Error('contractId must be a canonical bounded Kalvora mint ID');
|
|
46
|
+
}
|
|
47
|
+
if (!proposalIdHex)
|
|
48
|
+
throw new Error('proposalId (hex) is required');
|
|
49
|
+
if (!publicKeyBase58Identifier)
|
|
50
|
+
throw new Error('publicKey identifier is required');
|
|
51
|
+
const grpcConfig = options.grpcConfig || PROTONET_GRPC_CONFIG;
|
|
52
|
+
const feeId = options.feeId;
|
|
53
|
+
const feeAmountParts = options.feeAmountParts;
|
|
54
|
+
const hasSupport = typeof options.support === 'boolean';
|
|
55
|
+
const hasSupportOption = typeof options.supportOption === 'number';
|
|
56
|
+
if (hasSupport === hasSupportOption) {
|
|
57
|
+
throw new Error('Specify exactly one of: support (boolean) OR supportOption (number)');
|
|
58
|
+
}
|
|
59
|
+
if (hasSupportOption &&
|
|
60
|
+
(!Number.isSafeInteger(options.supportOption) ||
|
|
61
|
+
options.supportOption < 0 ||
|
|
62
|
+
options.supportOption > 4294967295)) {
|
|
63
|
+
throw new Error('supportOption must be a uint32 integer');
|
|
64
|
+
}
|
|
65
|
+
let proposalBytes;
|
|
66
|
+
try {
|
|
67
|
+
if (!/^[0-9a-fA-F]{64}$/.test(proposalIdHex))
|
|
68
|
+
throw new Error('Invalid hex');
|
|
69
|
+
proposalBytes = hexToBytes(proposalIdHex);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
throw new Error('Invalid proposalId: must be hex-encoded');
|
|
73
|
+
}
|
|
74
|
+
let nonce;
|
|
75
|
+
if (options.nonce !== undefined) {
|
|
76
|
+
nonce = protoInt64.uParse(String(options.nonce));
|
|
77
|
+
logger.warn('Manual nonce specified - skipping network nonce fetch.', { operation: 'buildVoteTXN', nonce: String(options.nonce) });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const result = await getAddressAndNonce(publicKeyBase58Identifier, grpcConfig);
|
|
81
|
+
nonce = result.nonce;
|
|
82
|
+
}
|
|
83
|
+
const baseParams = { publicKeyId: publicKeyBase58Identifier, nonce };
|
|
84
|
+
if (options.memo)
|
|
85
|
+
baseParams.memo = options.memo;
|
|
86
|
+
if (feeId !== undefined)
|
|
87
|
+
baseParams.feeId = feeId;
|
|
88
|
+
if (feeAmountParts !== undefined)
|
|
89
|
+
baseParams.feeAmountParts = feeAmountParts;
|
|
90
|
+
if (options.timestamp !== undefined)
|
|
91
|
+
baseParams.timestamp = options.timestamp;
|
|
92
|
+
const base = buildStandardBaseTXN(baseParams);
|
|
93
|
+
const voteData = { base, contractId, proposalId: proposalBytes };
|
|
94
|
+
if (hasSupport && options.support !== undefined)
|
|
95
|
+
voteData.support = options.support;
|
|
96
|
+
if (hasSupportOption && options.supportOption !== undefined)
|
|
97
|
+
voteData.supportOption = options.supportOption;
|
|
98
|
+
const voteTxn = create(GovernanceVoteSchema, voteData);
|
|
99
|
+
const effectiveFeeId = feeId || KALVORA_NATIVE_TOKEN;
|
|
100
|
+
const feeOptions = {
|
|
101
|
+
contractId, protoObject: voteTxn, tokenInfoMap: new Map(), baseFeeId: effectiveFeeId,
|
|
102
|
+
...(feeAmountParts !== undefined && { baseFeeParts: feeAmountParts }),
|
|
103
|
+
...(options.overestimatePercent !== undefined && { overestimatePercent: options.overestimatePercent })
|
|
104
|
+
};
|
|
105
|
+
if (feeAmountParts === undefined) {
|
|
106
|
+
await UniversalFeeCalculator.calculateFee(feeOptions);
|
|
107
|
+
}
|
|
108
|
+
if (voteTxn.base?.signature !== undefined || voteTxn.base?.hash !== undefined) {
|
|
109
|
+
throw new Error('Unsigned vote construction unexpectedly produced signature material');
|
|
110
|
+
}
|
|
111
|
+
return voteTxn;
|
|
112
|
+
}
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// PUBLIC API — CONVENIENCE (build + sign)
|
|
115
|
+
// ============================================================================
|
|
116
|
+
/**
|
|
117
|
+
* Create a GovernanceVote transaction.
|
|
118
|
+
*
|
|
119
|
+
* Convenience wrapper: builds with `buildVoteTXN()` then signs with the provided private key.
|
|
120
|
+
*/
|
|
121
|
+
export async function createVoteTXN(contractId, proposalIdHex, publicKeyBase58Identifier, privateKeyBase58, options = {}) {
|
|
122
|
+
if (!privateKeyBase58)
|
|
123
|
+
throw new Error('privateKey is required');
|
|
124
|
+
// Build unsigned transaction (validation, nonce, fees all handled inside)
|
|
125
|
+
const voteTxn = await buildVoteTXN(contractId, proposalIdHex, publicKeyBase58Identifier, options);
|
|
126
|
+
// Sign and hash
|
|
127
|
+
signWithKey(voteTxn, privateKeyBase58, publicKeyBase58Identifier);
|
|
128
|
+
return voteTxn;
|
|
129
|
+
}
|
|
130
|
+
// ============================================================================
|
|
131
|
+
// PUBLIC API — SEND
|
|
132
|
+
// ============================================================================
|
|
133
|
+
/**
|
|
134
|
+
* Submit a GovernanceVote to the network via gRPC.
|
|
135
|
+
*/
|
|
136
|
+
export async function sendVoteTXN(vote, grpcConfig = {}) {
|
|
137
|
+
const { submitTransaction } = await import('../grpc/transaction/transaction-client.js');
|
|
138
|
+
return submitTransaction(vote, grpcConfig);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=transaction.js.map
|