@totochain/client 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +307 -2
- package/_cjs/accounts/index.d.cts +7 -0
- package/_cjs/accounts/index.js +29 -0
- package/_cjs/accounts/keyring.d.cts +28 -0
- package/_cjs/accounts/keyring.js +102 -0
- package/_cjs/accounts/substrateSigner.d.cts +5 -0
- package/_cjs/accounts/substrateSigner.js +49 -0
- package/_cjs/accounts/types.d.cts +6 -0
- package/_cjs/accounts/types.js +2 -0
- package/_cjs/accounts/wellKnown.d.cts +24 -0
- package/_cjs/accounts/wellKnown.js +322 -0
- package/_cjs/actions/activityTracker/calculateActivityReputationAtBlock.d.cts +9 -0
- package/_cjs/actions/activityTracker/calculateActivityReputationAtBlock.js +8 -0
- package/_cjs/actions/activityTracker/decodeReputationPage.d.cts +4 -0
- package/_cjs/actions/activityTracker/decodeReputationPage.js +13 -0
- package/_cjs/actions/activityTracker/getActivityReputation.d.cts +8 -0
- package/_cjs/actions/activityTracker/getActivityReputation.js +8 -0
- package/_cjs/actions/activityTracker/getActivityReputationInfo.d.cts +9 -0
- package/_cjs/actions/activityTracker/getActivityReputationInfo.js +14 -0
- package/_cjs/actions/activityTracker/getActivityTrackerConfig.d.cts +8 -0
- package/_cjs/actions/activityTracker/getActivityTrackerConfig.js +13 -0
- package/_cjs/actions/activityTracker/getAllActivityReputations.d.cts +8 -0
- package/_cjs/actions/activityTracker/getAllActivityReputations.js +9 -0
- package/_cjs/actions/activityTracker/getAllRawActivityReputations.d.cts +8 -0
- package/_cjs/actions/activityTracker/getAllRawActivityReputations.js +9 -0
- package/_cjs/actions/activityTracker/getMaxActivityReputation.d.cts +7 -0
- package/_cjs/actions/activityTracker/getMaxActivityReputation.js +8 -0
- package/_cjs/actions/activityTracker/getRawActivityReputation.d.cts +8 -0
- package/_cjs/actions/activityTracker/getRawActivityReputation.js +8 -0
- package/_cjs/actions/activityTracker/index.d.cts +18 -0
- package/_cjs/actions/activityTracker/index.js +19 -0
- package/_cjs/actions/activityTracker/types.d.cts +20 -0
- package/_cjs/actions/activityTracker/types.js +2 -0
- package/_cjs/actions/attestation/attest.d.cts +21 -0
- package/_cjs/actions/attestation/attest.js +14 -0
- package/_cjs/actions/attestation/index.d.cts +3 -0
- package/_cjs/actions/attestation/index.js +7 -0
- package/_cjs/actions/did/createDid.d.cts +10 -0
- package/_cjs/actions/did/createDid.js +10 -0
- package/_cjs/actions/did/index.d.cts +3 -0
- package/_cjs/actions/did/index.js +6 -0
- package/_cjs/actions/handshake/getCompletedHandshakes.d.cts +8 -0
- package/_cjs/actions/handshake/getCompletedHandshakes.js +8 -0
- package/_cjs/actions/handshake/getHandshakeCount.d.cts +8 -0
- package/_cjs/actions/handshake/getHandshakeCount.js +8 -0
- package/_cjs/actions/handshake/getHandshakeStatus.d.cts +10 -0
- package/_cjs/actions/handshake/getHandshakeStatus.js +8 -0
- package/_cjs/actions/handshake/handshakeExists.d.cts +9 -0
- package/_cjs/actions/handshake/handshakeExists.js +8 -0
- package/_cjs/actions/handshake/hasHandshakeCompleted.d.cts +9 -0
- package/_cjs/actions/handshake/hasHandshakeCompleted.js +8 -0
- package/_cjs/actions/handshake/index.d.cts +12 -0
- package/_cjs/actions/handshake/index.js +13 -0
- package/_cjs/actions/handshake/types.d.cts +2 -0
- package/_cjs/actions/handshake/types.js +2 -0
- package/_cjs/actions/index.d.cts +14 -0
- package/_cjs/actions/index.js +35 -0
- package/_cjs/actions/potential/getActiveReferralShare.d.cts +8 -0
- package/_cjs/actions/potential/getActiveReferralShare.js +8 -0
- package/_cjs/actions/potential/getCycleNumber.d.cts +7 -0
- package/_cjs/actions/potential/getCycleNumber.js +8 -0
- package/_cjs/actions/potential/getCyclePotentialMinted.d.cts +7 -0
- package/_cjs/actions/potential/getCyclePotentialMinted.js +8 -0
- package/_cjs/actions/potential/getCycleSupply.d.cts +7 -0
- package/_cjs/actions/potential/getCycleSupply.js +8 -0
- package/_cjs/actions/potential/getDefaultActiveReferralShare.d.cts +7 -0
- package/_cjs/actions/potential/getDefaultActiveReferralShare.js +8 -0
- package/_cjs/actions/potential/getMaxSupply.d.cts +7 -0
- package/_cjs/actions/potential/getMaxSupply.js +8 -0
- package/_cjs/actions/potential/getMonthNumber.d.cts +7 -0
- package/_cjs/actions/potential/getMonthNumber.js +8 -0
- package/_cjs/actions/potential/getMonthPotentialMinted.d.cts +7 -0
- package/_cjs/actions/potential/getMonthPotentialMinted.js +8 -0
- package/_cjs/actions/potential/getMonthSupply.d.cts +7 -0
- package/_cjs/actions/potential/getMonthSupply.js +8 -0
- package/_cjs/actions/potential/getPotential.d.cts +8 -0
- package/_cjs/actions/potential/getPotential.js +8 -0
- package/_cjs/actions/potential/getTotalPotentialMinted.d.cts +7 -0
- package/_cjs/actions/potential/getTotalPotentialMinted.js +8 -0
- package/_cjs/actions/potential/index.d.cts +23 -0
- package/_cjs/actions/potential/index.js +25 -0
- package/_cjs/actions/puzzlePieces/getCollectionsCount.d.cts +7 -0
- package/_cjs/actions/puzzlePieces/getCollectionsCount.js +8 -0
- package/_cjs/actions/puzzlePieces/getItemsCount.d.cts +8 -0
- package/_cjs/actions/puzzlePieces/getItemsCount.js +8 -0
- package/_cjs/actions/puzzlePieces/getOwner.d.cts +9 -0
- package/_cjs/actions/puzzlePieces/getOwner.js +8 -0
- package/_cjs/actions/puzzlePieces/getPendingWildcards.d.cts +8 -0
- package/_cjs/actions/puzzlePieces/getPendingWildcards.js +9 -0
- package/_cjs/actions/puzzlePieces/getTotalPuzzlePiecesMinted.d.cts +7 -0
- package/_cjs/actions/puzzlePieces/getTotalPuzzlePiecesMinted.js +8 -0
- package/_cjs/actions/puzzlePieces/getWildcardCollectionId.d.cts +7 -0
- package/_cjs/actions/puzzlePieces/getWildcardCollectionId.js +8 -0
- package/_cjs/actions/puzzlePieces/getWildcardDistributionMap.d.cts +8 -0
- package/_cjs/actions/puzzlePieces/getWildcardDistributionMap.js +9 -0
- package/_cjs/actions/puzzlePieces/getWildcardThreshold.d.cts +7 -0
- package/_cjs/actions/puzzlePieces/getWildcardThreshold.js +8 -0
- package/_cjs/actions/puzzlePieces/index.d.cts +18 -0
- package/_cjs/actions/puzzlePieces/index.js +19 -0
- package/_cjs/actions/puzzlePieces/types.d.cts +5 -0
- package/_cjs/actions/puzzlePieces/types.js +2 -0
- package/_cjs/actions/referral/decodePage.d.cts +4 -0
- package/_cjs/actions/referral/decodePage.js +13 -0
- package/_cjs/actions/referral/getActiveReferrals.d.cts +9 -0
- package/_cjs/actions/referral/getActiveReferrals.js +14 -0
- package/_cjs/actions/referral/getActiveReferralsCount.d.cts +8 -0
- package/_cjs/actions/referral/getActiveReferralsCount.js +8 -0
- package/_cjs/actions/referral/getBlockProducers.d.cts +7 -0
- package/_cjs/actions/referral/getBlockProducers.js +8 -0
- package/_cjs/actions/referral/getBlockProducersPage.d.cts +8 -0
- package/_cjs/actions/referral/getBlockProducersPage.js +9 -0
- package/_cjs/actions/referral/getPendingReferrals.d.cts +8 -0
- package/_cjs/actions/referral/getPendingReferrals.js +8 -0
- package/_cjs/actions/referral/getPendingReferralsPage.d.cts +9 -0
- package/_cjs/actions/referral/getPendingReferralsPage.js +9 -0
- package/_cjs/actions/referral/getReferrer.d.cts +8 -0
- package/_cjs/actions/referral/getReferrer.js +8 -0
- package/_cjs/actions/referral/index.d.cts +16 -0
- package/_cjs/actions/referral/index.js +17 -0
- package/_cjs/actions/referral/types.d.cts +6 -0
- package/_cjs/actions/referral/types.js +2 -0
- package/_cjs/actions/reputationVoting/getTally.d.cts +9 -0
- package/_cjs/actions/reputationVoting/getTally.js +14 -0
- package/_cjs/actions/reputationVoting/getVotesForAccount.d.cts +9 -0
- package/_cjs/actions/reputationVoting/getVotesForAccount.js +16 -0
- package/_cjs/actions/reputationVoting/getVotingReputation.d.cts +8 -0
- package/_cjs/actions/reputationVoting/getVotingReputation.js +8 -0
- package/_cjs/actions/reputationVoting/index.d.cts +10 -0
- package/_cjs/actions/reputationVoting/index.js +11 -0
- package/_cjs/actions/reputationVoting/isPassing.d.cts +8 -0
- package/_cjs/actions/reputationVoting/isPassing.js +8 -0
- package/_cjs/actions/reputationVoting/types.d.cts +17 -0
- package/_cjs/actions/reputationVoting/types.js +2 -0
- package/_cjs/actions/rewardPool/getRewardPoolAccount.d.cts +7 -0
- package/_cjs/actions/rewardPool/getRewardPoolAccount.js +8 -0
- package/_cjs/actions/rewardPool/getRewardPoolBalance.d.cts +7 -0
- package/_cjs/actions/rewardPool/getRewardPoolBalance.js +8 -0
- package/_cjs/actions/rewardPool/index.d.cts +5 -0
- package/_cjs/actions/rewardPool/index.js +7 -0
- package/_cjs/actions/submitAndWait.d.cts +65 -0
- package/_cjs/actions/submitAndWait.js +141 -0
- package/_cjs/actions/techCommitteeManager/getSelectedTechCommittee.d.cts +7 -0
- package/_cjs/actions/techCommitteeManager/getSelectedTechCommittee.js +8 -0
- package/_cjs/actions/techCommitteeManager/getTechCommitteeCandidates.d.cts +7 -0
- package/_cjs/actions/techCommitteeManager/getTechCommitteeCandidates.js +8 -0
- package/_cjs/actions/techCommitteeManager/index.d.cts +5 -0
- package/_cjs/actions/techCommitteeManager/index.js +7 -0
- package/_cjs/actions/validatorManager/decodePairs.d.cts +8 -0
- package/_cjs/actions/validatorManager/decodePairs.js +7 -0
- package/_cjs/actions/validatorManager/getActiveValidators.d.cts +7 -0
- package/_cjs/actions/validatorManager/getActiveValidators.js +8 -0
- package/_cjs/actions/validatorManager/getOffenceValidators.d.cts +8 -0
- package/_cjs/actions/validatorManager/getOffenceValidators.js +9 -0
- package/_cjs/actions/validatorManager/getOfflineValidators.d.cts +8 -0
- package/_cjs/actions/validatorManager/getOfflineValidators.js +9 -0
- package/_cjs/actions/validatorManager/getReputationForAccount.d.cts +8 -0
- package/_cjs/actions/validatorManager/getReputationForAccount.js +8 -0
- package/_cjs/actions/validatorManager/getReputationPenaltyFor.d.cts +8 -0
- package/_cjs/actions/validatorManager/getReputationPenaltyFor.js +8 -0
- package/_cjs/actions/validatorManager/getReputations.d.cts +9 -0
- package/_cjs/actions/validatorManager/getReputations.js +9 -0
- package/_cjs/actions/validatorManager/getSelectedValidators.d.cts +7 -0
- package/_cjs/actions/validatorManager/getSelectedValidators.js +8 -0
- package/_cjs/actions/validatorManager/getValidatorCandidates.d.cts +7 -0
- package/_cjs/actions/validatorManager/getValidatorCandidates.js +8 -0
- package/_cjs/actions/validatorManager/index.d.cts +18 -0
- package/_cjs/actions/validatorManager/index.js +19 -0
- package/_cjs/actions/validatorManager/types.d.cts +10 -0
- package/_cjs/actions/validatorManager/types.js +2 -0
- package/_cjs/chains/defineChain.d.cts +18 -0
- package/_cjs/chains/defineChain.js +6 -0
- package/_cjs/chains/definitions.d.cts +65 -0
- package/_cjs/chains/definitions.js +52 -0
- package/_cjs/chains/index.d.cts +4 -0
- package/_cjs/chains/index.js +10 -0
- package/_cjs/client/compatibility.d.cts +16 -0
- package/_cjs/client/compatibility.js +60 -0
- package/_cjs/client/createClient.d.cts +12 -0
- package/_cjs/client/createClient.js +36 -0
- package/_cjs/client/types.d.cts +7 -0
- package/_cjs/client/types.js +2 -0
- package/_cjs/crypto/ctypeHash.d.cts +16 -0
- package/_cjs/crypto/ctypeHash.js +24 -0
- package/_cjs/crypto/index.d.cts +3 -0
- package/_cjs/crypto/index.js +6 -0
- package/_cjs/ctypes/definitions.d.cts +21 -0
- package/_cjs/ctypes/definitions.js +210 -0
- package/_cjs/ctypes/index.d.cts +4 -0
- package/_cjs/ctypes/index.js +21 -0
- package/_cjs/did/didUri.d.cts +11 -0
- package/_cjs/did/didUri.js +14 -0
- package/_cjs/index.d.cts +25 -0
- package/_cjs/index.js +67 -0
- package/_cjs/package.json +1 -0
- package/_cjs/plugins/activityTracker.d.cts +34 -0
- package/_cjs/plugins/activityTracker.js +18 -0
- package/_cjs/plugins/handshake.d.cts +32 -0
- package/_cjs/plugins/handshake.js +15 -0
- package/_cjs/plugins/index.d.cts +19 -0
- package/_cjs/plugins/index.js +21 -0
- package/_cjs/plugins/potential.d.cts +29 -0
- package/_cjs/plugins/potential.js +21 -0
- package/_cjs/plugins/puzzlePieces.d.cts +28 -0
- package/_cjs/plugins/puzzlePieces.js +18 -0
- package/_cjs/plugins/referral.d.cts +17 -0
- package/_cjs/plugins/referral.js +17 -0
- package/_cjs/plugins/reputationVoting.d.cts +25 -0
- package/_cjs/plugins/reputationVoting.js +14 -0
- package/_cjs/plugins/rewardPool.d.cts +14 -0
- package/_cjs/plugins/rewardPool.js +12 -0
- package/_cjs/plugins/techCommitteeManager.d.cts +14 -0
- package/_cjs/plugins/techCommitteeManager.js +12 -0
- package/_cjs/plugins/validatorManager.d.cts +30 -0
- package/_cjs/plugins/validatorManager.js +18 -0
- package/_cjs/rpc/bundle.d.cts +4 -0
- package/_cjs/rpc/bundle.js +24 -0
- package/_cjs/rpc/call.d.cts +4 -0
- package/_cjs/rpc/call.js +28 -0
- package/_cjs/rpc/definitions.d.cts +3 -0
- package/_cjs/rpc/definitions.js +382 -0
- package/_cjs/rpc/index.d.cts +4 -0
- package/_cjs/rpc/index.js +10 -0
- package/_cjs/rpc/types.d.cts +3 -0
- package/_cjs/rpc/types.js +44 -0
- package/_cjs/types/index.d.cts +17 -0
- package/_cjs/types/index.js +5 -0
- package/_esm/accounts/index.js +3 -0
- package/_esm/accounts/keyring.js +83 -0
- package/_esm/accounts/substrateSigner.js +46 -0
- package/_esm/accounts/types.js +1 -0
- package/_esm/accounts/wellKnown.js +317 -0
- package/_esm/actions/activityTracker/calculateActivityReputationAtBlock.js +5 -0
- package/_esm/actions/activityTracker/decodeReputationPage.js +10 -0
- package/_esm/actions/activityTracker/getActivityReputation.js +5 -0
- package/_esm/actions/activityTracker/getActivityReputationInfo.js +11 -0
- package/_esm/actions/activityTracker/getActivityTrackerConfig.js +10 -0
- package/_esm/actions/activityTracker/getAllActivityReputations.js +6 -0
- package/_esm/actions/activityTracker/getAllRawActivityReputations.js +6 -0
- package/_esm/actions/activityTracker/getMaxActivityReputation.js +5 -0
- package/_esm/actions/activityTracker/getRawActivityReputation.js +5 -0
- package/_esm/actions/activityTracker/index.js +8 -0
- package/_esm/actions/activityTracker/types.js +1 -0
- package/_esm/actions/attestation/attest.js +9 -0
- package/_esm/actions/attestation/index.js +1 -0
- package/_esm/actions/did/createDid.js +6 -0
- package/_esm/actions/did/index.js +1 -0
- package/_esm/actions/handshake/getCompletedHandshakes.js +5 -0
- package/_esm/actions/handshake/getHandshakeCount.js +5 -0
- package/_esm/actions/handshake/getHandshakeStatus.js +5 -0
- package/_esm/actions/handshake/handshakeExists.js +5 -0
- package/_esm/actions/handshake/hasHandshakeCompleted.js +5 -0
- package/_esm/actions/handshake/index.js +5 -0
- package/_esm/actions/handshake/types.js +1 -0
- package/_esm/actions/index.js +12 -0
- package/_esm/actions/potential/getActiveReferralShare.js +5 -0
- package/_esm/actions/potential/getCycleNumber.js +5 -0
- package/_esm/actions/potential/getCyclePotentialMinted.js +5 -0
- package/_esm/actions/potential/getCycleSupply.js +5 -0
- package/_esm/actions/potential/getDefaultActiveReferralShare.js +5 -0
- package/_esm/actions/potential/getMaxSupply.js +5 -0
- package/_esm/actions/potential/getMonthNumber.js +5 -0
- package/_esm/actions/potential/getMonthPotentialMinted.js +5 -0
- package/_esm/actions/potential/getMonthSupply.js +5 -0
- package/_esm/actions/potential/getPotential.js +5 -0
- package/_esm/actions/potential/getTotalPotentialMinted.js +5 -0
- package/_esm/actions/potential/index.js +11 -0
- package/_esm/actions/puzzlePieces/getCollectionsCount.js +5 -0
- package/_esm/actions/puzzlePieces/getItemsCount.js +5 -0
- package/_esm/actions/puzzlePieces/getOwner.js +5 -0
- package/_esm/actions/puzzlePieces/getPendingWildcards.js +6 -0
- package/_esm/actions/puzzlePieces/getTotalPuzzlePiecesMinted.js +5 -0
- package/_esm/actions/puzzlePieces/getWildcardCollectionId.js +5 -0
- package/_esm/actions/puzzlePieces/getWildcardDistributionMap.js +6 -0
- package/_esm/actions/puzzlePieces/getWildcardThreshold.js +5 -0
- package/_esm/actions/puzzlePieces/index.js +8 -0
- package/_esm/actions/puzzlePieces/types.js +1 -0
- package/_esm/actions/referral/decodePage.js +10 -0
- package/_esm/actions/referral/getActiveReferrals.js +11 -0
- package/_esm/actions/referral/getActiveReferralsCount.js +5 -0
- package/_esm/actions/referral/getBlockProducers.js +5 -0
- package/_esm/actions/referral/getBlockProducersPage.js +6 -0
- package/_esm/actions/referral/getPendingReferrals.js +5 -0
- package/_esm/actions/referral/getPendingReferralsPage.js +6 -0
- package/_esm/actions/referral/getReferrer.js +5 -0
- package/_esm/actions/referral/index.js +7 -0
- package/_esm/actions/referral/types.js +1 -0
- package/_esm/actions/reputationVoting/getTally.js +11 -0
- package/_esm/actions/reputationVoting/getVotesForAccount.js +13 -0
- package/_esm/actions/reputationVoting/getVotingReputation.js +5 -0
- package/_esm/actions/reputationVoting/index.js +4 -0
- package/_esm/actions/reputationVoting/isPassing.js +5 -0
- package/_esm/actions/reputationVoting/types.js +1 -0
- package/_esm/actions/rewardPool/getRewardPoolAccount.js +5 -0
- package/_esm/actions/rewardPool/getRewardPoolBalance.js +5 -0
- package/_esm/actions/rewardPool/index.js +2 -0
- package/_esm/actions/submitAndWait.js +132 -0
- package/_esm/actions/techCommitteeManager/getSelectedTechCommittee.js +5 -0
- package/_esm/actions/techCommitteeManager/getTechCommitteeCandidates.js +5 -0
- package/_esm/actions/techCommitteeManager/index.js +2 -0
- package/_esm/actions/validatorManager/decodePairs.js +4 -0
- package/_esm/actions/validatorManager/getActiveValidators.js +5 -0
- package/_esm/actions/validatorManager/getOffenceValidators.js +6 -0
- package/_esm/actions/validatorManager/getOfflineValidators.js +6 -0
- package/_esm/actions/validatorManager/getReputationForAccount.js +5 -0
- package/_esm/actions/validatorManager/getReputationPenaltyFor.js +5 -0
- package/_esm/actions/validatorManager/getReputations.js +6 -0
- package/_esm/actions/validatorManager/getSelectedValidators.js +5 -0
- package/_esm/actions/validatorManager/getValidatorCandidates.js +5 -0
- package/_esm/actions/validatorManager/index.js +8 -0
- package/_esm/actions/validatorManager/types.js +1 -0
- package/_esm/chains/defineChain.js +3 -0
- package/_esm/chains/definitions.js +49 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/client/compatibility.js +55 -0
- package/_esm/client/createClient.js +32 -0
- package/_esm/client/types.js +1 -0
- package/_esm/crypto/ctypeHash.js +20 -0
- package/_esm/crypto/index.js +1 -0
- package/_esm/ctypes/definitions.js +207 -0
- package/_esm/ctypes/index.js +2 -0
- package/_esm/did/didUri.js +11 -0
- package/_esm/index.js +14 -0
- package/_esm/package.json +1 -0
- package/_esm/plugins/activityTracker.js +15 -0
- package/_esm/plugins/handshake.js +12 -0
- package/_esm/plugins/index.js +9 -0
- package/_esm/plugins/potential.js +18 -0
- package/_esm/plugins/puzzlePieces.js +15 -0
- package/_esm/plugins/referral.js +14 -0
- package/_esm/plugins/reputationVoting.js +11 -0
- package/_esm/plugins/rewardPool.js +9 -0
- package/_esm/plugins/techCommitteeManager.js +9 -0
- package/_esm/plugins/validatorManager.js +15 -0
- package/_esm/rpc/bundle.js +21 -0
- package/_esm/rpc/call.js +25 -0
- package/_esm/rpc/definitions.js +379 -0
- package/_esm/rpc/index.js +3 -0
- package/_esm/rpc/types.js +41 -0
- package/_esm/types/index.js +2 -0
- package/_types/accounts/index.d.ts +7 -0
- package/_types/accounts/index.d.ts.map +1 -0
- package/_types/accounts/keyring.d.ts +28 -0
- package/_types/accounts/keyring.d.ts.map +1 -0
- package/_types/accounts/substrateSigner.d.ts +5 -0
- package/_types/accounts/substrateSigner.d.ts.map +1 -0
- package/_types/accounts/types.d.ts +6 -0
- package/_types/accounts/types.d.ts.map +1 -0
- package/_types/accounts/wellKnown.d.ts +24 -0
- package/_types/accounts/wellKnown.d.ts.map +1 -0
- package/_types/actions/activityTracker/calculateActivityReputationAtBlock.d.ts +9 -0
- package/_types/actions/activityTracker/calculateActivityReputationAtBlock.d.ts.map +1 -0
- package/_types/actions/activityTracker/decodeReputationPage.d.ts +4 -0
- package/_types/actions/activityTracker/decodeReputationPage.d.ts.map +1 -0
- package/_types/actions/activityTracker/getActivityReputation.d.ts +8 -0
- package/_types/actions/activityTracker/getActivityReputation.d.ts.map +1 -0
- package/_types/actions/activityTracker/getActivityReputationInfo.d.ts +9 -0
- package/_types/actions/activityTracker/getActivityReputationInfo.d.ts.map +1 -0
- package/_types/actions/activityTracker/getActivityTrackerConfig.d.ts +8 -0
- package/_types/actions/activityTracker/getActivityTrackerConfig.d.ts.map +1 -0
- package/_types/actions/activityTracker/getAllActivityReputations.d.ts +8 -0
- package/_types/actions/activityTracker/getAllActivityReputations.d.ts.map +1 -0
- package/_types/actions/activityTracker/getAllRawActivityReputations.d.ts +8 -0
- package/_types/actions/activityTracker/getAllRawActivityReputations.d.ts.map +1 -0
- package/_types/actions/activityTracker/getMaxActivityReputation.d.ts +7 -0
- package/_types/actions/activityTracker/getMaxActivityReputation.d.ts.map +1 -0
- package/_types/actions/activityTracker/getRawActivityReputation.d.ts +8 -0
- package/_types/actions/activityTracker/getRawActivityReputation.d.ts.map +1 -0
- package/_types/actions/activityTracker/index.d.ts +18 -0
- package/_types/actions/activityTracker/index.d.ts.map +1 -0
- package/_types/actions/activityTracker/types.d.ts +20 -0
- package/_types/actions/activityTracker/types.d.ts.map +1 -0
- package/_types/actions/attestation/attest.d.ts +21 -0
- package/_types/actions/attestation/attest.d.ts.map +1 -0
- package/_types/actions/attestation/index.d.ts +3 -0
- package/_types/actions/attestation/index.d.ts.map +1 -0
- package/_types/actions/did/createDid.d.ts +10 -0
- package/_types/actions/did/createDid.d.ts.map +1 -0
- package/_types/actions/did/index.d.ts +3 -0
- package/_types/actions/did/index.d.ts.map +1 -0
- package/_types/actions/handshake/getCompletedHandshakes.d.ts +8 -0
- package/_types/actions/handshake/getCompletedHandshakes.d.ts.map +1 -0
- package/_types/actions/handshake/getHandshakeCount.d.ts +8 -0
- package/_types/actions/handshake/getHandshakeCount.d.ts.map +1 -0
- package/_types/actions/handshake/getHandshakeStatus.d.ts +10 -0
- package/_types/actions/handshake/getHandshakeStatus.d.ts.map +1 -0
- package/_types/actions/handshake/handshakeExists.d.ts +9 -0
- package/_types/actions/handshake/handshakeExists.d.ts.map +1 -0
- package/_types/actions/handshake/hasHandshakeCompleted.d.ts +9 -0
- package/_types/actions/handshake/hasHandshakeCompleted.d.ts.map +1 -0
- package/_types/actions/handshake/index.d.ts +12 -0
- package/_types/actions/handshake/index.d.ts.map +1 -0
- package/_types/actions/handshake/types.d.ts +2 -0
- package/_types/actions/handshake/types.d.ts.map +1 -0
- package/_types/actions/index.d.ts +14 -0
- package/_types/actions/index.d.ts.map +1 -0
- package/_types/actions/potential/getActiveReferralShare.d.ts +8 -0
- package/_types/actions/potential/getActiveReferralShare.d.ts.map +1 -0
- package/_types/actions/potential/getCycleNumber.d.ts +7 -0
- package/_types/actions/potential/getCycleNumber.d.ts.map +1 -0
- package/_types/actions/potential/getCyclePotentialMinted.d.ts +7 -0
- package/_types/actions/potential/getCyclePotentialMinted.d.ts.map +1 -0
- package/_types/actions/potential/getCycleSupply.d.ts +7 -0
- package/_types/actions/potential/getCycleSupply.d.ts.map +1 -0
- package/_types/actions/potential/getDefaultActiveReferralShare.d.ts +7 -0
- package/_types/actions/potential/getDefaultActiveReferralShare.d.ts.map +1 -0
- package/_types/actions/potential/getMaxSupply.d.ts +7 -0
- package/_types/actions/potential/getMaxSupply.d.ts.map +1 -0
- package/_types/actions/potential/getMonthNumber.d.ts +7 -0
- package/_types/actions/potential/getMonthNumber.d.ts.map +1 -0
- package/_types/actions/potential/getMonthPotentialMinted.d.ts +7 -0
- package/_types/actions/potential/getMonthPotentialMinted.d.ts.map +1 -0
- package/_types/actions/potential/getMonthSupply.d.ts +7 -0
- package/_types/actions/potential/getMonthSupply.d.ts.map +1 -0
- package/_types/actions/potential/getPotential.d.ts +8 -0
- package/_types/actions/potential/getPotential.d.ts.map +1 -0
- package/_types/actions/potential/getTotalPotentialMinted.d.ts +7 -0
- package/_types/actions/potential/getTotalPotentialMinted.d.ts.map +1 -0
- package/_types/actions/potential/index.d.ts +23 -0
- package/_types/actions/potential/index.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getCollectionsCount.d.ts +7 -0
- package/_types/actions/puzzlePieces/getCollectionsCount.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getItemsCount.d.ts +8 -0
- package/_types/actions/puzzlePieces/getItemsCount.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getOwner.d.ts +9 -0
- package/_types/actions/puzzlePieces/getOwner.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getPendingWildcards.d.ts +8 -0
- package/_types/actions/puzzlePieces/getPendingWildcards.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getTotalPuzzlePiecesMinted.d.ts +7 -0
- package/_types/actions/puzzlePieces/getTotalPuzzlePiecesMinted.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getWildcardCollectionId.d.ts +7 -0
- package/_types/actions/puzzlePieces/getWildcardCollectionId.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getWildcardDistributionMap.d.ts +8 -0
- package/_types/actions/puzzlePieces/getWildcardDistributionMap.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/getWildcardThreshold.d.ts +7 -0
- package/_types/actions/puzzlePieces/getWildcardThreshold.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/index.d.ts +18 -0
- package/_types/actions/puzzlePieces/index.d.ts.map +1 -0
- package/_types/actions/puzzlePieces/types.d.ts +5 -0
- package/_types/actions/puzzlePieces/types.d.ts.map +1 -0
- package/_types/actions/referral/decodePage.d.ts +4 -0
- package/_types/actions/referral/decodePage.d.ts.map +1 -0
- package/_types/actions/referral/getActiveReferrals.d.ts +9 -0
- package/_types/actions/referral/getActiveReferrals.d.ts.map +1 -0
- package/_types/actions/referral/getActiveReferralsCount.d.ts +8 -0
- package/_types/actions/referral/getActiveReferralsCount.d.ts.map +1 -0
- package/_types/actions/referral/getBlockProducers.d.ts +7 -0
- package/_types/actions/referral/getBlockProducers.d.ts.map +1 -0
- package/_types/actions/referral/getBlockProducersPage.d.ts +8 -0
- package/_types/actions/referral/getBlockProducersPage.d.ts.map +1 -0
- package/_types/actions/referral/getPendingReferrals.d.ts +8 -0
- package/_types/actions/referral/getPendingReferrals.d.ts.map +1 -0
- package/_types/actions/referral/getPendingReferralsPage.d.ts +9 -0
- package/_types/actions/referral/getPendingReferralsPage.d.ts.map +1 -0
- package/_types/actions/referral/getReferrer.d.ts +8 -0
- package/_types/actions/referral/getReferrer.d.ts.map +1 -0
- package/_types/actions/referral/index.d.ts +16 -0
- package/_types/actions/referral/index.d.ts.map +1 -0
- package/_types/actions/referral/types.d.ts +6 -0
- package/_types/actions/referral/types.d.ts.map +1 -0
- package/_types/actions/reputationVoting/getTally.d.ts +9 -0
- package/_types/actions/reputationVoting/getTally.d.ts.map +1 -0
- package/_types/actions/reputationVoting/getVotesForAccount.d.ts +9 -0
- package/_types/actions/reputationVoting/getVotesForAccount.d.ts.map +1 -0
- package/_types/actions/reputationVoting/getVotingReputation.d.ts +8 -0
- package/_types/actions/reputationVoting/getVotingReputation.d.ts.map +1 -0
- package/_types/actions/reputationVoting/index.d.ts +10 -0
- package/_types/actions/reputationVoting/index.d.ts.map +1 -0
- package/_types/actions/reputationVoting/isPassing.d.ts +8 -0
- package/_types/actions/reputationVoting/isPassing.d.ts.map +1 -0
- package/_types/actions/reputationVoting/types.d.ts +17 -0
- package/_types/actions/reputationVoting/types.d.ts.map +1 -0
- package/_types/actions/rewardPool/getRewardPoolAccount.d.ts +7 -0
- package/_types/actions/rewardPool/getRewardPoolAccount.d.ts.map +1 -0
- package/_types/actions/rewardPool/getRewardPoolBalance.d.ts +7 -0
- package/_types/actions/rewardPool/getRewardPoolBalance.d.ts.map +1 -0
- package/_types/actions/rewardPool/index.d.ts +5 -0
- package/_types/actions/rewardPool/index.d.ts.map +1 -0
- package/_types/actions/submitAndWait.d.ts +65 -0
- package/_types/actions/submitAndWait.d.ts.map +1 -0
- package/_types/actions/techCommitteeManager/getSelectedTechCommittee.d.ts +7 -0
- package/_types/actions/techCommitteeManager/getSelectedTechCommittee.d.ts.map +1 -0
- package/_types/actions/techCommitteeManager/getTechCommitteeCandidates.d.ts +7 -0
- package/_types/actions/techCommitteeManager/getTechCommitteeCandidates.d.ts.map +1 -0
- package/_types/actions/techCommitteeManager/index.d.ts +5 -0
- package/_types/actions/techCommitteeManager/index.d.ts.map +1 -0
- package/_types/actions/validatorManager/decodePairs.d.ts +8 -0
- package/_types/actions/validatorManager/decodePairs.d.ts.map +1 -0
- package/_types/actions/validatorManager/getActiveValidators.d.ts +7 -0
- package/_types/actions/validatorManager/getActiveValidators.d.ts.map +1 -0
- package/_types/actions/validatorManager/getOffenceValidators.d.ts +8 -0
- package/_types/actions/validatorManager/getOffenceValidators.d.ts.map +1 -0
- package/_types/actions/validatorManager/getOfflineValidators.d.ts +8 -0
- package/_types/actions/validatorManager/getOfflineValidators.d.ts.map +1 -0
- package/_types/actions/validatorManager/getReputationForAccount.d.ts +8 -0
- package/_types/actions/validatorManager/getReputationForAccount.d.ts.map +1 -0
- package/_types/actions/validatorManager/getReputationPenaltyFor.d.ts +8 -0
- package/_types/actions/validatorManager/getReputationPenaltyFor.d.ts.map +1 -0
- package/_types/actions/validatorManager/getReputations.d.ts +9 -0
- package/_types/actions/validatorManager/getReputations.d.ts.map +1 -0
- package/_types/actions/validatorManager/getSelectedValidators.d.ts +7 -0
- package/_types/actions/validatorManager/getSelectedValidators.d.ts.map +1 -0
- package/_types/actions/validatorManager/getValidatorCandidates.d.ts +7 -0
- package/_types/actions/validatorManager/getValidatorCandidates.d.ts.map +1 -0
- package/_types/actions/validatorManager/index.d.ts +18 -0
- package/_types/actions/validatorManager/index.d.ts.map +1 -0
- package/_types/actions/validatorManager/types.d.ts +10 -0
- package/_types/actions/validatorManager/types.d.ts.map +1 -0
- package/_types/chains/defineChain.d.ts +18 -0
- package/_types/chains/defineChain.d.ts.map +1 -0
- package/_types/chains/definitions.d.ts +65 -0
- package/_types/chains/definitions.d.ts.map +1 -0
- package/_types/chains/index.d.ts +4 -0
- package/_types/chains/index.d.ts.map +1 -0
- package/_types/client/compatibility.d.ts +16 -0
- package/_types/client/compatibility.d.ts.map +1 -0
- package/_types/client/createClient.d.ts +12 -0
- package/_types/client/createClient.d.ts.map +1 -0
- package/_types/client/types.d.ts +7 -0
- package/_types/client/types.d.ts.map +1 -0
- package/_types/crypto/ctypeHash.d.ts +16 -0
- package/_types/crypto/ctypeHash.d.ts.map +1 -0
- package/_types/crypto/index.d.ts +3 -0
- package/_types/crypto/index.d.ts.map +1 -0
- package/_types/ctypes/definitions.d.ts +21 -0
- package/_types/ctypes/definitions.d.ts.map +1 -0
- package/_types/ctypes/index.d.ts +4 -0
- package/_types/ctypes/index.d.ts.map +1 -0
- package/_types/did/didUri.d.ts +11 -0
- package/_types/did/didUri.d.ts.map +1 -0
- package/_types/index.d.ts +25 -0
- package/_types/index.d.ts.map +1 -0
- package/_types/plugins/activityTracker.d.ts +34 -0
- package/_types/plugins/activityTracker.d.ts.map +1 -0
- package/_types/plugins/handshake.d.ts +32 -0
- package/_types/plugins/handshake.d.ts.map +1 -0
- package/_types/plugins/index.d.ts +19 -0
- package/_types/plugins/index.d.ts.map +1 -0
- package/_types/plugins/potential.d.ts +29 -0
- package/_types/plugins/potential.d.ts.map +1 -0
- package/_types/plugins/puzzlePieces.d.ts +28 -0
- package/_types/plugins/puzzlePieces.d.ts.map +1 -0
- package/_types/plugins/referral.d.ts +17 -0
- package/_types/plugins/referral.d.ts.map +1 -0
- package/_types/plugins/reputationVoting.d.ts +25 -0
- package/_types/plugins/reputationVoting.d.ts.map +1 -0
- package/_types/plugins/rewardPool.d.ts +14 -0
- package/_types/plugins/rewardPool.d.ts.map +1 -0
- package/_types/plugins/techCommitteeManager.d.ts +14 -0
- package/_types/plugins/techCommitteeManager.d.ts.map +1 -0
- package/_types/plugins/validatorManager.d.ts +30 -0
- package/_types/plugins/validatorManager.d.ts.map +1 -0
- package/_types/rpc/bundle.d.ts +4 -0
- package/_types/rpc/bundle.d.ts.map +1 -0
- package/_types/rpc/call.d.ts +4 -0
- package/_types/rpc/call.d.ts.map +1 -0
- package/_types/rpc/definitions.d.ts +3 -0
- package/_types/rpc/definitions.d.ts.map +1 -0
- package/_types/rpc/index.d.ts +4 -0
- package/_types/rpc/index.d.ts.map +1 -0
- package/_types/rpc/types.d.ts +3 -0
- package/_types/rpc/types.d.ts.map +1 -0
- package/_types/types/index.d.ts +17 -0
- package/_types/types/index.d.ts.map +1 -0
- package/package.json +173 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { getCollectionsCount } from './getCollectionsCount.js';
|
|
2
|
+
export { getItemsCount } from './getItemsCount.js';
|
|
3
|
+
export { getOwner } from './getOwner.js';
|
|
4
|
+
export { getPendingWildcards } from './getPendingWildcards.js';
|
|
5
|
+
export { getTotalPuzzlePiecesMinted } from './getTotalPuzzlePiecesMinted.js';
|
|
6
|
+
export { getWildcardCollectionId } from './getWildcardCollectionId.js';
|
|
7
|
+
export { getWildcardDistributionMap } from './getWildcardDistributionMap.js';
|
|
8
|
+
export { getWildcardThreshold } from './getWildcardThreshold.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function decodeAccountPage(raw) {
|
|
2
|
+
const page = raw.toJSON();
|
|
3
|
+
return {
|
|
4
|
+
items: (page.items ?? []),
|
|
5
|
+
total: page.total ?? null,
|
|
6
|
+
page: page.page ?? 0,
|
|
7
|
+
pageSize: page.pageSize ?? page.page_size ?? 0,
|
|
8
|
+
hasMore: page.hasMore ?? page.has_more ?? false,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
export async function getActiveReferrals(client, { account, at }) {
|
|
3
|
+
const result = await callRpc(client, 'referral', 'activeReferrals', account, at);
|
|
4
|
+
if (result.isNone)
|
|
5
|
+
return null;
|
|
6
|
+
const node = result.unwrap().toJSON();
|
|
7
|
+
return {
|
|
8
|
+
parent: (node.parent ?? null),
|
|
9
|
+
children: (node.children ?? []),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
import { decodeAccountPage } from './decodePage.js';
|
|
3
|
+
export async function getBlockProducersPage(client, { pagination, at } = {}) {
|
|
4
|
+
const result = await callRpc(client, 'referral', 'blockProducersPage', pagination, at);
|
|
5
|
+
return decodeAccountPage(result);
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
import { decodeAccountPage } from './decodePage.js';
|
|
3
|
+
export async function getPendingReferralsPage(client, { referrer, pagination, at }) {
|
|
4
|
+
const result = await callRpc(client, 'referral', 'pendingReferralsPage', referrer, pagination, at);
|
|
5
|
+
return decodeAccountPage(result);
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { getActiveReferrals } from './getActiveReferrals.js';
|
|
2
|
+
export { getActiveReferralsCount } from './getActiveReferralsCount.js';
|
|
3
|
+
export { getBlockProducers } from './getBlockProducers.js';
|
|
4
|
+
export { getBlockProducersPage } from './getBlockProducersPage.js';
|
|
5
|
+
export { getPendingReferrals } from './getPendingReferrals.js';
|
|
6
|
+
export { getPendingReferralsPage } from './getPendingReferralsPage.js';
|
|
7
|
+
export { getReferrer } from './getReferrer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
export async function getTally(client, { pollIndex, at }) {
|
|
3
|
+
const result = await callRpc(client, 'reputationVoting', 'getTally', pollIndex, at);
|
|
4
|
+
const tally = result.toJSON();
|
|
5
|
+
return {
|
|
6
|
+
ayes: BigInt(tally.ayes ?? 0),
|
|
7
|
+
nays: BigInt(tally.nays ?? 0),
|
|
8
|
+
turnout: tally.turnout ?? 0,
|
|
9
|
+
electorate: BigInt(tally.electorate ?? 0),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
export async function getVotesForAccount(client, { account, at }) {
|
|
3
|
+
const result = await callRpc(client, 'reputationVoting', 'getVotesForAccount', account, at);
|
|
4
|
+
const pairs = result.toJSON();
|
|
5
|
+
return pairs.map(([pollIndex, vote]) => ({
|
|
6
|
+
pollIndex,
|
|
7
|
+
vote: {
|
|
8
|
+
direction: (vote.direction ?? 'aye').toLowerCase(),
|
|
9
|
+
reputation: vote.reputation ?? 0,
|
|
10
|
+
votedAt: vote.votedAt ?? vote.voted_at ?? 0,
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A call the runtime rejected, carrying the pallet and variant that rejected it.
|
|
3
|
+
*
|
|
4
|
+
* The names are what callers branch on — `ctype.AlreadyExists` is an idempotent no-op, while
|
|
5
|
+
* another error from the same call is not. Parsing that back out of a message string is the
|
|
6
|
+
* failure mode this type exists to prevent, so the names stay structured.
|
|
7
|
+
*/
|
|
8
|
+
export class DispatchFailedError extends Error {
|
|
9
|
+
section;
|
|
10
|
+
method;
|
|
11
|
+
docs;
|
|
12
|
+
constructor(section, method, docs = []) {
|
|
13
|
+
const detail = docs.length > 0 ? `: ${docs.join(' ').trim()}` : '';
|
|
14
|
+
super(`${section}.${method}${detail}`);
|
|
15
|
+
this.name = 'DispatchFailedError';
|
|
16
|
+
this.section = section;
|
|
17
|
+
this.method = method;
|
|
18
|
+
this.docs = docs;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Narrows an unknown error to one specific runtime rejection. */
|
|
22
|
+
export function isDispatchFailure(error, section, method) {
|
|
23
|
+
return (error instanceof DispatchFailedError && error.section === section && error.method === method);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The provider abandoned the status subscription — a dropped socket, say.
|
|
27
|
+
*
|
|
28
|
+
* Distinct from the extrinsic being rejected: nothing is known about whether it executed, so a
|
|
29
|
+
* caller that retries has to treat the submission as possibly in flight.
|
|
30
|
+
*/
|
|
31
|
+
export class SubscriptionFailedError extends Error {
|
|
32
|
+
internalError;
|
|
33
|
+
constructor(internalError) {
|
|
34
|
+
super(internalError instanceof Error ? internalError.message : String(internalError));
|
|
35
|
+
this.name = 'SubscriptionFailedError';
|
|
36
|
+
this.internalError = internalError;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** No terminal status arrived within the budget. The extrinsic may still be in flight. */
|
|
40
|
+
export class SubmitTimeoutError extends Error {
|
|
41
|
+
timeoutMs;
|
|
42
|
+
constructor(timeoutMs) {
|
|
43
|
+
super(`transaction was not included within ${timeoutMs}ms`);
|
|
44
|
+
this.name = 'SubmitTimeoutError';
|
|
45
|
+
this.timeoutMs = timeoutMs;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The extrinsic reached a status it cannot recover from — dropped, invalid, usurped, or out of
|
|
50
|
+
* time for finality. It will never be included, so a caller may resubmit.
|
|
51
|
+
*/
|
|
52
|
+
export class NotIncludedError extends Error {
|
|
53
|
+
status;
|
|
54
|
+
txHash;
|
|
55
|
+
constructor(status, txHash) {
|
|
56
|
+
super(`transaction ${txHash} will not be included: ${status}`);
|
|
57
|
+
this.name = 'NotIncludedError';
|
|
58
|
+
this.status = status;
|
|
59
|
+
this.txHash = txHash;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export async function submitAndWait(client, params) {
|
|
63
|
+
const { extrinsic, signer, options } = params;
|
|
64
|
+
const timeoutMs = params.timeoutMs ?? 120_000;
|
|
65
|
+
const waitFor = params.waitFor ?? 'inBlock';
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
let unsubscribe;
|
|
68
|
+
let settled = false;
|
|
69
|
+
const settle = () => {
|
|
70
|
+
settled = true;
|
|
71
|
+
clearTimeout(timer);
|
|
72
|
+
unsubscribe?.();
|
|
73
|
+
};
|
|
74
|
+
const timer = setTimeout(() => {
|
|
75
|
+
settle();
|
|
76
|
+
reject(new SubmitTimeoutError(timeoutMs));
|
|
77
|
+
}, timeoutMs);
|
|
78
|
+
const handle = (result) => {
|
|
79
|
+
const { status, dispatchError, internalError, txHash, events } = result;
|
|
80
|
+
// The provider gives up on the subscription — a dropped socket, say. No further status
|
|
81
|
+
// will arrive, so waiting for one would only burn the timeout.
|
|
82
|
+
if (internalError) {
|
|
83
|
+
settle();
|
|
84
|
+
reject(new SubscriptionFailedError(internalError));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (status.isDropped || status.isInvalid || status.isUsurped || status.isFinalityTimeout) {
|
|
88
|
+
settle();
|
|
89
|
+
reject(new NotIncludedError(status.type, txHash.toHex()));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// A dispatch error is reported with the including block, so it is read before the status
|
|
93
|
+
// gate — waiting for finalization would otherwise sit on a failure already known.
|
|
94
|
+
if (dispatchError) {
|
|
95
|
+
settle();
|
|
96
|
+
if (dispatchError.isModule) {
|
|
97
|
+
const decoded = client.api.registry.findMetaError(dispatchError.asModule);
|
|
98
|
+
reject(new DispatchFailedError(decoded.section, decoded.name, decoded.docs.map(String)));
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
reject(new DispatchFailedError('runtime', dispatchError.type));
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const reached = waitFor === 'finalized' ? status.isFinalized : status.isInBlock;
|
|
106
|
+
if (!reached)
|
|
107
|
+
return;
|
|
108
|
+
settle();
|
|
109
|
+
const interrupted = events.find(({ event }) => client.api.events['utility']?.['BatchInterrupted']?.is(event));
|
|
110
|
+
if (interrupted) {
|
|
111
|
+
reject(new Error(`utility.BatchInterrupted: a call in the batch failed (${interrupted.event.data.toString()})`));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
resolve({
|
|
115
|
+
blockHash: (status.isFinalized ? status.asFinalized : status.asInBlock).toHex(),
|
|
116
|
+
txHash: txHash.toHex(),
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const send = options
|
|
120
|
+
? extrinsic.signAndSend(signer, options, handle)
|
|
121
|
+
: extrinsic.signAndSend(signer, handle);
|
|
122
|
+
send.then((unsub) => {
|
|
123
|
+
unsubscribe = unsub;
|
|
124
|
+
// The callback can reach a terminal status before this assignment lands.
|
|
125
|
+
if (settled)
|
|
126
|
+
unsub();
|
|
127
|
+
}, (error) => {
|
|
128
|
+
settle();
|
|
129
|
+
reject(error);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
import { decodePairs } from './decodePairs.js';
|
|
3
|
+
export async function getOffenceValidators(client, { at } = {}) {
|
|
4
|
+
const result = await callRpc(client, 'validatorManager', 'offenceValidators', at);
|
|
5
|
+
return decodePairs(result, 'account', 'session');
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
import { decodePairs } from './decodePairs.js';
|
|
3
|
+
export async function getOfflineValidators(client, { at } = {}) {
|
|
4
|
+
const result = await callRpc(client, 'validatorManager', 'offlineValidators', at);
|
|
5
|
+
return decodePairs(result, 'account', 'session');
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { callRpc } from '../../rpc/call.js';
|
|
2
|
+
import { decodePairs } from './decodePairs.js';
|
|
3
|
+
export async function getReputations(client, { accounts, at }) {
|
|
4
|
+
const result = await callRpc(client, 'validatorManager', 'getReputations', accounts, at);
|
|
5
|
+
return decodePairs(result, 'account', 'reputation');
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { getActiveValidators } from './getActiveValidators.js';
|
|
2
|
+
export { getOffenceValidators } from './getOffenceValidators.js';
|
|
3
|
+
export { getOfflineValidators } from './getOfflineValidators.js';
|
|
4
|
+
export { getReputationForAccount } from './getReputationForAccount.js';
|
|
5
|
+
export { getReputationPenaltyFor } from './getReputationPenaltyFor.js';
|
|
6
|
+
export { getReputations } from './getReputations.js';
|
|
7
|
+
export { getSelectedValidators } from './getSelectedValidators.js';
|
|
8
|
+
export { getValidatorCandidates } from './getValidatorCandidates.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineChain } from './defineChain.js';
|
|
2
|
+
export const totochain = defineChain({
|
|
3
|
+
id: 33000,
|
|
4
|
+
name: 'Totochain',
|
|
5
|
+
nativeCurrency: { decimals: 18, name: 'Toto', symbol: 'TOTO' },
|
|
6
|
+
rpcUrls: {
|
|
7
|
+
default: {
|
|
8
|
+
http: ['https://rpc.totochain.io'],
|
|
9
|
+
webSocket: ['wss://rpc.totochain.io'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
testnet: false,
|
|
13
|
+
});
|
|
14
|
+
export const totochainTestnet = defineChain({
|
|
15
|
+
id: 33001,
|
|
16
|
+
name: 'Totochain Testnet',
|
|
17
|
+
nativeCurrency: { decimals: 18, name: 'Test Toto', symbol: 'TEST' },
|
|
18
|
+
rpcUrls: {
|
|
19
|
+
default: {
|
|
20
|
+
http: ['https://rpc.testnet.totochain.io'],
|
|
21
|
+
webSocket: ['wss://rpc.testnet.totochain.io'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
testnet: true,
|
|
25
|
+
});
|
|
26
|
+
export const totochainLocal = defineChain({
|
|
27
|
+
id: 33002,
|
|
28
|
+
name: 'Totochain Local',
|
|
29
|
+
nativeCurrency: { decimals: 18, name: 'Test Toto', symbol: 'TEST' },
|
|
30
|
+
rpcUrls: {
|
|
31
|
+
default: {
|
|
32
|
+
http: ['http://127.0.0.1:9944'],
|
|
33
|
+
webSocket: ['ws://127.0.0.1:9944'],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
testnet: true,
|
|
37
|
+
});
|
|
38
|
+
export const totochainDev = defineChain({
|
|
39
|
+
id: 33003,
|
|
40
|
+
name: 'Totochain Dev',
|
|
41
|
+
nativeCurrency: { decimals: 18, name: 'Test Toto', symbol: 'TEST' },
|
|
42
|
+
rpcUrls: {
|
|
43
|
+
default: {
|
|
44
|
+
http: ['http://127.0.0.1:9944'],
|
|
45
|
+
webSocket: ['ws://127.0.0.1:9944'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
testnet: true,
|
|
49
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RPC_DEFINITIONS } from '../rpc/definitions.js';
|
|
2
|
+
/** The runtime this client is written against. */
|
|
3
|
+
export const SPEC_NAME = 'totochain';
|
|
4
|
+
/** Every call an action builds, with the arguments it passes, as the node's metadata lists them. */
|
|
5
|
+
export const EXPECTED_CALLS = {
|
|
6
|
+
'attestation.add': 'subject: AccountId20, ctypeHash: H256',
|
|
7
|
+
'attestation.remove': 'subject: AccountId20, ctypeHash: H256, issuanceId: u64',
|
|
8
|
+
'attestation.revoke': 'subject: AccountId20, ctypeHash: H256, issuanceId: u64',
|
|
9
|
+
'did.createDidFor': 'subject: AccountId20',
|
|
10
|
+
'did.createFromAccount': '',
|
|
11
|
+
};
|
|
12
|
+
/** Thrown by `createClient` in strict mode when the node does not match this client. */
|
|
13
|
+
export class IncompatibleNodeError extends Error {
|
|
14
|
+
problems;
|
|
15
|
+
constructor(problems) {
|
|
16
|
+
super(`The node does not match @totochain/client:\n- ${problems.join('\n- ')}`);
|
|
17
|
+
this.name = 'IncompatibleNodeError';
|
|
18
|
+
this.problems = problems;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Lists every way the connected node differs from what this client sends: the runtime, the
|
|
23
|
+
* calls the actions build and the custom RPCs. Empty when they match.
|
|
24
|
+
*/
|
|
25
|
+
export function checkCompatibility(api) {
|
|
26
|
+
const problems = [];
|
|
27
|
+
const specName = api.runtimeVersion.specName.toString();
|
|
28
|
+
if (specName !== SPEC_NAME) {
|
|
29
|
+
problems.push(`runtime is ${specName}, expected ${SPEC_NAME}`);
|
|
30
|
+
}
|
|
31
|
+
for (const [call, expected] of Object.entries(EXPECTED_CALLS)) {
|
|
32
|
+
const [section, method] = call.split('.');
|
|
33
|
+
const fn = api.tx[section]?.[method];
|
|
34
|
+
if (!fn) {
|
|
35
|
+
problems.push(`call ${call} is missing`);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const actual = fn.meta.args
|
|
39
|
+
.map((arg) => `${arg.name.toString()}: ${arg.type.toString()}`)
|
|
40
|
+
.join(', ');
|
|
41
|
+
if (actual !== expected) {
|
|
42
|
+
problems.push(`call ${call} takes (${actual}), the client sends (${expected})`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// polkadot-js removes every RPC the node does not list in `rpc_methods`.
|
|
46
|
+
const rpc = api.rpc;
|
|
47
|
+
for (const [section, methods] of Object.entries(RPC_DEFINITIONS)) {
|
|
48
|
+
for (const method of Object.keys(methods)) {
|
|
49
|
+
if (typeof rpc[section]?.[method] !== 'function') {
|
|
50
|
+
problems.push(`RPC ${section}_${method} is missing`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return problems;
|
|
55
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ApiPromise, WsProvider } from '@polkadot/api';
|
|
2
|
+
import { RPC_DEFINITIONS } from '../rpc/definitions.js';
|
|
3
|
+
import { CHAIN_TYPES } from '../rpc/types.js';
|
|
4
|
+
import { checkCompatibility, IncompatibleNodeError } from './compatibility.js';
|
|
5
|
+
export function createClientFromApi(api) {
|
|
6
|
+
const client = {
|
|
7
|
+
api,
|
|
8
|
+
use(plugin) {
|
|
9
|
+
return Object.assign(Object.create(Object.getPrototypeOf(this)), this, plugin(this));
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
return client;
|
|
13
|
+
}
|
|
14
|
+
export async function createClient(options) {
|
|
15
|
+
const provider = new WsProvider(options.url, undefined, undefined, options.timeoutMs);
|
|
16
|
+
const api = await ApiPromise.create({
|
|
17
|
+
provider: provider,
|
|
18
|
+
rpc: RPC_DEFINITIONS,
|
|
19
|
+
types: CHAIN_TYPES,
|
|
20
|
+
});
|
|
21
|
+
const mode = options.compatibility ?? 'warn';
|
|
22
|
+
const problems = mode === 'off' ? [] : checkCompatibility(api);
|
|
23
|
+
if (problems.length > 0) {
|
|
24
|
+
const error = new IncompatibleNodeError(problems);
|
|
25
|
+
if (mode === 'strict') {
|
|
26
|
+
await api.disconnect();
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
console.warn(error.message);
|
|
30
|
+
}
|
|
31
|
+
return createClientFromApi(api);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { blake2AsHex } from '@polkadot/util-crypto';
|
|
2
|
+
function canonicalise(value) {
|
|
3
|
+
if (Array.isArray(value))
|
|
4
|
+
return value.map(canonicalise);
|
|
5
|
+
if (value !== null && typeof value === 'object') {
|
|
6
|
+
const sorted = {};
|
|
7
|
+
for (const key of Object.keys(value).sort()) {
|
|
8
|
+
sorted[key] = canonicalise(value[key]);
|
|
9
|
+
}
|
|
10
|
+
return sorted;
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
export function canonicalCTypeBytes(schema) {
|
|
15
|
+
const { $id: _ignored, ...rest } = schema;
|
|
16
|
+
return JSON.stringify(canonicalise(rest));
|
|
17
|
+
}
|
|
18
|
+
export function ctypeHash(schema) {
|
|
19
|
+
return blake2AsHex(canonicalCTypeBytes(schema), 256);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { canonicalCTypeBytes, ctypeHash } from './ctypeHash.js';
|