@xyo-network/xl1-rpc 1.16.24 → 1.16.25
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/rpcMethodHandlersFromAccountBalanceViewer.d.ts +4 -0
- package/dist/neutral/engine/rpcMethodHandlersFromAccountBalanceViewer.d.ts.map +1 -0
- package/dist/neutral/engine/rpcMethodHandlersFromConnection.d.ts.map +1 -1
- package/dist/neutral/engine/rpcMethodHandlersFromNetworkStakeStepRewardsByPositionViewer.d.ts +4 -0
- package/dist/neutral/engine/rpcMethodHandlersFromNetworkStakeStepRewardsByPositionViewer.d.ts.map +1 -0
- package/dist/neutral/index.mjs +176 -143
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewer.d.ts +8 -0
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.d.ts +10 -0
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/index.d.ts +3 -0
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/index.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +5 -5
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/transport/HttpRpcTransport.d.ts +3 -2
- package/dist/neutral/transport/HttpRpcTransport.d.ts.map +1 -1
- package/dist/neutral/types/MempoolViewerRpc.d.ts +10 -0
- package/dist/neutral/types/MempoolViewerRpc.d.ts.map +1 -0
- package/dist/neutral/types/schema/AccountBalanceViewerRpcSchemas.d.ts +16 -28
- package/dist/neutral/types/schema/AccountBalanceViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts +225 -446
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/DataLakeViewerRpcSchema.d.ts +4 -12
- package/dist/neutral/types/schema/DataLakeViewerRpcSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/MempoolViewerRpcSchemas.d.ts +74 -0
- package/dist/neutral/types/schema/MempoolViewerRpcSchemas.d.ts.map +1 -0
- package/dist/neutral/types/schema/RewardsByPositionViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/RewardsTotalViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/StepViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/TimeSyncViewerRpcSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoRunnerRpcSchemas.d.ts +16 -30
- package/dist/neutral/types/schema/XyoRunnerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts +41 -90
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +152 -298
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/index.d.ts +1 -0
- package/dist/neutral/types/schema/index.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromAccountBalanceViewer.d.ts +4 -0
- package/dist/node/engine/rpcMethodHandlersFromAccountBalanceViewer.d.ts.map +1 -0
- package/dist/node/engine/rpcMethodHandlersFromConnection.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromNetworkStakeStepRewardsByPositionViewer.d.ts +4 -0
- package/dist/node/engine/rpcMethodHandlersFromNetworkStakeStepRewardsByPositionViewer.d.ts.map +1 -0
- package/dist/node/index-node.mjs +176 -143
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewer.d.ts +8 -0
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewer.d.ts.map +1 -0
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.d.ts +10 -0
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.d.ts.map +1 -0
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/index.d.ts +3 -0
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/index.d.ts.map +1 -0
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +5 -5
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/transport/HttpRpcTransport.d.ts +3 -2
- package/dist/node/transport/HttpRpcTransport.d.ts.map +1 -1
- package/dist/node/types/MempoolViewerRpc.d.ts +10 -0
- package/dist/node/types/MempoolViewerRpc.d.ts.map +1 -0
- package/dist/node/types/schema/AccountBalanceViewerRpcSchemas.d.ts +16 -28
- package/dist/node/types/schema/AccountBalanceViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/AllRpcSchemas.d.ts +225 -446
- package/dist/node/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/DataLakeViewerRpcSchema.d.ts +4 -12
- package/dist/node/types/schema/DataLakeViewerRpcSchema.d.ts.map +1 -1
- package/dist/node/types/schema/MempoolViewerRpcSchemas.d.ts +74 -0
- package/dist/node/types/schema/MempoolViewerRpcSchemas.d.ts.map +1 -0
- package/dist/node/types/schema/RewardsByPositionViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/RewardsTotalViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/StepViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/TimeSyncViewerRpcSchema.d.ts.map +1 -1
- package/dist/node/types/schema/XyoRunnerRpcSchemas.d.ts +16 -30
- package/dist/node/types/schema/XyoRunnerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts +41 -90
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +152 -298
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/index.d.ts +1 -0
- package/dist/node/types/schema/index.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/engine/rpcMethodHandlersFromAccountBalanceViewer.ts +10 -0
- package/src/engine/rpcMethodHandlersFromConnection.ts +8 -0
- package/src/engine/rpcMethodHandlersFromNetworkStakeStepRewardsByPositionViewer.ts +14 -0
- package/src/provider/signer/JsonRpcXyoSigner.ts +1 -2
- package/src/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewer.ts +11 -0
- package/src/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.ts +21 -0
- package/src/provider/viewer/JsonRpcMempoolViewer/index.ts +2 -0
- package/src/provider/viewer/JsonRpcXyoViewer.ts +10 -10
- package/src/transport/HttpRpcTransport.ts +15 -4
- package/src/types/MempoolViewerRpc.ts +16 -0
- package/src/types/schema/DataLakeViewerRpcSchema.ts +1 -1
- package/src/types/schema/MempoolViewerRpcSchemas.ts +19 -0
- package/src/types/schema/RewardsByPositionViewerRpcSchemas.ts +1 -2
- package/src/types/schema/RewardsByStakerViewerRpcSchemas.ts +1 -1
- package/src/types/schema/RewardsByStepViewerRpcSchemas.ts +1 -1
- package/src/types/schema/RewardsTotalViewerRpcSchemas.ts +1 -2
- package/src/types/schema/StepViewerRpcSchemas.ts +3 -2
- package/src/types/schema/TimeSyncViewerRpcSchema.ts +1 -2
- package/src/types/schema/XyoPermissionsRpcSchemas.ts +1 -1
- package/src/types/schema/XyoRunnerRpcSchemas.ts +1 -1
- package/src/types/schema/XyoSignerRpcSchemas.ts +3 -4
- package/src/types/schema/XyoViewerRpcSchemas.ts +3 -4
- package/src/types/schema/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyoViewerRpcSchemas.d.ts","sourceRoot":"","sources":["../../../../src/types/schema/XyoViewerRpcSchemas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XyoViewerRpcSchemas.d.ts","sourceRoot":"","sources":["../../../../src/types/schema/XyoViewerRpcSchemas.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAKxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqagB,CAAA"}
|
|
@@ -3,6 +3,7 @@ export * from './AllRpcSchemas.ts';
|
|
|
3
3
|
export * from './createRequestSchema.ts';
|
|
4
4
|
export * from './createResponseSchema.ts';
|
|
5
5
|
export * from './DataLakeViewerRpcSchema.ts';
|
|
6
|
+
export * from './MempoolViewerRpcSchemas.ts';
|
|
6
7
|
export * from './NetworkStakeViewerRpcSchemas.ts';
|
|
7
8
|
export * from './RewardsByPositionViewerRpcSchemas.ts';
|
|
8
9
|
export * from './RewardsByStakerViewerRpcSchemas.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,sCAAsC,CAAA;AACpD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mBAAmB,CAAA;AACjC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,sCAAsC,CAAA;AACpD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mBAAmB,CAAA;AACjC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
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-rpc",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.25",
|
|
5
5
|
"description": "XYO Layer One API",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"types": "tsc --noEmit -p tsconfig.test.json"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@metamask/json-rpc-engine": "~10.
|
|
62
|
-
"@xylabs/axios": "~5.0.
|
|
63
|
-
"@xylabs/sdk-js": "~5.0.
|
|
64
|
-
"@xyo-network/archivist-model": "~5.
|
|
65
|
-
"@xyo-network/module-model": "~5.
|
|
66
|
-
"@xyo-network/node-model": "~5.
|
|
67
|
-
"@xyo-network/payload-builder": "~5.
|
|
68
|
-
"@xyo-network/payload-model": "~5.
|
|
69
|
-
"@xyo-network/xl1-protocol": "~1.
|
|
70
|
-
"@xyo-network/xl1-protocol-sdk": "~1.16.
|
|
61
|
+
"@metamask/json-rpc-engine": "~10.2.0",
|
|
62
|
+
"@xylabs/axios": "~5.0.42",
|
|
63
|
+
"@xylabs/sdk-js": "~5.0.42",
|
|
64
|
+
"@xyo-network/archivist-model": "~5.2.10",
|
|
65
|
+
"@xyo-network/module-model": "~5.2.10",
|
|
66
|
+
"@xyo-network/node-model": "~5.2.10",
|
|
67
|
+
"@xyo-network/payload-builder": "~5.2.10",
|
|
68
|
+
"@xyo-network/payload-model": "~5.2.10",
|
|
69
|
+
"@xyo-network/xl1-protocol": "~1.14.13",
|
|
70
|
+
"@xyo-network/xl1-protocol-sdk": "~1.16.25",
|
|
71
71
|
"axios": "~1.13.2",
|
|
72
72
|
"uuid": "~13.0.0",
|
|
73
73
|
"zod": "~4.1.12"
|
|
@@ -75,18 +75,18 @@
|
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@metamask/utils": "~11.8.1",
|
|
77
77
|
"@types/node": "~24.10.1",
|
|
78
|
-
"@xylabs/sdk-js": "~5.0.
|
|
78
|
+
"@xylabs/sdk-js": "~5.0.42",
|
|
79
79
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
80
80
|
"@xylabs/tsconfig": "~7.2.8",
|
|
81
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
82
|
-
"@xyo-network/account": "~5.
|
|
83
|
-
"@xyo-network/account-model": "~5.
|
|
84
|
-
"@xyo-network/chain-protocol": "~1.16.
|
|
85
|
-
"@xyo-network/wallet": "~5.
|
|
81
|
+
"@xylabs/vitest-extended": "~5.0.42",
|
|
82
|
+
"@xyo-network/account": "~5.2.10",
|
|
83
|
+
"@xyo-network/account-model": "~5.2.10",
|
|
84
|
+
"@xyo-network/chain-protocol": "~1.16.25",
|
|
85
|
+
"@xyo-network/wallet": "~5.2.10",
|
|
86
86
|
"dotenv": "~17.2.3",
|
|
87
87
|
"eslint": "^9.39.1",
|
|
88
88
|
"typescript": "~5.9.3",
|
|
89
|
-
"vitest": "~4.0.
|
|
89
|
+
"vitest": "~4.0.13"
|
|
90
90
|
},
|
|
91
91
|
"packageManager": "yarn@4.6.0",
|
|
92
92
|
"engines": {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AccountBalanceViewerMethods } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
|
|
3
|
+
import type { AccountBalanceViewerRpcMethodHandlers } from '../types/index.ts'
|
|
4
|
+
|
|
5
|
+
export const rpcMethodHandlersFromAccountBalanceViewer = (viewer: AccountBalanceViewerMethods): AccountBalanceViewerRpcMethodHandlers => {
|
|
6
|
+
return {
|
|
7
|
+
accountBalanceViewer_accountsBalances: params => viewer.accountsBalances(params[0], params[1]),
|
|
8
|
+
accountBalanceViewer_accountsBalancesHistory: params => viewer.accountsBalancesHistory(params[0], params[1]),
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NetworkStakeViewer, XyoConnection } from '@xyo-network/xl1-protocol-sdk'
|
|
2
2
|
|
|
3
3
|
import type { XyoProviderRpcMethodHandlers } from '../types/index.ts'
|
|
4
|
+
import { rpcMethodHandlersFromAccountBalanceViewer } from './rpcMethodHandlersFromAccountBalanceViewer.ts'
|
|
4
5
|
import { rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer } from './rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer.ts'
|
|
5
6
|
import { rpcMethodHandlersFromRunner } from './rpcMethodHandlersFromRunner.ts'
|
|
6
7
|
import { rpcMethodHandlersFromViewer } from './rpcMethodHandlersFromViewer.ts'
|
|
@@ -17,5 +18,12 @@ export const rpcMethodHandlersFromConnection = (connection: XyoConnection, netwo
|
|
|
17
18
|
...rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer(networkStakeViewer.stepRewards.position),
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
const accountBalanceViewer = viewer?.account?.balance
|
|
22
|
+
if (accountBalanceViewer) {
|
|
23
|
+
result = {
|
|
24
|
+
...result,
|
|
25
|
+
...rpcMethodHandlersFromAccountBalanceViewer(accountBalanceViewer),
|
|
26
|
+
}
|
|
27
|
+
}
|
|
20
28
|
return result
|
|
21
29
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NetworkStakeStepRewardsByPositionViewerMethods } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
|
|
3
|
+
import type { NetworkStakingStepRewardsByPositionViewerRpcMethodHandlers } from '../types/index.ts'
|
|
4
|
+
|
|
5
|
+
export const rpcMethodHandlersFromNetworkStakeStepRewardsByPositionViewer
|
|
6
|
+
= (viewer: NetworkStakeStepRewardsByPositionViewerMethods): NetworkStakingStepRewardsByPositionViewerRpcMethodHandlers => {
|
|
7
|
+
return {
|
|
8
|
+
networkStakingStepRewardsByPositionViewer_bonus: params => viewer.bonus(...(params ?? [])),
|
|
9
|
+
networkStakingStepRewardsByPositionViewer_claimed: params => viewer.claimed(...(params ?? [])),
|
|
10
|
+
networkStakingStepRewardsByPositionViewer_earned: params => viewer.earned(...(params ?? [])),
|
|
11
|
+
networkStakingStepRewardsByPositionViewer_total: params => viewer.total(...(params ?? [])),
|
|
12
|
+
networkStakingStepRewardsByPositionViewer_unclaimed: params => viewer.unclaimed(...(params ?? [])),
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -20,7 +20,6 @@ export class RpcXyoSigner implements XyoSigner {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async signTransaction(tx: UnsignedHydratedTransaction): Promise<SignedHydratedTransactionWithHashMeta> {
|
|
23
|
-
|
|
24
|
-
return ret
|
|
23
|
+
return await this.transport.sendRequest('xyoSigner_signTransaction', [tx])
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MempoolViewer } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
|
|
3
|
+
import type { RpcTransport } from '../../../transport/index.ts'
|
|
4
|
+
import type { MempoolViewerRpcSchemas } from '../../../types/index.ts'
|
|
5
|
+
import { JsonRpcMempoolViewerMethods } from './JsonRpcMempoolViewerMethods.ts'
|
|
6
|
+
|
|
7
|
+
export class JsonRpcMempoolViewer extends JsonRpcMempoolViewerMethods implements MempoolViewer {
|
|
8
|
+
constructor(transport: RpcTransport<typeof MempoolViewerRpcSchemas>) {
|
|
9
|
+
super(transport)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-protocol'
|
|
2
|
+
import type { MempoolViewerMethods, PendingTransactionsOptions } from '@xyo-network/xl1-protocol-sdk'
|
|
3
|
+
|
|
4
|
+
import type { RpcTransport } from '../../../transport/index.ts'
|
|
5
|
+
import type { MempoolViewerRpcSchemas } from '../../../types/index.ts'
|
|
6
|
+
|
|
7
|
+
export class JsonRpcMempoolViewerMethods implements MempoolViewerMethods {
|
|
8
|
+
protected readonly transport: RpcTransport<typeof MempoolViewerRpcSchemas>
|
|
9
|
+
|
|
10
|
+
constructor(transport: RpcTransport<typeof MempoolViewerRpcSchemas>) {
|
|
11
|
+
this.transport = transport
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async pendingTransactions(options?: PendingTransactionsOptions): Promise<SignedHydratedTransactionWithHashMeta[]> {
|
|
15
|
+
const result = await this.transport.sendRequest(
|
|
16
|
+
'mempoolViewer_pendingTransactions',
|
|
17
|
+
options ? [options] : [],
|
|
18
|
+
)
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -4,14 +4,14 @@ import type {
|
|
|
4
4
|
AttoXL1,
|
|
5
5
|
BlockRange,
|
|
6
6
|
ChainId,
|
|
7
|
-
|
|
7
|
+
SignedHydratedBlockWithHashMeta,
|
|
8
8
|
SignedHydratedTransaction,
|
|
9
9
|
StepIdentity,
|
|
10
10
|
StepIdentityString,
|
|
11
11
|
XL1BlockNumber,
|
|
12
12
|
XL1BlockRange,
|
|
13
13
|
} from '@xyo-network/xl1-protocol'
|
|
14
|
-
import { asAttoXL1,
|
|
14
|
+
import { asAttoXL1, asSignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol'
|
|
15
15
|
import type {
|
|
16
16
|
AccountBalanceHistoryItem, ForkHistory, NetworkStakeViewer, Position, TransferBalanceHistoryItem, TransferPair, XyoViewer,
|
|
17
17
|
} from '@xyo-network/xl1-protocol-sdk'
|
|
@@ -76,16 +76,16 @@ export class JsonRpcXyoViewer implements XyoViewer {
|
|
|
76
76
|
throw new Error('Method not implemented.')
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
async blockByHash(hash: Hash): Promise<
|
|
80
|
-
return
|
|
79
|
+
async blockByHash(hash: Hash): Promise<SignedHydratedBlockWithHashMeta | null> {
|
|
80
|
+
return asSignedHydratedBlockWithHashMeta(await this.transport.sendRequest('xyoViewer_blockByHash', [hash])) ?? null
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
async blockByNumber(blockNumber: number): Promise<
|
|
84
|
-
return
|
|
83
|
+
async blockByNumber(blockNumber: number): Promise<SignedHydratedBlockWithHashMeta | null> {
|
|
84
|
+
return asSignedHydratedBlockWithHashMeta(await this.transport.sendRequest('xyoViewer_blockByNumber', [blockNumber])) ?? null
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
async blocksByHash(hash: Hash, limit?: number): Promise<
|
|
88
|
-
return (await this.transport.sendRequest('xyoViewer_blocksByHash', [hash, limit])).map(b =>
|
|
87
|
+
async blocksByHash(hash: Hash, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]> {
|
|
88
|
+
return (await this.transport.sendRequest('xyoViewer_blocksByHash', [hash, limit])).map(b => asSignedHydratedBlockWithHashMeta(b, true))
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
async chainId(): Promise<Address> {
|
|
@@ -96,8 +96,8 @@ export class JsonRpcXyoViewer implements XyoViewer {
|
|
|
96
96
|
return (await this.transport.sendRequest('xyoViewer_chainIdAtBlock', [blockNumber]))
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
async currentBlock(): Promise<
|
|
100
|
-
return
|
|
99
|
+
async currentBlock(): Promise<SignedHydratedBlockWithHashMeta> {
|
|
100
|
+
return asSignedHydratedBlockWithHashMeta(await this.transport.sendRequest('xyoViewer_currentBlock'), true)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
async currentBlockHash(): Promise<Hash> {
|
|
@@ -2,22 +2,26 @@ import type {
|
|
|
2
2
|
JsonRpcFailure, JsonRpcRequest, JsonRpcSuccess,
|
|
3
3
|
} from '@metamask/utils'
|
|
4
4
|
import { axiosJsonConfig } from '@xylabs/axios'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
isDefined, isError, isUndefinedOrNull,
|
|
7
|
+
} from '@xylabs/sdk-js'
|
|
6
8
|
import { Axios, isAxiosError } from 'axios'
|
|
7
9
|
import { v4 } from 'uuid'
|
|
8
|
-
import
|
|
10
|
+
import * as z from 'zod'
|
|
9
11
|
|
|
10
12
|
import type { RpcSchemaMap } from '../types/index.ts'
|
|
11
13
|
import { jsonrpc } from '../types/index.ts'
|
|
12
14
|
import type { RpcTransport } from './RpcTransport.ts'
|
|
13
15
|
|
|
14
16
|
export class HttpRpcTransport<T extends RpcSchemaMap = RpcSchemaMap> implements RpcTransport<T> {
|
|
17
|
+
protected readonly _passThrough: boolean
|
|
15
18
|
protected readonly _rpcUrl: string
|
|
16
19
|
protected readonly _schemas: T
|
|
17
20
|
|
|
18
|
-
constructor(rpcUrl: string, schemas: T) {
|
|
21
|
+
constructor(rpcUrl: string, schemas: T, passThrough = false) {
|
|
19
22
|
this._rpcUrl = rpcUrl
|
|
20
23
|
this._schemas = schemas
|
|
24
|
+
this._passThrough = passThrough
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
async sendRequest<
|
|
@@ -46,8 +50,15 @@ export class HttpRpcTransport<T extends RpcSchemaMap = RpcSchemaMap> implements
|
|
|
46
50
|
method: method as string,
|
|
47
51
|
}
|
|
48
52
|
|
|
53
|
+
const schema = schemas[method]
|
|
54
|
+
|
|
49
55
|
if (params) {
|
|
50
|
-
body.params =
|
|
56
|
+
body.params = isDefined(schema)
|
|
57
|
+
? schema.params.to.parse(params) as JsonRpcRequest
|
|
58
|
+
: this._passThrough ? z.json().parse(params) as JsonRpcRequest : undefined
|
|
59
|
+
if (!isDefined(body.params)) {
|
|
60
|
+
throw new Error(`RPC method ${String(method)} missing schema`)
|
|
61
|
+
}
|
|
51
62
|
}
|
|
52
63
|
|
|
53
64
|
const res = await new Axios(axiosJsonConfig()).post(url, body)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MempoolViewerMethods } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
|
|
3
|
+
import type { MethodName, RpcMethodName } from './RpcMethodName.ts'
|
|
4
|
+
|
|
5
|
+
export const MempoolViewerRpcNamespace = 'mempoolViewer' as const
|
|
6
|
+
export type MempoolViewerRpcNamespace = typeof MempoolViewerRpcNamespace
|
|
7
|
+
|
|
8
|
+
export type MempoolViewerMethodName = MethodName<MempoolViewerMethods>
|
|
9
|
+
export type MempoolViewerRpcMethodName = RpcMethodName<MempoolViewerRpcNamespace,
|
|
10
|
+
MempoolViewerMethodName>
|
|
11
|
+
|
|
12
|
+
export type MempoolViewerRpcMethodHandlers = {
|
|
13
|
+
[K in MempoolViewerMethodName as MempoolViewerRpcMethodName]: (
|
|
14
|
+
params: Parameters<MempoolViewerMethods[K]>,
|
|
15
|
+
) => ReturnType<MempoolViewerMethods[K]>
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HashZod } from '@xylabs/sdk-js'
|
|
2
2
|
import { PayloadZod } from '@xyo-network/payload-model'
|
|
3
|
-
import { ArrayBufferToJsonZod, JsonToArrayBufferZod } from '@xyo-network/xl1-protocol
|
|
3
|
+
import { ArrayBufferToJsonZod, JsonToArrayBufferZod } from '@xyo-network/xl1-protocol'
|
|
4
4
|
import * as z from 'zod'
|
|
5
5
|
|
|
6
6
|
import type { DataLakeViewerRpcMethodName } from '../DataLakeViewerRpc.ts'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SignedHydratedTransactionWithHashMetaZod } from '@xyo-network/xl1-protocol'
|
|
2
|
+
import { PendingTransactionsOptionsZod } from '@xyo-network/xl1-protocol-sdk'
|
|
3
|
+
import * as z from 'zod'
|
|
4
|
+
|
|
5
|
+
import type { MempoolViewerRpcMethodName } from '../MempoolViewerRpc.ts'
|
|
6
|
+
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
7
|
+
|
|
8
|
+
export const MempoolViewerRpcSchemas = {
|
|
9
|
+
mempoolViewer_pendingTransactions: {
|
|
10
|
+
params: {
|
|
11
|
+
to: z.tuple([PendingTransactionsOptionsZod.optional()]),
|
|
12
|
+
from: z.tuple([PendingTransactionsOptionsZod.optional()]),
|
|
13
|
+
},
|
|
14
|
+
result: {
|
|
15
|
+
to: z.array(SignedHydratedTransactionWithHashMetaZod),
|
|
16
|
+
from: z.array(SignedHydratedTransactionWithHashMetaZod),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} satisfies RpcSchemaMap<MempoolViewerRpcMethodName>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BigIntToJsonZod, JsonToBigIntZod } from '@xylabs/sdk-js'
|
|
2
|
-
import { asAttoXL1 } from '@xyo-network/xl1-protocol'
|
|
3
|
-
import { RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
import { asAttoXL1, RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol'
|
|
4
3
|
import z from 'zod'
|
|
5
4
|
|
|
6
5
|
import type { NetworkStakingStepRewardsByPositionViewerRpcMethodName } from '../NetworkStakingStepRewardsByPositionViewerRpc.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AddressZod, BigIntToJsonZod, JsonToBigIntZod,
|
|
3
3
|
} from '@xylabs/sdk-js'
|
|
4
|
-
import { RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol
|
|
4
|
+
import { RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import z from 'zod'
|
|
6
6
|
|
|
7
7
|
import type { NetworkStakingStepRewardsByStakerViewerRpcMethodName } from '../NetworkStakingStepRewardsByStakerViewerRpc.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AddressZod, BigIntToJsonZod, JsonToBigIntZod,
|
|
3
3
|
} from '@xylabs/sdk-js'
|
|
4
|
-
import { RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol
|
|
4
|
+
import { RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import z from 'zod'
|
|
6
6
|
|
|
7
7
|
import type { NetworkStakingStepRewardsByStepViewerRpcMethodName } from '../NetworkStakingStepRewardsByStepViewerRpc.ts'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BigIntToJsonZod, JsonToBigIntZod } from '@xylabs/sdk-js'
|
|
2
|
-
import { asAttoXL1 } from '@xyo-network/xl1-protocol'
|
|
3
|
-
import { RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
import { asAttoXL1, RewardsRangeOptionsZod } from '@xyo-network/xl1-protocol'
|
|
4
3
|
import * as z from 'zod'
|
|
5
4
|
|
|
6
5
|
import type { NetworkStakingStepRewardsTotalViewerRpcMethodName } from '../NetworkStakingStepRewardsTotalViewerRpc.ts'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AddressZod, BigIntToJsonZod, JsonToBigIntZod,
|
|
3
3
|
} from '@xylabs/sdk-js'
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
JsonToStakeZod, StakeToJsonZod, StepIdentityZod,
|
|
6
|
+
} from '@xyo-network/xl1-protocol'
|
|
6
7
|
import z from 'zod'
|
|
7
8
|
|
|
8
9
|
import type { StepViewerMethodName } from '../StepViewerRpc.ts'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TimePayloadZod } from '@xyo-network/xl1-protocol'
|
|
2
|
-
import { TimeDomainZod } from '@xyo-network/xl1-protocol-sdk'
|
|
1
|
+
import { TimeDomainZod, TimePayloadZod } from '@xyo-network/xl1-protocol'
|
|
3
2
|
import * as z from 'zod'
|
|
4
3
|
|
|
5
4
|
import type { TimeSyncViewerRpcMethodName } from '../TimeSyncViewerRpc.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HashToJsonZod, JsonToHashZod } from '@xylabs/sdk-js'
|
|
2
|
-
import { SignedHydratedTransactionZod } from '@xyo-network/xl1-protocol
|
|
2
|
+
import { SignedHydratedTransactionZod } from '@xyo-network/xl1-protocol'
|
|
3
3
|
import * as z from 'zod'
|
|
4
4
|
|
|
5
5
|
import type { XyoRunnerRpcMethodName } from '../XyoRunnerRpc.ts'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AddressZod } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
import { SignedHydratedTransactionZod, UnsignedHydratedTransactionZod } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
import { SignedHydratedTransactionWithHashMetaZod, UnsignedHydratedTransactionZod } from '@xyo-network/xl1-protocol'
|
|
4
3
|
import { z } from 'zod'
|
|
5
4
|
|
|
6
5
|
import type { XyoSignerRpcMethodName } from '../XyoSignerRpc.ts'
|
|
@@ -23,8 +22,8 @@ export const XyoSignerRpcSchemas = {
|
|
|
23
22
|
from: z.tuple([UnsignedHydratedTransactionZod]),
|
|
24
23
|
},
|
|
25
24
|
result: {
|
|
26
|
-
to:
|
|
27
|
-
from:
|
|
25
|
+
to: SignedHydratedTransactionWithHashMetaZod,
|
|
26
|
+
from: SignedHydratedTransactionWithHashMetaZod,
|
|
28
27
|
},
|
|
29
28
|
},
|
|
30
29
|
} as const satisfies RpcSchemaMap<XyoSignerRpcMethodName>
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
JsonToHashZod,
|
|
5
5
|
} from '@xylabs/sdk-js'
|
|
6
6
|
import {
|
|
7
|
-
BlockNumberZod, BlockRangeZod,
|
|
7
|
+
BlockNumberZod, BlockRangeZod, JsonToStakeZod, SignedHydratedBlockZod, SignedHydratedTransactionZod, StakeToJsonZod, StepIdentityZod, TransferPairZod,
|
|
8
|
+
XL1BlockNumberZod, XL1BlockRangeZod,
|
|
8
9
|
} from '@xyo-network/xl1-protocol'
|
|
9
|
-
import {
|
|
10
|
-
AccountBalanceHistoryItemZod, JsonToStakeZod, SignedHydratedBlockZod, SignedHydratedTransactionZod, StakeToJsonZod, TransferPairZod,
|
|
11
|
-
} from '@xyo-network/xl1-protocol-sdk'
|
|
10
|
+
import { AccountBalanceHistoryItemZod } from '@xyo-network/xl1-protocol-sdk'
|
|
12
11
|
import * as z from 'zod'
|
|
13
12
|
|
|
14
13
|
import type { XyoViewerRpcMethodName } from '../XyoViewerRpc.ts'
|
|
@@ -3,6 +3,7 @@ export * from './AllRpcSchemas.ts'
|
|
|
3
3
|
export * from './createRequestSchema.ts'
|
|
4
4
|
export * from './createResponseSchema.ts'
|
|
5
5
|
export * from './DataLakeViewerRpcSchema.ts'
|
|
6
|
+
export * from './MempoolViewerRpcSchemas.ts'
|
|
6
7
|
export * from './NetworkStakeViewerRpcSchemas.ts'
|
|
7
8
|
export * from './RewardsByPositionViewerRpcSchemas.ts'
|
|
8
9
|
export * from './RewardsByStakerViewerRpcSchemas.ts'
|