@xyo-network/xl1-protocol-model 1.26.12 → 1.26.13
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/model/Context/BlockContext.zod.d.ts +1 -1
- package/package.json +25 -10
- package/src/BlockNumber/BlockNumber.ts +0 -24
- package/src/BlockNumber/EthBlockNumber.ts +0 -25
- package/src/BlockNumber/Numberish.ts +0 -9
- package/src/BlockNumber/XL1BlockNumber.ts +0 -25
- package/src/BlockNumber/index.ts +0 -4
- package/src/RecordKeyType.ts +0 -5
- package/src/Step/StepHash.ts +0 -10
- package/src/Step/StepIdentity.ts +0 -46
- package/src/Step/StepSizes.ts +0 -47
- package/src/Step/index.ts +0 -3
- package/src/TransferPayload.ts +0 -35
- package/src/amount/ShiftedBigIntConfig.ts +0 -8
- package/src/amount/XL1AmountInstance.ts +0 -19
- package/src/amount/index.ts +0 -2
- package/src/block/AllowedBlockPayload.ts +0 -73
- package/src/block/BlockBoundWitness.ts +0 -72
- package/src/block/HydratedBlock.ts +0 -135
- package/src/block/index.ts +0 -5
- package/src/block/signed/SignedBlockBoundWitness.ts +0 -22
- package/src/block/signed/SignedBlockBoundWitnessWithHashMeta.ts +0 -35
- package/src/block/signed/SignedBlockBoundWitnessWithStorageMeta.ts +0 -41
- package/src/block/signed/index.ts +0 -3
- package/src/block/unsigned/UnsignedBlockBoundWitness.ts +0 -22
- package/src/block/unsigned/index.ts +0 -1
- package/src/chain/Chain.ts +0 -7
- package/src/chain/ChainAnalyzer.ts +0 -11
- package/src/chain/ChainId.ts +0 -4
- package/src/chain/index.ts +0 -3
- package/src/fields/Addressable.ts +0 -7
- package/src/fields/BlockDuration.ts +0 -25
- package/src/fields/BlockNumber.ts +0 -40
- package/src/fields/ChainReference.ts +0 -11
- package/src/fields/index.ts +0 -4
- package/src/index.ts +0 -14
- package/src/map/AsyncMap.ts +0 -38
- package/src/map/MapType.ts +0 -27
- package/src/map/SyncMap.ts +0 -38
- package/src/map/index.ts +0 -3
- package/src/model/AccountBalance.ts +0 -58
- package/src/model/ArrayBuffer.ts +0 -44
- package/src/model/BlockRange/BlockRange.ts +0 -43
- package/src/model/BlockRange/EthBlockRange.ts +0 -43
- package/src/model/BlockRange/Numberish.ts +0 -6
- package/src/model/BlockRange/Range.ts +0 -17
- package/src/model/BlockRange/XL1BlockRange.ts +0 -43
- package/src/model/BlockRange/index.ts +0 -4
- package/src/model/BlockRate.ts +0 -108
- package/src/model/ChainQualification.ts +0 -48
- package/src/model/Context/BaseContext.ts +0 -6
- package/src/model/Context/BaseContext.zod.ts +0 -36
- package/src/model/Context/BlockContext.ts +0 -12
- package/src/model/Context/BlockContext.zod.ts +0 -20
- package/src/model/Context/CachingContext.ts +0 -6
- package/src/model/Context/CachingContext.zod.ts +0 -4
- package/src/model/Context/ChainContext.ts +0 -12
- package/src/model/Context/ChainContext.zod.ts +0 -17
- package/src/model/Context/HeadContext.ts +0 -6
- package/src/model/Context/HeadContext.zod.ts +0 -13
- package/src/model/Context/index.ts +0 -10
- package/src/model/GatewayName.ts +0 -4
- package/src/model/HydratedTransaction.ts +0 -169
- package/src/model/OpCodes.ts +0 -2
- package/src/model/PayloadMap.ts +0 -13
- package/src/model/Permission.ts +0 -29
- package/src/model/Position.ts +0 -21
- package/src/model/PositionId.ts +0 -4
- package/src/model/RangeMultipliers.ts +0 -13
- package/src/model/RewardShare.ts +0 -2
- package/src/model/RewardsRangeOptions.ts +0 -13
- package/src/model/Sequence.ts +0 -21
- package/src/model/Stake.ts +0 -47
- package/src/model/StakeShare.ts +0 -2
- package/src/model/TimeDomain.ts +0 -8
- package/src/model/TransferPair.ts +0 -7
- package/src/model/addresses.ts +0 -36
- package/src/model/defaultRewardRatio.ts +0 -3
- package/src/model/defaultTransactionFees.ts +0 -11
- package/src/model/index.ts +0 -27
- package/src/model/minTransactionFees.ts +0 -10
- package/src/model/rewards.ts +0 -18
- package/src/model/spec/fixtures/index.ts +0 -2
- package/src/model/spec/fixtures/signedHydratedTransaction.ts +0 -58
- package/src/model/spec/fixtures/unsignedHydratedTransaction.ts +0 -62
- package/src/model/version.ts +0 -10
- package/src/payload/StepIdentityPayload.ts +0 -25
- package/src/payload/elevatable/Bridge/BridgeCompletion.ts +0 -28
- package/src/payload/elevatable/Bridge/BridgeDestinationObservation.ts +0 -38
- package/src/payload/elevatable/Bridge/BridgeDetails.ts +0 -69
- package/src/payload/elevatable/Bridge/BridgeIntent.ts +0 -36
- package/src/payload/elevatable/Bridge/BridgeSourceObservation.ts +0 -37
- package/src/payload/elevatable/Bridge/index.ts +0 -5
- package/src/payload/elevatable/ChainStakeIntent.ts +0 -45
- package/src/payload/elevatable/Executable.ts +0 -35
- package/src/payload/elevatable/Hash.ts +0 -25
- package/src/payload/elevatable/StepComplete.ts +0 -31
- package/src/payload/elevatable/Time.ts +0 -61
- package/src/payload/elevatable/index.ts +0 -6
- package/src/payload/index.ts +0 -2
- package/src/provider/Provider.ts +0 -6
- package/src/provider/ProviderMoniker.ts +0 -15
- package/src/provider/index.ts +0 -2
- package/src/transaction/TransactionBoundWitness.ts +0 -187
- package/src/transaction/TransactionFees.ts +0 -73
- package/src/transaction/TransactionGasCosts.ts +0 -42
- package/src/transaction/index.ts +0 -3
- package/src/xl1/AttoXL1.ts +0 -19
- package/src/xl1/FemtoXL1.ts +0 -20
- package/src/xl1/MicroXL1.ts +0 -20
- package/src/xl1/MilliXL1.ts +0 -20
- package/src/xl1/NanoXL1.ts +0 -20
- package/src/xl1/PicoXL1.ts +0 -20
- package/src/xl1/XL1.ts +0 -20
- package/src/xl1/XL1Units.ts +0 -26
- package/src/xl1/index.ts +0 -8
- package/src/xl1/isXL1Factory.ts +0 -56
- package/src/xl1/xl1MaxValue.ts +0 -2
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { SignedBoundWitnessZod } from '@xyo-network/sdk-js'
|
|
5
|
-
import type { z } from 'zod'
|
|
6
|
-
|
|
7
|
-
import { BlockBoundWitnessFieldsZod, BlockBoundWitnessMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
-
|
|
9
|
-
/** SignedBlockBoundWitnessZod constant. */
|
|
10
|
-
export const SignedBlockBoundWitnessZod = SignedBoundWitnessZod
|
|
11
|
-
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
12
|
-
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
13
|
-
|
|
14
|
-
/** SignedBlockBoundWitness type. */
|
|
15
|
-
export type SignedBlockBoundWitness = z.infer<typeof SignedBlockBoundWitnessZod>
|
|
16
|
-
|
|
17
|
-
/** Type guard that checks if a value is a valid SignedBlockBoundWitness. */
|
|
18
|
-
export const isSignedBlockBoundWitness = zodIsFactory(SignedBlockBoundWitnessZod)
|
|
19
|
-
/** Converts a value to SignedBlockBoundWitness, throwing if invalid. */
|
|
20
|
-
export const asSignedBlockBoundWitness = zodAsFactory(SignedBlockBoundWitnessZod, 'asSignedBlockBoundWitness')
|
|
21
|
-
/** toSignedBlockBoundWitness constant. */
|
|
22
|
-
export const toSignedBlockBoundWitness = zodToFactory(SignedBlockBoundWitnessZod, 'toSignedBlockBoundWitness')
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { PayloadBuilder, WithHashMetaZod } from '@xyo-network/sdk-js'
|
|
5
|
-
import type { z } from 'zod'
|
|
6
|
-
|
|
7
|
-
import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
|
|
8
|
-
|
|
9
|
-
/** SignedBlockBoundWitnessWithHashMetaZod constant. */
|
|
10
|
-
export const SignedBlockBoundWitnessWithHashMetaZod = WithHashMetaZod(SignedBlockBoundWitnessZod)
|
|
11
|
-
|
|
12
|
-
/** SignedBlockBoundWitnessWithHashMeta type. */
|
|
13
|
-
export type SignedBlockBoundWitnessWithHashMeta = z.infer<typeof SignedBlockBoundWitnessWithHashMetaZod>
|
|
14
|
-
|
|
15
|
-
/** Type guard that checks if a value is a valid SignedBlockBoundWitnessWithHashMeta. */
|
|
16
|
-
export const isSignedBlockBoundWitnessWithHashMeta = zodIsFactory(SignedBlockBoundWitnessWithHashMetaZod)
|
|
17
|
-
/** Converts a value to SignedBlockBoundWitnessWithHashMeta, throwing if invalid. */
|
|
18
|
-
export const asSignedBlockBoundWitnessWithHashMeta = zodAsFactory(SignedBlockBoundWitnessWithHashMetaZod, 'asSignedBlockBoundWitnessWithHashMeta')
|
|
19
|
-
|
|
20
|
-
/** SignedBlockBoundWitnessWithHashMetaishZod constant. */
|
|
21
|
-
export const SignedBlockBoundWitnessWithHashMetaishZod = SignedBlockBoundWitnessZod.transform(async (data) => {
|
|
22
|
-
if (isSignedBlockBoundWitnessWithHashMeta(data)) {
|
|
23
|
-
return data
|
|
24
|
-
}
|
|
25
|
-
if (isSignedBlockBoundWitness(data)) {
|
|
26
|
-
return await PayloadBuilder.addHashMeta(data)
|
|
27
|
-
}
|
|
28
|
-
throw new Error('Invalid SignedBlockBoundWitnessWithHashMetaish format')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
/** SignedBlockBoundWitnessWithHashMetaish type. */
|
|
32
|
-
export type SignedBlockBoundWitnessWithHashMetaish = z.input<typeof SignedBlockBoundWitnessWithHashMetaishZod>
|
|
33
|
-
|
|
34
|
-
/** toSignedBlockBoundWitnessWithHashMeta constant. */
|
|
35
|
-
export const toSignedBlockBoundWitnessWithHashMeta = zodToFactory(SignedBlockBoundWitnessWithHashMetaZod, 'toSignedBlockBoundWitnessWithHashMeta')
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { PayloadBuilder, WithStorageMetaZod } from '@xyo-network/sdk-js'
|
|
5
|
-
import type { z } from 'zod'
|
|
6
|
-
|
|
7
|
-
import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
|
|
8
|
-
|
|
9
|
-
/** SignedBlockBoundWitnessWithStorageMetaZod constant. */
|
|
10
|
-
export const SignedBlockBoundWitnessWithStorageMetaZod = WithStorageMetaZod(SignedBlockBoundWitnessZod)
|
|
11
|
-
|
|
12
|
-
/** SignedBlockBoundWitnessWithStorageMeta type. */
|
|
13
|
-
export type SignedBlockBoundWitnessWithStorageMeta = z.infer<typeof SignedBlockBoundWitnessWithStorageMetaZod>
|
|
14
|
-
|
|
15
|
-
/** Type guard that checks if a value is a valid SignedBlockBoundWitnessWithStorageMeta. */
|
|
16
|
-
export const isSignedBlockBoundWitnessWithStorageMeta = zodIsFactory(SignedBlockBoundWitnessWithStorageMetaZod)
|
|
17
|
-
/** Converts a value to SignedBlockBoundWitnessWithStorageMeta, throwing if invalid. */
|
|
18
|
-
export const asSignedBlockBoundWitnessWithStorageMeta = zodAsFactory(
|
|
19
|
-
SignedBlockBoundWitnessWithStorageMetaZod,
|
|
20
|
-
'asSignedBlockBoundWitnessWithStorageMeta',
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
/** SignedBlockBoundWitnessWithStorageMetaishZod constant. */
|
|
24
|
-
export const SignedBlockBoundWitnessWithStorageMetaishZod = SignedBlockBoundWitnessZod.transform(async (data) => {
|
|
25
|
-
if (isSignedBlockBoundWitnessWithStorageMeta(data)) {
|
|
26
|
-
return data
|
|
27
|
-
}
|
|
28
|
-
if (isSignedBlockBoundWitness(data)) {
|
|
29
|
-
return await PayloadBuilder.addStorageMeta(data)
|
|
30
|
-
}
|
|
31
|
-
throw new Error('Invalid SignedBlockBoundWitnessWithStorageMetaish format')
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
/** SignedBlockBoundWitnessWithStorageMetaish type. */
|
|
35
|
-
export type SignedBlockBoundWitnessWithStorageMetaish = z.input<typeof SignedBlockBoundWitnessWithStorageMetaishZod>
|
|
36
|
-
|
|
37
|
-
/** toSignedBlockBoundWitnessWithStorageMeta constant. */
|
|
38
|
-
export const toSignedBlockBoundWitnessWithStorageMeta = zodToFactory(
|
|
39
|
-
SignedBlockBoundWitnessWithStorageMetaishZod,
|
|
40
|
-
'toSignedBlockBoundWitnessWithStorageMeta',
|
|
41
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { UnsignedBoundWitnessZod } from '@xyo-network/sdk-js'
|
|
5
|
-
import type { z } from 'zod'
|
|
6
|
-
|
|
7
|
-
import { BlockBoundWitnessFieldsZod, BlockBoundWitnessMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
-
|
|
9
|
-
/** UnsignedBlockBoundWitnessZod constant. */
|
|
10
|
-
export const UnsignedBlockBoundWitnessZod = UnsignedBoundWitnessZod
|
|
11
|
-
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
12
|
-
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
13
|
-
|
|
14
|
-
/** UnsignedBlockBoundWitness type. */
|
|
15
|
-
export type UnsignedBlockBoundWitness = z.infer<typeof UnsignedBlockBoundWitnessZod>
|
|
16
|
-
|
|
17
|
-
/** Type guard that checks if a value is a valid UnsignedBlockBoundWitness. */
|
|
18
|
-
export const isUnsignedBlockBoundWitness = zodIsFactory(UnsignedBlockBoundWitnessZod)
|
|
19
|
-
/** Converts a value to UnsignedBlockBoundWitness, throwing if invalid. */
|
|
20
|
-
export const asUnsignedBlockBoundWitness = zodAsFactory(UnsignedBlockBoundWitnessZod, 'asUnsignedBlockBoundWitness')
|
|
21
|
-
/** toUnsignedBlockBoundWitness constant. */
|
|
22
|
-
export const toUnsignedBlockBoundWitness = zodToFactory(UnsignedBlockBoundWitnessZod, 'toUnsignedBlockBoundWitness')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './UnsignedBlockBoundWitness.ts'
|
package/src/chain/Chain.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AddressRegEx, toAddress } from '@xylabs/sdk-js'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import type { ChainId } from './ChainId.ts'
|
|
5
|
-
|
|
6
|
-
/** ChainZod constant. */
|
|
7
|
-
export const ChainZod = z.string().toLowerCase().regex(AddressRegEx).transform<ChainId>(v => toAddress(v) as ChainId)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/sdk-js'
|
|
2
|
-
import type { Payload } from '@xyo-network/sdk-js'
|
|
3
|
-
|
|
4
|
-
import type { HydratedBlock } from '../block/index.ts'
|
|
5
|
-
|
|
6
|
-
/** ChainAnalyzer interface. */
|
|
7
|
-
export interface ChainAnalyzer<T extends Payload = Payload> {
|
|
8
|
-
onBlock(block: HydratedBlock): Promisable<boolean>
|
|
9
|
-
result(): T
|
|
10
|
-
shouldContinue(): boolean
|
|
11
|
-
}
|
package/src/chain/ChainId.ts
DELETED
package/src/chain/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** BlockStart interface. */
|
|
2
|
-
export interface BlockStart {
|
|
3
|
-
/**
|
|
4
|
-
* The block at which the duration starts
|
|
5
|
-
*/
|
|
6
|
-
nbf: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** BlockEnd interface. */
|
|
10
|
-
export interface BlockEnd {
|
|
11
|
-
/**
|
|
12
|
-
* The block at which the duration ends
|
|
13
|
-
*/
|
|
14
|
-
exp: number
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A optional duration referenced to block numbers
|
|
19
|
-
*/
|
|
20
|
-
export interface OptionalBlockDuration extends Partial<BlockStart>, Partial<BlockEnd> {}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* A duration referenced to block numbers
|
|
24
|
-
*/
|
|
25
|
-
export interface BlockDuration extends BlockStart, BlockEnd {}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AsObjectFactory } from '@xylabs/sdk-js'
|
|
2
|
-
import type { Payload, WithSources } from '@xyo-network/sdk-js'
|
|
3
|
-
import {
|
|
4
|
-
asSchema,
|
|
5
|
-
isPayloadOfSchemaType,
|
|
6
|
-
isPayloadOfSchemaTypeWithSources,
|
|
7
|
-
} from '@xyo-network/sdk-js'
|
|
8
|
-
|
|
9
|
-
import type { XL1BlockNumber } from '../BlockNumber/index.ts'
|
|
10
|
-
|
|
11
|
-
/** Schema identifier for BlockNumber payloads. */
|
|
12
|
-
export const BlockNumberSchema = asSchema('network.xyo.chain.block.number', true)
|
|
13
|
-
/** Schema type for BlockNumber payloads. */
|
|
14
|
-
export type BlockNumberSchema = typeof BlockNumberSchema
|
|
15
|
-
|
|
16
|
-
/** BlockNumberFields interface. */
|
|
17
|
-
export interface BlockNumberFields {
|
|
18
|
-
/**
|
|
19
|
-
* The block number
|
|
20
|
-
*/
|
|
21
|
-
block: XL1BlockNumber
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The number of a block
|
|
25
|
-
*/
|
|
26
|
-
export type BlockNumberPayload = Payload<BlockNumberFields, BlockNumberSchema>
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Identity function for determining if an object is a BlockNumber
|
|
30
|
-
*/
|
|
31
|
-
export const isBlockNumberPayload = isPayloadOfSchemaType<BlockNumberPayload>(BlockNumberSchema)
|
|
32
|
-
/** Converts a value to BlockNumberPayload, throwing if invalid. */
|
|
33
|
-
export const asBlockNumberPayload = AsObjectFactory.create<BlockNumberPayload>(isBlockNumberPayload)
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Identity function for determining if an object is a BlockNumber with sources
|
|
37
|
-
*/
|
|
38
|
-
export const isBlockNumberPayloadWithSources = isPayloadOfSchemaTypeWithSources<BlockNumberPayload>(BlockNumberSchema)
|
|
39
|
-
/** Converts a value to BlockNumberPayloadWithSources, throwing if invalid. */
|
|
40
|
-
export const asBlockNumberPayloadWithSources = AsObjectFactory.create<WithSources<BlockNumberPayload>>(isBlockNumberPayloadWithSources)
|
package/src/fields/index.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './amount/index.ts'
|
|
2
|
-
export * from './block/index.ts'
|
|
3
|
-
export * from './BlockNumber/index.ts'
|
|
4
|
-
export * from './chain/index.ts'
|
|
5
|
-
export * from './fields/index.ts'
|
|
6
|
-
export * from './map/index.ts'
|
|
7
|
-
export * from './model/index.ts'
|
|
8
|
-
export * from './payload/index.ts'
|
|
9
|
-
export * from './provider/index.ts'
|
|
10
|
-
export * from './RecordKeyType.ts'
|
|
11
|
-
export * from './Step/index.ts'
|
|
12
|
-
export * from './transaction/index.ts'
|
|
13
|
-
export * from './TransferPayload.ts'
|
|
14
|
-
export * from './xl1/index.ts'
|
package/src/map/AsyncMap.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
|
-
/** AsyncMapRead interface. */
|
|
4
|
-
export interface AsyncMapRead<K, V> {
|
|
5
|
-
get(id: K): Promisable<V | undefined>
|
|
6
|
-
getMany(id: K[]): Promisable<V[]>
|
|
7
|
-
has(id: K): Promisable<boolean>
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use AsyncMapRead instead
|
|
11
|
-
*/
|
|
12
|
-
export interface AsynchronousMapRead<K, V> extends AsyncMapRead<K, V> {}
|
|
13
|
-
|
|
14
|
-
/** AsyncMapWrite interface. */
|
|
15
|
-
export interface AsyncMapWrite<K, V> {
|
|
16
|
-
clear(): Promisable<void>
|
|
17
|
-
delete(id: K): Promisable<boolean>
|
|
18
|
-
set(id: K, data: V): Promisable<K | undefined | void>
|
|
19
|
-
setMany(entries: [K, V][]): Promisable<K[] | void>
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use AsyncMapWrite instead
|
|
23
|
-
*/
|
|
24
|
-
export interface AsynchronousMapWrite<K, V> extends AsyncMapWrite<K, V> {}
|
|
25
|
-
|
|
26
|
-
/** AsyncMap interface. */
|
|
27
|
-
export interface AsyncMap<K, V> extends AsyncMapRead<K, V>, AsyncMapWrite<K, V> {}
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use AsyncMap instead
|
|
30
|
-
*/
|
|
31
|
-
export interface AsynchronousMap<K, V> extends AsyncMap<K, V> {}
|
|
32
|
-
|
|
33
|
-
/** AsyncIterableMapRead interface. */
|
|
34
|
-
export interface AsyncIterableMapRead<K, V>extends AsyncMapRead<K, V>, AsyncIterable<[K, V]> {}
|
|
35
|
-
/** AsyncIterableMapWrite interface. */
|
|
36
|
-
export interface AsyncIterableMapWrite<K, V>extends AsyncMapWrite<K, V>, AsyncIterable<[K, V]> {}
|
|
37
|
-
/** AsyncIterableMap interface. */
|
|
38
|
-
export interface AsyncIterableMap<K, V>extends AsyncMap<K, V>, AsyncIterable<[K, V]> {}
|
package/src/map/MapType.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AsyncIterableMap, AsyncIterableMapRead, AsyncIterableMapWrite, AsyncMap, AsyncMapRead, AsyncMapWrite,
|
|
3
|
-
} from './AsyncMap.ts'
|
|
4
|
-
import type {
|
|
5
|
-
SyncIterableMap, SyncIterableMapRead, SyncIterableMapWrite, SyncMap, SyncMapRead, SyncMapWrite,
|
|
6
|
-
} from './SyncMap.ts'
|
|
7
|
-
|
|
8
|
-
/** MapType type. */
|
|
9
|
-
export type MapType<TId, TData> = SyncMap<TId, TData> | AsyncMap<TId, TData>
|
|
10
|
-
|
|
11
|
-
/** MapTypeRead type. */
|
|
12
|
-
export type MapTypeRead<TId, TData> = SyncMapRead<TId, TData> | AsyncMapRead<TId, TData>
|
|
13
|
-
|
|
14
|
-
/** MapTypeWrite type. */
|
|
15
|
-
export type MapTypeWrite<TId, TData> = SyncMapWrite<TId, TData> | AsyncMapWrite<TId, TData>
|
|
16
|
-
|
|
17
|
-
/** AsynchronousMapType type. */
|
|
18
|
-
export type AsynchronousMapType<TId, TData> = AsyncMapRead<TId, TData> & AsyncMapWrite<TId, TData>
|
|
19
|
-
|
|
20
|
-
/** IterableMapRead type. */
|
|
21
|
-
export type IterableMapRead<TId, TData> = SyncIterableMapRead<TId, TData> | AsyncIterableMapRead<TId, TData>
|
|
22
|
-
|
|
23
|
-
/** IterableMapWrite type. */
|
|
24
|
-
export type IterableMapWrite<TId, TData> = SyncIterableMapWrite<TId, TData> | AsyncIterableMapWrite<TId, TData>
|
|
25
|
-
|
|
26
|
-
/** IterableMap type. */
|
|
27
|
-
export type IterableMap<TId, TData> = SyncIterableMap<TId, TData> | AsyncIterableMap<TId, TData>
|
package/src/map/SyncMap.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/** SyncMapRead interface. */
|
|
2
|
-
export interface SyncMapRead<K, V> {
|
|
3
|
-
get(id: K): V | undefined
|
|
4
|
-
getMany(id: K[]): V[]
|
|
5
|
-
has(id: K): boolean
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use SyncMapRead instead
|
|
10
|
-
*/
|
|
11
|
-
export interface SynchronousMapRead<K, V> extends SyncMapRead<K, V> {}
|
|
12
|
-
|
|
13
|
-
/** SyncMapWrite interface. */
|
|
14
|
-
export interface SyncMapWrite<K, V> {
|
|
15
|
-
clear(): void
|
|
16
|
-
delete(id: K): boolean
|
|
17
|
-
set(id: K, data: V): K | undefined | void
|
|
18
|
-
setMany(entries: [K, V][]): K[] | void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use SyncMapWrite instead
|
|
23
|
-
*/
|
|
24
|
-
export interface SynchronousMapWrite<K, V> extends SyncMapWrite<K, V> {}
|
|
25
|
-
|
|
26
|
-
/** SyncMap interface. */
|
|
27
|
-
export interface SyncMap<K, V> extends SyncMapRead<K, V>, SyncMapWrite<K, V> {}
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use SyncMap instead
|
|
30
|
-
*/
|
|
31
|
-
export interface SynchronousMap<K, V> extends SyncMap<K, V> {}
|
|
32
|
-
|
|
33
|
-
/** SyncIterableMapRead interface. */
|
|
34
|
-
export interface SyncIterableMapRead<K, V> extends SyncMapRead<K, V>, Iterable<[K, V]> {}
|
|
35
|
-
/** SyncIterableMapWrite interface. */
|
|
36
|
-
export interface SyncIterableMapWrite<K, V> extends SyncMapWrite<K, V>, Iterable<[K, V]> {}
|
|
37
|
-
/** SyncIterableMap interface. */
|
|
38
|
-
export interface SyncIterableMap<K, V> extends SyncMap<K, V>, Iterable<[K, V]> {}
|
package/src/map/index.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { type Address, type Promisable } from '@xylabs/sdk-js'
|
|
2
|
-
import { zodIsFactory } from '@xylabs/sdk-js'
|
|
3
|
-
import { WithHashMetaZod } from '@xyo-network/sdk-js'
|
|
4
|
-
import { z } from 'zod'
|
|
5
|
-
|
|
6
|
-
import { BlockBoundWitnessZod } from '../block/index.ts'
|
|
7
|
-
import type { Provider } from '../provider/index.ts'
|
|
8
|
-
import { TransactionBoundWitnessZod } from '../transaction/index.ts'
|
|
9
|
-
import { TransferZod } from '../TransferPayload.ts'
|
|
10
|
-
import type { AttoXL1 } from '../xl1/index.ts'
|
|
11
|
-
import type { ChainQualified } from './ChainQualification.ts'
|
|
12
|
-
import { ChainQualificationZod, ChainQualifiedConfigZod } from './ChainQualification.ts'
|
|
13
|
-
|
|
14
|
-
/** AccountBalanceHistoryItemZod constant. */
|
|
15
|
-
export const AccountBalanceHistoryItemZod = z.tuple([
|
|
16
|
-
WithHashMetaZod(BlockBoundWitnessZod),
|
|
17
|
-
WithHashMetaZod(TransactionBoundWitnessZod).nullable(),
|
|
18
|
-
WithHashMetaZod(TransferZod),
|
|
19
|
-
])
|
|
20
|
-
|
|
21
|
-
/** AccountBalanceHistoryItem type. */
|
|
22
|
-
export type AccountBalanceHistoryItem = z.infer<typeof AccountBalanceHistoryItemZod>
|
|
23
|
-
|
|
24
|
-
/** AccountBalanceQualificationZod constant. */
|
|
25
|
-
export const AccountBalanceQualificationZod = ChainQualificationZod
|
|
26
|
-
/** AccountBalanceQualification type. */
|
|
27
|
-
export type AccountBalanceQualification = z.infer<typeof AccountBalanceQualificationZod>
|
|
28
|
-
/** Type guard that checks if a value is a valid AccountBalanceQualification. */
|
|
29
|
-
export const isAccountBalanceQualification = zodIsFactory(AccountBalanceQualificationZod)
|
|
30
|
-
|
|
31
|
-
/** AccountBalanceConfigZod constant. */
|
|
32
|
-
export const AccountBalanceConfigZod = ChainQualifiedConfigZod
|
|
33
|
-
/** AccountBalanceConfig type. */
|
|
34
|
-
export type AccountBalanceConfig = z.infer<typeof AccountBalanceConfigZod>
|
|
35
|
-
/** Type guard that checks if a value is a valid AccountBalanceConfig. */
|
|
36
|
-
export const isAccountBalanceConfig = zodIsFactory(AccountBalanceConfigZod)
|
|
37
|
-
|
|
38
|
-
/** AccountBalanceViewerMethods interface. */
|
|
39
|
-
export interface AccountBalanceViewerMethods {
|
|
40
|
-
qualifiedAccountBalanceHistories(
|
|
41
|
-
address: Address[],
|
|
42
|
-
config: AccountBalanceConfig
|
|
43
|
-
): Promisable<ChainQualified<Record<Address, AccountBalanceHistoryItem[]>>>
|
|
44
|
-
qualifiedAccountBalances(address: Address[], config: AccountBalanceConfig): Promisable<ChainQualified<Record<Address, AttoXL1>>>
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Viewer interface for reading AccountBalance data. */
|
|
48
|
-
export interface AccountBalanceViewer extends AccountBalanceViewerMethods, Provider<AccountBalanceViewerMoniker> {
|
|
49
|
-
accountBalance(address: Address, config?: AccountBalanceConfig): Promisable<AttoXL1>
|
|
50
|
-
accountBalanceHistories(address: Address[], config?: AccountBalanceConfig): Promisable<Record<Address, AccountBalanceHistoryItem[]>>
|
|
51
|
-
accountBalanceHistory(address: Address, config?: AccountBalanceConfig): Promisable<AccountBalanceHistoryItem[]>
|
|
52
|
-
accountBalances(address: Address[], config?: AccountBalanceConfig): Promisable<Record<Address, AttoXL1>>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Moniker identifier for the AccountBalanceViewer provider. */
|
|
56
|
-
export const AccountBalanceViewerMoniker = 'AccountBalanceViewer' as const
|
|
57
|
-
/** Type literal for the AccountBalanceViewer provider moniker. */
|
|
58
|
-
export type AccountBalanceViewerMoniker = typeof AccountBalanceViewerMoniker
|
package/src/model/ArrayBuffer.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
function base64Encode(u8: Uint8Array): string {
|
|
4
|
-
// Node
|
|
5
|
-
if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {
|
|
6
|
-
return Buffer.from(u8).toString('base64')
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Browser
|
|
10
|
-
let binary = ''
|
|
11
|
-
const chunk = 0x80_00
|
|
12
|
-
for (let i = 0; i < u8.length; i += chunk) {
|
|
13
|
-
// eslint-disable-next-line unicorn/prefer-code-point
|
|
14
|
-
binary += String.fromCharCode(...u8.subarray(i, i + chunk))
|
|
15
|
-
}
|
|
16
|
-
return btoa(binary)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** Base64 decode that works in Node and browsers -> Uint8Array */
|
|
20
|
-
function base64Decode(b64: string): Uint8Array {
|
|
21
|
-
// Node
|
|
22
|
-
if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {
|
|
23
|
-
return new Uint8Array(Buffer.from(b64, 'base64'))
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Browser
|
|
27
|
-
const binary = atob(b64)
|
|
28
|
-
const u8 = new Uint8Array(binary.length)
|
|
29
|
-
// eslint-disable-next-line unicorn/prefer-code-point
|
|
30
|
-
for (let i = 0; i < binary.length; i++) u8[i] = binary.charCodeAt(i)
|
|
31
|
-
return u8
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** ArrayBufferToJsonZod constant. */
|
|
35
|
-
export const ArrayBufferToJsonZod = z.instanceof(ArrayBuffer).transform((x) => {
|
|
36
|
-
const u8 = new Uint8Array(x)
|
|
37
|
-
return base64Encode(u8)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
/** JsonToArrayBufferZod constant. */
|
|
41
|
-
export const JsonToArrayBufferZod = z.string().transform((x) => {
|
|
42
|
-
const u8 = base64Decode(x)
|
|
43
|
-
return u8.buffer
|
|
44
|
-
})
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AssertConfig, Brand } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
assertError,
|
|
4
|
-
isDefined, zodAsFactory, zodToFactory,
|
|
5
|
-
} from '@xylabs/sdk-js'
|
|
6
|
-
import { z } from 'zod'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
asBlockNumber,
|
|
10
|
-
type BlockNumber, BlockNumberishZod, BlockNumberZod,
|
|
11
|
-
} from '../../BlockNumber/index.ts'
|
|
12
|
-
|
|
13
|
-
/** BlockRange type. */
|
|
14
|
-
export type BlockRange = [BlockNumber, BlockNumber]
|
|
15
|
-
|
|
16
|
-
/** BlockRangeZod constant. */
|
|
17
|
-
export const BlockRangeZod = z.tuple([BlockNumberZod, BlockNumberZod])
|
|
18
|
-
/** BlockRangeishZod constant. */
|
|
19
|
-
export const BlockRangeishZod = z.tuple([BlockNumberishZod, BlockNumberishZod])
|
|
20
|
-
|
|
21
|
-
/** BlockRangeish type. */
|
|
22
|
-
export type BlockRangeish = z.input<typeof BlockRangeishZod>
|
|
23
|
-
|
|
24
|
-
/** Converts a value to BlockRange, throwing if invalid. */
|
|
25
|
-
export const asBlockRange = zodAsFactory<BlockRange>(BlockRangeZod, 'BlockRange')
|
|
26
|
-
/** toBlockRange constant. */
|
|
27
|
-
export const toBlockRange = zodToFactory<BlockRange>(BlockRangeishZod, 'BlockRange')
|
|
28
|
-
|
|
29
|
-
/** BlockRangeKey type. */
|
|
30
|
-
export type BlockRangeKey = Brand<string, { readonly __blockRangeKey: true }>
|
|
31
|
-
/** toBlockNumberKey constant. */
|
|
32
|
-
export const toBlockNumberKey = (range: BlockRange) => `${range[0]}|${range[1]}` as BlockRangeKey
|
|
33
|
-
|
|
34
|
-
/** Creates a value from BlockNumberKey input. */
|
|
35
|
-
export function fromBlockNumberKey(key: BlockRangeKey): BlockRange | undefined
|
|
36
|
-
/** Creates a value from BlockNumberKey input. */
|
|
37
|
-
export function fromBlockNumberKey(key: BlockRangeKey, assert: AssertConfig): BlockRange
|
|
38
|
-
/** Creates a value from BlockNumberKey input. */
|
|
39
|
-
export function fromBlockNumberKey(key: BlockRangeKey, assert?: AssertConfig): BlockRange | undefined {
|
|
40
|
-
const [start, end] = key.split('|').map(v => asBlockNumber(Number(v)))
|
|
41
|
-
const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
|
|
42
|
-
return assertError(result, assert, `Invalid BlockRangeKey: ${key}`)
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AssertConfig, Brand } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
assertError,
|
|
4
|
-
isDefined, zodAsFactory, zodToFactory,
|
|
5
|
-
} from '@xylabs/sdk-js'
|
|
6
|
-
import { z } from 'zod'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
asEthBlockNumber,
|
|
10
|
-
type EthBlockNumber, EthBlockNumberishZod, EthBlockNumberZod,
|
|
11
|
-
} from '../../BlockNumber/index.ts'
|
|
12
|
-
|
|
13
|
-
/** EthBlockRange type. */
|
|
14
|
-
export type EthBlockRange = [EthBlockNumber, EthBlockNumber]
|
|
15
|
-
|
|
16
|
-
/** EthBlockRangeZod constant. */
|
|
17
|
-
export const EthBlockRangeZod = z.tuple([EthBlockNumberZod, EthBlockNumberZod])
|
|
18
|
-
/** EthBlockRangeishZod constant. */
|
|
19
|
-
export const EthBlockRangeishZod = z.tuple([EthBlockNumberishZod, EthBlockNumberishZod])
|
|
20
|
-
|
|
21
|
-
/** EthBlockRangeish type. */
|
|
22
|
-
export type EthBlockRangeish = z.input<typeof EthBlockRangeishZod>
|
|
23
|
-
|
|
24
|
-
/** Converts a value to EthBlockRange, throwing if invalid. */
|
|
25
|
-
export const asEthBlockRange = zodAsFactory<EthBlockRange>(EthBlockRangeZod, 'EthBlockRange')
|
|
26
|
-
/** toEthBlockRange constant. */
|
|
27
|
-
export const toEthBlockRange = zodToFactory<EthBlockRange>(EthBlockRangeishZod, 'EthBlockRange')
|
|
28
|
-
|
|
29
|
-
/** EthBlockRangeKey type. */
|
|
30
|
-
export type EthBlockRangeKey = Brand<string, { readonly __ethBlockRangeKey: true }>
|
|
31
|
-
/** toEthBlockNumberKey constant. */
|
|
32
|
-
export const toEthBlockNumberKey = (range: EthBlockRange) => `${range[0]}|${range[1]}` as EthBlockRangeKey
|
|
33
|
-
|
|
34
|
-
/** Creates a value from EthBlockNumberKey input. */
|
|
35
|
-
export function fromEthBlockNumberKey(key: EthBlockRangeKey): EthBlockRange | undefined
|
|
36
|
-
/** Creates a value from EthBlockNumberKey input. */
|
|
37
|
-
export function fromEthBlockNumberKey(key: EthBlockRangeKey, assert: AssertConfig): EthBlockRange
|
|
38
|
-
/** Creates a value from EthBlockNumberKey input. */
|
|
39
|
-
export function fromEthBlockNumberKey(key: EthBlockRangeKey, assert?: AssertConfig): EthBlockRange | undefined {
|
|
40
|
-
const [start, end] = key.split('|').map(v => asEthBlockNumber(Number(v)))
|
|
41
|
-
const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
|
|
42
|
-
return assertError(result, assert, `Invalid EthBlockRangeKey: ${key}`)
|
|
43
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { z } from 'zod'
|
|
5
|
-
|
|
6
|
-
/** RangeZod constant. */
|
|
7
|
-
export const RangeZod = z.tuple([z.number(), z.number()])
|
|
8
|
-
|
|
9
|
-
/** Range type. */
|
|
10
|
-
export type Range = z.infer<typeof RangeZod>
|
|
11
|
-
|
|
12
|
-
/** Type guard that checks if a value is a valid Range. */
|
|
13
|
-
export const isRange = zodIsFactory<Range>(RangeZod)
|
|
14
|
-
/** Converts a value to Range, throwing if invalid. */
|
|
15
|
-
export const asRange = zodAsFactory<Range>(RangeZod, 'Range')
|
|
16
|
-
/** toRange constant. */
|
|
17
|
-
export const toRange = zodToFactory<Range>(RangeZod, 'Range')
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AssertConfig, Brand } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
assertError,
|
|
4
|
-
isDefined, zodAsFactory, zodToFactory,
|
|
5
|
-
} from '@xylabs/sdk-js'
|
|
6
|
-
import { z } from 'zod'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
asXL1BlockNumber,
|
|
10
|
-
type XL1BlockNumber, XL1BlockNumberishZod, XL1BlockNumberZod,
|
|
11
|
-
} from '../../BlockNumber/index.ts'
|
|
12
|
-
|
|
13
|
-
/** XL1BlockRange type. */
|
|
14
|
-
export type XL1BlockRange = [XL1BlockNumber, XL1BlockNumber]
|
|
15
|
-
|
|
16
|
-
/** XL1BlockRangeZod constant. */
|
|
17
|
-
export const XL1BlockRangeZod = z.tuple([XL1BlockNumberZod, XL1BlockNumberZod])
|
|
18
|
-
/** XL1BlockRangeishZod constant. */
|
|
19
|
-
export const XL1BlockRangeishZod = z.tuple([XL1BlockNumberishZod, XL1BlockNumberishZod])
|
|
20
|
-
|
|
21
|
-
/** XL1BlockRangeish type. */
|
|
22
|
-
export type XL1BlockRangeish = z.input<typeof XL1BlockRangeishZod>
|
|
23
|
-
|
|
24
|
-
/** Converts a value to XL1BlockRange, throwing if invalid. */
|
|
25
|
-
export const asXL1BlockRange = zodAsFactory<XL1BlockRange>(XL1BlockRangeZod, 'XL1BlockRange')
|
|
26
|
-
/** toXL1BlockRange constant. */
|
|
27
|
-
export const toXL1BlockRange = zodToFactory<XL1BlockRange>(XL1BlockRangeishZod, 'XL1BlockRange')
|
|
28
|
-
|
|
29
|
-
/** XL1BlockRangeKey type. */
|
|
30
|
-
export type XL1BlockRangeKey = Brand<string, { readonly __xl1BlockRangeKey: true }>
|
|
31
|
-
/** toXL1BlockNumberKey constant. */
|
|
32
|
-
export const toXL1BlockNumberKey = (range: XL1BlockRange) => `${range[0]}|${range[1]}` as XL1BlockRangeKey
|
|
33
|
-
|
|
34
|
-
/** Creates a value from XL1BlockNumberKey input. */
|
|
35
|
-
export function fromXL1BlockNumberKey(key: XL1BlockRangeKey): XL1BlockRange | undefined
|
|
36
|
-
/** Creates a value from XL1BlockNumberKey input. */
|
|
37
|
-
export function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert: AssertConfig): XL1BlockRange
|
|
38
|
-
/** Creates a value from XL1BlockNumberKey input. */
|
|
39
|
-
export function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert?: AssertConfig): XL1BlockRange | undefined {
|
|
40
|
-
const [start, end] = key.split('|').map(v => asXL1BlockNumber(Number(v)))
|
|
41
|
-
const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
|
|
42
|
-
return assertError(result, assert, `Invalid XL1BlockRangeKey: ${key}`)
|
|
43
|
-
}
|