@xyo-network/xl1-protocol 1.4.3 → 1.4.5

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 (103) hide show
  1. package/dist/neutral/index.mjs +45 -115
  2. package/dist/neutral/index.mjs.map +1 -1
  3. package/dist/node/index.mjs +45 -115
  4. package/dist/node/index.mjs.map +1 -1
  5. package/dist/types/block/AllowedBlockPayload.d.ts +2 -2
  6. package/dist/types/block/AllowedBlockPayload.d.ts.map +1 -1
  7. package/dist/types/chain/ChainAnalyzer.d.ts +1 -1
  8. package/dist/types/chain/ChainAnalyzer.d.ts.map +1 -1
  9. package/dist/types/constants/TransactionGasCosts.d.ts +6 -25
  10. package/dist/types/constants/TransactionGasCosts.d.ts.map +1 -1
  11. package/dist/types/index.d.ts +12 -12
  12. package/dist/types/index.d.ts.map +1 -1
  13. package/dist/types/iterator/ChainIterator.d.ts +3 -3
  14. package/dist/types/iterator/ChainIterator.d.ts.map +1 -1
  15. package/dist/types/iterator/ChainIteratorEventData.d.ts +1 -1
  16. package/dist/types/iterator/ChainIteratorEventData.d.ts.map +1 -1
  17. package/dist/types/payload/elevatable/ChainStakeIntent.d.ts +1 -1
  18. package/dist/types/payload/elevatable/ChainStakeIntent.d.ts.map +1 -1
  19. package/dist/types/provider/v1/XyoNetwork.d.ts +1 -1
  20. package/dist/types/provider/v1/XyoNetwork.d.ts.map +1 -1
  21. package/dist/types/provider/v1/XyoProvider.d.ts +2 -2
  22. package/dist/types/provider/v1/XyoProvider.d.ts.map +1 -1
  23. package/dist/types/provider/v1/XyoRunner.d.ts +1 -1
  24. package/dist/types/provider/v1/XyoRunner.d.ts.map +1 -1
  25. package/dist/types/provider/v1/XyoSigner.d.ts +2 -2
  26. package/dist/types/provider/v1/XyoSigner.d.ts.map +1 -1
  27. package/dist/types/provider/v1/XyoViewer.d.ts +3 -3
  28. package/dist/types/provider/v1/XyoViewer.d.ts.map +1 -1
  29. package/dist/types/provider/v2/viewer/Account.d.ts +1 -1
  30. package/dist/types/provider/v2/viewer/Account.d.ts.map +1 -1
  31. package/dist/types/provider/v2/viewer/Block.d.ts +1 -1
  32. package/dist/types/provider/v2/viewer/Block.d.ts.map +1 -1
  33. package/dist/types/provider/v2/viewer/Chain.d.ts +1 -1
  34. package/dist/types/provider/v2/viewer/Chain.d.ts.map +1 -1
  35. package/dist/types/provider/v2/viewer/Transaction.d.ts +1 -1
  36. package/dist/types/provider/v2/viewer/Transaction.d.ts.map +1 -1
  37. package/dist/types/repository/TransactionReadRepository.d.ts +1 -1
  38. package/dist/types/repository/TransactionReadRepository.d.ts.map +1 -1
  39. package/dist/types/repository/TransactionRepositoryIterator.d.ts +1 -1
  40. package/dist/types/repository/TransactionRepositoryIterator.d.ts.map +1 -1
  41. package/dist/types/repository/TransactionWriteRepository.d.ts +1 -1
  42. package/dist/types/repository/TransactionWriteRepository.d.ts.map +1 -1
  43. package/dist/types/services/BlockProducer.d.ts +3 -3
  44. package/dist/types/services/BlockProducer.d.ts.map +1 -1
  45. package/dist/types/services/Election.d.ts +1 -1
  46. package/dist/types/services/Election.d.ts.map +1 -1
  47. package/dist/types/services/PendingTransactionsService.d.ts +1 -1
  48. package/dist/types/services/PendingTransactionsService.d.ts.map +1 -1
  49. package/dist/types/services/stakeIntent/StakeIntentService.d.ts +1 -1
  50. package/dist/types/services/stakeIntent/StakeIntentService.d.ts.map +1 -1
  51. package/dist/types/transaction/TransactionBoundWitness.d.ts +2 -2
  52. package/dist/types/transaction/TransactionBoundWitness.d.ts.map +1 -1
  53. package/dist/types/transaction/TransactionFeesFields.d.ts +1 -1
  54. package/dist/types/transaction/TransactionFeesFields.d.ts.map +1 -1
  55. package/dist/types/validation/block/BlockValidationFunction.d.ts +1 -1
  56. package/dist/types/validation/block/BlockValidationFunction.d.ts.map +1 -1
  57. package/dist/types/validation/block/HydratedBlockStateValidationFunction.d.ts +5 -3
  58. package/dist/types/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
  59. package/dist/types/validation/block/HydratedBlockValidationFunction.d.ts +1 -1
  60. package/dist/types/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
  61. package/dist/types/validation/payload/InBlockPayloadValidationFunction.d.ts +1 -1
  62. package/dist/types/validation/payload/InBlockPayloadValidationFunction.d.ts.map +1 -1
  63. package/dist/types/validation/transaction/HydratedTransactionStateValidationFunction.d.ts +1 -1
  64. package/dist/types/validation/transaction/HydratedTransactionStateValidationFunction.d.ts.map +1 -1
  65. package/dist/types/validation/transaction/HydratedTransactionValidationFunction.d.ts +1 -1
  66. package/dist/types/validation/transaction/HydratedTransactionValidationFunction.d.ts.map +1 -1
  67. package/dist/types/xl1/XL1.d.ts +8 -25
  68. package/dist/types/xl1/XL1.d.ts.map +1 -1
  69. package/package.json +3 -10
  70. package/src/block/AllowedBlockPayload.ts +3 -3
  71. package/src/chain/ChainAnalyzer.ts +1 -1
  72. package/src/index.ts +12 -12
  73. package/src/iterator/ChainIterator.ts +3 -4
  74. package/src/iterator/ChainIteratorEventData.ts +1 -1
  75. package/src/payload/elevatable/ChainStakeIntent.ts +1 -2
  76. package/src/provider/v1/XyoNetwork.ts +1 -1
  77. package/src/provider/v1/XyoProvider.ts +2 -3
  78. package/src/provider/v1/XyoRunner.ts +1 -1
  79. package/src/provider/v1/XyoSigner.ts +2 -2
  80. package/src/provider/v1/XyoViewer.ts +3 -3
  81. package/src/provider/v2/viewer/Account.ts +1 -1
  82. package/src/provider/v2/viewer/Block.ts +1 -2
  83. package/src/provider/v2/viewer/Chain.ts +1 -2
  84. package/src/provider/v2/viewer/Transaction.ts +1 -2
  85. package/src/repository/TransactionReadRepository.ts +1 -2
  86. package/src/repository/TransactionRepositoryIterator.ts +1 -2
  87. package/src/repository/TransactionWriteRepository.ts +1 -2
  88. package/src/services/BlockProducer.ts +3 -3
  89. package/src/services/Election.ts +1 -2
  90. package/src/services/PendingTransactionsService.ts +1 -2
  91. package/src/services/stakeIntent/StakeIntentService.ts +1 -1
  92. package/src/transaction/TransactionBoundWitness.ts +2 -3
  93. package/src/transaction/TransactionFeesFields.ts +10 -8
  94. package/src/validation/block/BlockValidationFunction.ts +1 -1
  95. package/src/validation/block/HydratedBlockStateValidationFunction.ts +3 -3
  96. package/src/validation/block/HydratedBlockValidationFunction.ts +1 -1
  97. package/src/validation/payload/InBlockPayloadValidationFunction.ts +1 -1
  98. package/src/validation/transaction/HydratedTransactionStateValidationFunction.ts +1 -1
  99. package/src/validation/transaction/HydratedTransactionValidationFunction.ts +1 -1
  100. package/src/xl1/XL1.ts +9 -95
  101. package/tsconfig.json +0 -21
  102. package/dist/index.d.ts +0 -564
  103. package/dist/index.d.ts.map +0 -1
@@ -19,32 +19,15 @@ export type FemtoXL1 = bigint & {
19
19
  export type AttoXL1 = bigint & {
20
20
  readonly _tag: 'AttoXL1';
21
21
  };
22
+ export type TypingFunc<T extends bigint> = (value: bigint) => T;
23
+ export declare const XL1: TypingFunc<XL1>;
24
+ export declare const MilliXL1: TypingFunc<MilliXL1>;
25
+ export declare const MicroXL1: TypingFunc<MicroXL1>;
26
+ export declare const NanoXL1: TypingFunc<NanoXL1>;
27
+ export declare const PicoXL1: TypingFunc<PicoXL1>;
28
+ export declare const FemtoXL1: TypingFunc<FemtoXL1>;
29
+ export declare const AttoXL1: TypingFunc<AttoXL1>;
22
30
  type XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto';
23
- export type TypingFunc<T extends bigint> = {
24
- (value: bigint): T;
25
- toAtto: () => AttoXL1;
26
- };
27
- export declare function XL1(value: bigint): XL1 & {
28
- toAtto(): AttoXL1;
29
- };
30
- export declare function MilliXL1(value: bigint): MilliXL1 & {
31
- toAtto(): AttoXL1;
32
- };
33
- export declare function MicroXL1(value: bigint): MicroXL1 & {
34
- toAtto(): AttoXL1;
35
- };
36
- export declare function NanoXL1(value: bigint): NanoXL1 & {
37
- toAtto(): AttoXL1;
38
- };
39
- export declare function PicoXL1(value: bigint): PicoXL1 & {
40
- toAtto(): AttoXL1;
41
- };
42
- export declare function FemtoXL1(value: bigint): FemtoXL1 & {
43
- toAtto(): AttoXL1;
44
- };
45
- export declare function AttoXL1(value: bigint): AttoXL1 & {
46
- toAtto(): AttoXL1;
47
- };
48
31
  /** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */
49
32
  export declare const XL1ConvertDict: Record<XL1Units, number>;
50
33
  export declare const XL1Places: Record<XL1Units, bigint>;
@@ -1 +1 @@
1
- {"version":3,"file":"XL1.d.ts","sourceRoot":"","sources":["../../../src/xl1/XL1.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAA;AACnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAA;AAC7D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAA;AAC7D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAC3D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAC3D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAA;AAC7D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAE3D,KAAK,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI;IACzC,CAA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F,KAAK,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9E,mEAAmE;AACnE,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAQ1C,CAAA;AAEV,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAQrC,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAQhD,CAAA;AAEV,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,UAE9C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-protocol",
4
- "version": "1.4.3",
4
+ "version": "1.4.5",
5
5
  "description": "XYO Layer One Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -22,7 +22,7 @@
22
22
  "type": "module",
23
23
  "exports": {
24
24
  ".": {
25
- "types": "./dist/index.d.ts",
25
+ "types": "./dist/types/index.d.ts",
26
26
  "source": "./src/index.ts",
27
27
  "default": "./dist/neutral/index.mjs"
28
28
  },
@@ -30,10 +30,7 @@
30
30
  },
31
31
  "module": "./dist/neutral/index.mjs",
32
32
  "source": "./src/index.ts",
33
- "types": "./dist/index.d.ts",
34
- "scripts": {
35
- "package-compile": "package-compile-only && rollup --config rollup.dts.config.mjs"
36
- },
33
+ "types": "./dist/types/index.d.ts",
37
34
  "dependencies": {
38
35
  "@opentelemetry/api": "^1.9.0",
39
36
  "@xylabs/base": "^4.10.1",
@@ -50,8 +47,6 @@
50
47
  "@xyo-network/wallet-model": "^3.17.0"
51
48
  },
52
49
  "devDependencies": {
53
- "@esbuild-plugins/tsconfig-paths": "^0.1.2",
54
- "@rollup/plugin-alias": "^5.1.1",
55
50
  "@types/node": "^22.15.22",
56
51
  "@xylabs/eslint-config-flat": "^6.5.7",
57
52
  "@xylabs/ts-scripts-yarn3": "^6.5.7",
@@ -61,8 +56,6 @@
61
56
  "eslint": "^9.27.0",
62
57
  "eslint-import-resolver-typescript": "^4.4.1",
63
58
  "knip": "^5.58.1",
64
- "rollup": "^4.41.1",
65
- "rollup-plugin-dts": "^6.2.1",
66
59
  "typescript": "^5.8.3",
67
60
  "vite": "^6.3.5",
68
61
  "vite-tsconfig-paths": "^5.1.4",
@@ -6,11 +6,11 @@ import { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugi
6
6
 
7
7
  import type {
8
8
  ChainStakeIntent, HashPayload, Transfer,
9
- } from '#payload'
9
+ } from '../payload/index.ts'
10
10
  import {
11
11
  ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,
12
- } from '#payload'
13
- import { isTransactionBoundWitness, type TransactionBoundWitness } from '#transaction'
12
+ } from '../payload/index.ts'
13
+ import { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'
14
14
 
15
15
  export type AllowedBlockPayload = Transfer | ChainStakeIntent | SchemaPayload | TransactionBoundWitness | HashPayload
16
16
  export const AllowedBlockPayloadSchemas: Schema[] = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema]
@@ -1,7 +1,7 @@
1
1
  import type { Promisable } from '@xylabs/promise'
2
2
  import type { Payload } from '@xyo-network/payload-model'
3
3
 
4
- import type { HydratedBlock } from '#block'
4
+ import type { HydratedBlock } from '../block/index.ts'
5
5
 
6
6
  export interface ChainAnalyzer<T extends Payload = Payload> {
7
7
  onBlock(block: HydratedBlock): Promisable<boolean>
package/src/index.ts CHANGED
@@ -1,15 +1,15 @@
1
+ export * from './block/index.ts'
2
+ export * from './chain/index.ts'
3
+ export * from './constants/index.ts'
4
+ export * from './fields/index.ts'
1
5
  export * from './Initializable.ts'
6
+ export * from './iterator/index.ts'
7
+ export * from './network/index.ts'
2
8
  export * from './OpenTelemetryProviders.ts'
9
+ export * from './payload/index.ts'
10
+ export * from './provider/index.ts'
11
+ export * from './repository/index.ts'
12
+ export * from './services/index.ts'
13
+ export * from './transaction/index.ts'
14
+ export * from './validation/index.ts'
3
15
  export * from './xl1/index.ts'
4
- export * from '#block'
5
- export * from '#chain'
6
- export * from '#constants'
7
- export * from '#fields'
8
- export * from '#iterator'
9
- export * from '#network'
10
- export * from '#payload'
11
- export * from '#provider'
12
- export * from '#repository'
13
- export * from '#services'
14
- export * from '#transaction'
15
- export * from '#validation'
@@ -3,10 +3,9 @@ import type { BaseEmitter } from '@xylabs/events'
3
3
  import type { Hash } from '@xylabs/hex'
4
4
  import type { ArchivistInstance } from '@xyo-network/archivist-model'
5
5
 
6
- import type { BlockBoundWitness } from '#block'
7
- import type { IterableRepository, ReadRepository } from '#repository'
8
- import type { BaseServiceParams, ChainIdentification } from '#services'
9
-
6
+ import type { BlockBoundWitness } from '../block/index.ts'
7
+ import type { IterableRepository, ReadRepository } from '../repository/index.ts'
8
+ import type { BaseServiceParams, ChainIdentification } from '../services/index.ts'
10
9
  import type { ChainIteratorEventData } from './ChainIteratorEventData.ts'
11
10
 
12
11
  export interface ChainIterator<TKey, THead> extends ReadRepository<TKey, BlockBoundWitness>, IterableRepository<TKey, BlockBoundWitness> {
@@ -1,6 +1,6 @@
1
1
  import type { EventData } from '@xylabs/events'
2
2
 
3
- import type { BlockBoundWitness } from '#block'
3
+ import type { BlockBoundWitness } from '../block/index.ts'
4
4
 
5
5
  export type HeadEventArgs = { blocks: [BlockBoundWitness] }
6
6
 
@@ -2,8 +2,7 @@ import { AsObjectFactory } from '@xylabs/object'
2
2
  import type { Payload } from '@xyo-network/payload-model'
3
3
  import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
4
4
 
5
- import type { BlockDuration } from '#fields'
6
-
5
+ import type { BlockDuration } from '../../fields/index.ts'
7
6
  import type { FromFields } from './Executable.ts'
8
7
 
9
8
  export const ChainStakeIntentSchema = 'network.xyo.chain.stake.intent' as const
@@ -1,6 +1,6 @@
1
1
  import type { Promisable } from '@xylabs/promise'
2
2
 
3
- import type { NetworkStatus } from '#network'
3
+ import type { NetworkStatus } from '../../network/index.ts'
4
4
 
5
5
  export interface XyoNetwork {
6
6
  status(): Promisable<NetworkStatus>
@@ -2,9 +2,8 @@ import type { Address } from '@xylabs/hex'
2
2
  import type { Signed } from '@xyo-network/boundwitness-model'
3
3
  import type { Payload } from '@xyo-network/payload-model'
4
4
 
5
- import type { AllowedBlockPayload } from '#block'
6
- import type { TransactionBoundWitness, TransactionFeesBigInt } from '#transaction'
7
-
5
+ import type { AllowedBlockPayload } from '../../block/index.ts'
6
+ import type { TransactionBoundWitness, TransactionFeesBigInt } from '../../transaction/index.ts'
8
7
  import type { XyoDataLakeProvider } from './XyoDataLake.ts'
9
8
  import type { XyoNetwork } from './XyoNetwork.ts'
10
9
  import type { XyoRunner } from './XyoRunner.ts'
@@ -1,7 +1,7 @@
1
1
  import type { Hash } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
 
4
- import type { SignedHydratedTransaction } from '#transaction'
4
+ import type { SignedHydratedTransaction } from '../../transaction/index.ts'
5
5
 
6
6
  export interface XyoRunner {
7
7
  broadcastTransaction(transaction: SignedHydratedTransaction): Promisable<Hash>
@@ -3,8 +3,8 @@ import type { Promisable } from '@xylabs/promise'
3
3
  import type { Signed } from '@xyo-network/boundwitness-model'
4
4
  import type { Payload } from '@xyo-network/payload-model'
5
5
 
6
- import type { AllowedBlockPayload } from '#block'
7
- import type { TransactionBoundWitness, TransactionFeesBigInt } from '#transaction'
6
+ import type { AllowedBlockPayload } from '../../block/index.ts'
7
+ import type { TransactionBoundWitness, TransactionFeesBigInt } from '../../transaction/index.ts'
8
8
 
9
9
  export interface XyoSigner {
10
10
  address(): Promisable<Address>
@@ -1,9 +1,9 @@
1
1
  import type { Address, Hash } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
 
4
- import type { SignedHydratedBlock } from '#block'
5
- import type { Transfer } from '#payload'
6
- import type { SignedHydratedTransaction, TransactionBoundWitness } from '#transaction'
4
+ import type { SignedHydratedBlock } from '../../block/index.ts'
5
+ import type { Transfer } from '../../payload/index.ts'
6
+ import type { SignedHydratedTransaction, TransactionBoundWitness } from '../../transaction/index.ts'
7
7
 
8
8
  export interface XyoViewer {
9
9
  accountBalance: (address: Address) => Promisable<bigint>
@@ -1,7 +1,7 @@
1
1
  import type { Hash } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
 
4
- import type { Transfer } from '#payload'
4
+ import type { Transfer } from '../../../payload/index.ts'
5
5
 
6
6
  export interface AccountViewer {
7
7
  balance(): Promisable<bigint>
@@ -1,7 +1,6 @@
1
1
  import type { Address, Hash } from '@xylabs/hex'
2
2
 
3
- import type { SignedHydratedBlock } from '#block'
4
-
3
+ import type { SignedHydratedBlock } from '../../../block/index.ts'
5
4
  import type { TransactionViewer } from './Transaction.ts'
6
5
 
7
6
  export interface BlockViewer {
@@ -1,8 +1,7 @@
1
1
  import type { Address, Hash } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
 
4
- import type { NetworkStatus } from '#network'
5
-
4
+ import type { NetworkStatus } from '../../../network/index.ts'
6
5
  import type { AccountViewer } from './Account.ts'
7
6
  import type { BlockViewer } from './Block.ts'
8
7
 
@@ -1,5 +1,4 @@
1
- import type { SignedHydratedTransaction } from '#transaction'
2
-
1
+ import type { SignedHydratedTransaction } from '../../../transaction/index.ts'
3
2
  import type { BlockViewer } from './Block.ts'
4
3
 
5
4
  export interface TransactionViewer {
@@ -1,5 +1,4 @@
1
- import type { HydratedTransaction, TransactionBoundWitness } from '#transaction'
2
-
1
+ import type { HydratedTransaction, TransactionBoundWitness } from '../transaction/index.ts'
3
2
  import type { ReadRepository } from './Repository.ts'
4
3
 
5
4
  export interface TransactionReadRepository extends ReadRepository<TransactionBoundWitness, HydratedTransaction> {}
@@ -1,5 +1,4 @@
1
- import type { HydratedTransaction, TransactionBoundWitness } from '#transaction'
2
-
1
+ import type { HydratedTransaction, TransactionBoundWitness } from '../transaction/index.ts'
3
2
  import type { IterableRepository } from './Repository.ts'
4
3
 
5
4
  export interface TransactionRepositoryIterator extends IterableRepository<TransactionBoundWitness, HydratedTransaction> {}
@@ -1,5 +1,4 @@
1
- import type { HydratedTransaction } from '#transaction'
2
-
1
+ import type { HydratedTransaction } from '../transaction/index.ts'
3
2
  import type { WriteRepository } from './Repository.ts'
4
3
 
5
4
  export interface TransactionWriteRepository extends WriteRepository<HydratedTransaction, boolean> {}
@@ -1,6 +1,6 @@
1
- import type { BlockBoundWitness, HydratedBlock } from '#block'
2
- import type { Addressable } from '#fields'
3
- import type { IterableRepository } from '#repository'
1
+ import type { BlockBoundWitness, HydratedBlock } from '../block/index.ts'
2
+ import type { Addressable } from '../fields/index.ts'
3
+ import type { IterableRepository } from '../repository/index.ts'
4
4
 
5
5
  export type NextBlockProducer = IterableRepository<BlockBoundWitness, HydratedBlock>
6
6
 
@@ -1,7 +1,6 @@
1
1
  import type { Address } from '@xylabs/hex'
2
2
 
3
- import type { BlockBoundWitness } from '#block'
4
-
3
+ import type { BlockBoundWitness } from '../block/index.ts'
5
4
  import type { Service } from './Service.ts'
6
5
 
7
6
  export interface ElectionService extends Service {
@@ -1,7 +1,6 @@
1
1
  import type { Hash } from '@xylabs/hex'
2
2
 
3
- import type { HydratedTransaction } from '#transaction'
4
-
3
+ import type { HydratedTransaction } from '../transaction/index.ts'
5
4
  import type { Service } from './Service.ts'
6
5
 
7
6
  export interface PendingTransactionsService extends Service {
@@ -1,6 +1,6 @@
1
1
  import type { Address } from '@xylabs/hex'
2
2
 
3
- import type { Intent } from '#payload'
3
+ import type { Intent } from '../../payload/index.ts'
4
4
 
5
5
  export interface StakeIntentService {
6
6
 
@@ -5,9 +5,8 @@ import { isBoundWitness } from '@xyo-network/boundwitness-model'
5
5
  import type { WithStorageMeta } from '@xyo-network/payload-model'
6
6
  import { isStorageMeta } from '@xyo-network/payload-model'
7
7
 
8
- import type { BlockDuration } from '#fields'
9
- import type { FromFields, OptionalExecutable } from '#payload'
10
-
8
+ import type { BlockDuration } from '../fields/index.ts'
9
+ import type { FromFields, OptionalExecutable } from '../payload/index.ts'
11
10
  import type { TransactionFeesFields } from './TransactionFeesFields.ts'
12
11
 
13
12
  export interface TransactionBoundWitnessFields extends BlockDuration, TransactionFeesFields {
@@ -1,7 +1,9 @@
1
1
  import type { Hex } from '@xylabs/hex'
2
2
 
3
- import type { AttoXL1 } from '../xl1/index.ts'
4
- import { MicroXL1 } from '../xl1/index.ts'
3
+ import {
4
+ AttoXL1,
5
+ AttoXL1ConvertFactor,
6
+ } from '../xl1/index.ts'
5
7
 
6
8
  export interface TransactionFeesBigInt {
7
9
  base: AttoXL1
@@ -19,15 +21,15 @@ export interface TransactionFeesFields {
19
21
  }
20
22
 
21
23
  export const minTransactionFees: TransactionFeesBigInt = {
22
- base: MicroXL1(1000n).toAtto(),
23
- gasPrice: MicroXL1(1n).toAtto(),
24
- gasLimit: MicroXL1(1000n).toAtto(),
25
- priority: MicroXL1(0n).toAtto(),
24
+ base: AttoXL1(1000n * AttoXL1ConvertFactor.micro),
25
+ gasPrice: AttoXL1(1n * AttoXL1ConvertFactor.micro),
26
+ gasLimit: AttoXL1(1000n * AttoXL1ConvertFactor.micro),
27
+ priority: AttoXL1(0n * AttoXL1ConvertFactor.micro),
26
28
  } as const
27
29
 
28
30
  export const defaultTransactionFees: TransactionFeesBigInt = {
29
31
  base: minTransactionFees.base,
30
- gasPrice: MicroXL1(10n).toAtto(),
31
- gasLimit: MicroXL1(1_000_000n).toAtto(),
32
+ gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),
33
+ gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),
32
34
  priority: minTransactionFees.priority,
33
35
  } as const
@@ -1,7 +1,7 @@
1
1
  import type { Address } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
 
4
- import type { BlockBoundWitness } from '#block'
4
+ import type { BlockBoundWitness } from '../../block/index.ts'
5
5
 
6
6
  export type BlockValidatorFunction = (
7
7
  block: BlockBoundWitness,
@@ -1,8 +1,8 @@
1
1
  import type { Address } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
- import type { ReadArchivist } from '@xyo-network/archivist-model'
4
3
 
5
- import type { HydratedBlock } from '#block'
4
+ import type { HydratedBlock } from '../../block/index.ts'
5
+ import type { AccountBalanceService } from '../../services/index.ts'
6
6
 
7
7
  /**
8
8
  * A function that validates a hydrated block against chain state.
@@ -14,5 +14,5 @@ import type { HydratedBlock } from '#block'
14
14
  export type HydratedBlockStateValidationFunction = (
15
15
  hydratedBlock: HydratedBlock,
16
16
  chainId: Address,
17
- archivist: ReadArchivist,
17
+ services: { accountBalance: AccountBalanceService },
18
18
  ) => Promisable<Error[]>
@@ -1,7 +1,7 @@
1
1
  import type { Address } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
 
4
- import type { HydratedBlock } from '#block'
4
+ import type { HydratedBlock } from '../../block/index.ts'
5
5
 
6
6
  /**
7
7
  * A function that validates a hydrated block.
@@ -1,7 +1,7 @@
1
1
  import type { Promisable } from '@xylabs/promise'
2
2
  import type { Payload, WithHashStorageMeta } from '@xyo-network/payload-model'
3
3
 
4
- import type { HydratedBlock } from '#block'
4
+ import type { HydratedBlock } from '../../block/index.ts'
5
5
 
6
6
  export type InBlockPayloadValidationFunction = (
7
7
  payload: WithHashStorageMeta<Payload>, block: HydratedBlock
@@ -2,7 +2,7 @@ import type { Address } from '@xylabs/hex'
2
2
  import type { Promisable } from '@xylabs/promise'
3
3
  import type { HydratedBoundWitnessWithStorageMeta, ReadArchivist } from '@xyo-network/archivist-model'
4
4
 
5
- import type { TransactionBoundWitness } from '#transaction'
5
+ import type { TransactionBoundWitness } from '../../transaction/index.ts'
6
6
 
7
7
  /**
8
8
  * A function that validates a hydrated transaction against chain state.
@@ -3,7 +3,7 @@ import type { Promisable } from '@xylabs/promise'
3
3
 
4
4
  import type {
5
5
  HydratedTransaction, HydratedTransactionWithHashStorageMeta, TransactionBoundWitness,
6
- } from '#transaction'
6
+ } from '../../transaction/index.ts'
7
7
 
8
8
  /**
9
9
  * A function that validates a hydrated transaction.
package/src/xl1/XL1.ts CHANGED
@@ -6,103 +6,17 @@ export type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' } // 1e-6 [XL1 * 1e12
6
6
  export type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' } // 1e-3 [XL1 * 1e15 = femtoXL1] [femtoXL1 / 1e15 = XL1]
7
7
  export type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' } // 1e-0 [XL1 * 1e18 = attoXL1] [attoXL1 / 1e18 = XL1]
8
8
 
9
- type XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'
10
-
11
- export type TypingFunc<T extends bigint> = {
12
- (value: bigint): T
13
- toAtto: () => AttoXL1
14
- }
15
-
16
- export function XL1(value: bigint): XL1 & { toAtto(): AttoXL1 } {
17
- const xl1Value = value as XL1
18
-
19
- return new Proxy(xl1Value, {
20
- get(target, prop) {
21
- if (prop === 'toAtto') {
22
- return () => AttoXL1(target * AttoXL1ConvertFactor.xl1)
23
- }
24
- return Reflect.get(target, prop)
25
- },
26
- }) as XL1 & { toAtto(): AttoXL1 }
27
- }
28
-
29
- export function MilliXL1(value: bigint): MilliXL1 & { toAtto(): AttoXL1 } {
30
- const xl1Value = value as MilliXL1
31
-
32
- return new Proxy(xl1Value, {
33
- get(target, prop) {
34
- if (prop === 'toAtto') {
35
- return () => AttoXL1(target * AttoXL1ConvertFactor.milli)
36
- }
37
- return Reflect.get(target, prop)
38
- },
39
- }) as MilliXL1 & { toAtto(): AttoXL1 }
40
- }
41
-
42
- export function MicroXL1(value: bigint): MicroXL1 & { toAtto(): AttoXL1 } {
43
- const xl1Value = value as MicroXL1
44
-
45
- return new Proxy(xl1Value, {
46
- get(target, prop) {
47
- if (prop === 'toAtto') {
48
- return () => AttoXL1(target * AttoXL1ConvertFactor.micro)
49
- }
50
- return Reflect.get(target, prop)
51
- },
52
- }) as MicroXL1 & { toAtto(): AttoXL1 }
53
- }
9
+ export type TypingFunc<T extends bigint> = (value: bigint) => T
54
10
 
55
- export function NanoXL1(value: bigint): NanoXL1 & { toAtto(): AttoXL1 } {
56
- const xl1Value = value as NanoXL1
11
+ export const XL1: TypingFunc<XL1> = (value: bigint): XL1 => value as XL1
12
+ export const MilliXL1: TypingFunc<MilliXL1> = (value: bigint): MilliXL1 => value as MilliXL1
13
+ export const MicroXL1: TypingFunc<MicroXL1> = (value: bigint): MicroXL1 => value as MicroXL1
14
+ export const NanoXL1: TypingFunc<NanoXL1> = (value: bigint): NanoXL1 => value as NanoXL1
15
+ export const PicoXL1: TypingFunc<PicoXL1> = (value: bigint): PicoXL1 => value as PicoXL1
16
+ export const FemtoXL1: TypingFunc<FemtoXL1> = (value: bigint): FemtoXL1 => value as FemtoXL1
17
+ export const AttoXL1: TypingFunc<AttoXL1> = (value: bigint): AttoXL1 => value as AttoXL1
57
18
 
58
- return new Proxy(xl1Value, {
59
- get(target, prop) {
60
- if (prop === 'toAtto') {
61
- return () => AttoXL1(target * AttoXL1ConvertFactor.nano)
62
- }
63
- return Reflect.get(target, prop)
64
- },
65
- }) as NanoXL1 & { toAtto(): AttoXL1 }
66
- }
67
-
68
- export function PicoXL1(value: bigint): PicoXL1 & { toAtto(): AttoXL1 } {
69
- const xl1Value = value as PicoXL1
70
-
71
- return new Proxy(xl1Value, {
72
- get(target, prop) {
73
- if (prop === 'toAtto') {
74
- return () => AttoXL1(target * AttoXL1ConvertFactor.pico)
75
- }
76
- return Reflect.get(target, prop)
77
- },
78
- }) as PicoXL1 & { toAtto(): AttoXL1 }
79
- }
80
-
81
- export function FemtoXL1(value: bigint): FemtoXL1 & { toAtto(): AttoXL1 } {
82
- const xl1Value = value as FemtoXL1
83
-
84
- return new Proxy(xl1Value, {
85
- get(target, prop) {
86
- if (prop === 'toAtto') {
87
- return () => AttoXL1(target * AttoXL1ConvertFactor.femto)
88
- }
89
- return Reflect.get(target, prop)
90
- },
91
- }) as FemtoXL1 & { toAtto(): AttoXL1 }
92
- }
93
-
94
- export function AttoXL1(value: bigint): AttoXL1 & { toAtto(): AttoXL1 } {
95
- const xl1Value = value as AttoXL1
96
-
97
- return new Proxy(xl1Value, {
98
- get(target, prop) {
99
- if (prop === 'toAtto') {
100
- return () => AttoXL1(target * AttoXL1ConvertFactor.atto)
101
- }
102
- return Reflect.get(target, prop)
103
- },
104
- }) as AttoXL1 & { toAtto(): AttoXL1 }
105
- }
19
+ type XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'
106
20
 
107
21
  /** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */
108
22
  export const XL1ConvertDict: Record<XL1Units, number> = {
package/tsconfig.json CHANGED
@@ -1,25 +1,4 @@
1
1
  {
2
- "compilerOptions": {
3
- "paths": {
4
- "#block": ["./src/block/index.ts"],
5
- "#chain": ["./src/chain/index.ts"],
6
- "#constants": ["./src/constants/index.ts"],
7
- "#fields": ["./src/fields/index.ts"],
8
- "#iterator": ["./src/iterator/index.ts"],
9
- "#network": ["./src/network/index.ts"],
10
- "#payload": ["./src/payload/index.ts"],
11
- "#provider": ["./src/provider/index.ts"],
12
- "#repository": ["./src/repository/index.ts"],
13
- "#services": ["./src/services/index.ts"],
14
- "#transaction": ["./src/transaction/index.ts"],
15
- "#validation": ["./src/validation/index.ts"]
16
- },
17
- "noEmit": false,
18
- "declaration": true,
19
- "declarationMap": true,
20
- "emitDeclarationOnly": true,
21
- "outDir": "./dist"
22
- },
23
2
  "exclude": ["dist", "docs", "node_modules"],
24
3
  "extends": "@xylabs/tsconfig"
25
4
  }