@dedot/api 0.0.1-alpha.40 → 0.0.1-alpha.41
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/chaintypes/substrate/tx.d.ts +2 -2
- package/cjs/extrinsic/submittable/SubmittableExtrinsic.js +2 -2
- package/cjs/extrinsic/submittable/utils.js +3 -3
- package/extrinsic/submittable/SubmittableExtrinsic.js +3 -3
- package/extrinsic/submittable/utils.d.ts +2 -2
- package/extrinsic/submittable/utils.js +1 -1
- package/package.json +10 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AccountId32Like, BytesLike, Data, Extrinsic, FixedBytes, FixedU128, FixedU64, H256, MultiAddressLike, Perbill, Percent, Perquintill } from '@dedot/codecs';
|
|
2
|
-
import type { GenericChainTx, GenericTxCall, IRuntimeTxCall, ISubmittableExtrinsic, ISubmittableExtrinsicLegacy, ISubmittableResult, RpcV2, RpcVersion,
|
|
2
|
+
import type { GenericChainTx, GenericTxCall, IRuntimeTxCall, ISubmittableExtrinsic, ISubmittableExtrinsicLegacy, ISubmittableResult, RpcV2, RpcVersion, TxStatus } from '@dedot/types';
|
|
3
3
|
import type { FrameSupportPreimagesBounded, FrameSupportScheduleDispatchTime, FrameSupportTokensFungibleUnionOfNativeOrWithId, FrameSystemEventRecord, KitchensinkRuntimeOriginCaller, KitchensinkRuntimeProxyType, KitchensinkRuntimeRuntimeCallLike, KitchensinkRuntimeRuntimeParameters, KitchensinkRuntimeSessionKeys, PalletAllianceCid, PalletAllianceDisbandWitness, PalletAllianceUnscrupulousItem, PalletBalancesAdjustmentDirection, PalletBrokerConfigRecord, PalletBrokerCoreMask, PalletBrokerFinality, PalletBrokerRegionId, PalletBrokerScheduleItem, PalletContractsWasmDeterminism, PalletConvictionVotingConviction, PalletConvictionVotingVoteAccountVote, PalletCoreFellowshipParamsType, PalletCoreFellowshipWish, PalletDemocracyConviction, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityJudgement, PalletIdentityLegacyIdentityInfo, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMigrationsHistoricCleanupSelector, PalletMigrationsMigrationCursor, PalletMixnetRegistration, PalletMultisigTimepoint, PalletNftsAttributeNamespace, PalletNftsBitFlags, PalletNftsCancelAttributesApprovalWitness, PalletNftsCollectionConfig, PalletNftsDestroyWitness, PalletNftsItemConfig, PalletNftsItemTip, PalletNftsMintSettings, PalletNftsMintWitness, PalletNftsPreSignedAttributes, PalletNftsPreSignedMint, PalletNftsPriceWithDirection, PalletNominationPoolsBondExtra, PalletNominationPoolsClaimPermission, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsCommissionClaimPermission, PalletNominationPoolsConfigOp, PalletNominationPoolsConfigOp004, PalletNominationPoolsConfigOpPerbill, PalletNominationPoolsConfigOpU32, PalletNominationPoolsPoolState, PalletStakingPalletConfigOp, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletStateTrieMigrationProgress, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBeefyEquivocationProof, SpConsensusGrandpaEquivocationProof, SpConsensusSlotsEquivocationProof, SpMixnetAppSignature, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeMultiSignature, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof, SpWeightsWeightV2Weight } from './types.js';
|
|
4
|
-
export type ChainSubmittableExtrinsic<Rv extends RpcVersion, T extends IRuntimeTxCall = KitchensinkRuntimeRuntimeCallLike> = Extrinsic<MultiAddressLike, T, SpRuntimeMultiSignature, any[]> & (Rv extends RpcV2 ? ISubmittableExtrinsic<ISubmittableResult<FrameSystemEventRecord,
|
|
4
|
+
export type ChainSubmittableExtrinsic<Rv extends RpcVersion, T extends IRuntimeTxCall = KitchensinkRuntimeRuntimeCallLike> = Extrinsic<MultiAddressLike, T, SpRuntimeMultiSignature, any[]> & (Rv extends RpcV2 ? ISubmittableExtrinsic<ISubmittableResult<FrameSystemEventRecord, TxStatus>> : ISubmittableExtrinsicLegacy<ISubmittableResult<FrameSystemEventRecord, TxStatus>>);
|
|
5
5
|
export type TxCall<Rv extends RpcVersion> = (...args: any[]) => ChainSubmittableExtrinsic<Rv>;
|
|
6
6
|
export interface ChainTx<Rv extends RpcVersion> extends GenericChainTx<Rv, TxCall<Rv>> {
|
|
7
7
|
/**
|
|
@@ -33,11 +33,11 @@ class SubmittableExtrinsic extends BaseSubmittableExtrinsic_js_1.BaseSubmittable
|
|
|
33
33
|
const txIndex = signedBlock.block.extrinsics.indexOf(txHex);
|
|
34
34
|
(0, utils_1.assert)(txIndex >= 0, 'Extrinsic not found!');
|
|
35
35
|
const events = blockEvents.filter(({ phase }) => phase.type === 'ApplyExtrinsic' && phase.value === txIndex);
|
|
36
|
-
const status = (0, utils_js_1.
|
|
36
|
+
const status = (0, utils_js_1.toTxStatus)(txStatus, txIndex);
|
|
37
37
|
return callback(new SubmittableResult_js_1.SubmittableResult({ status, txHash, events, txIndex }));
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
const status = (0, utils_js_1.
|
|
40
|
+
const status = (0, utils_js_1.toTxStatus)(txStatus);
|
|
41
41
|
return callback(new SubmittableResult_js_1.SubmittableResult({ status, txHash }));
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toTxStatus = exports.signRaw = exports.isKeyringPair = void 0;
|
|
4
4
|
const utils_1 = require("@dedot/utils");
|
|
5
5
|
function isKeyringPair(account) {
|
|
6
6
|
return (0, utils_1.isFunction)(account.sign);
|
|
@@ -25,7 +25,7 @@ exports.signRaw = signRaw;
|
|
|
25
25
|
* @param txStatus
|
|
26
26
|
* @param txIndex
|
|
27
27
|
*/
|
|
28
|
-
function
|
|
28
|
+
function toTxStatus(txStatus, txIndex) {
|
|
29
29
|
switch (txStatus.type) {
|
|
30
30
|
case 'Ready':
|
|
31
31
|
case 'Future':
|
|
@@ -82,4 +82,4 @@ function toTransactionEvent(txStatus, txIndex) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
exports.
|
|
85
|
+
exports.toTxStatus = toTxStatus;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert, isHex } from '@dedot/utils';
|
|
2
2
|
import { BaseSubmittableExtrinsic } from './BaseSubmittableExtrinsic.js';
|
|
3
3
|
import { SubmittableResult } from './SubmittableResult.js';
|
|
4
|
-
import {
|
|
4
|
+
import { toTxStatus } from './utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* @name SubmittableExtrinsic
|
|
7
7
|
* @description A wrapper around an Extrinsic that exposes methods to sign, send, and other utility around Extrinsic.
|
|
@@ -30,11 +30,11 @@ export class SubmittableExtrinsic extends BaseSubmittableExtrinsic {
|
|
|
30
30
|
const txIndex = signedBlock.block.extrinsics.indexOf(txHex);
|
|
31
31
|
assert(txIndex >= 0, 'Extrinsic not found!');
|
|
32
32
|
const events = blockEvents.filter(({ phase }) => phase.type === 'ApplyExtrinsic' && phase.value === txIndex);
|
|
33
|
-
const status =
|
|
33
|
+
const status = toTxStatus(txStatus, txIndex);
|
|
34
34
|
return callback(new SubmittableResult({ status, txHash, events, txIndex }));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
const status =
|
|
37
|
+
const status = toTxStatus(txStatus);
|
|
38
38
|
return callback(new SubmittableResult({ status, txHash }));
|
|
39
39
|
}
|
|
40
40
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IKeyringPair } from '@polkadot/types/types';
|
|
2
2
|
import { TransactionStatus } from '@dedot/codecs';
|
|
3
|
-
import type { AddressOrPair,
|
|
3
|
+
import type { AddressOrPair, TxStatus } from '@dedot/types';
|
|
4
4
|
import { HexString } from '@dedot/utils';
|
|
5
5
|
export declare function isKeyringPair(account: AddressOrPair): account is IKeyringPair;
|
|
6
6
|
/**
|
|
@@ -16,4 +16,4 @@ export declare function signRaw(signerPair: IKeyringPair, raw: HexString): Uint8
|
|
|
16
16
|
* @param txStatus
|
|
17
17
|
* @param txIndex
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function toTxStatus(txStatus: TransactionStatus, txIndex?: number): TxStatus;
|
|
@@ -20,7 +20,7 @@ export function signRaw(signerPair, raw) {
|
|
|
20
20
|
* @param txStatus
|
|
21
21
|
* @param txIndex
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
23
|
+
export function toTxStatus(txStatus, txIndex) {
|
|
24
24
|
switch (txStatus.type) {
|
|
25
25
|
case 'Ready':
|
|
26
26
|
case 'Future':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/api",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.41",
|
|
4
4
|
"description": "A delightful JavaScript/TypeScript client for Polkadot & Substrate",
|
|
5
5
|
"author": "Thang X. Vu <thang@coongcrafts.io>",
|
|
6
6
|
"homepage": "https://github.com/dedotdev/dedot/tree/main/packages/api",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dedot/codecs": "0.0.1-alpha.
|
|
17
|
-
"@dedot/providers": "0.0.1-alpha.
|
|
18
|
-
"@dedot/runtime-specs": "0.0.1-alpha.
|
|
19
|
-
"@dedot/shape": "0.0.1-alpha.
|
|
20
|
-
"@dedot/storage": "0.0.1-alpha.
|
|
21
|
-
"@dedot/types": "0.0.1-alpha.
|
|
22
|
-
"@dedot/utils": "0.0.1-alpha.
|
|
16
|
+
"@dedot/codecs": "0.0.1-alpha.41",
|
|
17
|
+
"@dedot/providers": "0.0.1-alpha.41",
|
|
18
|
+
"@dedot/runtime-specs": "0.0.1-alpha.41",
|
|
19
|
+
"@dedot/shape": "0.0.1-alpha.41",
|
|
20
|
+
"@dedot/storage": "0.0.1-alpha.41",
|
|
21
|
+
"@dedot/types": "0.0.1-alpha.41",
|
|
22
|
+
"@dedot/utils": "0.0.1-alpha.41"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"license": "Apache-2.0",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@polkadot/types": "^12.
|
|
49
|
+
"@polkadot/types": "^12.2.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "4c699c73281cf4525be2d8e31c416f4dd7dc2fdd",
|
|
52
52
|
"module": "./index.js",
|
|
53
53
|
"types": "./index.d.ts"
|
|
54
54
|
}
|