@d9-network/spec 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/README.md +89 -0
  2. package/dist/{chunk-7P6ASYW6-Ds265KHm.cjs → chunk-7P6ASYW6-SIIdNtOm.cjs} +2 -2
  3. package/dist/{chunk-7P6ASYW6-Ds265KHm.cjs.map → chunk-7P6ASYW6-SIIdNtOm.cjs.map} +1 -1
  4. package/dist/{chunk-7P6ASYW6-Dj19mDfr.mjs → chunk-7P6ASYW6-kh065yQz.mjs} +2 -2
  5. package/dist/{chunk-7P6ASYW6-Dj19mDfr.mjs.map → chunk-7P6ASYW6-kh065yQz.mjs.map} +1 -1
  6. package/dist/{d9_metadata-EHIEZLL5-DINtR7s1.mjs → d9_metadata-EHIEZLL5-4QVv-sUA.mjs} +2 -2
  7. package/dist/{d9_metadata-EHIEZLL5-DINtR7s1.mjs.map → d9_metadata-EHIEZLL5-4QVv-sUA.mjs.map} +1 -1
  8. package/dist/{d9_metadata-EHIEZLL5-V9xdvdYJ.cjs → d9_metadata-EHIEZLL5-Dy3ZBTsV.cjs} +2 -2
  9. package/dist/{d9_metadata-EHIEZLL5-V9xdvdYJ.cjs.map → d9_metadata-EHIEZLL5-Dy3ZBTsV.cjs.map} +1 -1
  10. package/dist/{descriptors-JQ4ZJQ4V-DlW2JaTI.mjs → descriptors-JQ4ZJQ4V-GlRQE9ha.mjs} +2 -2
  11. package/dist/{descriptors-JQ4ZJQ4V-DlW2JaTI.mjs.map → descriptors-JQ4ZJQ4V-GlRQE9ha.mjs.map} +1 -1
  12. package/dist/{descriptors-JQ4ZJQ4V-UD5DIXxW.cjs → descriptors-JQ4ZJQ4V-X9ZqDTps.cjs} +2 -2
  13. package/dist/{descriptors-JQ4ZJQ4V-UD5DIXxW.cjs.map → descriptors-JQ4ZJQ4V-X9ZqDTps.cjs.map} +1 -1
  14. package/dist/index.cjs +106 -116
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +14 -18
  17. package/dist/index.d.mts +14 -18
  18. package/dist/index.mjs +106 -111
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{metadataTypes-32V7BYUB-CDFRtnc1.cjs → metadataTypes-32V7BYUB-CPWXqPoY.cjs} +2 -2
  21. package/dist/{metadataTypes-32V7BYUB-CDFRtnc1.cjs.map → metadataTypes-32V7BYUB-CPWXqPoY.cjs.map} +1 -1
  22. package/dist/{metadataTypes-32V7BYUB-C4W1aZST.mjs → metadataTypes-32V7BYUB-CSALtZ-5.mjs} +2 -2
  23. package/dist/{metadataTypes-32V7BYUB-C4W1aZST.mjs.map → metadataTypes-32V7BYUB-CSALtZ-5.mjs.map} +1 -1
  24. package/package.json +11 -11
package/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ import { KeyPair } from "@polkadot-labs/hdkd-helpers";
8
8
 
9
9
  //#region rolldown:runtime
10
10
  //#endregion
11
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/common-types.d.ts
11
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/common-types.d.ts
12
12
  type AnonymousEnum$9<T$1 extends {}> = T$1 & {
13
13
  __anonymous: true;
14
14
  };
@@ -3375,7 +3375,7 @@ type I1q6j2f64t5q87 = {
3375
3375
  };
3376
3376
  };
3377
3377
  //#endregion
3378
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/d9.d.ts
3378
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/d9.d.ts
3379
3379
  type AnonymousEnum$8<T$1 extends {}> = T$1 & {
3380
3380
  __anonymous: true;
3381
3381
  };
@@ -6712,7 +6712,7 @@ type D9WhitelistEntry = PalletKey | `query.${NestedKey<AllInteractions['storage'
6712
6712
  type PalletKey = `*.${({ [K in keyof AllInteractions]: K extends 'apis' ? never : keyof AllInteractions[K] })[keyof AllInteractions]}`;
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
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/nodeReward.d.ts
6715
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/nodeReward.d.ts
6716
6716
  type AnonymousEnum$7<T$1 extends {}> = T$1 & {
6717
6717
  __anonymous: true;
6718
6718
  };
@@ -6879,7 +6879,7 @@ type EventDescriptor$7 = Enum<{
6879
6879
  }>;
6880
6880
  declare const descriptor$7: InkDescriptors<StorageDescriptor$8, MessagesDescriptor$7, ConstructorsDescriptor$7, EventDescriptor$7>;
6881
6881
  //#endregion
6882
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/merchantMining.d.ts
6882
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/merchantMining.d.ts
6883
6883
  type AnonymousEnum$6<T$1 extends {}> = T$1 & {
6884
6884
  __anonymous: true;
6885
6885
  };
@@ -7137,7 +7137,7 @@ type EventDescriptor$6 = Enum<{
7137
7137
  }>;
7138
7138
  declare const descriptor$6: InkDescriptors<StorageDescriptor$7, MessagesDescriptor$6, ConstructorsDescriptor$6, EventDescriptor$6>;
7139
7139
  //#endregion
7140
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/usdt.d.ts
7140
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/usdt.d.ts
7141
7141
  type AnonymousEnum$5<T$1 extends {}> = T$1 & {
7142
7142
  __anonymous: true;
7143
7143
  };
@@ -7277,7 +7277,7 @@ type EventDescriptor$5 = Enum<{
7277
7277
  }>;
7278
7278
  declare const descriptor$5: InkDescriptors<StorageDescriptor$6, MessagesDescriptor$5, ConstructorsDescriptor$5, EventDescriptor$5>;
7279
7279
  //#endregion
7280
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/burnManager.d.ts
7280
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/burnManager.d.ts
7281
7281
  type AnonymousEnum$4<T$1 extends {}> = T$1 & {
7282
7282
  __anonymous: true;
7283
7283
  };
@@ -7455,7 +7455,7 @@ type EventDescriptor$4 = Enum<{
7455
7455
  }>;
7456
7456
  declare const descriptor$4: InkDescriptors<StorageDescriptor$5, MessagesDescriptor$4, ConstructorsDescriptor$4, EventDescriptor$4>;
7457
7457
  //#endregion
7458
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/crossChainTransfer.d.ts
7458
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/crossChainTransfer.d.ts
7459
7459
  type AnonymousEnum$3<T$1 extends {}> = T$1 & {
7460
7460
  __anonymous: true;
7461
7461
  };
@@ -7699,7 +7699,7 @@ type EventDescriptor$3 = Enum<{
7699
7699
  }>;
7700
7700
  declare const descriptor$3: InkDescriptors<StorageDescriptor$4, MessagesDescriptor$3, ConstructorsDescriptor$3, EventDescriptor$3>;
7701
7701
  //#endregion
7702
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/marketMaker.d.ts
7702
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/marketMaker.d.ts
7703
7703
  type AnonymousEnum$2<T$1 extends {}> = T$1 & {
7704
7704
  __anonymous: true;
7705
7705
  };
@@ -7903,7 +7903,7 @@ type EventDescriptor$2 = Enum<{
7903
7903
  }>;
7904
7904
  declare const descriptor$2: InkDescriptors<StorageDescriptor$3, MessagesDescriptor$2, ConstructorsDescriptor$2, EventDescriptor$2>;
7905
7905
  //#endregion
7906
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/burnMining.d.ts
7906
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/burnMining.d.ts
7907
7907
  type AnonymousEnum$1<T$1 extends {}> = T$1 & {
7908
7908
  __anonymous: true;
7909
7909
  };
@@ -8082,7 +8082,7 @@ type ConstructorsDescriptor$1 = {
8082
8082
  type EventDescriptor$1 = Enum<{}>;
8083
8083
  declare const descriptor$1: InkDescriptors<StorageDescriptor$2, MessagesDescriptor$1, ConstructorsDescriptor$1, EventDescriptor$1>;
8084
8084
  //#endregion
8085
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/miningPool.d.ts
8085
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/miningPool.d.ts
8086
8086
  type AnonymousEnum<T$1 extends {}> = T$1 & {
8087
8087
  __anonymous: true;
8088
8088
  };
@@ -8239,7 +8239,7 @@ declare namespace index_d_exports {
8239
8239
  export { descriptor$4 as burnManager, descriptor$1 as burnMining, descriptor$3 as crossChainTransfer, descriptor$2 as marketMaker, descriptor$6 as merchantMining, descriptor as miningPool, descriptor$7 as nodeReward, descriptor$5 as usdt };
8240
8240
  }
8241
8241
  //#endregion
8242
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/index.d.ts
8242
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/index.d.ts
8243
8243
  declare const getMetadata: (codeHash: string) => Promise<Uint8Array | null>;
8244
8244
  type WhitelistEntry = D9WhitelistEntry;
8245
8245
  type WhitelistEntriesByChain = Partial<{
@@ -8325,7 +8325,8 @@ type TypedContractEvent<E extends Event> = E extends Enum<infer T> ? { [K in key
8325
8325
  raw: RawContractEvent;
8326
8326
  };
8327
8327
  /**
8328
- * Decoded contract event (legacy, use TypedContractEvent for type safety)
8328
+ * Decoded contract event with generic data type.
8329
+ * For full type safety with discriminated unions, use TypedContractEvent instead.
8329
8330
  */
8330
8331
  interface DecodedContractEvent<T$1 = unknown> {
8331
8332
  /** Event label from metadata (e.g., "Transfer", "Approval") */
@@ -9306,11 +9307,6 @@ declare function toD9Address(address: SS58String$1): SS58String$1;
9306
9307
  /**
9307
9308
  * Balance formatting utilities for D9 blockchain
9308
9309
  */
9309
- declare const D9_DECIMALS = 2;
9310
- declare const D9_SYMBOL = "D9";
9311
- declare const D9_SS58_PREFIX = 9;
9312
- declare const USDT_DECIMALS = 2;
9313
- declare const USDT_SYMBOL = "USDT";
9314
9310
  /**
9315
9311
  * Token configuration for formatting
9316
9312
  */
@@ -9499,5 +9495,5 @@ interface FormatDurationOptions {
9499
9495
  */
9500
9496
  declare function formatBlockDuration(blocks: number, options?: FormatDurationOptions): string;
9501
9497
  //#endregion
9502
- 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 };
9498
+ 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_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_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 };
9503
9499
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ import { Observable } from "rxjs";
8
8
 
9
9
  //#region rolldown:runtime
10
10
  //#endregion
11
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/common-types.d.ts
11
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/common-types.d.ts
12
12
  type AnonymousEnum$9<T$1 extends {}> = T$1 & {
13
13
  __anonymous: true;
14
14
  };
@@ -3375,7 +3375,7 @@ type I1q6j2f64t5q87 = {
3375
3375
  };
3376
3376
  };
3377
3377
  //#endregion
3378
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/d9.d.ts
3378
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/d9.d.ts
3379
3379
  type AnonymousEnum$8<T$1 extends {}> = T$1 & {
3380
3380
  __anonymous: true;
3381
3381
  };
@@ -6712,7 +6712,7 @@ type D9WhitelistEntry = PalletKey | `query.${NestedKey<AllInteractions['storage'
6712
6712
  type PalletKey = `*.${({ [K in keyof AllInteractions]: K extends 'apis' ? never : keyof AllInteractions[K] })[keyof AllInteractions]}`;
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
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/nodeReward.d.ts
6715
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/nodeReward.d.ts
6716
6716
  type AnonymousEnum$7<T$1 extends {}> = T$1 & {
6717
6717
  __anonymous: true;
6718
6718
  };
@@ -6879,7 +6879,7 @@ type EventDescriptor$7 = Enum<{
6879
6879
  }>;
6880
6880
  declare const descriptor$7: InkDescriptors<StorageDescriptor$8, MessagesDescriptor$7, ConstructorsDescriptor$7, EventDescriptor$7>;
6881
6881
  //#endregion
6882
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/merchantMining.d.ts
6882
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/merchantMining.d.ts
6883
6883
  type AnonymousEnum$6<T$1 extends {}> = T$1 & {
6884
6884
  __anonymous: true;
6885
6885
  };
@@ -7137,7 +7137,7 @@ type EventDescriptor$6 = Enum<{
7137
7137
  }>;
7138
7138
  declare const descriptor$6: InkDescriptors<StorageDescriptor$7, MessagesDescriptor$6, ConstructorsDescriptor$6, EventDescriptor$6>;
7139
7139
  //#endregion
7140
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/usdt.d.ts
7140
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/usdt.d.ts
7141
7141
  type AnonymousEnum$5<T$1 extends {}> = T$1 & {
7142
7142
  __anonymous: true;
7143
7143
  };
@@ -7277,7 +7277,7 @@ type EventDescriptor$5 = Enum<{
7277
7277
  }>;
7278
7278
  declare const descriptor$5: InkDescriptors<StorageDescriptor$6, MessagesDescriptor$5, ConstructorsDescriptor$5, EventDescriptor$5>;
7279
7279
  //#endregion
7280
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/burnManager.d.ts
7280
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/burnManager.d.ts
7281
7281
  type AnonymousEnum$4<T$1 extends {}> = T$1 & {
7282
7282
  __anonymous: true;
7283
7283
  };
@@ -7455,7 +7455,7 @@ type EventDescriptor$4 = Enum<{
7455
7455
  }>;
7456
7456
  declare const descriptor$4: InkDescriptors<StorageDescriptor$5, MessagesDescriptor$4, ConstructorsDescriptor$4, EventDescriptor$4>;
7457
7457
  //#endregion
7458
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/crossChainTransfer.d.ts
7458
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/crossChainTransfer.d.ts
7459
7459
  type AnonymousEnum$3<T$1 extends {}> = T$1 & {
7460
7460
  __anonymous: true;
7461
7461
  };
@@ -7699,7 +7699,7 @@ type EventDescriptor$3 = Enum<{
7699
7699
  }>;
7700
7700
  declare const descriptor$3: InkDescriptors<StorageDescriptor$4, MessagesDescriptor$3, ConstructorsDescriptor$3, EventDescriptor$3>;
7701
7701
  //#endregion
7702
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/marketMaker.d.ts
7702
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/marketMaker.d.ts
7703
7703
  type AnonymousEnum$2<T$1 extends {}> = T$1 & {
7704
7704
  __anonymous: true;
7705
7705
  };
@@ -7903,7 +7903,7 @@ type EventDescriptor$2 = Enum<{
7903
7903
  }>;
7904
7904
  declare const descriptor$2: InkDescriptors<StorageDescriptor$3, MessagesDescriptor$2, ConstructorsDescriptor$2, EventDescriptor$2>;
7905
7905
  //#endregion
7906
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/burnMining.d.ts
7906
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/burnMining.d.ts
7907
7907
  type AnonymousEnum$1<T$1 extends {}> = T$1 & {
7908
7908
  __anonymous: true;
7909
7909
  };
@@ -8082,7 +8082,7 @@ type ConstructorsDescriptor$1 = {
8082
8082
  type EventDescriptor$1 = Enum<{}>;
8083
8083
  declare const descriptor$1: InkDescriptors<StorageDescriptor$2, MessagesDescriptor$1, ConstructorsDescriptor$1, EventDescriptor$1>;
8084
8084
  //#endregion
8085
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/contracts/miningPool.d.ts
8085
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/contracts/miningPool.d.ts
8086
8086
  type AnonymousEnum<T$1 extends {}> = T$1 & {
8087
8087
  __anonymous: true;
8088
8088
  };
@@ -8239,7 +8239,7 @@ declare namespace index_d_exports {
8239
8239
  export { descriptor$4 as burnManager, descriptor$1 as burnMining, descriptor$3 as crossChainTransfer, descriptor$2 as marketMaker, descriptor$6 as merchantMining, descriptor as miningPool, descriptor$7 as nodeReward, descriptor$5 as usdt };
8240
8240
  }
8241
8241
  //#endregion
8242
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/index.d.ts
8242
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/index.d.ts
8243
8243
  declare const getMetadata: (codeHash: string) => Promise<Uint8Array | null>;
8244
8244
  type WhitelistEntry = D9WhitelistEntry;
8245
8245
  type WhitelistEntriesByChain = Partial<{
@@ -8325,7 +8325,8 @@ type TypedContractEvent<E extends Event> = E extends Enum<infer T> ? { [K in key
8325
8325
  raw: RawContractEvent;
8326
8326
  };
8327
8327
  /**
8328
- * Decoded contract event (legacy, use TypedContractEvent for type safety)
8328
+ * Decoded contract event with generic data type.
8329
+ * For full type safety with discriminated unions, use TypedContractEvent instead.
8329
8330
  */
8330
8331
  interface DecodedContractEvent<T$1 = unknown> {
8331
8332
  /** Event label from metadata (e.g., "Transfer", "Approval") */
@@ -9306,11 +9307,6 @@ declare function toD9Address(address: SS58String$1): SS58String$1;
9306
9307
  /**
9307
9308
  * Balance formatting utilities for D9 blockchain
9308
9309
  */
9309
- declare const D9_DECIMALS = 2;
9310
- declare const D9_SYMBOL = "D9";
9311
- declare const D9_SS58_PREFIX = 9;
9312
- declare const USDT_DECIMALS = 2;
9313
- declare const USDT_SYMBOL = "USDT";
9314
9310
  /**
9315
9311
  * Token configuration for formatting
9316
9312
  */
@@ -9499,5 +9495,5 @@ interface FormatDurationOptions {
9499
9495
  */
9500
9496
  declare function formatBlockDuration(blocks: number, options?: FormatDurationOptions): string;
9501
9497
  //#endregion
9502
- 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 };
9498
+ 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_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_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 };
9503
9499
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { t as __export } from "./chunk-7P6ASYW6-Dj19mDfr.mjs";
1
+ import { t as __export } from "./chunk-7P6ASYW6-kh065yQz.mjs";
2
2
  import { _Enum, createClient } from "polkadot-api";
3
3
  import { getWsProvider } from "polkadot-api/ws-provider";
4
4
  import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat";
5
5
  import { withLegacy } from "@polkadot-api/legacy-provider";
6
- import { ContractEventParser, D9_DECIMALS as D9_DECIMALS$1, D9_SS58_PREFIX as D9_SS58_PREFIX$1, D9_SYMBOL as D9_SYMBOL$1, USDT_DECIMALS as USDT_DECIMALS$1, USDT_SYMBOL as USDT_SYMBOL$1, createContractEventStream, createD9InkSdk, createNativeTransferStream, createPSP22TransferStream } from "@d9-network/ink";
6
+ import { ContractEventParser, D9_DECIMALS, D9_SS58_PREFIX, D9_SYMBOL, USDT_DECIMALS, USDT_SYMBOL, createContractEventStream, createD9InkSdk, createNativeTransferStream, createPSP22TransferStream } from "@d9-network/ink";
7
7
  import { generateMnemonic as generateMnemonic$1, mnemonicToMiniSecret as mnemonicToMiniSecret$1, ss58Decode, ss58Encode, validateMnemonic as validateMnemonic$1 } from "@polkadot-labs/hdkd-helpers";
8
8
  import { sr25519CreateDerive, withNetworkAccount } from "@polkadot-labs/hdkd";
9
9
  import { getPolkadotSigner } from "@polkadot-api/signer";
10
10
 
11
- //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+14313b0e56f5ab4e/node_modules/@polkadot-api/descriptors/dist/index.mjs
11
+ //#region ../../node_modules/.bun/@polkadot-api+descriptors@file+packages+spec+.papi+descriptors+ec2463ed5a666297/node_modules/@polkadot-api/descriptors/dist/index.mjs
12
12
  var table = new Uint8Array(128);
13
13
  for (let i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
14
14
  var toBinary = (base64) => {
@@ -22,11 +22,11 @@ var toBinary = (base64) => {
22
22
  }
23
23
  return bytes;
24
24
  };
25
- var descriptorValues = import("./descriptors-JQ4ZJQ4V-DlW2JaTI.mjs").then((module) => module["D9"]);
26
- var metadataTypes = import("./metadataTypes-32V7BYUB-C4W1aZST.mjs").then((module) => toBinary("default" in module ? module.default : module));
25
+ var descriptorValues = import("./descriptors-JQ4ZJQ4V-GlRQE9ha.mjs").then((module) => module["D9"]);
26
+ var metadataTypes = import("./metadataTypes-32V7BYUB-CSALtZ-5.mjs").then((module) => toBinary("default" in module ? module.default : module));
27
27
  var asset = {};
28
28
  var extensions = {};
29
- var getMetadata = () => import("./d9_metadata-EHIEZLL5-DINtR7s1.mjs").then((module) => toBinary("default" in module ? module.default : module));
29
+ var getMetadata = () => import("./d9_metadata-EHIEZLL5-4QVv-sUA.mjs").then((module) => toBinary("default" in module ? module.default : module));
30
30
  var d9_default = {
31
31
  descriptors: descriptorValues,
32
32
  metadataTypes,
@@ -7584,110 +7584,6 @@ function createAccountFromPrivateKey(options) {
7584
7584
  };
7585
7585
  }
7586
7586
 
7587
- //#endregion
7588
- //#region src/utils/balance.ts
7589
- /**
7590
- * Balance formatting utilities for D9 blockchain
7591
- */
7592
- const D9_DECIMALS = D9_DECIMALS$1;
7593
- const D9_SYMBOL = D9_SYMBOL$1;
7594
- const D9_SS58_PREFIX = D9_SS58_PREFIX$1;
7595
- const USDT_DECIMALS = USDT_DECIMALS$1;
7596
- const USDT_SYMBOL = USDT_SYMBOL$1;
7597
- /**
7598
- * Pre-configured D9 token
7599
- */
7600
- const D9_TOKEN = {
7601
- decimals: D9_DECIMALS,
7602
- symbol: D9_SYMBOL
7603
- };
7604
- /**
7605
- * Pre-configured USDT token
7606
- */
7607
- const USDT_TOKEN = {
7608
- decimals: USDT_DECIMALS,
7609
- symbol: USDT_SYMBOL
7610
- };
7611
- /**
7612
- * Format a raw planck value to a human-readable balance string
7613
- *
7614
- * @param planck - The raw balance in planck units (smallest unit)
7615
- * @param options - Formatting options
7616
- * @returns Formatted balance string
7617
- *
7618
- * @example
7619
- * ```typescript
7620
- * formatBalance(1_500_000_000_000n, { decimals: 12 }); // "1.5"
7621
- * formatBalance(1_500_000_000_000n, { decimals: 12, maxDecimals: 2 }); // "1.50"
7622
- * formatBalance(1_000_000_000_000_000n, { decimals: 12, thousandsSeparator: "," }); // "1,000"
7623
- * ```
7624
- */
7625
- function formatBalance(planck, options = {}) {
7626
- const { decimals = D9_DECIMALS, maxDecimals = 4, trimTrailingZeros = true, thousandsSeparator } = options;
7627
- if (decimals < 0 || decimals > 30) throw new Error("Decimals must be between 0 and 30");
7628
- const divisor = 10n ** BigInt(decimals);
7629
- const isNegative = planck < 0n;
7630
- const absolutePlanck = isNegative ? -planck : planck;
7631
- const wholePart = absolutePlanck / divisor;
7632
- const fractionalPart = absolutePlanck % divisor;
7633
- let wholeStr = wholePart.toString();
7634
- if (thousandsSeparator && wholeStr.length > 3) wholeStr = wholeStr.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
7635
- if (decimals === 0 || maxDecimals === 0) return isNegative ? `-${wholeStr}` : wholeStr;
7636
- let fractionalStr = fractionalPart.toString().padStart(decimals, "0");
7637
- if (fractionalStr.length > maxDecimals) fractionalStr = fractionalStr.slice(0, maxDecimals);
7638
- if (trimTrailingZeros) fractionalStr = fractionalStr.replace(/0+$/, "");
7639
- const prefix = isNegative ? "-" : "";
7640
- if (fractionalStr === "") return `${prefix}${wholeStr}`;
7641
- return `${prefix}${wholeStr}.${fractionalStr}`;
7642
- }
7643
- /**
7644
- * Parse a human-readable amount string to planck units
7645
- *
7646
- * @param amount - The amount as a string or number
7647
- * @param options - Parse options
7648
- * @returns The amount in planck units (bigint)
7649
- *
7650
- * @example
7651
- * ```typescript
7652
- * parseAmount("1.5", { decimals: 12 }); // 1_500_000_000_000n
7653
- * parseAmount(1.5, { decimals: 12 }); // 1_500_000_000_000n
7654
- * parseAmount("1,000.50", { decimals: 12 }); // 1_000_500_000_000_000n
7655
- * ```
7656
- */
7657
- function parseAmount(amount, options = {}) {
7658
- const { decimals = D9_DECIMALS } = options;
7659
- if (decimals < 0 || decimals > 30) throw new Error("Decimals must be between 0 and 30");
7660
- let amountStr = String(amount).replace(/,/g, "").trim();
7661
- const isNegative = amountStr.startsWith("-");
7662
- if (isNegative) amountStr = amountStr.slice(1);
7663
- if (!/^\d*\.?\d*$/.test(amountStr) || amountStr === "" || amountStr === ".") throw new Error(`Invalid amount format: ${amount}`);
7664
- const [wholePart = "0", fractionalPart = ""] = amountStr.split(".");
7665
- if (fractionalPart.length > decimals) throw new Error(`Amount has more decimal places (${fractionalPart.length}) than supported (${decimals})`);
7666
- const planckStr = wholePart + fractionalPart.padEnd(decimals, "0");
7667
- const planck = BigInt(planckStr);
7668
- return isNegative ? -planck : planck;
7669
- }
7670
- /**
7671
- * Format a token amount with symbol
7672
- *
7673
- * @param planck - The raw balance in planck units
7674
- * @param token - Token configuration
7675
- * @param options - Additional formatting options
7676
- * @returns Formatted string with token symbol
7677
- *
7678
- * @example
7679
- * ```typescript
7680
- * formatTokenAmount(1_500_000_000_000n, D9_TOKEN); // "1.5 D9"
7681
- * formatTokenAmount(1000n, USDT_TOKEN); // "10 USDT"
7682
- * ```
7683
- */
7684
- function formatTokenAmount(planck, token, options = {}) {
7685
- return `${formatBalance(planck, {
7686
- ...options,
7687
- decimals: token.decimals
7688
- })} ${token.symbol}`;
7689
- }
7690
-
7691
7587
  //#endregion
7692
7588
  //#region src/wallet/validation.ts
7693
7589
  /**
@@ -7830,6 +7726,105 @@ function toD9Address(address) {
7830
7726
  return toNetworkAddress(address, D9_SS58_PREFIX);
7831
7727
  }
7832
7728
 
7729
+ //#endregion
7730
+ //#region src/utils/balance.ts
7731
+ /**
7732
+ * Balance formatting utilities for D9 blockchain
7733
+ */
7734
+ /**
7735
+ * Pre-configured D9 token
7736
+ */
7737
+ const D9_TOKEN = {
7738
+ decimals: D9_DECIMALS,
7739
+ symbol: D9_SYMBOL
7740
+ };
7741
+ /**
7742
+ * Pre-configured USDT token
7743
+ */
7744
+ const USDT_TOKEN = {
7745
+ decimals: USDT_DECIMALS,
7746
+ symbol: USDT_SYMBOL
7747
+ };
7748
+ /**
7749
+ * Format a raw planck value to a human-readable balance string
7750
+ *
7751
+ * @param planck - The raw balance in planck units (smallest unit)
7752
+ * @param options - Formatting options
7753
+ * @returns Formatted balance string
7754
+ *
7755
+ * @example
7756
+ * ```typescript
7757
+ * formatBalance(1_500_000_000_000n, { decimals: 12 }); // "1.5"
7758
+ * formatBalance(1_500_000_000_000n, { decimals: 12, maxDecimals: 2 }); // "1.50"
7759
+ * formatBalance(1_000_000_000_000_000n, { decimals: 12, thousandsSeparator: "," }); // "1,000"
7760
+ * ```
7761
+ */
7762
+ function formatBalance(planck, options = {}) {
7763
+ const { decimals = D9_DECIMALS, maxDecimals = 4, trimTrailingZeros = true, thousandsSeparator } = options;
7764
+ if (decimals < 0 || decimals > 30) throw new Error("Decimals must be between 0 and 30");
7765
+ const divisor = 10n ** BigInt(decimals);
7766
+ const isNegative = planck < 0n;
7767
+ const absolutePlanck = isNegative ? -planck : planck;
7768
+ const wholePart = absolutePlanck / divisor;
7769
+ const fractionalPart = absolutePlanck % divisor;
7770
+ let wholeStr = wholePart.toString();
7771
+ if (thousandsSeparator && wholeStr.length > 3) wholeStr = wholeStr.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
7772
+ if (decimals === 0 || maxDecimals === 0) return isNegative ? `-${wholeStr}` : wholeStr;
7773
+ let fractionalStr = fractionalPart.toString().padStart(decimals, "0");
7774
+ if (fractionalStr.length > maxDecimals) fractionalStr = fractionalStr.slice(0, maxDecimals);
7775
+ if (trimTrailingZeros) fractionalStr = fractionalStr.replace(/0+$/, "");
7776
+ const prefix = isNegative ? "-" : "";
7777
+ if (fractionalStr === "") return `${prefix}${wholeStr}`;
7778
+ return `${prefix}${wholeStr}.${fractionalStr}`;
7779
+ }
7780
+ /**
7781
+ * Parse a human-readable amount string to planck units
7782
+ *
7783
+ * @param amount - The amount as a string or number
7784
+ * @param options - Parse options
7785
+ * @returns The amount in planck units (bigint)
7786
+ *
7787
+ * @example
7788
+ * ```typescript
7789
+ * parseAmount("1.5", { decimals: 12 }); // 1_500_000_000_000n
7790
+ * parseAmount(1.5, { decimals: 12 }); // 1_500_000_000_000n
7791
+ * parseAmount("1,000.50", { decimals: 12 }); // 1_000_500_000_000_000n
7792
+ * ```
7793
+ */
7794
+ function parseAmount(amount, options = {}) {
7795
+ const { decimals = D9_DECIMALS } = options;
7796
+ if (decimals < 0 || decimals > 30) throw new Error("Decimals must be between 0 and 30");
7797
+ let amountStr = String(amount).replace(/,/g, "").trim();
7798
+ const isNegative = amountStr.startsWith("-");
7799
+ if (isNegative) amountStr = amountStr.slice(1);
7800
+ if (!/^\d*\.?\d*$/.test(amountStr) || amountStr === "" || amountStr === ".") throw new Error(`Invalid amount format: ${amount}`);
7801
+ const [wholePart = "0", fractionalPart = ""] = amountStr.split(".");
7802
+ if (fractionalPart.length > decimals) throw new Error(`Amount has more decimal places (${fractionalPart.length}) than supported (${decimals})`);
7803
+ const planckStr = wholePart + fractionalPart.padEnd(decimals, "0");
7804
+ const planck = BigInt(planckStr);
7805
+ return isNegative ? -planck : planck;
7806
+ }
7807
+ /**
7808
+ * Format a token amount with symbol
7809
+ *
7810
+ * @param planck - The raw balance in planck units
7811
+ * @param token - Token configuration
7812
+ * @param options - Additional formatting options
7813
+ * @returns Formatted string with token symbol
7814
+ *
7815
+ * @example
7816
+ * ```typescript
7817
+ * formatTokenAmount(1_500_000_000_000n, D9_TOKEN); // "1.5 D9"
7818
+ * formatTokenAmount(1000n, USDT_TOKEN); // "10 USDT"
7819
+ * ```
7820
+ */
7821
+ function formatTokenAmount(planck, token, options = {}) {
7822
+ return `${formatBalance(planck, {
7823
+ ...options,
7824
+ decimals: token.decimals
7825
+ })} ${token.symbol}`;
7826
+ }
7827
+
7833
7828
  //#endregion
7834
7829
  //#region src/utils/time.ts
7835
7830
  /**
@@ -7965,5 +7960,5 @@ function formatBlockDuration(blocks, options = {}) {
7965
7960
  }
7966
7961
 
7967
7962
  //#endregion
7968
- export { ArithmeticError, BLOCKS_PER_DAY, BLOCKS_PER_HOUR, BLOCKS_PER_MINUTE, BLOCKS_PER_WEEK, BalanceStatus, BalancesTypesReasons, ContractEventParser, D9_BLOCK_TIME_MS, D9_DECIMALS, D9_SS58_PREFIX, D9_SYMBOL, D9_TOKEN, DigestItem, DispatchClass, GrandpaEquivocation, GrandpaEvent, GrandpaStoredState, MultiAddress, Phase, SessionEvent, TransactionPaymentEvent, TransactionPaymentReleases, TransactionalError, USDT_DECIMALS, USDT_SYMBOL, USDT_TOKEN, addressesEqual, blocksToMs, blocksUntil, bytesToHex, contracts_exports as contracts, createAccountFromMnemonic, createAccountFromPrivateKey, createContractEventStream, createD9SdkClient, createNativeTransferStream, createPSP22TransferStream, createSr25519SignerFromKeypair, d9_default as d9, estimateBlockAtTime, estimateTimeAtBlock, formatBalance, formatBlockDuration, formatTokenAmount, generateMnemonic, getAddressPrefix, getMetadata2 as getMetadata, hexToBytes, isHexString, isValidAddress, isValidAddressForNetwork, isValidD9Address, mnemonicToMiniSecret, msToBlocks, parseAmount, sr25519AddressFromKeypair, sr25519AddressFromSecretKeyHex, sr25519DeriveFromMiniSecret, sr25519KeypairFromMiniSecret, ss58DecodePublicKey, ss58Reencode, toD9Address, toNetworkAddress, validateMnemonic };
7963
+ export { ArithmeticError, BLOCKS_PER_DAY, BLOCKS_PER_HOUR, BLOCKS_PER_MINUTE, BLOCKS_PER_WEEK, BalanceStatus, BalancesTypesReasons, ContractEventParser, D9_BLOCK_TIME_MS, D9_TOKEN, DigestItem, DispatchClass, GrandpaEquivocation, GrandpaEvent, GrandpaStoredState, MultiAddress, Phase, SessionEvent, TransactionPaymentEvent, TransactionPaymentReleases, TransactionalError, USDT_TOKEN, addressesEqual, blocksToMs, blocksUntil, bytesToHex, contracts_exports as contracts, createAccountFromMnemonic, createAccountFromPrivateKey, createContractEventStream, createD9SdkClient, createNativeTransferStream, createPSP22TransferStream, createSr25519SignerFromKeypair, d9_default as d9, estimateBlockAtTime, estimateTimeAtBlock, formatBalance, formatBlockDuration, formatTokenAmount, generateMnemonic, getAddressPrefix, getMetadata2 as getMetadata, hexToBytes, isHexString, isValidAddress, isValidAddressForNetwork, isValidD9Address, mnemonicToMiniSecret, msToBlocks, parseAmount, sr25519AddressFromKeypair, sr25519AddressFromSecretKeyHex, sr25519DeriveFromMiniSecret, sr25519KeypairFromMiniSecret, ss58DecodePublicKey, ss58Reencode, toD9Address, toNetworkAddress, validateMnemonic };
7969
7964
  //# sourceMappingURL=index.mjs.map