@d9-network/spec 0.0.12 → 0.0.14
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/dist/index.cjs +409 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +860 -84
- package/dist/index.d.mts +860 -84
- package/dist/index.mjs +382 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -9,12 +9,12 @@ import { Observable } from "rxjs";
|
|
|
9
9
|
//#region rolldown:runtime
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/common-types.d.ts
|
|
12
|
-
type AnonymousEnum$9<T extends {}> = T & {
|
|
12
|
+
type AnonymousEnum$9<T$1 extends {}> = T$1 & {
|
|
13
13
|
__anonymous: true;
|
|
14
14
|
};
|
|
15
|
-
type MyTuple$9<T> = [T, ...T[]];
|
|
16
|
-
type SeparateUndefined$9<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
17
|
-
type Anonymize$9<T> = SeparateUndefined$9<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$9<infer V> ? Enum<V> : T extends MyTuple$9<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
15
|
+
type MyTuple$9<T$1> = [T$1, ...T$1[]];
|
|
16
|
+
type SeparateUndefined$9<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
17
|
+
type Anonymize$9<T$1> = SeparateUndefined$9<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$9<infer V> ? Enum<V> : T$1 extends MyTuple$9<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
18
18
|
type Ic5m5lp1oioo8r = Array<FixedSizeBinary<32>>;
|
|
19
19
|
type Ihfphjolmsqq1 = (SS58String$1) | undefined;
|
|
20
20
|
type Idrurqd6ddlmr3 = {
|
|
@@ -3376,12 +3376,12 @@ type I1q6j2f64t5q87 = {
|
|
|
3376
3376
|
};
|
|
3377
3377
|
//#endregion
|
|
3378
3378
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/d9.d.ts
|
|
3379
|
-
type AnonymousEnum$8<T extends {}> = T & {
|
|
3379
|
+
type AnonymousEnum$8<T$1 extends {}> = T$1 & {
|
|
3380
3380
|
__anonymous: true;
|
|
3381
3381
|
};
|
|
3382
|
-
type MyTuple$8<T> = [T, ...T[]];
|
|
3383
|
-
type SeparateUndefined$8<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
3384
|
-
type Anonymize$8<T> = SeparateUndefined$8<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$8<infer V> ? Enum<V> : T extends MyTuple$8<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
3382
|
+
type MyTuple$8<T$1> = [T$1, ...T$1[]];
|
|
3383
|
+
type SeparateUndefined$8<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
3384
|
+
type Anonymize$8<T$1> = SeparateUndefined$8<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$8<infer V> ? Enum<V> : T$1 extends MyTuple$8<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
3385
3385
|
type IStorage = {
|
|
3386
3386
|
Aura: {
|
|
3387
3387
|
/**
|
|
@@ -6713,12 +6713,12 @@ type PalletKey = `*.${({ [K in keyof AllInteractions]: K extends 'apis' ? never
|
|
|
6713
6713
|
type NestedKey<D extends Record<string, string[]>> = "*" | { [P in keyof D & string]: `${P}.*` | `${P}.${D[P][number]}` }[keyof D & string];
|
|
6714
6714
|
//#endregion
|
|
6715
6715
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/nodeReward.d.ts
|
|
6716
|
-
type AnonymousEnum$7<T extends {}> = T & {
|
|
6716
|
+
type AnonymousEnum$7<T$1 extends {}> = T$1 & {
|
|
6717
6717
|
__anonymous: true;
|
|
6718
6718
|
};
|
|
6719
|
-
type MyTuple$7<T> = [T, ...T[]];
|
|
6720
|
-
type SeparateUndefined$7<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
6721
|
-
type Anonymize$7<T> = SeparateUndefined$7<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$7<infer V> ? Enum<V> : T extends MyTuple$7<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
6719
|
+
type MyTuple$7<T$1> = [T$1, ...T$1[]];
|
|
6720
|
+
type SeparateUndefined$7<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
6721
|
+
type Anonymize$7<T$1> = SeparateUndefined$7<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$7<infer V> ? Enum<V> : T$1 extends MyTuple$7<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
6722
6722
|
type T0$7 = ResultPayload<undefined, Anonymize$7<T1$7>>;
|
|
6723
6723
|
type T1$7 = Enum<{
|
|
6724
6724
|
"CouldNotReadInput": undefined;
|
|
@@ -6880,12 +6880,12 @@ type EventDescriptor$7 = Enum<{
|
|
|
6880
6880
|
declare const descriptor$7: InkDescriptors<StorageDescriptor$8, MessagesDescriptor$7, ConstructorsDescriptor$7, EventDescriptor$7>;
|
|
6881
6881
|
//#endregion
|
|
6882
6882
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/merchantMining.d.ts
|
|
6883
|
-
type AnonymousEnum$6<T extends {}> = T & {
|
|
6883
|
+
type AnonymousEnum$6<T$1 extends {}> = T$1 & {
|
|
6884
6884
|
__anonymous: true;
|
|
6885
6885
|
};
|
|
6886
|
-
type MyTuple$6<T> = [T, ...T[]];
|
|
6887
|
-
type SeparateUndefined$6<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
6888
|
-
type Anonymize$6<T> = SeparateUndefined$6<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$6<infer V> ? Enum<V> : T extends MyTuple$6<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
6886
|
+
type MyTuple$6<T$1> = [T$1, ...T$1[]];
|
|
6887
|
+
type SeparateUndefined$6<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
6888
|
+
type Anonymize$6<T$1> = SeparateUndefined$6<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$6<infer V> ? Enum<V> : T$1 extends MyTuple$6<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
6889
6889
|
type T0$6 = ResultPayload<undefined, Anonymize$6<T1$6>>;
|
|
6890
6890
|
type T1$6 = Enum<{
|
|
6891
6891
|
"CouldNotReadInput": undefined;
|
|
@@ -7138,12 +7138,12 @@ type EventDescriptor$6 = Enum<{
|
|
|
7138
7138
|
declare const descriptor$6: InkDescriptors<StorageDescriptor$7, MessagesDescriptor$6, ConstructorsDescriptor$6, EventDescriptor$6>;
|
|
7139
7139
|
//#endregion
|
|
7140
7140
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/usdt.d.ts
|
|
7141
|
-
type AnonymousEnum$5<T extends {}> = T & {
|
|
7141
|
+
type AnonymousEnum$5<T$1 extends {}> = T$1 & {
|
|
7142
7142
|
__anonymous: true;
|
|
7143
7143
|
};
|
|
7144
|
-
type MyTuple$5<T> = [T, ...T[]];
|
|
7145
|
-
type SeparateUndefined$5<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
7146
|
-
type Anonymize$5<T> = SeparateUndefined$5<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$5<infer V> ? Enum<V> : T extends MyTuple$5<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
7144
|
+
type MyTuple$5<T$1> = [T$1, ...T$1[]];
|
|
7145
|
+
type SeparateUndefined$5<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
7146
|
+
type Anonymize$5<T$1> = SeparateUndefined$5<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$5<infer V> ? Enum<V> : T$1 extends MyTuple$5<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
7147
7147
|
type T0$5 = Enum<{
|
|
7148
7148
|
"CouldNotReadInput": undefined;
|
|
7149
7149
|
}>;
|
|
@@ -7278,12 +7278,12 @@ type EventDescriptor$5 = Enum<{
|
|
|
7278
7278
|
declare const descriptor$5: InkDescriptors<StorageDescriptor$6, MessagesDescriptor$5, ConstructorsDescriptor$5, EventDescriptor$5>;
|
|
7279
7279
|
//#endregion
|
|
7280
7280
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/burnManager.d.ts
|
|
7281
|
-
type AnonymousEnum$4<T extends {}> = T & {
|
|
7281
|
+
type AnonymousEnum$4<T$1 extends {}> = T$1 & {
|
|
7282
7282
|
__anonymous: true;
|
|
7283
7283
|
};
|
|
7284
|
-
type MyTuple$4<T> = [T, ...T[]];
|
|
7285
|
-
type SeparateUndefined$4<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
7286
|
-
type Anonymize$4<T> = SeparateUndefined$4<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$4<infer V> ? Enum<V> : T extends MyTuple$4<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
7284
|
+
type MyTuple$4<T$1> = [T$1, ...T$1[]];
|
|
7285
|
+
type SeparateUndefined$4<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
7286
|
+
type Anonymize$4<T$1> = SeparateUndefined$4<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$4<infer V> ? Enum<V> : T$1 extends MyTuple$4<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
7287
7287
|
type T0$4 = Array<SS58String$1>;
|
|
7288
7288
|
type T1$4 = ResultPayload<undefined, Anonymize$4<T2$4>>;
|
|
7289
7289
|
type T2$4 = Enum<{
|
|
@@ -7456,12 +7456,12 @@ type EventDescriptor$4 = Enum<{
|
|
|
7456
7456
|
declare const descriptor$4: InkDescriptors<StorageDescriptor$5, MessagesDescriptor$4, ConstructorsDescriptor$4, EventDescriptor$4>;
|
|
7457
7457
|
//#endregion
|
|
7458
7458
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/crossChainTransfer.d.ts
|
|
7459
|
-
type AnonymousEnum$3<T extends {}> = T & {
|
|
7459
|
+
type AnonymousEnum$3<T$1 extends {}> = T$1 & {
|
|
7460
7460
|
__anonymous: true;
|
|
7461
7461
|
};
|
|
7462
|
-
type MyTuple$3<T> = [T, ...T[]];
|
|
7463
|
-
type SeparateUndefined$3<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
7464
|
-
type Anonymize$3<T> = SeparateUndefined$3<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$3<infer V> ? Enum<V> : T extends MyTuple$3<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
7462
|
+
type MyTuple$3<T$1> = [T$1, ...T$1[]];
|
|
7463
|
+
type SeparateUndefined$3<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
7464
|
+
type Anonymize$3<T$1> = SeparateUndefined$3<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$3<infer V> ? Enum<V> : T$1 extends MyTuple$3<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
7465
7465
|
type T5$2 = Array<SS58String$1>;
|
|
7466
7466
|
type T0$3 = ResultPayload<undefined, Anonymize$3<T1$3>>;
|
|
7467
7467
|
type T1$3 = Enum<{
|
|
@@ -7700,12 +7700,12 @@ type EventDescriptor$3 = Enum<{
|
|
|
7700
7700
|
declare const descriptor$3: InkDescriptors<StorageDescriptor$4, MessagesDescriptor$3, ConstructorsDescriptor$3, EventDescriptor$3>;
|
|
7701
7701
|
//#endregion
|
|
7702
7702
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/marketMaker.d.ts
|
|
7703
|
-
type AnonymousEnum$2<T extends {}> = T & {
|
|
7703
|
+
type AnonymousEnum$2<T$1 extends {}> = T$1 & {
|
|
7704
7704
|
__anonymous: true;
|
|
7705
7705
|
};
|
|
7706
|
-
type MyTuple$2<T> = [T, ...T[]];
|
|
7707
|
-
type SeparateUndefined$2<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
7708
|
-
type Anonymize$2<T> = SeparateUndefined$2<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$2<infer V> ? Enum<V> : T extends MyTuple$2<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
7706
|
+
type MyTuple$2<T$1> = [T$1, ...T$1[]];
|
|
7707
|
+
type SeparateUndefined$2<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
7708
|
+
type Anonymize$2<T$1> = SeparateUndefined$2<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$2<infer V> ? Enum<V> : T$1 extends MyTuple$2<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
7709
7709
|
type T0$2 = ResultPayload<undefined, Anonymize$2<T1$2>>;
|
|
7710
7710
|
type T1$2 = Enum<{
|
|
7711
7711
|
"CouldNotReadInput": undefined;
|
|
@@ -7904,12 +7904,12 @@ type EventDescriptor$2 = Enum<{
|
|
|
7904
7904
|
declare const descriptor$2: InkDescriptors<StorageDescriptor$3, MessagesDescriptor$2, ConstructorsDescriptor$2, EventDescriptor$2>;
|
|
7905
7905
|
//#endregion
|
|
7906
7906
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/burnMining.d.ts
|
|
7907
|
-
type AnonymousEnum$1<T extends {}> = T & {
|
|
7907
|
+
type AnonymousEnum$1<T$1 extends {}> = T$1 & {
|
|
7908
7908
|
__anonymous: true;
|
|
7909
7909
|
};
|
|
7910
|
-
type MyTuple$1<T> = [T, ...T[]];
|
|
7911
|
-
type SeparateUndefined$1<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
7912
|
-
type Anonymize$1<T> = SeparateUndefined$1<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum$1<infer V> ? Enum<V> : T extends MyTuple$1<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
7910
|
+
type MyTuple$1<T$1> = [T$1, ...T$1[]];
|
|
7911
|
+
type SeparateUndefined$1<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
7912
|
+
type Anonymize$1<T$1> = SeparateUndefined$1<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum$1<infer V> ? Enum<V> : T$1 extends MyTuple$1<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
7913
7913
|
type T0$1 = ResultPayload<undefined, Anonymize$1<T1$1>>;
|
|
7914
7914
|
type T1$1 = Enum<{
|
|
7915
7915
|
"CouldNotReadInput": undefined;
|
|
@@ -8083,12 +8083,12 @@ type EventDescriptor$1 = Enum<{}>;
|
|
|
8083
8083
|
declare const descriptor$1: InkDescriptors<StorageDescriptor$2, MessagesDescriptor$1, ConstructorsDescriptor$1, EventDescriptor$1>;
|
|
8084
8084
|
//#endregion
|
|
8085
8085
|
//#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/miningPool.d.ts
|
|
8086
|
-
type AnonymousEnum<T extends {}> = T & {
|
|
8086
|
+
type AnonymousEnum<T$1 extends {}> = T$1 & {
|
|
8087
8087
|
__anonymous: true;
|
|
8088
8088
|
};
|
|
8089
|
-
type MyTuple<T> = [T, ...T[]];
|
|
8090
|
-
type SeparateUndefined<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
|
|
8091
|
-
type Anonymize<T> = SeparateUndefined<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum<infer V> ? Enum<V> : T extends MyTuple<any> ? { [K in keyof T]: T[K] } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : { [K in keyof T & string]: T[K] }>;
|
|
8089
|
+
type MyTuple<T$1> = [T$1, ...T$1[]];
|
|
8090
|
+
type SeparateUndefined<T$1> = undefined extends T$1 ? undefined | Exclude<T$1, undefined> : T$1;
|
|
8091
|
+
type Anonymize<T$1> = SeparateUndefined<T$1 extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T$1 extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T$1 : T$1 extends AnonymousEnum<infer V> ? Enum<V> : T$1 extends MyTuple<any> ? { [K in keyof T$1]: T$1[K] } : T$1 extends [] ? [] : T$1 extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T$1> : FixedSizeArray<L, T$1> : { [K in keyof T$1 & string]: T$1[K] }>;
|
|
8092
8092
|
type T0 = ResultPayload<undefined, Anonymize<T1>>;
|
|
8093
8093
|
type T1 = Enum<{
|
|
8094
8094
|
"CouldNotReadInput": undefined;
|
|
@@ -8300,13 +8300,37 @@ interface RawContractEvent {
|
|
|
8300
8300
|
topics: Uint8Array[];
|
|
8301
8301
|
}
|
|
8302
8302
|
/**
|
|
8303
|
-
*
|
|
8303
|
+
* Extract the definition object from an Enum type or InkEvent type
|
|
8304
|
+
* e.g. ExtractEnumDef<Enum<{A: X, B: Y}>> = {A: X, B: Y}
|
|
8305
|
+
*
|
|
8306
|
+
* For non-Enum types (e.g., InkEvent { type: string; value: unknown }),
|
|
8307
|
+
* returns a generic event definition.
|
|
8308
|
+
*/
|
|
8309
|
+
|
|
8310
|
+
/**
|
|
8311
|
+
* Type-safe contract event with discriminated union
|
|
8312
|
+
* Enables type narrowing: `if (event.type === "Transfer") { event.value.from }`
|
|
8313
|
+
*/
|
|
8314
|
+
type TypedContractEvent<E extends Event> = E extends Enum<infer T> ? { [K in keyof T & string]: {
|
|
8315
|
+
/** Event type (discriminant for type narrowing) */
|
|
8316
|
+
type: K;
|
|
8317
|
+
/** Decoded event data (type-safe based on event type) */
|
|
8318
|
+
value: T[K];
|
|
8319
|
+
/** Original raw event */
|
|
8320
|
+
raw: RawContractEvent;
|
|
8321
|
+
} }[keyof T & string] : {
|
|
8322
|
+
type: string;
|
|
8323
|
+
value: unknown;
|
|
8324
|
+
raw: RawContractEvent;
|
|
8325
|
+
};
|
|
8326
|
+
/**
|
|
8327
|
+
* Decoded contract event (legacy, use TypedContractEvent for type safety)
|
|
8304
8328
|
*/
|
|
8305
|
-
interface DecodedContractEvent<T = unknown> {
|
|
8329
|
+
interface DecodedContractEvent<T$1 = unknown> {
|
|
8306
8330
|
/** Event label from metadata (e.g., "Transfer", "Approval") */
|
|
8307
8331
|
label: string;
|
|
8308
8332
|
/** Decoded event data */
|
|
8309
|
-
data: T;
|
|
8333
|
+
data: T$1;
|
|
8310
8334
|
/** Original raw event */
|
|
8311
8335
|
raw: RawContractEvent;
|
|
8312
8336
|
}
|
|
@@ -8323,6 +8347,20 @@ interface EventFilterOptions {
|
|
|
8323
8347
|
/** To block number (inclusive) */
|
|
8324
8348
|
toBlock?: number;
|
|
8325
8349
|
}
|
|
8350
|
+
/**
|
|
8351
|
+
* Type-safe event filter options with literal event labels
|
|
8352
|
+
* Provides compile-time validation of event label names
|
|
8353
|
+
*
|
|
8354
|
+
* @typeParam E - The event type representing all possible events
|
|
8355
|
+
*
|
|
8356
|
+
* @example
|
|
8357
|
+
* ```ts
|
|
8358
|
+
* const options: TypedEventFilterOptions<typeof contracts.usdt.__types.event> = {
|
|
8359
|
+
* eventLabels: ["Transfer", "Approval"], // Must be valid event names
|
|
8360
|
+
* };
|
|
8361
|
+
* ```
|
|
8362
|
+
*/
|
|
8363
|
+
|
|
8326
8364
|
/**
|
|
8327
8365
|
* Event subscription options
|
|
8328
8366
|
*/
|
|
@@ -8350,9 +8388,76 @@ interface EventSubscriptionOptions {
|
|
|
8350
8388
|
getEvents: (blockHash: string) => Promise<unknown[]>;
|
|
8351
8389
|
}
|
|
8352
8390
|
//#endregion
|
|
8353
|
-
//#region src/types.d.ts
|
|
8391
|
+
//#region src/call-types.d.ts
|
|
8354
8392
|
/**
|
|
8355
|
-
*
|
|
8393
|
+
* Raw call data from a transaction
|
|
8394
|
+
*/
|
|
8395
|
+
|
|
8396
|
+
/**
|
|
8397
|
+
* Extract message labels as a union type from InkCallableDescriptor
|
|
8398
|
+
* e.g. ExtractMessageLabels<Messages> = "PSP22::transfer" | "PSP22::balance_of" | ...
|
|
8399
|
+
*/
|
|
8400
|
+
type ExtractMessageLabels<M$1 extends InkCallableDescriptor> = keyof M$1 & string;
|
|
8401
|
+
/**
|
|
8402
|
+
* Type-safe parsed contract call with discriminated union
|
|
8403
|
+
* Enables type narrowing: `if (call.type === "PSP22::transfer") { call.args.to }`
|
|
8404
|
+
*/
|
|
8405
|
+
|
|
8406
|
+
//#endregion
|
|
8407
|
+
//#region src/message-builder.d.ts
|
|
8408
|
+
/**
|
|
8409
|
+
* Message attributes from metadata
|
|
8410
|
+
*/
|
|
8411
|
+
interface MessageAttributes {
|
|
8412
|
+
/** Whether the message mutates state */
|
|
8413
|
+
mutates: boolean;
|
|
8414
|
+
/** Whether the message is payable */
|
|
8415
|
+
payable: boolean;
|
|
8416
|
+
/** Whether this is the default message */
|
|
8417
|
+
default: boolean;
|
|
8418
|
+
}
|
|
8419
|
+
/**
|
|
8420
|
+
* Type-safe message interface with encode/decode methods
|
|
8421
|
+
*
|
|
8422
|
+
* @typeParam M - The InkCallableDescriptor type (message definitions)
|
|
8423
|
+
* @typeParam L - The specific message label
|
|
8424
|
+
*/
|
|
8425
|
+
interface TypedMessage<M$1 extends InkCallableDescriptor, L$1 extends keyof M$1 & string> {
|
|
8426
|
+
/**
|
|
8427
|
+
* Encode message arguments to Binary
|
|
8428
|
+
*
|
|
8429
|
+
* @param args - The message arguments (fully typed)
|
|
8430
|
+
* @returns Encoded call data as Binary
|
|
8431
|
+
*
|
|
8432
|
+
* @example
|
|
8433
|
+
* ```ts
|
|
8434
|
+
* const transfer = builder.message("PSP22::transfer");
|
|
8435
|
+
* const encoded = transfer.encode({
|
|
8436
|
+
* to: recipientAddress,
|
|
8437
|
+
* value: 1000n,
|
|
8438
|
+
* data: new Uint8Array(),
|
|
8439
|
+
* });
|
|
8440
|
+
* ```
|
|
8441
|
+
*/
|
|
8442
|
+
encode: {} extends M$1[L$1]["message"] ? (args?: M$1[L$1]["message"]) => Binary : (args: M$1[L$1]["message"]) => Binary;
|
|
8443
|
+
/**
|
|
8444
|
+
* Decode response to typed value
|
|
8445
|
+
*
|
|
8446
|
+
* @param response - The response data
|
|
8447
|
+
* @returns Decoded response value
|
|
8448
|
+
*/
|
|
8449
|
+
decode: (response: Binary | Uint8Array) => M$1[L$1]["response"];
|
|
8450
|
+
/** Message attributes (mutates, payable, default) */
|
|
8451
|
+
attributes: MessageAttributes;
|
|
8452
|
+
/** 4-byte selector */
|
|
8453
|
+
selector: Uint8Array;
|
|
8454
|
+
/** Message label */
|
|
8455
|
+
label: L$1;
|
|
8456
|
+
}
|
|
8457
|
+
/**
|
|
8458
|
+
* Contract message builder interface
|
|
8459
|
+
*
|
|
8460
|
+
* @typeParam M - The InkCallableDescriptor type (message definitions)
|
|
8356
8461
|
*/
|
|
8357
8462
|
|
|
8358
8463
|
/**
|
|
@@ -8393,16 +8498,16 @@ interface SendOptions<Args = unknown> {
|
|
|
8393
8498
|
/**
|
|
8394
8499
|
* Sendable transaction that can be signed and submitted
|
|
8395
8500
|
*/
|
|
8396
|
-
interface SendableTransaction<T> {
|
|
8501
|
+
interface SendableTransaction<T$1> {
|
|
8397
8502
|
/** Sign and submit the transaction */
|
|
8398
|
-
signAndSubmit(signer: PolkadotSigner$1): Promise<TxResult<T>>;
|
|
8503
|
+
signAndSubmit(signer: PolkadotSigner$1): Promise<TxResult<T$1>>;
|
|
8399
8504
|
/** Get the encoded call data */
|
|
8400
8505
|
getEncodedData(): Uint8Array;
|
|
8401
8506
|
}
|
|
8402
8507
|
/**
|
|
8403
8508
|
* Transaction result
|
|
8404
8509
|
*/
|
|
8405
|
-
interface TxResult<T> {
|
|
8510
|
+
interface TxResult<T$1> {
|
|
8406
8511
|
/** Whether the transaction was successful */
|
|
8407
8512
|
ok: boolean;
|
|
8408
8513
|
/** Transaction hash */
|
|
@@ -8413,7 +8518,7 @@ interface TxResult<T> {
|
|
|
8413
8518
|
number: number;
|
|
8414
8519
|
};
|
|
8415
8520
|
/** Decoded return value (if any) */
|
|
8416
|
-
result?: T;
|
|
8521
|
+
result?: T$1;
|
|
8417
8522
|
/** Events emitted by the transaction */
|
|
8418
8523
|
events: unknown[];
|
|
8419
8524
|
/** Dispatch error if failed */
|
|
@@ -8422,9 +8527,9 @@ interface TxResult<T> {
|
|
|
8422
8527
|
/**
|
|
8423
8528
|
* Successful query result value
|
|
8424
8529
|
*/
|
|
8425
|
-
interface QuerySuccessValue<T> {
|
|
8530
|
+
interface QuerySuccessValue<T$1> {
|
|
8426
8531
|
/** The decoded response from the contract */
|
|
8427
|
-
value: T;
|
|
8532
|
+
value: T$1;
|
|
8428
8533
|
/** Events that would be emitted */
|
|
8429
8534
|
events: unknown[];
|
|
8430
8535
|
/** Gas consumed during dry-run */
|
|
@@ -8440,16 +8545,16 @@ interface QuerySuccessValue<T> {
|
|
|
8440
8545
|
/** Storage deposit required */
|
|
8441
8546
|
storageDeposit: bigint;
|
|
8442
8547
|
/** Create a sendable transaction from this query result */
|
|
8443
|
-
send(): SendableTransaction<T>;
|
|
8548
|
+
send(): SendableTransaction<T$1>;
|
|
8444
8549
|
}
|
|
8445
8550
|
/**
|
|
8446
8551
|
* Query result - discriminated union for success/failure
|
|
8447
8552
|
* On success: QuerySuccessValue fields are spread to the same level as success
|
|
8448
8553
|
* On failure: error field contains the ContractError
|
|
8449
8554
|
*/
|
|
8450
|
-
type QueryResult<T> = ({
|
|
8555
|
+
type QueryResult<T$1> = ({
|
|
8451
8556
|
success: true;
|
|
8452
|
-
} & QuerySuccessValue<T>) | {
|
|
8557
|
+
} & QuerySuccessValue<T$1>) | {
|
|
8453
8558
|
success: false;
|
|
8454
8559
|
error: ContractError;
|
|
8455
8560
|
};
|
|
@@ -8490,9 +8595,9 @@ type InkLangError = {
|
|
|
8490
8595
|
* ink! MessageResult type pattern (Result<T, LangError>)
|
|
8491
8596
|
* papi generates this as { success: true; value: T } | { success: false; value: LangError }
|
|
8492
8597
|
*/
|
|
8493
|
-
type InkMessageResult<T> = {
|
|
8598
|
+
type InkMessageResult<T$1> = {
|
|
8494
8599
|
success: true;
|
|
8495
|
-
value: T;
|
|
8600
|
+
value: T$1;
|
|
8496
8601
|
} | {
|
|
8497
8602
|
success: false;
|
|
8498
8603
|
value: unknown;
|
|
@@ -8502,15 +8607,18 @@ type InkMessageResult<T> = {
|
|
|
8502
8607
|
* 1. Extract T from { success: true; value: T } | { success: false; value: ... }
|
|
8503
8608
|
* 2. Exclude LangError variants from T
|
|
8504
8609
|
*/
|
|
8505
|
-
type UnwrapMessageResult<T> = T extends InkMessageResult<infer U> ? Exclude<U, InkLangError> : T;
|
|
8610
|
+
type UnwrapMessageResult<T$1> = T$1 extends InkMessageResult<infer U> ? Exclude<U, InkLangError> : T$1;
|
|
8506
8611
|
/**
|
|
8507
8612
|
* Type helper to extract message response type (with MessageResult unwrapped)
|
|
8508
8613
|
*/
|
|
8509
8614
|
type MessageResponse<M$1 extends InkCallableDescriptor, K$1 extends keyof M$1> = UnwrapMessageResult<M$1[K$1]["response"]>;
|
|
8510
8615
|
/**
|
|
8511
8616
|
* D9 Ink Contract interface
|
|
8617
|
+
*
|
|
8618
|
+
* @typeParam M - The callable descriptor type (message definitions)
|
|
8619
|
+
* @typeParam E - The event type for type-safe event filtering
|
|
8512
8620
|
*/
|
|
8513
|
-
interface D9InkContract<M$1 extends InkCallableDescriptor> {
|
|
8621
|
+
interface D9InkContract<M$1 extends InkCallableDescriptor, E extends Event = Event> {
|
|
8514
8622
|
/** Contract address */
|
|
8515
8623
|
readonly address: SS58String$1;
|
|
8516
8624
|
/** Contract metadata */
|
|
@@ -8533,13 +8641,69 @@ interface D9InkContract<M$1 extends InkCallableDescriptor> {
|
|
|
8533
8641
|
getStorage(): ContractStorage;
|
|
8534
8642
|
/**
|
|
8535
8643
|
* Filter events from a transaction result to only include this contract's events
|
|
8644
|
+
* Returns type-safe events that can be narrowed using `event.type`
|
|
8645
|
+
*
|
|
8646
|
+
* @example
|
|
8647
|
+
* ```ts
|
|
8648
|
+
* const events = contract.filterEvents(txResult.events);
|
|
8649
|
+
* for (const event of events) {
|
|
8650
|
+
* if (event.type === "Transfer") {
|
|
8651
|
+
* console.log(event.value.from, event.value.to, event.value.value);
|
|
8652
|
+
* }
|
|
8653
|
+
* }
|
|
8654
|
+
* ```
|
|
8536
8655
|
*/
|
|
8537
|
-
filterEvents(events: unknown[]):
|
|
8656
|
+
filterEvents(events: unknown[]): TypedContractEvent<E>[];
|
|
8538
8657
|
/**
|
|
8539
8658
|
* Subscribe to contract events as an RxJS Observable
|
|
8540
8659
|
* @param options - Event subscription options (event labels to filter, etc.)
|
|
8541
8660
|
*/
|
|
8542
|
-
subscribeToEvents(options?: Omit<EventSubscriptionOptions, "contractAddress">): Observable<
|
|
8661
|
+
subscribeToEvents(options?: Omit<EventSubscriptionOptions, "contractAddress">): Observable<TypedContractEvent<E>>;
|
|
8662
|
+
/**
|
|
8663
|
+
* Get a type-safe message builder for a specific message
|
|
8664
|
+
*
|
|
8665
|
+
* Provides a polkadot-api compatible API for encoding and decoding
|
|
8666
|
+
* contract messages with full TypeScript type inference.
|
|
8667
|
+
*
|
|
8668
|
+
* @param label - The message label (e.g., "PSP22::transfer")
|
|
8669
|
+
* @returns Typed message interface with encode/decode methods
|
|
8670
|
+
*
|
|
8671
|
+
* @example
|
|
8672
|
+
* ```ts
|
|
8673
|
+
* const transfer = contract.message("PSP22::transfer");
|
|
8674
|
+
*
|
|
8675
|
+
* // Encode with full type checking on args
|
|
8676
|
+
* const encoded = transfer.encode({
|
|
8677
|
+
* to: recipientAddress,
|
|
8678
|
+
* value: 1000000n,
|
|
8679
|
+
* data: new Uint8Array(),
|
|
8680
|
+
* });
|
|
8681
|
+
*
|
|
8682
|
+
* // Decode response with full type inference
|
|
8683
|
+
* const decoded = transfer.decode(responseBytes);
|
|
8684
|
+
* ```
|
|
8685
|
+
*/
|
|
8686
|
+
message<L$1 extends ExtractMessageLabels<M$1>>(label: L$1): TypedMessage<M$1, L$1>;
|
|
8687
|
+
/**
|
|
8688
|
+
* Filter events by specific type with proper type narrowing
|
|
8689
|
+
*
|
|
8690
|
+
* @param events - Array of chain events to filter
|
|
8691
|
+
* @param label - The event label to filter by
|
|
8692
|
+
* @returns Array of events narrowed to the specific type
|
|
8693
|
+
*
|
|
8694
|
+
* @example
|
|
8695
|
+
* ```ts
|
|
8696
|
+
* const transfers = contract.filterEventsByType(txResult.events, "Transfer");
|
|
8697
|
+
*
|
|
8698
|
+
* for (const t of transfers) {
|
|
8699
|
+
* // t.value is fully typed as Transfer event data
|
|
8700
|
+
* console.log(t.value.from, "->", t.value.to, ":", t.value.value);
|
|
8701
|
+
* }
|
|
8702
|
+
* ```
|
|
8703
|
+
*/
|
|
8704
|
+
filterEventsByType<L$1 extends string>(events: unknown[], label: L$1): Array<TypedContractEvent<E> & {
|
|
8705
|
+
type: L$1;
|
|
8706
|
+
}>;
|
|
8543
8707
|
}
|
|
8544
8708
|
/**
|
|
8545
8709
|
* D9 Ink SDK options
|
|
@@ -8554,29 +8718,296 @@ interface D9InkSdk {
|
|
|
8554
8718
|
* @param descriptor - The contract descriptor from @polkadot-api/descriptors
|
|
8555
8719
|
* @param address - The contract address (SS58 format)
|
|
8556
8720
|
*/
|
|
8557
|
-
getContract<S extends InkStorageDescriptor, M$1 extends InkCallableDescriptor, C extends InkCallableDescriptor, E extends Event>(descriptor: InkDescriptors$1<S, M$1, C, E>, address: SS58String$1): D9InkContract<M$1>;
|
|
8721
|
+
getContract<S extends InkStorageDescriptor, M$1 extends InkCallableDescriptor, C extends InkCallableDescriptor, E extends Event>(descriptor: InkDescriptors$1<S, M$1, C, E>, address: SS58String$1): D9InkContract<M$1, E>;
|
|
8722
|
+
}
|
|
8723
|
+
/**
|
|
8724
|
+
* Type helper to extract D9InkContract type from an InkDescriptors
|
|
8725
|
+
*/
|
|
8726
|
+
|
|
8727
|
+
//#endregion
|
|
8728
|
+
//#region src/rpc-types.d.ts
|
|
8729
|
+
/**
|
|
8730
|
+
* Block header structure
|
|
8731
|
+
*/
|
|
8732
|
+
interface BlockHeader {
|
|
8733
|
+
parentHash: HexString$1;
|
|
8734
|
+
number: HexString$1;
|
|
8735
|
+
stateRoot: HexString$1;
|
|
8736
|
+
extrinsicsRoot: HexString$1;
|
|
8737
|
+
digest: {
|
|
8738
|
+
logs: HexString$1[];
|
|
8739
|
+
};
|
|
8740
|
+
}
|
|
8741
|
+
/**
|
|
8742
|
+
* System health information
|
|
8743
|
+
*/
|
|
8744
|
+
interface SystemHealth {
|
|
8745
|
+
peers: number;
|
|
8746
|
+
isSyncing: boolean;
|
|
8747
|
+
shouldHavePeers: boolean;
|
|
8748
|
+
}
|
|
8749
|
+
/**
|
|
8750
|
+
* Runtime version information
|
|
8751
|
+
*/
|
|
8752
|
+
interface RuntimeVersion {
|
|
8753
|
+
specName: string;
|
|
8754
|
+
implName: string;
|
|
8755
|
+
authoringVersion: number;
|
|
8756
|
+
specVersion: number;
|
|
8757
|
+
implVersion: number;
|
|
8758
|
+
apis: [HexString$1, number][];
|
|
8759
|
+
transactionVersion: number;
|
|
8760
|
+
stateVersion: number;
|
|
8761
|
+
}
|
|
8762
|
+
/**
|
|
8763
|
+
* Storage change set
|
|
8764
|
+
*/
|
|
8765
|
+
interface StorageChangeSet {
|
|
8766
|
+
block: HexString$1;
|
|
8767
|
+
changes: [HexString$1, HexString$1 | null][];
|
|
8768
|
+
}
|
|
8769
|
+
/**
|
|
8770
|
+
* RPC method signatures: method name -> [params tuple, return type]
|
|
8771
|
+
*
|
|
8772
|
+
* This interface maps known Substrate RPC methods to their parameter and return types.
|
|
8773
|
+
* Methods not in this list will fall back to unknown types.
|
|
8774
|
+
*/
|
|
8775
|
+
interface SubstrateRpcMethods {
|
|
8776
|
+
chain_getBlockHash: [[blockNumber?: number], HexString$1 | null];
|
|
8777
|
+
chain_getHeader: [[hash?: HexString$1], BlockHeader | null];
|
|
8778
|
+
chain_getBlock: [[hash?: HexString$1], {
|
|
8779
|
+
block: {
|
|
8780
|
+
header: BlockHeader;
|
|
8781
|
+
extrinsics: HexString$1[];
|
|
8782
|
+
};
|
|
8783
|
+
justifications: unknown;
|
|
8784
|
+
} | null];
|
|
8785
|
+
chain_getFinalizedHead: [[], HexString$1];
|
|
8786
|
+
state_call: [[method: string, data: HexString$1, at?: HexString$1], HexString$1];
|
|
8787
|
+
state_getStorage: [[key: HexString$1, at?: HexString$1], HexString$1 | null];
|
|
8788
|
+
state_getStorageAt: [[key: HexString$1, at: HexString$1], HexString$1 | null];
|
|
8789
|
+
state_getStorageHash: [[key: HexString$1, at?: HexString$1], HexString$1 | null];
|
|
8790
|
+
state_getStorageSize: [[key: HexString$1, at?: HexString$1], number | null];
|
|
8791
|
+
state_getMetadata: [[at?: HexString$1], HexString$1];
|
|
8792
|
+
state_getRuntimeVersion: [[at?: HexString$1], RuntimeVersion];
|
|
8793
|
+
state_queryStorageAt: [[keys: HexString$1[], at?: HexString$1], StorageChangeSet[]];
|
|
8794
|
+
system_chain: [[], string];
|
|
8795
|
+
system_name: [[], string];
|
|
8796
|
+
system_version: [[], string];
|
|
8797
|
+
system_health: [[], SystemHealth];
|
|
8798
|
+
system_properties: [[], Record<string, unknown>];
|
|
8799
|
+
system_peers: [[], {
|
|
8800
|
+
peerId: string;
|
|
8801
|
+
roles: string;
|
|
8802
|
+
bestHash: HexString$1;
|
|
8803
|
+
bestNumber: number;
|
|
8804
|
+
}[]];
|
|
8805
|
+
system_chainType: [[], string];
|
|
8806
|
+
author_submitExtrinsic: [[extrinsic: HexString$1], HexString$1];
|
|
8807
|
+
author_pendingExtrinsics: [[], HexString$1[]];
|
|
8808
|
+
author_removeExtrinsic: [[bytesOrHash: (HexString$1 | {
|
|
8809
|
+
Hash: HexString$1;
|
|
8810
|
+
})[]], number];
|
|
8811
|
+
payment_queryInfo: [[extrinsic: HexString$1, at?: HexString$1], {
|
|
8812
|
+
weight: {
|
|
8813
|
+
refTime: number;
|
|
8814
|
+
proofSize: number;
|
|
8815
|
+
};
|
|
8816
|
+
class: string;
|
|
8817
|
+
partialFee: string;
|
|
8818
|
+
}];
|
|
8819
|
+
payment_queryFeeDetails: [[extrinsic: HexString$1, at?: HexString$1], {
|
|
8820
|
+
inclusionFee: {
|
|
8821
|
+
baseFee: string;
|
|
8822
|
+
lenFee: string;
|
|
8823
|
+
adjustedWeightFee: string;
|
|
8824
|
+
} | null;
|
|
8825
|
+
}];
|
|
8826
|
+
}
|
|
8827
|
+
/**
|
|
8828
|
+
* Known RPC method names (for autocomplete)
|
|
8829
|
+
*/
|
|
8830
|
+
type KnownRpcMethod = keyof SubstrateRpcMethods;
|
|
8831
|
+
/**
|
|
8832
|
+
* Extract parameter types for a known RPC method
|
|
8833
|
+
*/
|
|
8834
|
+
type RpcParams<M$1 extends KnownRpcMethod> = SubstrateRpcMethods[M$1][0];
|
|
8835
|
+
/**
|
|
8836
|
+
* Extract return type for a known RPC method
|
|
8837
|
+
*/
|
|
8838
|
+
type RpcReturn<M$1 extends KnownRpcMethod> = SubstrateRpcMethods[M$1][1];
|
|
8839
|
+
/**
|
|
8840
|
+
* Type-safe RPC request interface
|
|
8841
|
+
*
|
|
8842
|
+
* Provides full type inference for known RPC methods while allowing
|
|
8843
|
+
* arbitrary method calls with explicit type parameters.
|
|
8844
|
+
*
|
|
8845
|
+
* @example
|
|
8846
|
+
* ```ts
|
|
8847
|
+
* // Known method: types are inferred
|
|
8848
|
+
* const hash = await rpc("chain_getBlockHash", [12345]);
|
|
8849
|
+
* // hash: HexString | null
|
|
8850
|
+
*
|
|
8851
|
+
* // Unknown method: provide explicit types
|
|
8852
|
+
* const result = await rpc<MyType>("custom_method", [arg1, arg2]);
|
|
8853
|
+
* ```
|
|
8854
|
+
*/
|
|
8855
|
+
interface TypedRpcRequest {
|
|
8856
|
+
/**
|
|
8857
|
+
* Call a known RPC method with full type inference
|
|
8858
|
+
*/
|
|
8859
|
+
<M$1 extends KnownRpcMethod>(method: M$1, params: RpcParams<M$1>): Promise<RpcReturn<M$1>>;
|
|
8860
|
+
/**
|
|
8861
|
+
* Call an unknown RPC method with explicit type parameters
|
|
8862
|
+
*/
|
|
8863
|
+
<Reply = unknown, Params extends unknown[] = unknown[]>(method: string, params: Params): Promise<Reply>;
|
|
8558
8864
|
}
|
|
8865
|
+
//#endregion
|
|
8866
|
+
//#region src/sdk.d.ts
|
|
8867
|
+
/**
|
|
8868
|
+
* Options for creating D9 Ink SDK
|
|
8869
|
+
*/
|
|
8870
|
+
|
|
8871
|
+
/**
|
|
8872
|
+
* Extended D9 Ink SDK interface with typed RPC access
|
|
8873
|
+
*/
|
|
8874
|
+
interface D9InkSdkWithRpc extends D9InkSdk {
|
|
8875
|
+
/**
|
|
8876
|
+
* Type-safe RPC request function
|
|
8877
|
+
*
|
|
8878
|
+
* Provides autocomplete for known Substrate RPC methods and type inference
|
|
8879
|
+
* for parameters and return values.
|
|
8880
|
+
*
|
|
8881
|
+
* @example
|
|
8882
|
+
* ```ts
|
|
8883
|
+
* // Known method with full type inference
|
|
8884
|
+
* const hash = await sdk.rpc("chain_getBlockHash", [12345]);
|
|
8885
|
+
* // hash: HexString | null
|
|
8886
|
+
*
|
|
8887
|
+
* // Custom method with explicit types
|
|
8888
|
+
* const custom = await sdk.rpc<MyType>("custom_method", [arg]);
|
|
8889
|
+
* ```
|
|
8890
|
+
*/
|
|
8891
|
+
rpc: TypedRpcRequest;
|
|
8892
|
+
}
|
|
8893
|
+
/**
|
|
8894
|
+
* Create a D9 Ink SDK instance.
|
|
8895
|
+
*
|
|
8896
|
+
* This SDK provides a similar API to the official @polkadot-api/sdk-ink,
|
|
8897
|
+
* but uses state_call + ContractsApi_call instead of ReviveApi.
|
|
8898
|
+
*
|
|
8899
|
+
* @example
|
|
8900
|
+
* ```ts
|
|
8901
|
+
* import { createD9InkSdk } from "@d9-network/ink";
|
|
8902
|
+
* import { contracts } from "@polkadot-api/descriptors";
|
|
8903
|
+
*
|
|
8904
|
+
* const sdk = createD9InkSdk(client);
|
|
8905
|
+
* const usdtContract = sdk.getContract(
|
|
8906
|
+
* contracts.d9_usdt,
|
|
8907
|
+
* "uLj9DRUujbpCyK7USZY5ebGbxdtKoWvdRvGyyUsoLWDsNng"
|
|
8908
|
+
* );
|
|
8909
|
+
*
|
|
8910
|
+
* // Query balance
|
|
8911
|
+
* const result = await usdtContract.query("PSP22::balance_of", {
|
|
8912
|
+
* origin: aliceAddress,
|
|
8913
|
+
* args: { owner: aliceAddress }
|
|
8914
|
+
* });
|
|
8915
|
+
*
|
|
8916
|
+
* if (result.success) {
|
|
8917
|
+
* console.log("Balance:", result.value.response);
|
|
8918
|
+
*
|
|
8919
|
+
* // Send transaction from the query result
|
|
8920
|
+
* const txResult = await result.value.send().signAndSubmit(aliceSigner);
|
|
8921
|
+
* }
|
|
8922
|
+
*
|
|
8923
|
+
* // Or send directly
|
|
8924
|
+
* const txResult = await usdtContract
|
|
8925
|
+
* .send("PSP22::transfer", {
|
|
8926
|
+
* origin: aliceAddress,
|
|
8927
|
+
* args: { to: bobAddress, value: 1000n, data: [] }
|
|
8928
|
+
* })
|
|
8929
|
+
* .signAndSubmit(aliceSigner);
|
|
8930
|
+
* ```
|
|
8931
|
+
*
|
|
8932
|
+
* @param client - The PolkadotClient instance
|
|
8933
|
+
* @param options - Optional SDK configuration
|
|
8934
|
+
* @returns D9 Ink SDK instance with typed RPC access
|
|
8935
|
+
*/
|
|
8936
|
+
|
|
8559
8937
|
//#endregion
|
|
8560
8938
|
//#region src/events.d.ts
|
|
8561
8939
|
/**
|
|
8562
|
-
*
|
|
8940
|
+
* Type-safe event parser for a specific contract
|
|
8941
|
+
*
|
|
8942
|
+
* @typeParam S - The storage descriptor type
|
|
8943
|
+
* @typeParam M - The messages descriptor type
|
|
8944
|
+
* @typeParam C - The constructors descriptor type
|
|
8945
|
+
* @typeParam E - The event type representing all possible events for this contract
|
|
8563
8946
|
*/
|
|
8564
|
-
declare class ContractEventParser {
|
|
8947
|
+
declare class ContractEventParser<S extends InkStorageDescriptor = InkStorageDescriptor, M$1 extends InkCallableDescriptor = InkCallableDescriptor, C extends InkCallableDescriptor = InkCallableDescriptor, E extends Event = Event> {
|
|
8565
8948
|
private eventDecoders;
|
|
8566
8949
|
private eventSignatures;
|
|
8567
8950
|
private contractAddressBytes;
|
|
8568
8951
|
private contractAddress;
|
|
8569
8952
|
private metadata;
|
|
8570
|
-
constructor(
|
|
8953
|
+
constructor(descriptor: InkDescriptors$1<S, M$1, C, E>, contractAddress: SS58String$1);
|
|
8571
8954
|
/**
|
|
8572
|
-
* Parse a raw chain event into a contract event (if it matches)
|
|
8955
|
+
* Parse a raw chain event into a type-safe contract event (if it matches)
|
|
8573
8956
|
* Returns null if the event is not from this contract or cannot be parsed
|
|
8957
|
+
*
|
|
8958
|
+
* @example
|
|
8959
|
+
* ```ts
|
|
8960
|
+
* const event = parser.parseEvent(chainEvent);
|
|
8961
|
+
* if (event?.type === "Transfer") {
|
|
8962
|
+
* // event.value is now typed as { from: SS58String; to: SS58String; value: bigint }
|
|
8963
|
+
* console.log(event.value.from);
|
|
8964
|
+
* }
|
|
8965
|
+
* ```
|
|
8574
8966
|
*/
|
|
8575
|
-
parseEvent(chainEvent: unknown):
|
|
8967
|
+
parseEvent(chainEvent: unknown): TypedContractEvent<E> | null;
|
|
8576
8968
|
/**
|
|
8577
|
-
*
|
|
8969
|
+
* Extract event label from ASCII-encoded topic (D9 chain format)
|
|
8970
|
+
*
|
|
8971
|
+
* D9 chain uses a format where:
|
|
8972
|
+
* - First byte is 0x00 (null)
|
|
8973
|
+
* - Remaining 31 bytes are ASCII characters of `ContractName::EventLabel`
|
|
8974
|
+
* - Total is exactly 32 bytes (truncated/padded as needed)
|
|
8975
|
+
*
|
|
8976
|
+
* @param topic - The 32-byte topic from the event
|
|
8977
|
+
* @returns The extracted event label, or null if not in ASCII format
|
|
8978
|
+
*/
|
|
8979
|
+
private extractEventLabelFromAsciiTopic;
|
|
8980
|
+
/**
|
|
8981
|
+
* Filter a batch of events and return type-safe results
|
|
8982
|
+
*
|
|
8983
|
+
* @param chainEvents - Array of chain events to filter
|
|
8984
|
+
* @param options - Optional filter criteria
|
|
8985
|
+
* @returns Array of type-safe contract events
|
|
8986
|
+
*/
|
|
8987
|
+
filterEvents(chainEvents: unknown[], options?: EventFilterOptions): TypedContractEvent<E>[];
|
|
8988
|
+
/**
|
|
8989
|
+
* Filter events by specific type with proper type narrowing
|
|
8990
|
+
*
|
|
8991
|
+
* This method provides better type safety than filterEvents with eventLabels
|
|
8992
|
+
* because TypeScript can narrow the return type to only the specified event type.
|
|
8993
|
+
*
|
|
8994
|
+
* @param chainEvents - Array of chain events to filter
|
|
8995
|
+
* @param label - The event label to filter by
|
|
8996
|
+
* @returns Array of events narrowed to the specific type
|
|
8997
|
+
*
|
|
8998
|
+
* @example
|
|
8999
|
+
* ```ts
|
|
9000
|
+
* const transfers = parser.filterByType(events, "Transfer");
|
|
9001
|
+
*
|
|
9002
|
+
* for (const t of transfers) {
|
|
9003
|
+
* // t.value is fully typed as Transfer event data
|
|
9004
|
+
* console.log(t.value.from, "->", t.value.to, ":", t.value.value);
|
|
9005
|
+
* }
|
|
9006
|
+
* ```
|
|
8578
9007
|
*/
|
|
8579
|
-
|
|
9008
|
+
filterByType<L$1 extends string>(chainEvents: unknown[], label: L$1): Array<TypedContractEvent<E> & {
|
|
9009
|
+
type: L$1;
|
|
9010
|
+
}>;
|
|
8580
9011
|
/**
|
|
8581
9012
|
* Get the contract address as SS58 string
|
|
8582
9013
|
*/
|
|
@@ -8590,37 +9021,74 @@ declare class ContractEventParser {
|
|
|
8590
9021
|
* Compare two Uint8Arrays for equality
|
|
8591
9022
|
*/
|
|
8592
9023
|
private bytesEqual;
|
|
8593
|
-
/**
|
|
8594
|
-
* Build event signature map from metadata
|
|
8595
|
-
*/
|
|
8596
|
-
private static buildEventSignatureMap;
|
|
8597
9024
|
}
|
|
9025
|
+
/**
|
|
9026
|
+
* Type guard for narrowing event types
|
|
9027
|
+
*
|
|
9028
|
+
* Use this function when you have a `TypedContractEvent` and need to
|
|
9029
|
+
* narrow it to a specific event type. This is useful when the type
|
|
9030
|
+
* information is lost (e.g., after serialization or in generic functions).
|
|
9031
|
+
*
|
|
9032
|
+
* @typeParam E - The Enum type representing all possible events
|
|
9033
|
+
* @typeParam L - The specific event label to check
|
|
9034
|
+
* @param event - The event to check
|
|
9035
|
+
* @param label - The event label to match
|
|
9036
|
+
* @returns True if the event type matches the label
|
|
9037
|
+
*
|
|
9038
|
+
* @example
|
|
9039
|
+
* ```ts
|
|
9040
|
+
* const event = parser.parseEvent(chainEvent);
|
|
9041
|
+
*
|
|
9042
|
+
* if (event && isEventType(event, "Transfer")) {
|
|
9043
|
+
* // TypeScript knows event.value is Transfer event data
|
|
9044
|
+
* console.log(event.value.from);
|
|
9045
|
+
* console.log(event.value.to);
|
|
9046
|
+
* console.log(event.value.value);
|
|
9047
|
+
* }
|
|
9048
|
+
* ```
|
|
9049
|
+
*/
|
|
9050
|
+
|
|
8598
9051
|
//#endregion
|
|
8599
9052
|
//#region src/subscriptions.d.ts
|
|
8600
9053
|
/**
|
|
8601
9054
|
* Create an observable stream of contract events
|
|
8602
9055
|
*
|
|
8603
9056
|
* @param client - Polkadot API client
|
|
8604
|
-
* @param
|
|
9057
|
+
* @param descriptor - Contract descriptor
|
|
8605
9058
|
* @param options - Subscription options
|
|
8606
|
-
* @returns Observable stream of
|
|
9059
|
+
* @returns Observable stream of type-safe contract events
|
|
8607
9060
|
*/
|
|
8608
|
-
declare function createContractEventStream(client: PolkadotClient,
|
|
9061
|
+
declare function createContractEventStream<S extends InkStorageDescriptor = InkStorageDescriptor, M$1 extends InkCallableDescriptor = InkCallableDescriptor, C extends InkCallableDescriptor = InkCallableDescriptor, E extends Event = Event>(client: PolkadotClient, descriptor: InkDescriptors$1<S, M$1, C, E>, options: EventSubscriptionOptions): Observable<TypedContractEvent<E>>;
|
|
9062
|
+
/**
|
|
9063
|
+
* PSP22 Transfer event type
|
|
9064
|
+
*/
|
|
9065
|
+
interface PSP22TransferEvent {
|
|
9066
|
+
type: "Transfer";
|
|
9067
|
+
value: {
|
|
9068
|
+
from?: SS58String$1 | null;
|
|
9069
|
+
to?: SS58String$1 | null;
|
|
9070
|
+
value: bigint;
|
|
9071
|
+
};
|
|
9072
|
+
raw: {
|
|
9073
|
+
blockNumber: number;
|
|
9074
|
+
blockHash: string;
|
|
9075
|
+
eventIndex: number;
|
|
9076
|
+
contractAddress: SS58String$1;
|
|
9077
|
+
data: Uint8Array;
|
|
9078
|
+
topics: Uint8Array[];
|
|
9079
|
+
};
|
|
9080
|
+
}
|
|
8609
9081
|
/**
|
|
8610
9082
|
* Convenience helper to create a Transfer event stream for PSP22 tokens
|
|
8611
9083
|
*
|
|
8612
9084
|
* @param client - Polkadot API client
|
|
8613
|
-
* @param
|
|
9085
|
+
* @param descriptor - PSP22 contract descriptor
|
|
8614
9086
|
* @param contractAddress - PSP22 contract address
|
|
8615
9087
|
* @param getEvents - Function to fetch System.Events at a block hash
|
|
8616
9088
|
* @param watchAddress - Optional address to filter transfers (only events involving this address)
|
|
8617
9089
|
* @returns Observable stream of Transfer events
|
|
8618
9090
|
*/
|
|
8619
|
-
declare function createPSP22TransferStream(client: PolkadotClient,
|
|
8620
|
-
from?: SS58String$1 | null;
|
|
8621
|
-
to?: SS58String$1 | null;
|
|
8622
|
-
value: bigint;
|
|
8623
|
-
}>>;
|
|
9091
|
+
declare function createPSP22TransferStream<S extends InkStorageDescriptor = InkStorageDescriptor, M$1 extends InkCallableDescriptor = InkCallableDescriptor, C extends InkCallableDescriptor = InkCallableDescriptor, E extends Event = Event>(client: PolkadotClient, descriptor: InkDescriptors$1<S, M$1, C, E>, contractAddress: SS58String$1, getEvents: (blockHash: string) => Promise<unknown[]>, watchAddress?: SS58String$1): Observable<PSP22TransferEvent>;
|
|
8624
9092
|
/**
|
|
8625
9093
|
* Create a native token (D9) transfer event stream
|
|
8626
9094
|
*
|
|
@@ -8639,6 +9107,15 @@ declare function createNativeTransferStream(client: PolkadotClient, getEvents: (
|
|
|
8639
9107
|
blockHash: string;
|
|
8640
9108
|
}>;
|
|
8641
9109
|
//#endregion
|
|
9110
|
+
//#region src/calls.d.ts
|
|
9111
|
+
/**
|
|
9112
|
+
* Type-safe call parser for a specific contract
|
|
9113
|
+
*
|
|
9114
|
+
* @typeParam S - The storage descriptor type
|
|
9115
|
+
* @typeParam M - The InkCallableDescriptor type (message definitions)
|
|
9116
|
+
* @typeParam C - The constructors descriptor type
|
|
9117
|
+
* @typeParam E - The events Enum type
|
|
9118
|
+
*/
|
|
8642
9119
|
//#endregion
|
|
8643
9120
|
//#region src/client.d.ts
|
|
8644
9121
|
type CreateD9SdkClientOptions = {
|
|
@@ -8655,7 +9132,7 @@ type CreateD9SdkClientOptions = {
|
|
|
8655
9132
|
* @example
|
|
8656
9133
|
* ```ts
|
|
8657
9134
|
* const d9Client = createD9SdkClient({
|
|
8658
|
-
* endpoint: "wss://
|
|
9135
|
+
* endpoint: "wss://archiver.d9network.com:40300",
|
|
8659
9136
|
* });
|
|
8660
9137
|
*
|
|
8661
9138
|
* // Query USDT balance
|
|
@@ -8672,7 +9149,7 @@ type CreateD9SdkClientOptions = {
|
|
|
8672
9149
|
declare function createD9SdkClient(options: CreateD9SdkClientOptions): {
|
|
8673
9150
|
client: polkadot_api0.PolkadotClient;
|
|
8674
9151
|
api: polkadot_api0.TypedApi<D9>;
|
|
8675
|
-
inkSdk:
|
|
9152
|
+
inkSdk: D9InkSdkWithRpc;
|
|
8676
9153
|
};
|
|
8677
9154
|
type D9SdkClientReturn = ReturnType<typeof createD9SdkClient>;
|
|
8678
9155
|
//#endregion
|
|
@@ -8722,5 +9199,304 @@ declare function createAccountFromPrivateKey(options: {
|
|
|
8722
9199
|
keyType: "sr25519" | "ed25519" | "secp256k1";
|
|
8723
9200
|
}): WalletAccount;
|
|
8724
9201
|
//#endregion
|
|
8725
|
-
|
|
9202
|
+
//#region src/wallet/validation.d.ts
|
|
9203
|
+
/**
|
|
9204
|
+
* Check if a value is a valid SS58 address
|
|
9205
|
+
*
|
|
9206
|
+
* @param address - The value to check
|
|
9207
|
+
* @returns True if the value is a valid SS58 address
|
|
9208
|
+
*
|
|
9209
|
+
* @example
|
|
9210
|
+
* ```typescript
|
|
9211
|
+
* isValidAddress("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"); // true
|
|
9212
|
+
* isValidAddress("invalid"); // false
|
|
9213
|
+
* isValidAddress(null); // false
|
|
9214
|
+
* ```
|
|
9215
|
+
*/
|
|
9216
|
+
declare function isValidAddress(address: unknown): address is SS58String$1;
|
|
9217
|
+
/**
|
|
9218
|
+
* Check if a value is a valid D9 address (SS58 prefix 9)
|
|
9219
|
+
*
|
|
9220
|
+
* @param address - The value to check
|
|
9221
|
+
* @returns True if the value is a valid D9 address
|
|
9222
|
+
*
|
|
9223
|
+
* @example
|
|
9224
|
+
* ```typescript
|
|
9225
|
+
* isValidD9Address("XYZd9..."); // true (if valid D9 prefix)
|
|
9226
|
+
* isValidD9Address("5GrwvaEF..."); // false (Polkadot prefix)
|
|
9227
|
+
* ```
|
|
9228
|
+
*/
|
|
9229
|
+
declare function isValidD9Address(address: unknown): address is SS58String$1;
|
|
9230
|
+
/**
|
|
9231
|
+
* Check if a value is a valid address for a specific network
|
|
9232
|
+
*
|
|
9233
|
+
* @param address - The value to check
|
|
9234
|
+
* @param expectedPrefix - The expected SS58 prefix
|
|
9235
|
+
* @returns True if the value is a valid address with the expected prefix
|
|
9236
|
+
*
|
|
9237
|
+
* @example
|
|
9238
|
+
* ```typescript
|
|
9239
|
+
* isValidAddressForNetwork(address, 0); // Polkadot
|
|
9240
|
+
* isValidAddressForNetwork(address, 2); // Kusama
|
|
9241
|
+
* isValidAddressForNetwork(address, 9); // D9
|
|
9242
|
+
* ```
|
|
9243
|
+
*/
|
|
9244
|
+
declare function isValidAddressForNetwork(address: unknown, expectedPrefix: number): address is SS58String$1;
|
|
9245
|
+
/**
|
|
9246
|
+
* Get the SS58 prefix of an address
|
|
9247
|
+
*
|
|
9248
|
+
* @param address - The SS58 address
|
|
9249
|
+
* @returns The SS58 prefix
|
|
9250
|
+
* @throws Error if the address is invalid
|
|
9251
|
+
*
|
|
9252
|
+
* @example
|
|
9253
|
+
* ```typescript
|
|
9254
|
+
* getAddressPrefix("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"); // 42 (Substrate generic)
|
|
9255
|
+
* ```
|
|
9256
|
+
*/
|
|
9257
|
+
declare function getAddressPrefix(address: SS58String$1): number;
|
|
9258
|
+
/**
|
|
9259
|
+
* Compare two addresses for equality (same public key)
|
|
9260
|
+
*
|
|
9261
|
+
* Addresses with different SS58 prefixes can represent the same account.
|
|
9262
|
+
* This function compares the underlying public keys.
|
|
9263
|
+
*
|
|
9264
|
+
* @param a - First address
|
|
9265
|
+
* @param b - Second address
|
|
9266
|
+
* @returns True if both addresses represent the same public key
|
|
9267
|
+
*
|
|
9268
|
+
* @example
|
|
9269
|
+
* ```typescript
|
|
9270
|
+
* // Same account, different network formats
|
|
9271
|
+
* const polkadotAddr = "15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5";
|
|
9272
|
+
* const genericAddr = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
|
|
9273
|
+
* addressesEqual(polkadotAddr, genericAddr); // true
|
|
9274
|
+
* ```
|
|
9275
|
+
*/
|
|
9276
|
+
declare function addressesEqual(a: SS58String$1, b: SS58String$1): boolean;
|
|
9277
|
+
/**
|
|
9278
|
+
* Convert an address to a specific SS58 format
|
|
9279
|
+
*
|
|
9280
|
+
* @param address - The SS58 address
|
|
9281
|
+
* @param targetPrefix - The target SS58 prefix
|
|
9282
|
+
* @returns The address encoded with the target prefix
|
|
9283
|
+
* @throws Error if the address is invalid
|
|
9284
|
+
*
|
|
9285
|
+
* @example
|
|
9286
|
+
* ```typescript
|
|
9287
|
+
* const d9Address = toNetworkAddress("5GrwvaEF...", 9);
|
|
9288
|
+
* ```
|
|
9289
|
+
*/
|
|
9290
|
+
declare function toNetworkAddress(address: SS58String$1, targetPrefix: number): SS58String$1;
|
|
9291
|
+
/**
|
|
9292
|
+
* Convert an address to D9 format
|
|
9293
|
+
*
|
|
9294
|
+
* @param address - The SS58 address
|
|
9295
|
+
* @returns The address encoded with D9 prefix (9)
|
|
9296
|
+
*
|
|
9297
|
+
* @example
|
|
9298
|
+
* ```typescript
|
|
9299
|
+
* const d9Address = toD9Address("5GrwvaEF...");
|
|
9300
|
+
* ```
|
|
9301
|
+
*/
|
|
9302
|
+
declare function toD9Address(address: SS58String$1): SS58String$1;
|
|
9303
|
+
//#endregion
|
|
9304
|
+
//#region src/utils/balance.d.ts
|
|
9305
|
+
/**
|
|
9306
|
+
* Balance formatting utilities for D9 blockchain
|
|
9307
|
+
*/
|
|
9308
|
+
declare const D9_DECIMALS = 12;
|
|
9309
|
+
declare const D9_SYMBOL = "D9";
|
|
9310
|
+
declare const D9_SS58_PREFIX = 9;
|
|
9311
|
+
declare const USDT_DECIMALS = 2;
|
|
9312
|
+
declare const USDT_SYMBOL = "USDT";
|
|
9313
|
+
/**
|
|
9314
|
+
* Token configuration for formatting
|
|
9315
|
+
*/
|
|
9316
|
+
interface TokenConfig {
|
|
9317
|
+
decimals: number;
|
|
9318
|
+
symbol: string;
|
|
9319
|
+
}
|
|
9320
|
+
/**
|
|
9321
|
+
* Pre-configured D9 token
|
|
9322
|
+
*/
|
|
9323
|
+
declare const D9_TOKEN: TokenConfig;
|
|
9324
|
+
/**
|
|
9325
|
+
* Pre-configured USDT token
|
|
9326
|
+
*/
|
|
9327
|
+
declare const USDT_TOKEN: TokenConfig;
|
|
9328
|
+
/**
|
|
9329
|
+
* Options for formatting balance
|
|
9330
|
+
*/
|
|
9331
|
+
interface FormatBalanceOptions {
|
|
9332
|
+
/** Number of decimal places (default: token's decimals) */
|
|
9333
|
+
decimals?: number;
|
|
9334
|
+
/** Maximum decimal places to display (default: 4) */
|
|
9335
|
+
maxDecimals?: number;
|
|
9336
|
+
/** Whether to trim trailing zeros (default: true) */
|
|
9337
|
+
trimTrailingZeros?: boolean;
|
|
9338
|
+
/** Thousands separator (default: none) */
|
|
9339
|
+
thousandsSeparator?: string;
|
|
9340
|
+
}
|
|
9341
|
+
/**
|
|
9342
|
+
* Format a raw planck value to a human-readable balance string
|
|
9343
|
+
*
|
|
9344
|
+
* @param planck - The raw balance in planck units (smallest unit)
|
|
9345
|
+
* @param options - Formatting options
|
|
9346
|
+
* @returns Formatted balance string
|
|
9347
|
+
*
|
|
9348
|
+
* @example
|
|
9349
|
+
* ```typescript
|
|
9350
|
+
* formatBalance(1_500_000_000_000n, { decimals: 12 }); // "1.5"
|
|
9351
|
+
* formatBalance(1_500_000_000_000n, { decimals: 12, maxDecimals: 2 }); // "1.50"
|
|
9352
|
+
* formatBalance(1_000_000_000_000_000n, { decimals: 12, thousandsSeparator: "," }); // "1,000"
|
|
9353
|
+
* ```
|
|
9354
|
+
*/
|
|
9355
|
+
declare function formatBalance(planck: bigint, options?: FormatBalanceOptions): string;
|
|
9356
|
+
/**
|
|
9357
|
+
* Parse a human-readable amount string to planck units
|
|
9358
|
+
*
|
|
9359
|
+
* @param amount - The amount as a string or number
|
|
9360
|
+
* @param options - Parse options
|
|
9361
|
+
* @returns The amount in planck units (bigint)
|
|
9362
|
+
*
|
|
9363
|
+
* @example
|
|
9364
|
+
* ```typescript
|
|
9365
|
+
* parseAmount("1.5", { decimals: 12 }); // 1_500_000_000_000n
|
|
9366
|
+
* parseAmount(1.5, { decimals: 12 }); // 1_500_000_000_000n
|
|
9367
|
+
* parseAmount("1,000.50", { decimals: 12 }); // 1_000_500_000_000_000n
|
|
9368
|
+
* ```
|
|
9369
|
+
*/
|
|
9370
|
+
declare function parseAmount(amount: string | number, options?: {
|
|
9371
|
+
decimals?: number;
|
|
9372
|
+
}): bigint;
|
|
9373
|
+
/**
|
|
9374
|
+
* Format a token amount with symbol
|
|
9375
|
+
*
|
|
9376
|
+
* @param planck - The raw balance in planck units
|
|
9377
|
+
* @param token - Token configuration
|
|
9378
|
+
* @param options - Additional formatting options
|
|
9379
|
+
* @returns Formatted string with token symbol
|
|
9380
|
+
*
|
|
9381
|
+
* @example
|
|
9382
|
+
* ```typescript
|
|
9383
|
+
* formatTokenAmount(1_500_000_000_000n, D9_TOKEN); // "1.5 D9"
|
|
9384
|
+
* formatTokenAmount(1000n, USDT_TOKEN); // "10 USDT"
|
|
9385
|
+
* ```
|
|
9386
|
+
*/
|
|
9387
|
+
declare function formatTokenAmount(planck: bigint, token: TokenConfig, options?: Omit<FormatBalanceOptions, "decimals">): string;
|
|
9388
|
+
//#endregion
|
|
9389
|
+
//#region src/utils/time.d.ts
|
|
9390
|
+
/**
|
|
9391
|
+
* Block time utilities for D9 blockchain
|
|
9392
|
+
*/
|
|
9393
|
+
declare const D9_BLOCK_TIME_MS = 3000;
|
|
9394
|
+
declare const BLOCKS_PER_MINUTE = 20;
|
|
9395
|
+
declare const BLOCKS_PER_HOUR = 1200;
|
|
9396
|
+
declare const BLOCKS_PER_DAY = 28800;
|
|
9397
|
+
declare const BLOCKS_PER_WEEK = 201600;
|
|
9398
|
+
/**
|
|
9399
|
+
* Convert milliseconds to blocks
|
|
9400
|
+
*
|
|
9401
|
+
* @param ms - Duration in milliseconds
|
|
9402
|
+
* @returns Number of blocks (rounded down)
|
|
9403
|
+
*
|
|
9404
|
+
* @example
|
|
9405
|
+
* ```typescript
|
|
9406
|
+
* msToBlocks(60_000); // 20 blocks (1 minute)
|
|
9407
|
+
* msToBlocks(3_600_000); // 1200 blocks (1 hour)
|
|
9408
|
+
* ```
|
|
9409
|
+
*/
|
|
9410
|
+
declare function msToBlocks(ms: number): number;
|
|
9411
|
+
/**
|
|
9412
|
+
* Convert blocks to milliseconds
|
|
9413
|
+
*
|
|
9414
|
+
* @param blocks - Number of blocks
|
|
9415
|
+
* @returns Duration in milliseconds
|
|
9416
|
+
*
|
|
9417
|
+
* @example
|
|
9418
|
+
* ```typescript
|
|
9419
|
+
* blocksToMs(20); // 60_000 (1 minute)
|
|
9420
|
+
* blocksToMs(1200); // 3_600_000 (1 hour)
|
|
9421
|
+
* ```
|
|
9422
|
+
*/
|
|
9423
|
+
declare function blocksToMs(blocks: number): number;
|
|
9424
|
+
/**
|
|
9425
|
+
* Estimate the block number at a target time
|
|
9426
|
+
*
|
|
9427
|
+
* @param targetTime - The target time to estimate block for
|
|
9428
|
+
* @param currentBlock - The current block number
|
|
9429
|
+
* @param currentTime - The current time (default: now)
|
|
9430
|
+
* @returns Estimated block number at target time
|
|
9431
|
+
*
|
|
9432
|
+
* @example
|
|
9433
|
+
* ```typescript
|
|
9434
|
+
* const targetBlock = estimateBlockAtTime(
|
|
9435
|
+
* new Date(Date.now() + 3_600_000), // 1 hour from now
|
|
9436
|
+
* 1000, // current block
|
|
9437
|
+
* ); // ~2200
|
|
9438
|
+
* ```
|
|
9439
|
+
*/
|
|
9440
|
+
declare function estimateBlockAtTime(targetTime: Date, currentBlock: number, currentTime?: Date): number;
|
|
9441
|
+
/**
|
|
9442
|
+
* Estimate the time at a target block
|
|
9443
|
+
*
|
|
9444
|
+
* @param targetBlock - The target block number
|
|
9445
|
+
* @param currentBlock - The current block number
|
|
9446
|
+
* @param currentTime - The current time (default: now)
|
|
9447
|
+
* @returns Estimated time at target block
|
|
9448
|
+
*
|
|
9449
|
+
* @example
|
|
9450
|
+
* ```typescript
|
|
9451
|
+
* const unlockTime = estimateTimeAtBlock(
|
|
9452
|
+
* 2200, // target block
|
|
9453
|
+
* 1000, // current block
|
|
9454
|
+
* ); // ~1 hour from now
|
|
9455
|
+
* ```
|
|
9456
|
+
*/
|
|
9457
|
+
declare function estimateTimeAtBlock(targetBlock: number, currentBlock: number, currentTime?: Date): Date;
|
|
9458
|
+
/**
|
|
9459
|
+
* Calculate the number of blocks until a target time
|
|
9460
|
+
*
|
|
9461
|
+
* @param targetTime - The target time
|
|
9462
|
+
* @param currentBlock - The current block number
|
|
9463
|
+
* @param currentTime - The current time (default: now)
|
|
9464
|
+
* @returns Number of blocks until target time (negative if in the past)
|
|
9465
|
+
*
|
|
9466
|
+
* @example
|
|
9467
|
+
* ```typescript
|
|
9468
|
+
* const blocksRemaining = blocksUntil(unlockTime, currentBlock);
|
|
9469
|
+
* if (blocksRemaining > 0) {
|
|
9470
|
+
* console.log(`${blocksRemaining} blocks until unlock`);
|
|
9471
|
+
* }
|
|
9472
|
+
* ```
|
|
9473
|
+
*/
|
|
9474
|
+
declare function blocksUntil(targetTime: Date, currentBlock: number, currentTime?: Date): number;
|
|
9475
|
+
/**
|
|
9476
|
+
* Format options for duration display
|
|
9477
|
+
*/
|
|
9478
|
+
interface FormatDurationOptions {
|
|
9479
|
+
/** Whether to show short units (d, h, m, s) or long (days, hours, minutes, seconds) */
|
|
9480
|
+
short?: boolean;
|
|
9481
|
+
/** Maximum number of units to display (default: 2) */
|
|
9482
|
+
maxUnits?: number;
|
|
9483
|
+
}
|
|
9484
|
+
/**
|
|
9485
|
+
* Format a block duration as a human-readable string
|
|
9486
|
+
*
|
|
9487
|
+
* @param blocks - Number of blocks
|
|
9488
|
+
* @param options - Formatting options
|
|
9489
|
+
* @returns Human-readable duration string
|
|
9490
|
+
*
|
|
9491
|
+
* @example
|
|
9492
|
+
* ```typescript
|
|
9493
|
+
* formatBlockDuration(20); // "1 minute"
|
|
9494
|
+
* formatBlockDuration(1200); // "1 hour"
|
|
9495
|
+
* formatBlockDuration(BLOCKS_PER_DAY); // "1 day"
|
|
9496
|
+
* formatBlockDuration(30000, { short: true }); // "1d 1h"
|
|
9497
|
+
* ```
|
|
9498
|
+
*/
|
|
9499
|
+
declare function formatBlockDuration(blocks: number, options?: FormatDurationOptions): string;
|
|
9500
|
+
//#endregion
|
|
9501
|
+
export { ArithmeticError, BLOCKS_PER_DAY, BLOCKS_PER_HOUR, BLOCKS_PER_MINUTE, BLOCKS_PER_WEEK, BalanceStatus, BalancesTypesReasons, ContractEventParser, CreateD9SdkClientOptions, D9, D9Apis, D9CallData, D9Calls, D9Constants, D9DispatchError, D9Errors, D9Events, D9Extensions, D9Queries, D9SdkClientReturn, D9ViewFns, D9WhitelistEntry, D9_BLOCK_TIME_MS, D9_DECIMALS, D9_SS58_PREFIX, D9_SYMBOL, D9_TOKEN, type DecodedContractEvent, DigestItem, DispatchClass, type EventFilterOptions, type EventSubscriptionOptions, FormatBalanceOptions, FormatDurationOptions, GrandpaEquivocation, GrandpaEvent, GrandpaStoredState, type HexString, MultiAddress, Phase, type PolkadotSigner, type RawContractEvent, type SS58String, SessionEvent, Sr25519Keypair, TokenConfig, TransactionPaymentEvent, TransactionPaymentReleases, TransactionalError, USDT_DECIMALS, USDT_SYMBOL, USDT_TOKEN, WalletAccount, WhitelistEntriesByChain, WhitelistEntry, addressesEqual, blocksToMs, blocksUntil, bytesToHex, index_d_exports as contracts, createAccountFromMnemonic, createAccountFromPrivateKey, createContractEventStream, createD9SdkClient, createNativeTransferStream, createPSP22TransferStream, createSr25519SignerFromKeypair, _allDescriptors as d9, estimateBlockAtTime, estimateTimeAtBlock, formatBalance, formatBlockDuration, formatTokenAmount, generateMnemonic, getAddressPrefix, getMetadata, hexToBytes, isHexString, isValidAddress, isValidAddressForNetwork, isValidD9Address, mnemonicToMiniSecret, msToBlocks, parseAmount, sr25519AddressFromKeypair, sr25519AddressFromSecretKeyHex, sr25519DeriveFromMiniSecret, sr25519KeypairFromMiniSecret, ss58DecodePublicKey, ss58Reencode, toD9Address, toNetworkAddress, validateMnemonic };
|
|
8726
9502
|
//# sourceMappingURL=index.d.mts.map
|