@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.
- package/dist/neutral/index.mjs +45 -115
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/index.mjs +45 -115
- package/dist/node/index.mjs.map +1 -1
- package/dist/types/block/AllowedBlockPayload.d.ts +2 -2
- package/dist/types/block/AllowedBlockPayload.d.ts.map +1 -1
- package/dist/types/chain/ChainAnalyzer.d.ts +1 -1
- package/dist/types/chain/ChainAnalyzer.d.ts.map +1 -1
- package/dist/types/constants/TransactionGasCosts.d.ts +6 -25
- package/dist/types/constants/TransactionGasCosts.d.ts.map +1 -1
- package/dist/types/index.d.ts +12 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/iterator/ChainIterator.d.ts +3 -3
- package/dist/types/iterator/ChainIterator.d.ts.map +1 -1
- package/dist/types/iterator/ChainIteratorEventData.d.ts +1 -1
- package/dist/types/iterator/ChainIteratorEventData.d.ts.map +1 -1
- package/dist/types/payload/elevatable/ChainStakeIntent.d.ts +1 -1
- package/dist/types/payload/elevatable/ChainStakeIntent.d.ts.map +1 -1
- package/dist/types/provider/v1/XyoNetwork.d.ts +1 -1
- package/dist/types/provider/v1/XyoNetwork.d.ts.map +1 -1
- package/dist/types/provider/v1/XyoProvider.d.ts +2 -2
- package/dist/types/provider/v1/XyoProvider.d.ts.map +1 -1
- package/dist/types/provider/v1/XyoRunner.d.ts +1 -1
- package/dist/types/provider/v1/XyoRunner.d.ts.map +1 -1
- package/dist/types/provider/v1/XyoSigner.d.ts +2 -2
- package/dist/types/provider/v1/XyoSigner.d.ts.map +1 -1
- package/dist/types/provider/v1/XyoViewer.d.ts +3 -3
- package/dist/types/provider/v1/XyoViewer.d.ts.map +1 -1
- package/dist/types/provider/v2/viewer/Account.d.ts +1 -1
- package/dist/types/provider/v2/viewer/Account.d.ts.map +1 -1
- package/dist/types/provider/v2/viewer/Block.d.ts +1 -1
- package/dist/types/provider/v2/viewer/Block.d.ts.map +1 -1
- package/dist/types/provider/v2/viewer/Chain.d.ts +1 -1
- package/dist/types/provider/v2/viewer/Chain.d.ts.map +1 -1
- package/dist/types/provider/v2/viewer/Transaction.d.ts +1 -1
- package/dist/types/provider/v2/viewer/Transaction.d.ts.map +1 -1
- package/dist/types/repository/TransactionReadRepository.d.ts +1 -1
- package/dist/types/repository/TransactionReadRepository.d.ts.map +1 -1
- package/dist/types/repository/TransactionRepositoryIterator.d.ts +1 -1
- package/dist/types/repository/TransactionRepositoryIterator.d.ts.map +1 -1
- package/dist/types/repository/TransactionWriteRepository.d.ts +1 -1
- package/dist/types/repository/TransactionWriteRepository.d.ts.map +1 -1
- package/dist/types/services/BlockProducer.d.ts +3 -3
- package/dist/types/services/BlockProducer.d.ts.map +1 -1
- package/dist/types/services/Election.d.ts +1 -1
- package/dist/types/services/Election.d.ts.map +1 -1
- package/dist/types/services/PendingTransactionsService.d.ts +1 -1
- package/dist/types/services/PendingTransactionsService.d.ts.map +1 -1
- package/dist/types/services/stakeIntent/StakeIntentService.d.ts +1 -1
- package/dist/types/services/stakeIntent/StakeIntentService.d.ts.map +1 -1
- package/dist/types/transaction/TransactionBoundWitness.d.ts +2 -2
- package/dist/types/transaction/TransactionBoundWitness.d.ts.map +1 -1
- package/dist/types/transaction/TransactionFeesFields.d.ts +1 -1
- package/dist/types/transaction/TransactionFeesFields.d.ts.map +1 -1
- package/dist/types/validation/block/BlockValidationFunction.d.ts +1 -1
- package/dist/types/validation/block/BlockValidationFunction.d.ts.map +1 -1
- package/dist/types/validation/block/HydratedBlockStateValidationFunction.d.ts +5 -3
- package/dist/types/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
- package/dist/types/validation/block/HydratedBlockValidationFunction.d.ts +1 -1
- package/dist/types/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
- package/dist/types/validation/payload/InBlockPayloadValidationFunction.d.ts +1 -1
- package/dist/types/validation/payload/InBlockPayloadValidationFunction.d.ts.map +1 -1
- package/dist/types/validation/transaction/HydratedTransactionStateValidationFunction.d.ts +1 -1
- package/dist/types/validation/transaction/HydratedTransactionStateValidationFunction.d.ts.map +1 -1
- package/dist/types/validation/transaction/HydratedTransactionValidationFunction.d.ts +1 -1
- package/dist/types/validation/transaction/HydratedTransactionValidationFunction.d.ts.map +1 -1
- package/dist/types/xl1/XL1.d.ts +8 -25
- package/dist/types/xl1/XL1.d.ts.map +1 -1
- package/package.json +3 -10
- package/src/block/AllowedBlockPayload.ts +3 -3
- package/src/chain/ChainAnalyzer.ts +1 -1
- package/src/index.ts +12 -12
- package/src/iterator/ChainIterator.ts +3 -4
- package/src/iterator/ChainIteratorEventData.ts +1 -1
- package/src/payload/elevatable/ChainStakeIntent.ts +1 -2
- package/src/provider/v1/XyoNetwork.ts +1 -1
- package/src/provider/v1/XyoProvider.ts +2 -3
- package/src/provider/v1/XyoRunner.ts +1 -1
- package/src/provider/v1/XyoSigner.ts +2 -2
- package/src/provider/v1/XyoViewer.ts +3 -3
- package/src/provider/v2/viewer/Account.ts +1 -1
- package/src/provider/v2/viewer/Block.ts +1 -2
- package/src/provider/v2/viewer/Chain.ts +1 -2
- package/src/provider/v2/viewer/Transaction.ts +1 -2
- package/src/repository/TransactionReadRepository.ts +1 -2
- package/src/repository/TransactionRepositoryIterator.ts +1 -2
- package/src/repository/TransactionWriteRepository.ts +1 -2
- package/src/services/BlockProducer.ts +3 -3
- package/src/services/Election.ts +1 -2
- package/src/services/PendingTransactionsService.ts +1 -2
- package/src/services/stakeIntent/StakeIntentService.ts +1 -1
- package/src/transaction/TransactionBoundWitness.ts +2 -3
- package/src/transaction/TransactionFeesFields.ts +10 -8
- package/src/validation/block/BlockValidationFunction.ts +1 -1
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +3 -3
- package/src/validation/block/HydratedBlockValidationFunction.ts +1 -1
- package/src/validation/payload/InBlockPayloadValidationFunction.ts +1 -1
- package/src/validation/transaction/HydratedTransactionStateValidationFunction.ts +1 -1
- package/src/validation/transaction/HydratedTransactionValidationFunction.ts +1 -1
- package/src/xl1/XL1.ts +9 -95
- package/tsconfig.json +0 -21
- package/dist/index.d.ts +0 -564
- package/dist/index.d.ts.map +0 -1
package/dist/types/xl1/XL1.d.ts
CHANGED
|
@@ -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,
|
|
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,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAA;AAE/D,eAAO,MAAM,GAAG,EAAE,UAAU,CAAC,GAAG,CAAwC,CAAA;AACxE,eAAO,MAAM,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAkD,CAAA;AAC5F,eAAO,MAAM,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAkD,CAAA;AAC5F,eAAO,MAAM,OAAO,EAAE,UAAU,CAAC,OAAO,CAAgD,CAAA;AACxF,eAAO,MAAM,OAAO,EAAE,UAAU,CAAC,OAAO,CAAgD,CAAA;AACxF,eAAO,MAAM,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAkD,CAAA;AAC5F,eAAO,MAAM,OAAO,EAAE,UAAU,CAAC,OAAO,CAAgD,CAAA;AAExF,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.
|
|
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 '
|
|
9
|
+
} from '../payload/index.ts'
|
|
10
10
|
import {
|
|
11
11
|
ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,
|
|
12
|
-
} from '
|
|
13
|
-
import { isTransactionBoundWitness, type TransactionBoundWitness } from '
|
|
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 '
|
|
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 '
|
|
7
|
-
import type { IterableRepository, ReadRepository } from '
|
|
8
|
-
import type { BaseServiceParams, ChainIdentification } from '
|
|
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> {
|
|
@@ -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 '
|
|
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
|
|
@@ -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 '
|
|
6
|
-
import type { TransactionBoundWitness, TransactionFeesBigInt } from '
|
|
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 '
|
|
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 '
|
|
7
|
-
import type { TransactionBoundWitness, TransactionFeesBigInt } from '
|
|
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 '
|
|
5
|
-
import type { Transfer } from '
|
|
6
|
-
import type { SignedHydratedTransaction, TransactionBoundWitness } from '
|
|
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,6 @@
|
|
|
1
1
|
import type { Address, Hash } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import type { SignedHydratedBlock } from '
|
|
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 '
|
|
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 { HydratedTransaction, TransactionBoundWitness } from '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
2
|
-
import type { Addressable } from '
|
|
3
|
-
import type { IterableRepository } from '
|
|
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
|
|
package/src/services/Election.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import type { HydratedTransaction } from '
|
|
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 {
|
|
@@ -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 '
|
|
9
|
-
import type { FromFields, OptionalExecutable } from '
|
|
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
|
|
4
|
-
|
|
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:
|
|
23
|
-
gasPrice:
|
|
24
|
-
gasLimit:
|
|
25
|
-
priority:
|
|
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:
|
|
31
|
-
gasLimit:
|
|
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 '
|
|
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 '
|
|
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
|
-
|
|
17
|
+
services: { accountBalance: AccountBalanceService },
|
|
18
18
|
) => Promisable<Error[]>
|
|
@@ -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 '
|
|
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 '
|
|
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 '
|
|
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
|
|
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
|
|
56
|
-
|
|
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
|
-
|
|
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
|
}
|