@dedot/api 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import { ChainJsonRpcApis } from './json-rpc.js';
7
7
  import { ChainStorage } from './query.js';
8
8
  import { RuntimeApis } from './runtime.js';
9
9
  import { ChainTx } from './tx.js';
10
- import type { FrameMetadataHashExtensionCheckMetadataHash, FrameSupportTokensFungibleUnionOfNativeOrWithId, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckMortality, FrameSystemExtensionsCheckNonZeroSender, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemExtensionsWeightReclaim, KitchensinkRuntimeRuntimeCall, PalletAssetConversionTxPaymentChargeAssetTxPayment, SpRuntimeMultiSignature } from './types.js';
10
+ import type { FrameMetadataHashExtensionCheckMetadataHash, FrameSupportTokensFungibleUnionOfNativeOrWithId, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckMortality, FrameSystemExtensionsCheckNonZeroSender, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemExtensionsWeightReclaim, KitchensinkRuntimeRuntimeCall, PalletAssetConversionTxPaymentChargeAssetTxPayment, SpRuntimeMultiSignature } from './types.js';
11
11
  import { ChainViewFunctions } from './view-functions.js';
12
12
  export * from './types.js';
13
13
  interface ChainKnownTypes extends GenericChainKnownTypes {
@@ -27,6 +27,7 @@ interface ChainKnownTypes extends GenericChainKnownTypes {
27
27
  FrameSystemExtensionsWeightReclaim
28
28
  ];
29
29
  AssetId: FrameSupportTokensFungibleUnionOfNativeOrWithId;
30
+ EventRecord: FrameSystemEventRecord;
30
31
  }
31
32
  /**
32
33
  * @name: SubstrateApi
@@ -1,7 +1,7 @@
1
1
  import { BlockHash, Extrinsic, Hash, Metadata, PortableRegistry, RuntimeVersion } from '@dedot/codecs';
2
2
  import { type JsonRpcProvider } from '@dedot/providers';
3
3
  import { type IStorage } from '@dedot/storage';
4
- import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, Query, QueryFnResult, RpcVersion, TxUnsub, Unsub } from '@dedot/types';
4
+ import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, ISubmittableResult, Query, QueryFnResult, RpcVersion, TxUnsub, Unsub } from '@dedot/types';
5
5
  import { Deferred, HexString, LRUCache } from '@dedot/utils';
6
6
  import type { SubstrateApi } from '../chaintypes/index.js';
7
7
  import { JsonRpcClient } from '../json-rpc/index.js';
@@ -132,7 +132,7 @@ export declare abstract class BaseSubstrateClient<ChainApi extends GenericSubstr
132
132
  [K in keyof Fns]: QueryFnResult<Fns[K]>;
133
133
  }>): Promise<Unsub>;
134
134
  protected getStorageQuery(): BaseStorageQuery;
135
- sendTx(tx: HexString | Extrinsic, callback?: Callback): TxUnsub;
135
+ sendTx(tx: HexString | Extrinsic, callback?: Callback<ISubmittableResult<ChainApi['types']['EventRecord']>>): TxUnsub;
136
136
  get chainSpec(): IChainSpec;
137
137
  on<Event extends Events = Events>(event: Event, handler: EventHandlerFn<Event>): () => void;
138
138
  }
@@ -1,6 +1,6 @@
1
1
  import { type Extrinsic, Metadata, PortableRegistry } from '@dedot/codecs';
2
2
  import { ConnectionStatus, JsonRpcProvider } from '@dedot/providers';
3
- import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, Query, QueryFnResult, RpcVersion, TxUnsub, Unsub } from '@dedot/types';
3
+ import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, ISubmittableResult, Query, QueryFnResult, RpcVersion, TxUnsub, Unsub } from '@dedot/types';
4
4
  import { HexString } from '@dedot/utils';
5
5
  import { SubstrateApi } from '../chaintypes/index.js';
6
6
  import { ApiEvent, ApiOptions, BlockExplorer, ISubstrateClient, ISubstrateClientAt, SubstrateRuntimeVersion, IChainSpec, type EventHandlerFn } from '../types.js';
@@ -358,7 +358,7 @@ export declare class DedotClient<ChainApi extends GenericSubstrateApi = Substrat
358
358
  * });
359
359
  * ```
360
360
  */
361
- sendTx(tx: HexString | Extrinsic, callback?: Callback): TxUnsub;
361
+ sendTx(tx: HexString | Extrinsic, callback?: Callback<ISubmittableResult<ChainApi['types']['EventRecord']>>): TxUnsub;
362
362
  /**
363
363
  * Clear internal caches.
364
364
  *
@@ -1,6 +1,6 @@
1
1
  import { BlockHash, type Extrinsic, Metadata } from '@dedot/codecs';
2
2
  import type { JsonRpcProvider } from '@dedot/providers';
3
- import { Callback, GenericSubstrateApi, TxUnsub } from '@dedot/types';
3
+ import { Callback, GenericSubstrateApi, ISubmittableResult, TxUnsub } from '@dedot/types';
4
4
  import { HexString } from '@dedot/utils';
5
5
  import type { SubstrateApi } from '../chaintypes/index.js';
6
6
  import { BaseStorageQuery } from '../storage/index.js';
@@ -136,5 +136,5 @@ export declare class LegacyClient<ChainApi extends GenericSubstrateApi = Substra
136
136
  */
137
137
  at<ChainApiAt extends GenericSubstrateApi = ChainApi>(hash: BlockHash): Promise<ISubstrateClientAt<ChainApiAt>>;
138
138
  protected getStorageQuery(): BaseStorageQuery;
139
- sendTx(tx: HexString | Extrinsic, callback?: Callback): TxUnsub;
139
+ sendTx(tx: HexString | Extrinsic, callback?: Callback<ISubmittableResult<ChainApi['types']['EventRecord']>>): TxUnsub;
140
140
  }
@@ -1,6 +1,6 @@
1
1
  import { BlockHash, type Extrinsic, Metadata } from '@dedot/codecs';
2
2
  import type { JsonRpcProvider } from '@dedot/providers';
3
- import { Callback, GenericSubstrateApi, TxUnsub } from '@dedot/types';
3
+ import { Callback, GenericSubstrateApi, ISubmittableResult, TxUnsub } from '@dedot/types';
4
4
  import { HexString } from '@dedot/utils';
5
5
  import type { SubstrateApi } from '../chaintypes/index.js';
6
6
  import { Archive, ChainHead, ChainSpec, PinnedBlock } from '../json-rpc/index.js';
@@ -71,5 +71,5 @@ export declare class V2Client<ChainApi extends GenericSubstrateApi = SubstrateAp
71
71
  */
72
72
  at<ChainApiAt extends GenericSubstrateApi = ChainApi>(hash: BlockHash): Promise<ISubstrateClientAt<ChainApiAt>>;
73
73
  protected getStorageQuery(): BaseStorageQuery;
74
- sendTx(tx: HexString | Extrinsic, callback?: Callback): TxUnsub;
74
+ sendTx(tx: HexString | Extrinsic, callback?: Callback<ISubmittableResult<ChainApi['types']['EventRecord']>>): TxUnsub;
75
75
  }
@@ -1,5 +1,5 @@
1
1
  import { Extrinsic, Preamble } from '@dedot/codecs';
2
- import { Callback, IRuntimeTxCall, TxHash, TxUnsub } from '@dedot/types';
2
+ import { Callback, IRuntimeTxCall, ISubmittableResult, TxHash, TxUnsub } from '@dedot/types';
3
3
  import { HexString } from '@dedot/utils';
4
4
  import { V2Client } from '../../client/V2Client.js';
5
5
  import { BaseSubmittableExtrinsic } from './BaseSubmittableExtrinsic.js';
@@ -13,5 +13,5 @@ export declare class SubmittableExtrinsicV2 extends BaseSubmittableExtrinsic {
13
13
  constructor(client: V2Client<any>, call: IRuntimeTxCall, preamble?: Preamble);
14
14
  static fromTx(client: V2Client<any>, tx: HexString | Extrinsic): SubmittableExtrinsicV2;
15
15
  send(): TxHash;
16
- send(callback: Callback): TxUnsub;
16
+ send(callback: Callback<ISubmittableResult>): TxUnsub;
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/api",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A delightful JavaScript/TypeScript client for Polkadot & Substrate",
5
5
  "author": "Thang X. Vu <thang@dedot.dev>",
6
6
  "homepage": "https://dedot.dev",
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "sideEffects": false,
15
15
  "dependencies": {
16
- "@dedot/codecs": "1.0.0",
17
- "@dedot/providers": "1.0.0",
18
- "@dedot/runtime-specs": "1.0.0",
19
- "@dedot/shape": "1.0.0",
20
- "@dedot/storage": "1.0.0",
21
- "@dedot/types": "1.0.0",
22
- "@dedot/utils": "1.0.0"
16
+ "@dedot/codecs": "1.0.1",
17
+ "@dedot/providers": "1.0.1",
18
+ "@dedot/runtime-specs": "1.0.1",
19
+ "@dedot/shape": "1.0.1",
20
+ "@dedot/storage": "1.0.1",
21
+ "@dedot/types": "1.0.1",
22
+ "@dedot/utils": "1.0.1"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json",
@@ -48,7 +48,7 @@
48
48
  "node": ">=18"
49
49
  },
50
50
  "license": "Apache-2.0",
51
- "gitHead": "7767062a2188b4ac90561c5ad3cc3f06ac608a24",
51
+ "gitHead": "f9f1bd894a76672675008e1f94d4f98422e9655e",
52
52
  "module": "./index.js",
53
53
  "types": "./index.d.ts"
54
54
  }
package/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BlockHash, Extrinsic, Hash, Header, Metadata, PortableRegistry } from '
2
2
  import type { ConnectionStatus, JsonRpcProvider, ProviderEvent } from '@dedot/providers';
3
3
  import type { AnyShape } from '@dedot/shape';
4
4
  import type { IStorage } from '@dedot/storage';
5
- import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, Query, QueryFnResult, RpcVersion, RuntimeApiName, RuntimeApiSpec, TxUnsub, Unsub } from '@dedot/types';
5
+ import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, ISubmittableResult, Query, QueryFnResult, RpcVersion, RuntimeApiName, RuntimeApiSpec, TxUnsub, Unsub } from '@dedot/types';
6
6
  import { Properties } from '@dedot/types/json-rpc';
7
7
  import type { HashFn, HexString, IEventEmitter } from '@dedot/utils';
8
8
  import type { SubstrateApi } from './chaintypes/index.js';
@@ -224,7 +224,7 @@ Events extends string = ApiEvent> extends IJsonRpcClient<ChainApi, Events>, IGen
224
224
  * const result = await client.sendTx(rawTxHex).untilFinalized();
225
225
  * console.log('Transaction finalized:', result);
226
226
  */
227
- sendTx(tx: HexString | Extrinsic, callback?: Callback): TxUnsub;
227
+ sendTx(tx: HexString | Extrinsic, callback?: Callback<ISubmittableResult<ChainApi['types']['EventRecord']>>): TxUnsub;
228
228
  /**
229
229
  * Query multiple storage items in a single call or subscribe to multiple storage items
230
230
  *