@xyo-network/xl1-rpc 1.14.0 → 1.14.2
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/engine/rpcEngineFromProvider.d.ts +2 -2
- package/dist/neutral/engine/rpcEngineFromProvider.d.ts.map +1 -1
- package/dist/neutral/engine/rpcMethodHandlersFromProvider.d.ts +2 -2
- package/dist/neutral/engine/rpcMethodHandlersFromProvider.d.ts.map +1 -1
- package/dist/neutral/engine/rpcMethodHandlersFromViewer.d.ts.map +1 -1
- package/dist/neutral/index.mjs +209 -107
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/connection/HttpRpcXyoConnection.d.ts +4 -4
- package/dist/neutral/provider/connection/HttpRpcXyoConnection.d.ts.map +1 -1
- package/dist/neutral/provider/connection/{XyoConnection.d.ts → XyoBaseConnection.d.ts} +5 -5
- package/dist/neutral/provider/connection/XyoBaseConnection.d.ts.map +1 -0
- package/dist/neutral/provider/connection/index.d.ts +1 -1
- package/dist/neutral/provider/connection/index.d.ts.map +1 -1
- package/dist/neutral/provider/datalake/AbstractXyoDataLake.d.ts +2 -2
- package/dist/neutral/provider/datalake/AbstractXyoDataLake.d.ts.map +1 -1
- package/dist/neutral/provider/gateway/Abstract.d.ts +2 -2
- package/dist/neutral/provider/gateway/Abstract.d.ts.map +1 -1
- package/dist/neutral/provider/gateway/MemoryXyoGateway.d.ts +3 -3
- package/dist/neutral/provider/gateway/MemoryXyoGateway.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +9 -4
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/types/XyoProviderRpc.d.ts +3 -3
- package/dist/neutral/types/XyoProviderRpc.d.ts.map +1 -1
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts +262 -6
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts +1 -5
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +261 -1
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/common/Stake.d.ts +119 -0
- package/dist/neutral/types/schema/common/Stake.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/TransactionFees.d.ts +5 -1
- package/dist/neutral/types/schema/common/TransactionFees.d.ts.map +1 -1
- package/dist/neutral/types/schema/common/index.d.ts +1 -1
- package/dist/neutral/types/schema/common/index.d.ts.map +1 -1
- package/dist/node/engine/rpcEngineFromProvider.d.ts +2 -2
- package/dist/node/engine/rpcEngineFromProvider.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromProvider.d.ts +2 -2
- package/dist/node/engine/rpcMethodHandlersFromProvider.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromViewer.d.ts.map +1 -1
- package/dist/node/index-node.mjs +209 -107
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/connection/HttpRpcXyoConnection.d.ts +4 -4
- package/dist/node/provider/connection/HttpRpcXyoConnection.d.ts.map +1 -1
- package/dist/node/provider/connection/{XyoConnection.d.ts → XyoBaseConnection.d.ts} +5 -5
- package/dist/node/provider/connection/XyoBaseConnection.d.ts.map +1 -0
- package/dist/node/provider/connection/index.d.ts +1 -1
- package/dist/node/provider/connection/index.d.ts.map +1 -1
- package/dist/node/provider/datalake/AbstractXyoDataLake.d.ts +2 -2
- package/dist/node/provider/datalake/AbstractXyoDataLake.d.ts.map +1 -1
- package/dist/node/provider/gateway/Abstract.d.ts +2 -2
- package/dist/node/provider/gateway/Abstract.d.ts.map +1 -1
- package/dist/node/provider/gateway/MemoryXyoGateway.d.ts +3 -3
- package/dist/node/provider/gateway/MemoryXyoGateway.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +9 -4
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/types/XyoProviderRpc.d.ts +3 -3
- package/dist/node/types/XyoProviderRpc.d.ts.map +1 -1
- package/dist/node/types/schema/AllRpcSchemas.d.ts +262 -6
- package/dist/node/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts +1 -5
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +261 -1
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/common/Stake.d.ts +119 -0
- package/dist/node/types/schema/common/Stake.d.ts.map +1 -0
- package/dist/node/types/schema/common/TransactionFees.d.ts +5 -1
- package/dist/node/types/schema/common/TransactionFees.d.ts.map +1 -1
- package/dist/node/types/schema/common/index.d.ts +1 -1
- package/dist/node/types/schema/common/index.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/engine/rpcEngineFromProvider.ts +2 -2
- package/src/engine/rpcMethodHandlersFromProvider.ts +3 -3
- package/src/engine/rpcMethodHandlersFromViewer.ts +5 -1
- package/src/provider/client/spec/MemoryXyoClient.spec.ts +2 -2
- package/src/provider/connection/HttpRpcXyoConnection.ts +4 -4
- package/src/provider/connection/{XyoConnection.ts → XyoBaseConnection.ts} +5 -5
- package/src/provider/connection/index.ts +1 -1
- package/src/provider/connection/spec/XyoConnection.ts +4 -4
- package/src/provider/datalake/AbstractXyoDataLake.ts +2 -2
- package/src/provider/gateway/Abstract.ts +2 -2
- package/src/provider/gateway/MemoryXyoGateway.ts +4 -4
- package/src/provider/signer/spec/RpcEngineXyoSigner.spec.ts +2 -2
- package/src/provider/viewer/JsonRpcXyoViewer.ts +30 -9
- package/src/types/XyoProviderRpc.ts +4 -4
- package/src/types/schema/XyoSignerRpcSchemas.ts +1 -2
- package/src/types/schema/XyoViewerRpcSchemas.ts +43 -1
- package/src/types/schema/common/Stake.ts +43 -0
- package/src/types/schema/common/TransactionFees.ts +4 -2
- package/src/types/schema/common/index.ts +1 -1
- package/dist/neutral/provider/connection/XyoConnection.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/AllowedBlockPayload.d.ts +0 -11
- package/dist/neutral/types/schema/common/AllowedBlockPayload.d.ts.map +0 -1
- package/dist/node/provider/connection/XyoConnection.d.ts.map +0 -1
- package/dist/node/types/schema/common/AllowedBlockPayload.d.ts +0 -11
- package/dist/node/types/schema/common/AllowedBlockPayload.d.ts.map +0 -1
- package/src/types/schema/common/AllowedBlockPayload.ts +0 -16
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './HttpRpcXyoConnection.ts'
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './XyoBaseConnection.ts'
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { toAddress } from '@xylabs/hex'
|
|
2
2
|
import { Account } from '@xyo-network/account'
|
|
3
|
-
import type {
|
|
3
|
+
import type { XyoConnection } from '@xyo-network/xl1-protocol'
|
|
4
4
|
import {
|
|
5
5
|
beforeAll, describe, expect, it,
|
|
6
6
|
} from 'vitest'
|
|
7
7
|
|
|
8
8
|
import { MemoryXyoRunner } from '../../runner/index.ts'
|
|
9
9
|
import { MemoryXyoSigner } from '../../signer/index.ts'
|
|
10
|
-
import {
|
|
10
|
+
import { XyoBaseConnection } from '../XyoBaseConnection.ts'
|
|
11
11
|
|
|
12
12
|
describe('RpcEngine - XyoProvider', () => {
|
|
13
13
|
const chain = toAddress('2AAE728aFd1777b79c34D79c4523797F9D9965b0')
|
|
14
|
-
let sut:
|
|
14
|
+
let sut: XyoConnection
|
|
15
15
|
beforeAll(async () => {
|
|
16
16
|
const account = await Account.random()
|
|
17
17
|
const runner = new MemoryXyoRunner()
|
|
18
18
|
const signer = new MemoryXyoSigner(account)
|
|
19
|
-
sut = new
|
|
19
|
+
sut = new XyoBaseConnection({ runner, signer })
|
|
20
20
|
})
|
|
21
21
|
it('should submit transaction', async () => {
|
|
22
22
|
// eslint-disable-next-line sonarjs/deprecation
|
|
@@ -6,10 +6,10 @@ import { isAnyPayload } from '@xyo-network/payload-model'
|
|
|
6
6
|
import {
|
|
7
7
|
type DataLakeData,
|
|
8
8
|
isHashPayload,
|
|
9
|
-
type
|
|
9
|
+
type XyoDataLake,
|
|
10
10
|
} from '@xyo-network/xl1-protocol'
|
|
11
11
|
|
|
12
|
-
export abstract class AbstractXyoDataLake implements
|
|
12
|
+
export abstract class AbstractXyoDataLake implements XyoDataLake {
|
|
13
13
|
async fetch(hashes: Hash[], maxDepth: number = 10): Promise<DataLakeData[]> {
|
|
14
14
|
const results: DataLakeData[] = await this.get(hashes)
|
|
15
15
|
if (maxDepth > 0) {
|
|
@@ -6,7 +6,7 @@ import type { Payload } from '@xyo-network/payload-model'
|
|
|
6
6
|
import type {
|
|
7
7
|
AllowedBlockPayload,
|
|
8
8
|
SignedHydratedTransaction,
|
|
9
|
-
|
|
9
|
+
XyoConnection, XyoGatewayProvider, XyoSigner,
|
|
10
10
|
} from '@xyo-network/xl1-protocol'
|
|
11
11
|
import { buildUnsignedTransaction } from '@xyo-network/xl1-protocol-sdk'
|
|
12
12
|
|
|
@@ -43,6 +43,6 @@ export abstract class AbstractXyoGateway implements XyoGatewayProvider {
|
|
|
43
43
|
return assertEx(tx, () => 'Transaction submission failed')
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
abstract connection(): Promisable<
|
|
46
|
+
abstract connection(): Promisable<XyoConnection>
|
|
47
47
|
abstract signer(): Promisable<XyoSigner>
|
|
48
48
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { XyoConnection, XyoSigner } from '@xyo-network/xl1-protocol'
|
|
2
2
|
|
|
3
3
|
import { AbstractXyoGateway } from './Abstract.ts'
|
|
4
4
|
|
|
5
5
|
export class MemoryXyoGateway extends AbstractXyoGateway {
|
|
6
|
-
private readonly _connection:
|
|
6
|
+
private readonly _connection: XyoConnection
|
|
7
7
|
private readonly _signer: XyoSigner
|
|
8
8
|
|
|
9
|
-
constructor(signer: XyoSigner, connection:
|
|
9
|
+
constructor(signer: XyoSigner, connection: XyoConnection) {
|
|
10
10
|
super()
|
|
11
11
|
this._signer = signer
|
|
12
12
|
this._connection = connection
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
connection():
|
|
15
|
+
connection(): XyoConnection {
|
|
16
16
|
return this._connection
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { rpcEngineFromProvider } from '../../../engine/index-node.ts'
|
|
11
11
|
import { XyoSignerRpcSchemas } from '../../../index-node.ts'
|
|
12
12
|
import { MemoryRpcTransport } from '../../../transport/index.ts'
|
|
13
|
-
import {
|
|
13
|
+
import { XyoBaseConnection } from '../../connection/index.ts'
|
|
14
14
|
import { RpcXyoSigner } from '../JsonRpcXyoSigner.ts'
|
|
15
15
|
import { MemoryXyoSigner } from '../MemoryXyoSigner.ts'
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ describe('RpcEngine - XyoSigner', () => {
|
|
|
20
20
|
beforeAll(async () => {
|
|
21
21
|
const account = await Account.random()
|
|
22
22
|
const signer = new MemoryXyoSigner(account)
|
|
23
|
-
const provider = new
|
|
23
|
+
const provider = new XyoBaseConnection({ signer })
|
|
24
24
|
const engine = rpcEngineFromProvider(provider)
|
|
25
25
|
const transport = new MemoryRpcTransport(engine, XyoSignerRpcSchemas)
|
|
26
26
|
sut = new RpcXyoSigner(transport)
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { Address, Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import {
|
|
4
|
+
asAttoXL1,
|
|
5
|
+
type AttoXL1,
|
|
6
|
+
type ForkHistory,
|
|
7
|
+
type HydratedBlock, type SignedHydratedTransaction,
|
|
8
|
+
type Stake,
|
|
9
|
+
type Transfer,
|
|
10
|
+
type XyoViewer,
|
|
6
11
|
} from '@xyo-network/xl1-protocol'
|
|
7
12
|
|
|
8
13
|
import type { RpcTransport } from '../../transport/index.ts'
|
|
@@ -14,12 +19,12 @@ export class JsonRpcXyoViewer implements XyoViewer {
|
|
|
14
19
|
this.transport = transport
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
async accountBalance(address: Address): Promise<
|
|
18
|
-
return await this.transport.sendRequest('xyoViewer_accountBalance', [address])
|
|
22
|
+
async accountBalance(address: Address): Promise<AttoXL1> {
|
|
23
|
+
return asAttoXL1(await this.transport.sendRequest('xyoViewer_accountBalance', [address]))
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
async
|
|
22
|
-
return (await this.transport.sendRequest('
|
|
26
|
+
async accountBalanceHistory(address: Address): Promise<[Hash, Hash, Transfer][]> {
|
|
27
|
+
return (await this.transport.sendRequest('xyoViewer_accountBalanceHistory', [address])) as [Hash, Hash, Transfer][]
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
async blockByHash(hash: Hash): Promise<HydratedBlock | null> {
|
|
@@ -38,6 +43,10 @@ export class JsonRpcXyoViewer implements XyoViewer {
|
|
|
38
43
|
return await this.transport.sendRequest('xyoViewer_chainId')
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
async chainIdAtBlock(blockNumber: number): Promise<Address> {
|
|
47
|
+
return (await this.transport.sendRequest('xyoViewer_chainIdAtBlock', [blockNumber])) as Address
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
async currentBlock(): Promise<HydratedBlock> {
|
|
42
51
|
return (await this.transport.sendRequest('xyoViewer_currentBlock')) as HydratedBlock
|
|
43
52
|
}
|
|
@@ -50,6 +59,18 @@ export class JsonRpcXyoViewer implements XyoViewer {
|
|
|
50
59
|
return (await this.transport.sendRequest('xyoViewer_currentBlockNumber')) as number
|
|
51
60
|
}
|
|
52
61
|
|
|
62
|
+
forkHistory(): Promisable<ForkHistory> {
|
|
63
|
+
throw new Error('Method not implemented.')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async stakeByAddress(address: Address, slot: number): Promise<Stake> {
|
|
67
|
+
return (await this.transport.sendRequest('xyoViewer_stakeByAddress', [address, slot]))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
stakeById(_id: number): Promisable<Stake> {
|
|
71
|
+
throw new Error('Method not implemented.')
|
|
72
|
+
}
|
|
73
|
+
|
|
53
74
|
async transactionByBlockHashAndIndex(blockHash: Hash, transactionIndex: number): Promise<SignedHydratedTransaction | null> {
|
|
54
75
|
return (await this.transport.sendRequest('xyoViewer_transactionByBlockHashAndIndex', [blockHash, transactionIndex])) as SignedHydratedTransaction | null
|
|
55
76
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { XyoConnection } from '@xyo-network/xl1-protocol'
|
|
2
2
|
|
|
3
3
|
import type { XyoRunnerRpcMethodHandlers } from './XyoRunnerRpc.ts'
|
|
4
4
|
import type { XyoSignerRpcMethodHandlers } from './XyoSignerRpc.ts'
|
|
5
5
|
import type { XyoViewerRpcMethodHandlers } from './XyoViewerRpc.ts'
|
|
6
6
|
|
|
7
|
-
export type XyoProviderMethodName = keyof Pick<
|
|
7
|
+
export type XyoProviderMethodName = keyof Pick<XyoConnection, 'send'>
|
|
8
8
|
|
|
9
9
|
// Convert `accountBalance` to `xyo_accountBalance`, etc.
|
|
10
10
|
export type XyoProviderRpcMethodName = `xyoProvider_${XyoProviderMethodName}`
|
|
@@ -12,8 +12,8 @@ export type XyoProviderRpcMethodName = `xyoProvider_${XyoProviderMethodName}`
|
|
|
12
12
|
// Map each XYO RPC method string to the corresponding function type from XyoProvider
|
|
13
13
|
export type XyoProviderRpcMethodHandlers = {
|
|
14
14
|
[K in XyoProviderMethodName as `xyoProvider_${K}`]: (
|
|
15
|
-
params: Parameters<Required<
|
|
16
|
-
) => ReturnType<Required<
|
|
15
|
+
params: Parameters<Required<XyoConnection>[K]>
|
|
16
|
+
) => ReturnType<Required<XyoConnection>[K]>
|
|
17
17
|
}
|
|
18
18
|
& Partial<XyoRunnerRpcMethodHandlers>
|
|
19
19
|
& Partial<XyoSignerRpcMethodHandlers>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Signed } from '@xyo-network/boundwitness-model'
|
|
2
2
|
import type { TransactionBoundWitness } from '@xyo-network/xl1-protocol'
|
|
3
|
-
import { asHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-protocol'
|
|
3
|
+
import { AllowedBlockPayloadZod, asHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-protocol'
|
|
4
4
|
import * as z from 'zod'
|
|
5
5
|
|
|
6
6
|
import type { XyoSignerRpcMethodName } from '../XyoSignerRpc.ts'
|
|
7
7
|
import {
|
|
8
8
|
AddressZod,
|
|
9
|
-
AllowedBlockPayloadZod,
|
|
10
9
|
ChainZod,
|
|
11
10
|
PayloadZod, SignedHydratedTransactionZod, SignedTransactionBoundWitnessZod,
|
|
12
11
|
TransactionFeesBigIntToJsonZod,
|
|
@@ -8,9 +8,11 @@ import type { XyoViewerRpcMethodName } from '../XyoViewerRpc.ts'
|
|
|
8
8
|
import {
|
|
9
9
|
AddressZod,
|
|
10
10
|
BlockNumberZod,
|
|
11
|
+
JsonToStakeZod,
|
|
11
12
|
PayloadZod,
|
|
12
13
|
SignedHydratedBlockZod,
|
|
13
14
|
SignedHydratedTransactionZod,
|
|
15
|
+
StakeToJsonZod,
|
|
14
16
|
} from './common/index.ts'
|
|
15
17
|
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
16
18
|
|
|
@@ -33,7 +35,7 @@ export const XyoViewerRpcSchemas = {
|
|
|
33
35
|
from: JsonToBigIntZod,
|
|
34
36
|
},
|
|
35
37
|
},
|
|
36
|
-
|
|
38
|
+
xyoViewer_accountBalanceHistory: {
|
|
37
39
|
params: {
|
|
38
40
|
to: z.union([
|
|
39
41
|
z.tuple([AddressZod]),
|
|
@@ -91,6 +93,16 @@ export const XyoViewerRpcSchemas = {
|
|
|
91
93
|
from: AddressZod,
|
|
92
94
|
},
|
|
93
95
|
},
|
|
96
|
+
xyoViewer_chainIdAtBlock: {
|
|
97
|
+
params: {
|
|
98
|
+
to: z.tuple([BlockNumberZod]),
|
|
99
|
+
from: z.tuple([BlockNumberZod]),
|
|
100
|
+
},
|
|
101
|
+
result: {
|
|
102
|
+
to: AddressZod,
|
|
103
|
+
from: AddressZod,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
94
106
|
xyoViewer_currentBlock: {
|
|
95
107
|
params: {
|
|
96
108
|
to: z.array(z.any()).length(0).optional(),
|
|
@@ -121,6 +133,36 @@ export const XyoViewerRpcSchemas = {
|
|
|
121
133
|
from: BlockNumberZod,
|
|
122
134
|
},
|
|
123
135
|
},
|
|
136
|
+
xyoViewer_forkHistory: {
|
|
137
|
+
params: {
|
|
138
|
+
to: z.array(z.any()).length(0).optional(),
|
|
139
|
+
from: z.array(z.any()).length(0).optional(),
|
|
140
|
+
},
|
|
141
|
+
result: {
|
|
142
|
+
to: z.record(z.number(), AddressZod),
|
|
143
|
+
from: z.record(z.number(), AddressZod),
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
xyoViewer_stakeByAddress: {
|
|
147
|
+
params: {
|
|
148
|
+
to: z.tuple([AddressZod, z.number()]),
|
|
149
|
+
from: z.tuple([AddressZod, z.number()]),
|
|
150
|
+
},
|
|
151
|
+
result: {
|
|
152
|
+
to: StakeToJsonZod,
|
|
153
|
+
from: JsonToStakeZod,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
xyoViewer_stakeById: {
|
|
157
|
+
params: {
|
|
158
|
+
to: z.tuple([z.number()]),
|
|
159
|
+
from: z.tuple([z.number()]),
|
|
160
|
+
},
|
|
161
|
+
result: {
|
|
162
|
+
to: StakeToJsonZod,
|
|
163
|
+
from: JsonToStakeZod,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
124
166
|
xyoViewer_transactionByBlockHashAndIndex: {
|
|
125
167
|
params: {
|
|
126
168
|
to: z.tuple([HashZod, z.number()]),
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as z from 'zod'
|
|
2
|
+
|
|
3
|
+
import { AddressZod } from './Address.ts'
|
|
4
|
+
import {
|
|
5
|
+
AttoToJsonZod, AttoZod, JsonToAttoZod,
|
|
6
|
+
} from './TransactionFees.ts'
|
|
7
|
+
|
|
8
|
+
export const StakeZod = z.object({
|
|
9
|
+
// the block number when the stake was added
|
|
10
|
+
addBlock: z.number(),
|
|
11
|
+
// the amount that is staked
|
|
12
|
+
amount: AttoZod,
|
|
13
|
+
// the unique id for the stake item
|
|
14
|
+
id: z.number(),
|
|
15
|
+
// the block number when the stake was removed (set to 0 if not removed)
|
|
16
|
+
removeBlock: z.number(),
|
|
17
|
+
// the address that is being staked
|
|
18
|
+
staked: AddressZod,
|
|
19
|
+
// the address that owns the stake
|
|
20
|
+
staker: AddressZod,
|
|
21
|
+
// the block number when the stake was withdrawn (set to 0 if not withdrawn)
|
|
22
|
+
withdrawBlock: z.number(),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const StakeToJsonZod = StakeZod.transform(val => ({
|
|
26
|
+
addBlock: val.addBlock,
|
|
27
|
+
amount: AttoToJsonZod.parse(val.amount),
|
|
28
|
+
id: val.id,
|
|
29
|
+
removeBlock: val.removeBlock,
|
|
30
|
+
staked: AddressZod.parse(val.staked),
|
|
31
|
+
staker: AddressZod.parse(val.staker),
|
|
32
|
+
withdrawBlock: val.withdrawBlock,
|
|
33
|
+
}))
|
|
34
|
+
|
|
35
|
+
export const JsonToStakeZod = StakeZod.transform(val => ({
|
|
36
|
+
addBlock: val.addBlock,
|
|
37
|
+
amount: JsonToAttoZod.parse(val.amount),
|
|
38
|
+
id: val.id,
|
|
39
|
+
removeBlock: val.removeBlock,
|
|
40
|
+
staked: val.staked,
|
|
41
|
+
staker: val.staker,
|
|
42
|
+
withdrawBlock: val.withdrawBlock,
|
|
43
|
+
}))
|
|
@@ -4,8 +4,10 @@ import {
|
|
|
4
4
|
import { asAttoXL1 } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import * as z from 'zod'
|
|
6
6
|
|
|
7
|
-
const AttoZod = z.bigint()
|
|
8
|
-
export const
|
|
7
|
+
export const AttoZod = z.bigint()
|
|
8
|
+
export const JsonToAttoZod = JsonToBigIntZod.transform(v => asAttoXL1(v))
|
|
9
|
+
// eslint-disable-next-line unicorn/prefer-export-from
|
|
10
|
+
export const AttoToJsonZod = BigIntToJsonZod
|
|
9
11
|
|
|
10
12
|
export const TransactionFeesHexZod = z.object({
|
|
11
13
|
base: HexZod,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './Address.ts'
|
|
2
|
-
export * from './AllowedBlockPayload.ts'
|
|
3
2
|
export * from './BlockBoundWitness.ts'
|
|
4
3
|
export * from './BoundWitness.ts'
|
|
5
4
|
export * from './Chain.ts'
|
|
@@ -8,5 +7,6 @@ export * from './HydratedTransaction.ts'
|
|
|
8
7
|
export * from './Json.ts'
|
|
9
8
|
export * from './Payload.ts'
|
|
10
9
|
export * from './Sequence.ts'
|
|
10
|
+
export * from './Stake.ts'
|
|
11
11
|
export * from './TransactionBoundWitness.ts'
|
|
12
12
|
export * from './TransactionFees.ts'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XyoConnection.d.ts","sourceRoot":"","sources":["../../../../src/provider/connection/XyoConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAE7D,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,wCAAwC,EACxC,uBAAuB,EAAE,qBAAqB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ACxD,iBAAiB,CACrB,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,kBAAkB,EAAE,OAAO,EAAE,EAC7B,EACE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAC5B,GAAE,kBAAuB,GACzB,OAAO,CAAC,wCAAwC,CAAC;CAoCrD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
export declare const AllowedBlockPayloadZod: z.ZodObject<{
|
|
3
|
-
schema: z.ZodEnum<{
|
|
4
|
-
"network.xyo.boundwitness": "network.xyo.boundwitness";
|
|
5
|
-
"network.xyo.chain.stake.intent": "network.xyo.chain.stake.intent";
|
|
6
|
-
"network.xyo.hash": "network.xyo.hash";
|
|
7
|
-
"network.xyo.schema": "network.xyo.schema";
|
|
8
|
-
"network.xyo.transfer": "network.xyo.transfer";
|
|
9
|
-
}>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
//# sourceMappingURL=AllowedBlockPayload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AllowedBlockPayload.d.ts","sourceRoot":"","sources":["../../../../../src/types/schema/common/AllowedBlockPayload.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAUxB,eAAO,MAAM,sBAAsB;;;;;;;;iBAA2D,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XyoConnection.d.ts","sourceRoot":"","sources":["../../../../src/provider/connection/XyoConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAE7D,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,wCAAwC,EACxC,uBAAuB,EAAE,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AA8D;IACxD,iBAAiB,CACrB,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,kBAAkB,EAAE,OAAO,EAAE,EAC7B,EACE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAC5B,GAAE,kBAAuB,GACzB,OAAO,CAAC,wCAAwC,CAAC;CAoCrD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
export declare const AllowedBlockPayloadZod: z.ZodObject<{
|
|
3
|
-
schema: z.ZodEnum<{
|
|
4
|
-
"network.xyo.boundwitness": "network.xyo.boundwitness";
|
|
5
|
-
"network.xyo.chain.stake.intent": "network.xyo.chain.stake.intent";
|
|
6
|
-
"network.xyo.hash": "network.xyo.hash";
|
|
7
|
-
"network.xyo.schema": "network.xyo.schema";
|
|
8
|
-
"network.xyo.transfer": "network.xyo.transfer";
|
|
9
|
-
}>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
//# sourceMappingURL=AllowedBlockPayload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AllowedBlockPayload.d.ts","sourceRoot":"","sources":["../../../../../src/types/schema/common/AllowedBlockPayload.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAUxB,eAAO,MAAM,sBAAsB;;;;;;;;iBAA2D,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { SchemaSchema } from '@xyo-network/core-payload-plugins'
|
|
3
|
-
import {
|
|
4
|
-
ChainStakeIntentSchema, HashSchema, TransferSchema,
|
|
5
|
-
} from '@xyo-network/xl1-protocol'
|
|
6
|
-
import * as z from 'zod'
|
|
7
|
-
|
|
8
|
-
const AllowedBlockPayloadSchemas = [
|
|
9
|
-
BoundWitnessSchema,
|
|
10
|
-
ChainStakeIntentSchema,
|
|
11
|
-
HashSchema,
|
|
12
|
-
SchemaSchema,
|
|
13
|
-
TransferSchema,
|
|
14
|
-
] as const
|
|
15
|
-
|
|
16
|
-
export const AllowedBlockPayloadZod = z.object({ schema: z.enum(AllowedBlockPayloadSchemas) })
|