@totochain/client 0.0.0-stage → 0.1.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 +283 -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 +46 -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 +16 -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/fractionalNft/getCollectionsCount.d.cts +7 -0
- package/_cjs/actions/fractionalNft/getCollectionsCount.js +8 -0
- package/_cjs/actions/fractionalNft/getItemsCount.d.cts +8 -0
- package/_cjs/actions/fractionalNft/getItemsCount.js +8 -0
- package/_cjs/actions/fractionalNft/getNftInfo.d.cts +9 -0
- package/_cjs/actions/fractionalNft/getNftInfo.js +12 -0
- package/_cjs/actions/fractionalNft/getOwner.d.cts +9 -0
- package/_cjs/actions/fractionalNft/getOwner.js +8 -0
- package/_cjs/actions/fractionalNft/getTotalFnftsMinted.d.cts +7 -0
- package/_cjs/actions/fractionalNft/getTotalFnftsMinted.js +8 -0
- package/_cjs/actions/fractionalNft/getWildcardCollectionId.d.cts +7 -0
- package/_cjs/actions/fractionalNft/getWildcardCollectionId.js +8 -0
- package/_cjs/actions/fractionalNft/getWildcardDistributionMap.d.cts +8 -0
- package/_cjs/actions/fractionalNft/getWildcardDistributionMap.js +9 -0
- package/_cjs/actions/fractionalNft/getWildcardThreshold.d.cts +7 -0
- package/_cjs/actions/fractionalNft/getWildcardThreshold.js +8 -0
- package/_cjs/actions/fractionalNft/index.d.cts +18 -0
- package/_cjs/actions/fractionalNft/index.js +19 -0
- package/_cjs/actions/fractionalNft/types.d.cts +10 -0
- package/_cjs/actions/fractionalNft/types.js +2 -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/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/getCollectionIds.d.cts +7 -0
- package/_cjs/actions/rewardPool/getCollectionIds.js +8 -0
- package/_cjs/actions/rewardPool/getItemIds.d.cts +8 -0
- package/_cjs/actions/rewardPool/getItemIds.js +8 -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 +9 -0
- package/_cjs/actions/rewardPool/index.js +11 -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/createClient.d.cts +10 -0
- package/_cjs/client/createClient.js +25 -0
- package/_cjs/client/types.d.cts +7 -0
- package/_cjs/client/types.js +2 -0
- package/_cjs/crypto/claimHash.d.cts +23 -0
- package/_cjs/crypto/claimHash.js +38 -0
- package/_cjs/crypto/ctypeHash.d.cts +16 -0
- package/_cjs/crypto/ctypeHash.js +24 -0
- package/_cjs/crypto/index.d.cts +5 -0
- package/_cjs/crypto/index.js +9 -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/index.d.cts +22 -0
- package/_cjs/index.js +62 -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/fractionalNft.d.cts +31 -0
- package/_cjs/plugins/fractionalNft.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/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 +19 -0
- package/_cjs/plugins/rewardPool.js +14 -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 +12 -0
- package/_cjs/rpc/definitions.d.cts +3 -0
- package/_cjs/rpc/definitions.js +398 -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 +48 -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 +43 -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/fractionalNft/getCollectionsCount.js +5 -0
- package/_esm/actions/fractionalNft/getItemsCount.js +5 -0
- package/_esm/actions/fractionalNft/getNftInfo.js +9 -0
- package/_esm/actions/fractionalNft/getOwner.js +5 -0
- package/_esm/actions/fractionalNft/getTotalFnftsMinted.js +5 -0
- package/_esm/actions/fractionalNft/getWildcardCollectionId.js +5 -0
- package/_esm/actions/fractionalNft/getWildcardDistributionMap.js +6 -0
- package/_esm/actions/fractionalNft/getWildcardThreshold.js +5 -0
- package/_esm/actions/fractionalNft/index.js +8 -0
- package/_esm/actions/fractionalNft/types.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/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/getCollectionIds.js +5 -0
- package/_esm/actions/rewardPool/getItemIds.js +5 -0
- package/_esm/actions/rewardPool/getRewardPoolAccount.js +5 -0
- package/_esm/actions/rewardPool/getRewardPoolBalance.js +5 -0
- package/_esm/actions/rewardPool/index.js +4 -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/createClient.js +21 -0
- package/_esm/client/types.js +1 -0
- package/_esm/crypto/claimHash.js +34 -0
- package/_esm/crypto/ctypeHash.js +20 -0
- package/_esm/crypto/index.js +2 -0
- package/_esm/ctypes/definitions.js +207 -0
- package/_esm/ctypes/index.js +2 -0
- package/_esm/index.js +12 -0
- package/_esm/package.json +1 -0
- package/_esm/plugins/activityTracker.js +15 -0
- package/_esm/plugins/fractionalNft.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/referral.js +14 -0
- package/_esm/plugins/reputationVoting.js +11 -0
- package/_esm/plugins/rewardPool.js +11 -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 +9 -0
- package/_esm/rpc/definitions.js +395 -0
- package/_esm/rpc/index.js +3 -0
- package/_esm/rpc/types.js +45 -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 +16 -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/fractionalNft/getCollectionsCount.d.ts +7 -0
- package/_types/actions/fractionalNft/getCollectionsCount.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getItemsCount.d.ts +8 -0
- package/_types/actions/fractionalNft/getItemsCount.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getNftInfo.d.ts +9 -0
- package/_types/actions/fractionalNft/getNftInfo.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getOwner.d.ts +9 -0
- package/_types/actions/fractionalNft/getOwner.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getTotalFnftsMinted.d.ts +7 -0
- package/_types/actions/fractionalNft/getTotalFnftsMinted.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getWildcardCollectionId.d.ts +7 -0
- package/_types/actions/fractionalNft/getWildcardCollectionId.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getWildcardDistributionMap.d.ts +8 -0
- package/_types/actions/fractionalNft/getWildcardDistributionMap.d.ts.map +1 -0
- package/_types/actions/fractionalNft/getWildcardThreshold.d.ts +7 -0
- package/_types/actions/fractionalNft/getWildcardThreshold.d.ts.map +1 -0
- package/_types/actions/fractionalNft/index.d.ts +18 -0
- package/_types/actions/fractionalNft/index.d.ts.map +1 -0
- package/_types/actions/fractionalNft/types.d.ts +10 -0
- package/_types/actions/fractionalNft/types.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/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/getCollectionIds.d.ts +7 -0
- package/_types/actions/rewardPool/getCollectionIds.d.ts.map +1 -0
- package/_types/actions/rewardPool/getItemIds.d.ts +8 -0
- package/_types/actions/rewardPool/getItemIds.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 +9 -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/createClient.d.ts +10 -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/claimHash.d.ts +23 -0
- package/_types/crypto/claimHash.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 +5 -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/index.d.ts +22 -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/fractionalNft.d.ts +31 -0
- package/_types/plugins/fractionalNft.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/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 +19 -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
package/README.md
CHANGED
|
@@ -1,3 +1,284 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @totochain/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JavaScript and TypeScript client library for Totochain.
|
|
4
|
+
|
|
5
|
+
Totochain is a Substrate L1 with a Frontier EVM and H160 addresses end to end. This library
|
|
6
|
+
covers the **Substrate side** — the custom pallets and their RPC. For contracts, balances and
|
|
7
|
+
anything else the EVM exposes, use [viem](https://viem.sh) or
|
|
8
|
+
[ethers](https://docs.ethers.org) unmodified: the chain is ordinary Ethereum to those tools.
|
|
9
|
+
|
|
10
|
+
> Pre-release. The API is not yet stable.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @totochain/client @polkadot/api @polkadot/util @polkadot/util-crypto
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`@polkadot/*` are peer dependencies. Installing them yourself keeps a single copy in your
|
|
19
|
+
dependency tree; two copies make `@polkadot/api` warn and misbehave.
|
|
20
|
+
|
|
21
|
+
## Getting started
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createClient, potentialPlugin, referralPlugin } from '@totochain/client';
|
|
25
|
+
|
|
26
|
+
const client = (await createClient({ url: 'ws://127.0.0.1:9944' }))
|
|
27
|
+
.use(potentialPlugin())
|
|
28
|
+
.use(referralPlugin());
|
|
29
|
+
|
|
30
|
+
const balance = await client.potential.getPotential({ account: '0x…' });
|
|
31
|
+
const referrer = await client.referral.getReferrer({ account: '0x…' });
|
|
32
|
+
|
|
33
|
+
await client.api.disconnect();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The caller owns the connection. Nothing closes it for you, and a Node process will not
|
|
37
|
+
exit while a WebSocket is open.
|
|
38
|
+
|
|
39
|
+
## Three ways in
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createClient, referralPlugin } from '@totochain/client';
|
|
43
|
+
const client = (await createClient({ url })).use(referralPlugin());
|
|
44
|
+
await client.referral.getReferrer({ account });
|
|
45
|
+
|
|
46
|
+
import * as actions from '@totochain/client/actions';
|
|
47
|
+
await actions.getReferrer(client, { account });
|
|
48
|
+
|
|
49
|
+
import { getReferrer } from '@totochain/client/actions';
|
|
50
|
+
await getReferrer(client, { account });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Every action takes the client first. The first form is convenient and pulls in the
|
|
54
|
+
whole module; the last imports one action and costs one action. Capabilities delegate
|
|
55
|
+
to the actions, so the three cannot diverge.
|
|
56
|
+
|
|
57
|
+
Use `createClientFromApi` instead of `createClient` when you already manage your own
|
|
58
|
+
`ApiPromise`.
|
|
59
|
+
|
|
60
|
+
## Coverage
|
|
61
|
+
|
|
62
|
+
All 57 custom RPC methods, across the chain's nine RPC-exposing pallets, plus the DID
|
|
63
|
+
and attestation extrinsics.
|
|
64
|
+
|
|
65
|
+
| Pallet | Methods | Plugin |
|
|
66
|
+
| ---------------------- | ------- | ---------------------------- |
|
|
67
|
+
| potential | 11 | `potentialPlugin` |
|
|
68
|
+
| activity-tracker | 8 | `activityTrackerPlugin` |
|
|
69
|
+
| fractional-nft | 8 | `fractionalNftPlugin` |
|
|
70
|
+
| validator-manager | 8 | `validatorManagerPlugin` |
|
|
71
|
+
| referral | 7 | `referralPlugin` |
|
|
72
|
+
| handshake | 5 | `handshakePlugin` |
|
|
73
|
+
| reputation-voting | 4 | `reputationVotingPlugin` |
|
|
74
|
+
| reward-pool | 4 | `rewardPoolPlugin` |
|
|
75
|
+
| tech-committee-manager | 2 | `techCommitteeManagerPlugin` |
|
|
76
|
+
|
|
77
|
+
Each plugin is optional. Import the bare actions instead and you pay only for what you
|
|
78
|
+
use. `RPC_DEFINITIONS` and the registered chain types are applied by `createClient`;
|
|
79
|
+
pass them yourself if you build the `ApiPromise`.
|
|
80
|
+
|
|
81
|
+
## DID and attestation
|
|
82
|
+
|
|
83
|
+
An attestation records that a provider vouches for a claim about a subject. The chain
|
|
84
|
+
stores only hashes, so the client derives both.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import {
|
|
88
|
+
account,
|
|
89
|
+
deriveClaimHash,
|
|
90
|
+
didUri,
|
|
91
|
+
REGISTERED_CTYPES,
|
|
92
|
+
submitAndWait,
|
|
93
|
+
} from '@totochain/client';
|
|
94
|
+
import { attest, createDid } from '@totochain/client/actions';
|
|
95
|
+
|
|
96
|
+
const provider = account('AttestationProvider');
|
|
97
|
+
const subject = account('Alith');
|
|
98
|
+
|
|
99
|
+
await submitAndWait(client, { extrinsic: createDid(client), signer: subject });
|
|
100
|
+
|
|
101
|
+
const email = REGISTERED_CTYPES.find((c) => c.title === 'Email' && !c.deprecated)!;
|
|
102
|
+
|
|
103
|
+
// The key must be the property the CType declares — it is part of the hash preimage.
|
|
104
|
+
const claimHash = deriveClaimHash({
|
|
105
|
+
ctypeHash: email.hash,
|
|
106
|
+
subject: didUri(subject.address),
|
|
107
|
+
contents: { email: 'alice@example.com' },
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
await submitAndWait(client, {
|
|
111
|
+
extrinsic: attest(client, {
|
|
112
|
+
claimHash,
|
|
113
|
+
ctypeHash: email.hash,
|
|
114
|
+
subject: subject.address,
|
|
115
|
+
}),
|
|
116
|
+
signer: provider,
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`submitAndWait` resolves once the extrinsic is in a block and succeeded, rejecting on
|
|
121
|
+
a module error, on a status that means it will never be included, on a failed call
|
|
122
|
+
inside a `utility.batch`, and on the provider dropping the subscription. It takes a
|
|
123
|
+
`timeoutMs`, defaulting to two minutes.
|
|
124
|
+
|
|
125
|
+
Pass `waitFor: 'finalized'` when the result is written somewhere a reorg must not
|
|
126
|
+
invalidate — a database row pointing at a dropped block is worse than a slower write.
|
|
127
|
+
The default, `'inBlock'`, is enough to read the result back.
|
|
128
|
+
|
|
129
|
+
Every rejection is a typed error, so a caller can tell an idempotent no-op from a real
|
|
130
|
+
failure without matching on message text:
|
|
131
|
+
|
|
132
|
+
| Error | Means |
|
|
133
|
+
| ------------------------- | ---------------------------------------------------------- |
|
|
134
|
+
| `DispatchFailedError` | the runtime rejected the call; carries `section`, `method` |
|
|
135
|
+
| `NotIncludedError` | dropped, invalid, usurped or out of time for finality |
|
|
136
|
+
| `SubmitTimeoutError` | nothing terminal arrived within `timeoutMs` |
|
|
137
|
+
| `SubscriptionFailedError` | the provider gave up on the subscription |
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import { isDispatchFailure, submitAndWait } from '@totochain/client';
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
await submitAndWait(client, { extrinsic: ctypeAdd, signer: provider });
|
|
144
|
+
} catch (error) {
|
|
145
|
+
// Registering a CType twice is a no-op, not a failure.
|
|
146
|
+
if (!isDispatchFailure(error, 'ctype', 'AlreadyExists')) throw error;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Both derivations are consensus-relevant. `ctypeHash` reproduces all 11 registered
|
|
151
|
+
CTypes, and `deriveClaimHash` matches what the chain's own tests expect — a change to
|
|
152
|
+
either makes every previously issued attestation unfindable. `REGISTERED_CTYPES`
|
|
153
|
+
carries the registered schemas, deprecated ones included, so old attestations resolve.
|
|
154
|
+
|
|
155
|
+
## Pagination
|
|
156
|
+
|
|
157
|
+
Several actions come in pairs. The unpaged form grows with the chain; prefer the paged
|
|
158
|
+
one.
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
import { MAX_PAGE_SIZE } from '@totochain/client';
|
|
162
|
+
import { getBlockProducersPage } from '@totochain/client/actions';
|
|
163
|
+
|
|
164
|
+
let page = 0;
|
|
165
|
+
for (;;) {
|
|
166
|
+
const result = await getBlockProducersPage(client, {
|
|
167
|
+
pagination: { page, pageSize: 500 },
|
|
168
|
+
});
|
|
169
|
+
handle(result.items);
|
|
170
|
+
if (!result.hasMore) break;
|
|
171
|
+
page += 1;
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`pageSize` defaults to 100 and the chain rejects anything above `MAX_PAGE_SIZE`
|
|
176
|
+
(1000). `total` is `null` when the chain cannot determine it, which is not the same as
|
|
177
|
+
zero.
|
|
178
|
+
|
|
179
|
+
## Numbers
|
|
180
|
+
|
|
181
|
+
Balances, token ids and vote tallies are `bigint`. The chain uses `u128`, `U256` and
|
|
182
|
+
`u64`, none of which a JavaScript `number` holds exactly — one TOTO is already 1e18.
|
|
183
|
+
Counters, block numbers and reputation scores are `number`, because they are `u32`.
|
|
184
|
+
|
|
185
|
+
## Chain IDs
|
|
186
|
+
|
|
187
|
+
| Network | EVM chain ID | Definition |
|
|
188
|
+
| ------- | ------------ | ------------------ |
|
|
189
|
+
| mainnet | 33000 | `totochain` |
|
|
190
|
+
| testnet | 33001 | `totochainTestnet` |
|
|
191
|
+
| local | 33002 | `totochainLocal` |
|
|
192
|
+
| dev | 33003 | `totochainDev` |
|
|
193
|
+
|
|
194
|
+
Fixed at genesis: the value lives in storage and the chain ships no extrinsic to
|
|
195
|
+
change it. `defineChain` is exported for networks of your own.
|
|
196
|
+
|
|
197
|
+
## Accounts
|
|
198
|
+
|
|
199
|
+
The chain's 23 well-known accounts are mirrored from `primitives/keyring`, with their
|
|
200
|
+
addresses, mnemonics and keys:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
import {
|
|
204
|
+
account,
|
|
205
|
+
stash,
|
|
206
|
+
DEV_ACCOUNTS,
|
|
207
|
+
VALIDATOR_ACCOUNTS,
|
|
208
|
+
WELL_KNOWN_ACCOUNTS,
|
|
209
|
+
} from '@totochain/client/accounts';
|
|
210
|
+
|
|
211
|
+
const alith = account('Alith');
|
|
212
|
+
const init00Stash = stash('init00');
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
These are published development keys, identical to the ones in the chain repository.
|
|
216
|
+
They exist so tests and scripts can use the accounts the dev and local chain specs
|
|
217
|
+
fund. They are not secrets and must never hold value on a live network.
|
|
218
|
+
|
|
219
|
+
Three derivations are in use and they are not interchangeable: `DEV_ACCOUNTS` are
|
|
220
|
+
BIP-44 over the shared dev phrase, validators use the Substrate mini-secret, and the
|
|
221
|
+
attestation provider is the BIP-32 master of its own mnemonic.
|
|
222
|
+
|
|
223
|
+
### Keys
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
import {
|
|
227
|
+
deriveAddress,
|
|
228
|
+
fromMnemonic,
|
|
229
|
+
fromPrivateKey,
|
|
230
|
+
generateAccount,
|
|
231
|
+
generateMnemonic,
|
|
232
|
+
isValidAddress,
|
|
233
|
+
toChecksummed,
|
|
234
|
+
} from '@totochain/client/accounts';
|
|
235
|
+
|
|
236
|
+
const { mnemonic, privateKey, address } = generateAccount();
|
|
237
|
+
const fromKey = fromPrivateKey('0x…');
|
|
238
|
+
const second = fromMnemonic(mnemonic, 1);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
`fromMnemonic` walks the Ethereum path `m/44'/60'/0'/0/index`. `fromSubstrateMnemonic`
|
|
242
|
+
is the scheme the chain's validators use. `createKeyring` and `addressOf` are there
|
|
243
|
+
when you need the underlying `Keyring` directly.
|
|
244
|
+
|
|
245
|
+
### Signing
|
|
246
|
+
|
|
247
|
+
For keys the library never sees — a browser extension, a hardware wallet, a remote
|
|
248
|
+
signer — implement `TotoSigner` and adapt it:
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
import { toSubstrateSigner } from '@totochain/client/accounts';
|
|
252
|
+
|
|
253
|
+
const signer = toSubstrateSigner(client.api, {
|
|
254
|
+
address: '0x…',
|
|
255
|
+
signDigest: (digest) => wallet.sign(digest),
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
await submitAndWait(client, { extrinsic, signer: '0x…', options: { signer } });
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
`signDigest` receives a 32-byte digest that is already hashed and must sign it as
|
|
262
|
+
given. Most convenience helpers hash their input first, which produces a signature
|
|
263
|
+
over a double hash that the chain rejects. It returns 65 bytes, `r || s || v`; both
|
|
264
|
+
recovery-id conventions are accepted.
|
|
265
|
+
|
|
266
|
+
## EVM side
|
|
267
|
+
|
|
268
|
+
The chain is ordinary Ethereum to EVM tooling. Pass a definition to viem or ethers
|
|
269
|
+
unchanged:
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
import { createPublicClient, http } from 'viem';
|
|
273
|
+
import { totochain } from '@totochain/client/chains';
|
|
274
|
+
|
|
275
|
+
const client = createPublicClient({ chain: totochain, transport: http() });
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Contributing
|
|
279
|
+
|
|
280
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for the build, test and release commands.
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
Apache-2.0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ETHEREUM_PATH, account, addressOf, createKeyring, deriveAddress, derivationOf, fromMnemonic, fromPrivateKey, fromSubstrateMnemonic, generateAccount, generateMnemonic, isChecksummed, isValidAddress, pairFor, privateKeyFromMnemonic, stash, toChecksummed, } from './keyring.cjs';
|
|
2
|
+
export { toSubstrateSigner } from './substrateSigner.cjs';
|
|
3
|
+
export { DEV_ACCOUNTS, DEV_PHRASE, VALIDATOR_ACCOUNTS, WELL_KNOWN_ACCOUNTS, wellKnownAccount, } from './wellKnown.cjs';
|
|
4
|
+
export type { GeneratedAccount } from './keyring.cjs';
|
|
5
|
+
export type { TotoSigner } from './types.cjs';
|
|
6
|
+
export type { Derivation, SessionKeys, WellKnownAccount, WellKnownKeypair } from './wellKnown.cjs';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wellKnownAccount = exports.WELL_KNOWN_ACCOUNTS = exports.VALIDATOR_ACCOUNTS = exports.DEV_PHRASE = exports.DEV_ACCOUNTS = exports.toSubstrateSigner = exports.toChecksummed = exports.stash = exports.privateKeyFromMnemonic = exports.pairFor = exports.isValidAddress = exports.isChecksummed = exports.generateMnemonic = exports.generateAccount = exports.fromSubstrateMnemonic = exports.fromPrivateKey = exports.fromMnemonic = exports.derivationOf = exports.deriveAddress = exports.createKeyring = exports.addressOf = exports.account = exports.ETHEREUM_PATH = void 0;
|
|
4
|
+
var keyring_js_1 = require("./keyring.js");
|
|
5
|
+
Object.defineProperty(exports, "ETHEREUM_PATH", { enumerable: true, get: function () { return keyring_js_1.ETHEREUM_PATH; } });
|
|
6
|
+
Object.defineProperty(exports, "account", { enumerable: true, get: function () { return keyring_js_1.account; } });
|
|
7
|
+
Object.defineProperty(exports, "addressOf", { enumerable: true, get: function () { return keyring_js_1.addressOf; } });
|
|
8
|
+
Object.defineProperty(exports, "createKeyring", { enumerable: true, get: function () { return keyring_js_1.createKeyring; } });
|
|
9
|
+
Object.defineProperty(exports, "deriveAddress", { enumerable: true, get: function () { return keyring_js_1.deriveAddress; } });
|
|
10
|
+
Object.defineProperty(exports, "derivationOf", { enumerable: true, get: function () { return keyring_js_1.derivationOf; } });
|
|
11
|
+
Object.defineProperty(exports, "fromMnemonic", { enumerable: true, get: function () { return keyring_js_1.fromMnemonic; } });
|
|
12
|
+
Object.defineProperty(exports, "fromPrivateKey", { enumerable: true, get: function () { return keyring_js_1.fromPrivateKey; } });
|
|
13
|
+
Object.defineProperty(exports, "fromSubstrateMnemonic", { enumerable: true, get: function () { return keyring_js_1.fromSubstrateMnemonic; } });
|
|
14
|
+
Object.defineProperty(exports, "generateAccount", { enumerable: true, get: function () { return keyring_js_1.generateAccount; } });
|
|
15
|
+
Object.defineProperty(exports, "generateMnemonic", { enumerable: true, get: function () { return keyring_js_1.generateMnemonic; } });
|
|
16
|
+
Object.defineProperty(exports, "isChecksummed", { enumerable: true, get: function () { return keyring_js_1.isChecksummed; } });
|
|
17
|
+
Object.defineProperty(exports, "isValidAddress", { enumerable: true, get: function () { return keyring_js_1.isValidAddress; } });
|
|
18
|
+
Object.defineProperty(exports, "pairFor", { enumerable: true, get: function () { return keyring_js_1.pairFor; } });
|
|
19
|
+
Object.defineProperty(exports, "privateKeyFromMnemonic", { enumerable: true, get: function () { return keyring_js_1.privateKeyFromMnemonic; } });
|
|
20
|
+
Object.defineProperty(exports, "stash", { enumerable: true, get: function () { return keyring_js_1.stash; } });
|
|
21
|
+
Object.defineProperty(exports, "toChecksummed", { enumerable: true, get: function () { return keyring_js_1.toChecksummed; } });
|
|
22
|
+
var substrateSigner_js_1 = require("./substrateSigner.js");
|
|
23
|
+
Object.defineProperty(exports, "toSubstrateSigner", { enumerable: true, get: function () { return substrateSigner_js_1.toSubstrateSigner; } });
|
|
24
|
+
var wellKnown_js_1 = require("./wellKnown.js");
|
|
25
|
+
Object.defineProperty(exports, "DEV_ACCOUNTS", { enumerable: true, get: function () { return wellKnown_js_1.DEV_ACCOUNTS; } });
|
|
26
|
+
Object.defineProperty(exports, "DEV_PHRASE", { enumerable: true, get: function () { return wellKnown_js_1.DEV_PHRASE; } });
|
|
27
|
+
Object.defineProperty(exports, "VALIDATOR_ACCOUNTS", { enumerable: true, get: function () { return wellKnown_js_1.VALIDATOR_ACCOUNTS; } });
|
|
28
|
+
Object.defineProperty(exports, "WELL_KNOWN_ACCOUNTS", { enumerable: true, get: function () { return wellKnown_js_1.WELL_KNOWN_ACCOUNTS; } });
|
|
29
|
+
Object.defineProperty(exports, "wellKnownAccount", { enumerable: true, get: function () { return wellKnown_js_1.wellKnownAccount; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Keyring } from '@polkadot/keyring';
|
|
2
|
+
import type { KeyringPair } from '@polkadot/keyring/types';
|
|
3
|
+
import type { Address, Hash } from '../types/index.cjs';
|
|
4
|
+
import type { Derivation, WellKnownAccount } from './wellKnown.cjs';
|
|
5
|
+
export declare const ETHEREUM_PATH = "m/44'/60'/0'/0";
|
|
6
|
+
export declare function createKeyring(): Keyring;
|
|
7
|
+
export declare function addressOf(pair: KeyringPair): Address;
|
|
8
|
+
export declare function isValidAddress(value: string): value is Address;
|
|
9
|
+
export declare function isChecksummed(address: string): boolean;
|
|
10
|
+
export declare function toChecksummed(address: Address): Address;
|
|
11
|
+
export declare function fromPrivateKey(privateKey: Hash): KeyringPair;
|
|
12
|
+
export declare function fromMnemonic(mnemonic: string, index?: number): KeyringPair;
|
|
13
|
+
export declare function fromSubstrateMnemonic(mnemonic: string): KeyringPair;
|
|
14
|
+
export interface GeneratedAccount {
|
|
15
|
+
mnemonic: string;
|
|
16
|
+
privateKey: Hash;
|
|
17
|
+
address: Address;
|
|
18
|
+
pair: KeyringPair;
|
|
19
|
+
}
|
|
20
|
+
export declare function generateMnemonic(words?: 12 | 15 | 18 | 21 | 24): string;
|
|
21
|
+
export declare function generateAccount(index?: number): GeneratedAccount;
|
|
22
|
+
export declare function privateKeyFromMnemonic(mnemonic: string, index?: number): Hash;
|
|
23
|
+
export declare function deriveAddress(privateKey: Hash): Address;
|
|
24
|
+
export declare function account(name: string): KeyringPair;
|
|
25
|
+
export declare function stash(name: string): KeyringPair;
|
|
26
|
+
export declare function pairFor(record: WellKnownAccount): KeyringPair;
|
|
27
|
+
export declare function derivationOf(name: string): Derivation;
|
|
28
|
+
//# sourceMappingURL=keyring.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ETHEREUM_PATH = void 0;
|
|
4
|
+
exports.createKeyring = createKeyring;
|
|
5
|
+
exports.addressOf = addressOf;
|
|
6
|
+
exports.isValidAddress = isValidAddress;
|
|
7
|
+
exports.isChecksummed = isChecksummed;
|
|
8
|
+
exports.toChecksummed = toChecksummed;
|
|
9
|
+
exports.fromPrivateKey = fromPrivateKey;
|
|
10
|
+
exports.fromMnemonic = fromMnemonic;
|
|
11
|
+
exports.fromSubstrateMnemonic = fromSubstrateMnemonic;
|
|
12
|
+
exports.generateMnemonic = generateMnemonic;
|
|
13
|
+
exports.generateAccount = generateAccount;
|
|
14
|
+
exports.privateKeyFromMnemonic = privateKeyFromMnemonic;
|
|
15
|
+
exports.deriveAddress = deriveAddress;
|
|
16
|
+
exports.account = account;
|
|
17
|
+
exports.stash = stash;
|
|
18
|
+
exports.pairFor = pairFor;
|
|
19
|
+
exports.derivationOf = derivationOf;
|
|
20
|
+
const keyring_1 = require("@polkadot/keyring");
|
|
21
|
+
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
22
|
+
const util_1 = require("@polkadot/util");
|
|
23
|
+
const wellKnown_js_1 = require("./wellKnown.js");
|
|
24
|
+
exports.ETHEREUM_PATH = "m/44'/60'/0'/0";
|
|
25
|
+
function createKeyring() {
|
|
26
|
+
return new keyring_1.Keyring({ type: 'ethereum' });
|
|
27
|
+
}
|
|
28
|
+
function addressOf(pair) {
|
|
29
|
+
return pair.address;
|
|
30
|
+
}
|
|
31
|
+
function isValidAddress(value) {
|
|
32
|
+
return /^0x[0-9a-fA-F]{40}$/.test(value);
|
|
33
|
+
}
|
|
34
|
+
function isChecksummed(address) {
|
|
35
|
+
return isValidAddress(address) && (0, util_crypto_1.isEthereumChecksum)(address);
|
|
36
|
+
}
|
|
37
|
+
function toChecksummed(address) {
|
|
38
|
+
return (0, util_crypto_1.ethereumEncode)(address);
|
|
39
|
+
}
|
|
40
|
+
const PRIVATE_KEY = /^0x[0-9a-fA-F]{64}$/;
|
|
41
|
+
function fromPrivateKey(privateKey) {
|
|
42
|
+
if (!PRIVATE_KEY.test(privateKey)) {
|
|
43
|
+
throw new Error('expected a 32-byte 0x-prefixed private key');
|
|
44
|
+
}
|
|
45
|
+
return createKeyring().addFromUri(privateKey);
|
|
46
|
+
}
|
|
47
|
+
function fromMnemonic(mnemonic, index = 0) {
|
|
48
|
+
if (!(0, util_crypto_1.mnemonicValidate)(mnemonic)) {
|
|
49
|
+
throw new Error('expected a valid BIP-39 mnemonic');
|
|
50
|
+
}
|
|
51
|
+
return createKeyring().addFromUri(`${mnemonic}/${exports.ETHEREUM_PATH}/${index}`);
|
|
52
|
+
}
|
|
53
|
+
function fromSubstrateMnemonic(mnemonic) {
|
|
54
|
+
if (!(0, util_crypto_1.mnemonicValidate)(mnemonic)) {
|
|
55
|
+
throw new Error('expected a valid BIP-39 mnemonic');
|
|
56
|
+
}
|
|
57
|
+
return fromPrivateKey((0, util_1.u8aToHex)((0, util_crypto_1.mnemonicToMiniSecret)(mnemonic)));
|
|
58
|
+
}
|
|
59
|
+
function generateMnemonic(words = 12) {
|
|
60
|
+
return (0, util_crypto_1.mnemonicGenerate)(words);
|
|
61
|
+
}
|
|
62
|
+
function generateAccount(index = 0) {
|
|
63
|
+
const mnemonic = generateMnemonic();
|
|
64
|
+
const pair = fromMnemonic(mnemonic, index);
|
|
65
|
+
return {
|
|
66
|
+
mnemonic,
|
|
67
|
+
privateKey: privateKeyFromMnemonic(mnemonic, index),
|
|
68
|
+
address: pair.address,
|
|
69
|
+
pair,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function privateKeyFromMnemonic(mnemonic, index = 0) {
|
|
73
|
+
if (!(0, util_crypto_1.mnemonicValidate)(mnemonic)) {
|
|
74
|
+
throw new Error('expected a valid BIP-39 mnemonic');
|
|
75
|
+
}
|
|
76
|
+
const seed = (0, util_crypto_1.mnemonicToLegacySeed)(mnemonic, '', false, 64);
|
|
77
|
+
return (0, util_1.u8aToHex)((0, util_crypto_1.hdEthereum)(seed, `${exports.ETHEREUM_PATH}/${index}`).secretKey);
|
|
78
|
+
}
|
|
79
|
+
function deriveAddress(privateKey) {
|
|
80
|
+
if (!PRIVATE_KEY.test(privateKey)) {
|
|
81
|
+
throw new Error('expected a 32-byte 0x-prefixed private key');
|
|
82
|
+
}
|
|
83
|
+
const seed = Uint8Array.from((privateKey.slice(2).match(/.{2}/g) ?? []).map((b) => parseInt(b, 16)));
|
|
84
|
+
return (0, util_crypto_1.ethereumEncode)((0, util_crypto_1.secp256k1PairFromSeed)(seed).publicKey);
|
|
85
|
+
}
|
|
86
|
+
function account(name) {
|
|
87
|
+
const record = (0, wellKnown_js_1.wellKnownAccount)(name);
|
|
88
|
+
return pairFor(record);
|
|
89
|
+
}
|
|
90
|
+
function stash(name) {
|
|
91
|
+
const record = (0, wellKnown_js_1.wellKnownAccount)(name);
|
|
92
|
+
if (!record.stash) {
|
|
93
|
+
throw new Error(`${record.name} has no stash account`);
|
|
94
|
+
}
|
|
95
|
+
return fromPrivateKey(record.stash.privateKey);
|
|
96
|
+
}
|
|
97
|
+
function pairFor(record) {
|
|
98
|
+
return fromPrivateKey(record.privateKey);
|
|
99
|
+
}
|
|
100
|
+
function derivationOf(name) {
|
|
101
|
+
return (0, wellKnown_js_1.wellKnownAccount)(name).derivation;
|
|
102
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Signer } from '@polkadot/api/types';
|
|
2
|
+
import type { ApiPromise } from '@polkadot/api';
|
|
3
|
+
import type { TotoSigner } from './types.cjs';
|
|
4
|
+
export declare function toSubstrateSigner(api: ApiPromise, signer: TotoSigner): Signer;
|
|
5
|
+
//# sourceMappingURL=substrateSigner.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toSubstrateSigner = toSubstrateSigner;
|
|
4
|
+
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
5
|
+
const util_1 = require("@polkadot/util");
|
|
6
|
+
const RAW_MESSAGE_DOMAIN = /*#__PURE__*/ (0, util_1.stringToU8a)('\x19Totochain Signed Message:\n');
|
|
7
|
+
function toSubstrateSigner(api, signer) {
|
|
8
|
+
const normalise = (signature) => {
|
|
9
|
+
if (signature.length !== 65) {
|
|
10
|
+
throw new Error(`signDigest must return 65 bytes (r || s || v); received ${signature.length}`);
|
|
11
|
+
}
|
|
12
|
+
const out = new Uint8Array(signature);
|
|
13
|
+
const v = out[64];
|
|
14
|
+
if (v === 0 || v === 1) {
|
|
15
|
+
out[64] = v + 27;
|
|
16
|
+
}
|
|
17
|
+
else if (v === 27 || v === 28) {
|
|
18
|
+
out[64] = v;
|
|
19
|
+
}
|
|
20
|
+
else if (v === 35 || v === 36) {
|
|
21
|
+
out[64] = v - 8;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw new Error(`unsupported recovery id ${v}; expected 0, 1, 27, 28, 35 or 36`);
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
async signPayload(payload) {
|
|
30
|
+
const extrinsic = api.registry.createType('ExtrinsicPayload', payload, {
|
|
31
|
+
version: payload.version,
|
|
32
|
+
});
|
|
33
|
+
const digest = (0, util_crypto_1.keccakAsU8a)(extrinsic.toU8a({ method: true }));
|
|
34
|
+
return { id: 0, signature: (0, util_1.u8aToHex)(normalise(await signer.signDigest(digest))) };
|
|
35
|
+
},
|
|
36
|
+
async signRaw(raw) {
|
|
37
|
+
if (raw.type !== 'bytes') {
|
|
38
|
+
throw new Error(`signRaw accepts only type 'bytes'; received '${String(raw.type)}'. ` +
|
|
39
|
+
'Transaction payloads must go through signPayload.');
|
|
40
|
+
}
|
|
41
|
+
const data = (0, util_1.hexToU8a)(raw.data);
|
|
42
|
+
const digest = (0, util_crypto_1.keccakAsU8a)((0, util_1.u8aConcat)(RAW_MESSAGE_DOMAIN, (0, util_1.stringToU8a)(`${data.length}\n`), data));
|
|
43
|
+
return { id: 0, signature: (0, util_1.u8aToHex)(normalise(await signer.signDigest(digest))) };
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Address, Hash } from '../types/index.cjs';
|
|
2
|
+
export type Derivation = 'bip44' | 'bip32Master' | 'secretUri';
|
|
3
|
+
export interface WellKnownKeypair {
|
|
4
|
+
address: Address;
|
|
5
|
+
privateKey: Hash;
|
|
6
|
+
}
|
|
7
|
+
export interface SessionKeys {
|
|
8
|
+
sr25519: Hash;
|
|
9
|
+
ed25519: Hash;
|
|
10
|
+
}
|
|
11
|
+
export interface WellKnownAccount extends WellKnownKeypair {
|
|
12
|
+
name: string;
|
|
13
|
+
mnemonic: string;
|
|
14
|
+
derivation: Derivation;
|
|
15
|
+
index?: number;
|
|
16
|
+
stash?: WellKnownKeypair;
|
|
17
|
+
session?: SessionKeys;
|
|
18
|
+
}
|
|
19
|
+
export declare const WELL_KNOWN_ACCOUNTS: WellKnownAccount[];
|
|
20
|
+
export { DEV_PHRASE } from '@polkadot/keyring';
|
|
21
|
+
export declare function wellKnownAccount(name: string): WellKnownAccount;
|
|
22
|
+
export declare const DEV_ACCOUNTS: WellKnownAccount[];
|
|
23
|
+
export declare const VALIDATOR_ACCOUNTS: WellKnownAccount[];
|
|
24
|
+
//# sourceMappingURL=wellKnown.d.ts.map
|