@xyo-network/xl1-rpc 1.7.0 → 1.7.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/index-node.d.ts +4 -0
- package/dist/neutral/engine/index-node.d.ts.map +1 -0
- package/dist/neutral/engine/index.d.ts +1 -1
- package/dist/neutral/engine/index.d.ts.map +1 -1
- package/dist/neutral/index-node.d.ts +4 -2
- package/dist/neutral/index-node.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +5 -349
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +43 -17
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/host/JsonRpcXyoGateway.d.ts +17 -0
- package/dist/neutral/provider/host/JsonRpcXyoGateway.d.ts.map +1 -0
- package/dist/neutral/provider/host/index.d.ts +1 -1
- package/dist/neutral/provider/host/index.d.ts.map +1 -1
- package/dist/neutral/provider/runner/JsonRpcXyoRunner.d.ts +1 -1
- package/dist/neutral/provider/runner/JsonRpcXyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/runner/NodeXyoRunner.d.ts +2 -2
- package/dist/neutral/provider/runner/NodeXyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/signer/JsonRpcXyoSigner.d.ts +1 -1
- package/dist/neutral/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/transport/post-message/PostMessageRpcTransport.d.ts.map +1 -1
- package/dist/neutral/types/XyoGatewayRpc.d.ts +8 -0
- package/dist/neutral/types/XyoGatewayRpc.d.ts.map +1 -0
- package/dist/neutral/types/index.d.ts +2 -2
- package/dist/neutral/types/index.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoHostRpcSchemas.d.ts +2 -2
- package/dist/neutral/types/schema/XyoHostRpcSchemas.d.ts.map +1 -1
- package/dist/node/engine/index-node.d.ts +4 -0
- package/dist/node/engine/index-node.d.ts.map +1 -0
- package/dist/node/engine/index.d.ts +1 -1
- package/dist/node/engine/index.d.ts.map +1 -1
- package/dist/node/index-node.d.ts +5 -351
- package/dist/node/index-node.d.ts.map +1 -1
- package/dist/node/index-node.mjs +97 -71
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/index.d.ts +1 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/provider/host/JsonRpcXyoGateway.d.ts +17 -0
- package/dist/node/provider/host/JsonRpcXyoGateway.d.ts.map +1 -0
- package/dist/node/provider/host/index.d.ts +1 -1
- package/dist/node/provider/host/index.d.ts.map +1 -1
- package/dist/node/provider/runner/JsonRpcXyoRunner.d.ts +1 -1
- package/dist/node/provider/runner/JsonRpcXyoRunner.d.ts.map +1 -1
- package/dist/node/provider/runner/NodeXyoRunner.d.ts +2 -2
- package/dist/node/provider/runner/NodeXyoRunner.d.ts.map +1 -1
- package/dist/node/provider/signer/JsonRpcXyoSigner.d.ts +1 -1
- package/dist/node/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/transport/post-message/PostMessageRpcTransport.d.ts.map +1 -1
- package/dist/node/types/XyoGatewayRpc.d.ts +8 -0
- package/dist/node/types/XyoGatewayRpc.d.ts.map +1 -0
- package/dist/node/types/index.d.ts +2 -2
- package/dist/node/types/index.d.ts.map +1 -1
- package/dist/node/types/schema/XyoHostRpcSchemas.d.ts +2 -2
- package/dist/node/types/schema/XyoHostRpcSchemas.d.ts.map +1 -1
- package/package.json +23 -23
- package/src/engine/index-node.ts +3 -0
- package/src/engine/index.ts +1 -1
- package/src/index-node.ts +5 -2
- package/src/index.ts +1 -2
- package/src/provider/host/JsonRpcXyoGateway.ts +44 -0
- package/src/provider/host/index.ts +1 -1
- package/src/provider/runner/JsonRpcXyoRunner.ts +1 -1
- package/src/provider/signer/JsonRpcXyoSigner.ts +1 -1
- package/src/provider/viewer/JsonRpcXyoViewer.ts +1 -1
- package/src/transport/post-message/PostMessageRpcTransport.ts +2 -2
- package/src/types/XyoGatewayRpc.ts +15 -0
- package/src/types/index.ts +2 -2
- package/src/types/schema/XyoHostRpcSchemas.ts +32 -7
- package/dist/neutral/provider/host/JsonRpcXyoHost.d.ts +0 -14
- package/dist/neutral/provider/host/JsonRpcXyoHost.d.ts.map +0 -1
- package/dist/neutral/types/XyoHostRpc.d.ts +0 -8
- package/dist/neutral/types/XyoHostRpc.d.ts.map +0 -1
- package/dist/node/provider/host/JsonRpcXyoHost.d.ts +0 -14
- package/dist/node/provider/host/JsonRpcXyoHost.d.ts.map +0 -1
- package/dist/node/types/XyoHostRpc.d.ts +0 -8
- package/dist/node/types/XyoHostRpc.d.ts.map +0 -1
- package/src/provider/host/JsonRpcXyoHost.ts +0 -35
- package/src/types/XyoHostRpc.ts +0 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../../src/engine/index-node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oCAAoC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oCAAoC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,349 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as _xyo_network_payload_model from '@xyo-network/payload-model';
|
|
7
|
-
import { Payload } from '@xyo-network/payload-model';
|
|
8
|
-
import { MemoryArchivist } from '@xyo-network/archivist-memory';
|
|
9
|
-
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
10
|
-
import { ModuleIdentifier } from '@xyo-network/module-model';
|
|
11
|
-
import * as _xyo_network_archivist_model from '@xyo-network/archivist-model';
|
|
12
|
-
import { ArchivistInstance } from '@xyo-network/archivist-model';
|
|
13
|
-
import { NodeInstance } from '@xyo-network/node-model';
|
|
14
|
-
import { AccountInstance } from '@xyo-network/account-model';
|
|
15
|
-
import { JsonRpcEngine } from '@metamask/json-rpc-engine';
|
|
16
|
-
import { JsonRpcRequest } from '@metamask/utils';
|
|
17
|
-
import { JsonValue } from '@xylabs/object';
|
|
18
|
-
|
|
19
|
-
declare const requestSchemas: Record<string, AnyZodObject | undefined>;
|
|
20
|
-
|
|
21
|
-
declare const JsonRpcErrorCodes: Record<string, {
|
|
22
|
-
code: number;
|
|
23
|
-
message: string;
|
|
24
|
-
}>;
|
|
25
|
-
|
|
26
|
-
declare const jsonrpc: "2.0";
|
|
27
|
-
|
|
28
|
-
type SerializationTransform = {
|
|
29
|
-
from: ZodType;
|
|
30
|
-
to: ZodType;
|
|
31
|
-
};
|
|
32
|
-
type RequestResponseSchemas = {
|
|
33
|
-
/**
|
|
34
|
-
* Schema for validating (and optionally transforming) the RPC request
|
|
35
|
-
*/
|
|
36
|
-
params: SerializationTransform;
|
|
37
|
-
/**
|
|
38
|
-
* Schema for validating (and optionally transforming) the result property of the RPC response
|
|
39
|
-
*/
|
|
40
|
-
result: SerializationTransform;
|
|
41
|
-
};
|
|
42
|
-
type RpcSchemaMap<TMethod extends string = string> = Record<TMethod, RequestResponseSchemas>;
|
|
43
|
-
|
|
44
|
-
declare const AllRpcSchemas: RpcSchemaMap;
|
|
45
|
-
|
|
46
|
-
declare const createRequestSchema: <TParams extends z.ZodTypeAny, TMethodName extends string = string>(methodName: TMethodName, paramsSchema?: TParams | ZodUndefined) => z.ZodObject<{
|
|
47
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
48
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
49
|
-
method: z.ZodLiteral<TMethodName>;
|
|
50
|
-
params: TParams | ZodUndefined;
|
|
51
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
52
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
53
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
54
|
-
method: z.ZodLiteral<TMethodName>;
|
|
55
|
-
params: TParams | ZodUndefined;
|
|
56
|
-
}>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
57
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
58
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
59
|
-
method: z.ZodLiteral<TMethodName>;
|
|
60
|
-
params: TParams | ZodUndefined;
|
|
61
|
-
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
62
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
63
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
64
|
-
method: z.ZodLiteral<TMethodName>;
|
|
65
|
-
params: TParams | ZodUndefined;
|
|
66
|
-
}> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<{
|
|
67
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
68
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
69
|
-
method: z.ZodLiteral<TMethodName>;
|
|
70
|
-
params: TParams | ZodUndefined;
|
|
71
|
-
}>[k_1]; } : never>;
|
|
72
|
-
|
|
73
|
-
declare const createResponseSchema: <TParams extends z.ZodTypeAny>(resultSchema?: TParams | ZodUndefined) => z.ZodObject<{
|
|
74
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
75
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
76
|
-
result: ZodUndefined | TParams;
|
|
77
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
78
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
79
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
80
|
-
result: ZodUndefined | TParams;
|
|
81
|
-
}>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
82
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
83
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
84
|
-
result: ZodUndefined | TParams;
|
|
85
|
-
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
86
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
87
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
88
|
-
result: ZodUndefined | TParams;
|
|
89
|
-
}> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<{
|
|
90
|
-
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
91
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
92
|
-
result: ZodUndefined | TParams;
|
|
93
|
-
}>[k_1]; } : never>;
|
|
94
|
-
|
|
95
|
-
type XyoHostMethodPrefix = 'xyoHost';
|
|
96
|
-
type XyoHostMethodName = keyof XyoHost;
|
|
97
|
-
type XyoHostRpcMethodName = `${XyoHostMethodPrefix}_${XyoHostMethodName}`;
|
|
98
|
-
type XyoHostRpcRpcMethodHandlers = {
|
|
99
|
-
[K in XyoHostMethodName as `${XyoHostMethodPrefix}_${K}`]: (params: Parameters<XyoHost[K]>) => ReturnType<XyoHost[K]>;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
declare const ChainConnectionSchema: z.ZodObject<{
|
|
103
|
-
chainId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<Lowercase<string>, z.ZodTypeDef, Lowercase<string>>]>>;
|
|
104
|
-
name: z.ZodString;
|
|
105
|
-
url: z.ZodString;
|
|
106
|
-
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
name: string;
|
|
108
|
-
url: string;
|
|
109
|
-
chainId?: string | undefined;
|
|
110
|
-
}, {
|
|
111
|
-
name: string;
|
|
112
|
-
url: string;
|
|
113
|
-
chainId?: string | undefined;
|
|
114
|
-
}>;
|
|
115
|
-
declare const CaveatTypesSchema: z.ZodEnum<["chain", "expiration", "filteredResponse", "rateLimit"]>;
|
|
116
|
-
declare const CaveatsSchema: z.ZodObject<{
|
|
117
|
-
type: z.ZodEnum<["chain", "expiration", "filteredResponse", "rateLimit"]>;
|
|
118
|
-
value: z.ZodUnknown;
|
|
119
|
-
}, "strip", z.ZodTypeAny, {
|
|
120
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
121
|
-
value?: unknown;
|
|
122
|
-
}, {
|
|
123
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
124
|
-
value?: unknown;
|
|
125
|
-
}>;
|
|
126
|
-
declare const PermissionSchema: z.ZodObject<{
|
|
127
|
-
capability: z.ZodString;
|
|
128
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
129
|
-
type: z.ZodEnum<["chain", "expiration", "filteredResponse", "rateLimit"]>;
|
|
130
|
-
value: z.ZodUnknown;
|
|
131
|
-
}, "strip", z.ZodTypeAny, {
|
|
132
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
133
|
-
value?: unknown;
|
|
134
|
-
}, {
|
|
135
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
136
|
-
value?: unknown;
|
|
137
|
-
}>, "many">>;
|
|
138
|
-
invoker: z.ZodString;
|
|
139
|
-
}, "strip", z.ZodTypeAny, {
|
|
140
|
-
capability: string;
|
|
141
|
-
invoker: string;
|
|
142
|
-
caveats?: {
|
|
143
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
144
|
-
value?: unknown;
|
|
145
|
-
}[] | undefined;
|
|
146
|
-
}, {
|
|
147
|
-
capability: string;
|
|
148
|
-
invoker: string;
|
|
149
|
-
caveats?: {
|
|
150
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
151
|
-
value?: unknown;
|
|
152
|
-
}[] | undefined;
|
|
153
|
-
}>;
|
|
154
|
-
declare const InvokerPermissionSchema: z.ZodObject<{
|
|
155
|
-
capability: z.ZodString;
|
|
156
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
157
|
-
type: z.ZodEnum<["chain", "expiration", "filteredResponse", "rateLimit"]>;
|
|
158
|
-
value: z.ZodUnknown;
|
|
159
|
-
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
161
|
-
value?: unknown;
|
|
162
|
-
}, {
|
|
163
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
164
|
-
value?: unknown;
|
|
165
|
-
}>, "many">>;
|
|
166
|
-
invoker: z.ZodString;
|
|
167
|
-
} & {
|
|
168
|
-
date: z.ZodOptional<z.ZodNumber>;
|
|
169
|
-
}, "strip", z.ZodTypeAny, {
|
|
170
|
-
capability: string;
|
|
171
|
-
invoker: string;
|
|
172
|
-
date?: number | undefined;
|
|
173
|
-
caveats?: {
|
|
174
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
175
|
-
value?: unknown;
|
|
176
|
-
}[] | undefined;
|
|
177
|
-
}, {
|
|
178
|
-
capability: string;
|
|
179
|
-
invoker: string;
|
|
180
|
-
date?: number | undefined;
|
|
181
|
-
caveats?: {
|
|
182
|
-
type: "chain" | "expiration" | "filteredResponse" | "rateLimit";
|
|
183
|
-
value?: unknown;
|
|
184
|
-
}[] | undefined;
|
|
185
|
-
}>;
|
|
186
|
-
type ChainConnection = z.infer<typeof ChainConnectionSchema>;
|
|
187
|
-
declare const XyoHostRpcSchemas: RpcSchemaMap<XyoHostRpcMethodName>;
|
|
188
|
-
|
|
189
|
-
type XyoRunnerMethodName = keyof XyoRunner;
|
|
190
|
-
type XyoRunnerRpcMethodName = `xyoRunner_${XyoRunnerMethodName}`;
|
|
191
|
-
type XyoRunnerRpcMethodHandlers = {
|
|
192
|
-
[K in XyoRunnerMethodName as `xyoRunner_${K}`]: (params: Parameters<XyoRunner[K]>) => ReturnType<XyoRunner[K]>;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
type XyoSignerMethodName = keyof XyoSigner;
|
|
196
|
-
type XyoSignerRpcMethodName = `xyoSigner_${XyoSignerMethodName}`;
|
|
197
|
-
type XyoSignerRpcMethodHandlers = {
|
|
198
|
-
[K in XyoSignerMethodName as `xyoSigner_${K}`]: (params: Parameters<XyoSigner[K]>) => ReturnType<XyoSigner[K]>;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
type XyoViewerMethodName = keyof XyoViewer;
|
|
202
|
-
type XyoViewerRpcMethodName = `xyoViewer_${XyoViewerMethodName}`;
|
|
203
|
-
type XyoViewerRpcMethodHandlers = {
|
|
204
|
-
[K in XyoViewerMethodName as `xyoViewer_${K}`]: (params: Parameters<XyoViewer[K]>) => ReturnType<XyoViewer[K]>;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
type XyoProviderMethodName = keyof Pick<XyoProvider, 'send'>;
|
|
208
|
-
type XyoProviderRpcMethodName = `xyoProvider_${XyoProviderMethodName}`;
|
|
209
|
-
type XyoProviderRpcMethodHandlers = {
|
|
210
|
-
[K in XyoProviderMethodName as `xyoProvider_${K}`]: (params: Parameters<Required<XyoProvider>[K]>) => ReturnType<Required<XyoProvider>[K]>;
|
|
211
|
-
} & Partial<XyoRunnerRpcMethodHandlers> & Partial<XyoSignerRpcMethodHandlers> & Partial<XyoViewerRpcMethodHandlers>;
|
|
212
|
-
|
|
213
|
-
declare const XyoProviderRpcSchemas: RpcSchemaMap<XyoProviderRpcMethodName>;
|
|
214
|
-
|
|
215
|
-
declare const XyoRunnerRpcSchemas: RpcSchemaMap<XyoRunnerRpcMethodName>;
|
|
216
|
-
|
|
217
|
-
declare const XyoSignerRpcSchemas: RpcSchemaMap<XyoSignerRpcMethodName>;
|
|
218
|
-
|
|
219
|
-
declare const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName>;
|
|
220
|
-
|
|
221
|
-
declare const rpcMethodHandlersFromProvider: (provider: XyoProvider) => XyoProviderRpcMethodHandlers;
|
|
222
|
-
|
|
223
|
-
interface RpcTransport<TSchemas extends RpcSchemaMap> {
|
|
224
|
-
sendRequest<TMethod extends keyof TSchemas & string>(method: TMethod, params?: z.infer<TSchemas[TMethod]['params']['to']>): Promise<z.infer<TSchemas[TMethod]['result']['from']>>;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
declare class HttpRpcTransport<T extends RpcSchemaMap = RpcSchemaMap> implements RpcTransport<T> {
|
|
228
|
-
protected readonly _rpcUrl: string;
|
|
229
|
-
protected readonly _schemas: T;
|
|
230
|
-
constructor(rpcUrl: string, schemas: T);
|
|
231
|
-
sendRequest<TMethod extends keyof T & string>(method: TMethod, params?: z.infer<T[TMethod]['params']['to']>): Promise<z.infer<T[TMethod]['result']['from']>>;
|
|
232
|
-
private callRpc;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
declare class MemoryRpcTransport<T extends RpcSchemaMap = typeof AllRpcSchemas> implements RpcTransport<T> {
|
|
236
|
-
protected readonly _rpcEngine: JsonRpcEngine;
|
|
237
|
-
protected readonly _schemas: T;
|
|
238
|
-
protected readonly requestSchemas: Record<string, z.AnyZodObject>;
|
|
239
|
-
protected readonly responseSchemas: Record<string, z.AnyZodObject>;
|
|
240
|
-
constructor(rpcEngine: JsonRpcEngine, schemas?: T);
|
|
241
|
-
sendRequest<TMethod extends keyof T & string>(method: TMethod, params?: z.infer<T[TMethod]['params']['to']>): Promise<z.infer<T[TMethod]['result']['from']>>;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
declare class PostMessageRpcTransport<T extends RpcSchemaMap = RpcSchemaMap> implements RpcTransport<T> {
|
|
245
|
-
protected readonly destination?: string;
|
|
246
|
-
protected readonly schemas: T;
|
|
247
|
-
constructor(defaultDestination?: string, schemas?: T);
|
|
248
|
-
sendRequest<TMethod extends keyof T & string>(method: TMethod, params?: z.infer<T[TMethod]['params']['to']>): Promise<z.infer<T[TMethod]['result']['from']>>;
|
|
249
|
-
private callRpc;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
interface SessionMessageEnvelope<T extends JsonValue> {
|
|
253
|
-
data: T;
|
|
254
|
-
destination?: string;
|
|
255
|
-
sessionId: string;
|
|
256
|
-
}
|
|
257
|
-
/** Only intended for web pages where the xyo global object was injected */
|
|
258
|
-
declare const buildSessionMessageRequest: <T extends JsonRpcRequest>(data: T, destination?: string) => SessionMessageEnvelope<T>;
|
|
259
|
-
|
|
260
|
-
declare class JsonRpcXyoHost implements XyoHost {
|
|
261
|
-
private readonly transport;
|
|
262
|
-
constructor(transport: RpcTransport<typeof XyoHostRpcSchemas>);
|
|
263
|
-
addChain(chainConnectionInfo: ChainConnection$1): Promisable<boolean>;
|
|
264
|
-
chains(): Promisable<ChainConnection$1[]>;
|
|
265
|
-
getPermissions(): Promisable<InvokerPermission[]>;
|
|
266
|
-
requestPermissions(permissions: Permission[]): Promisable<boolean>;
|
|
267
|
-
revokePermissions(permissions: Permission[]): Promisable<boolean>;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
declare class MemoryXyoNetwork implements XyoNetwork {
|
|
271
|
-
protected readonly _networkId: NetworkId;
|
|
272
|
-
constructor(networkId: NetworkId);
|
|
273
|
-
status(): Promise<NetworkStatus>;
|
|
274
|
-
private makeRequest;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
declare class MemoryXyoProvider implements XyoProvider {
|
|
278
|
-
private readonly _network?;
|
|
279
|
-
private readonly _runner?;
|
|
280
|
-
private readonly _signer?;
|
|
281
|
-
private readonly _viewer?;
|
|
282
|
-
constructor(params?: {
|
|
283
|
-
network?: XyoNetwork;
|
|
284
|
-
runner?: XyoRunner;
|
|
285
|
-
signer?: XyoSigner;
|
|
286
|
-
viewer?: XyoViewer;
|
|
287
|
-
});
|
|
288
|
-
get network(): XyoNetwork | undefined;
|
|
289
|
-
get runner(): XyoRunner | undefined;
|
|
290
|
-
get signer(): XyoSigner | undefined;
|
|
291
|
-
get viewer(): XyoViewer | undefined;
|
|
292
|
-
send(elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], chain?: Address, nbf?: number, exp?: number, from?: Address, fees?: TransactionFeesBigInt): Promise<Signed<TransactionBoundWitness>>;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
declare class JsonRpcXyoRunner implements XyoRunner {
|
|
296
|
-
protected readonly transport: RpcTransport<typeof XyoRunnerRpcSchemas>;
|
|
297
|
-
constructor(transport: RpcTransport<typeof XyoRunnerRpcSchemas>);
|
|
298
|
-
broadcastTransaction(transaction: HydratedTransaction): Promise<Hash>;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
declare class MemoryXyoRunner implements XyoRunner {
|
|
302
|
-
protected _archivist: MemoryArchivist | undefined;
|
|
303
|
-
broadcastTransaction(transaction: HydratedTransaction): Promise<Hash>;
|
|
304
|
-
protected getArchivist(): Promise<MemoryArchivist>;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
declare class NodeXyoRunner implements XyoRunner {
|
|
308
|
-
protected readonly node: NodeInstance;
|
|
309
|
-
protected readonly pendingArchivistPath: ModuleIdentifier;
|
|
310
|
-
private _pendingArchivist;
|
|
311
|
-
constructor(node: NodeInstance);
|
|
312
|
-
broadcastTransaction(transaction: HydratedTransaction): Promise<Hash>;
|
|
313
|
-
protected getArchivist: (identifier: ModuleIdentifier) => Promise<ArchivistInstance<_xyo_network_archivist_model.ArchivistParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_archivist_model.ArchivistConfig<void, void>>>, _xyo_network_archivist_model.ArchivistModuleEventData, _xyo_network_payload_model.Payload>>;
|
|
314
|
-
protected getPendingArchivist: () => Promise<ArchivistInstance<_xyo_network_archivist_model.ArchivistParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_archivist_model.ArchivistConfig<void, void>>>, _xyo_network_archivist_model.ArchivistModuleEventData, _xyo_network_payload_model.Payload>>;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
declare class JsonRpcXyoSigner implements XyoSigner {
|
|
318
|
-
protected readonly transport: RpcTransport<typeof XyoSignerRpcSchemas>;
|
|
319
|
-
constructor(transport: RpcTransport<typeof XyoSignerRpcSchemas>);
|
|
320
|
-
address(): Promise<Address>;
|
|
321
|
-
createSignedTransaction(chain: Address, elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], nbf: number, exp: number, fees: TransactionFeesBigInt, from?: Address): Promise<Signed<TransactionBoundWitness>>;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
declare class MemoryXyoSigner implements XyoSigner {
|
|
325
|
-
protected readonly _account: AccountInstance;
|
|
326
|
-
constructor(account: AccountInstance);
|
|
327
|
-
address(): Address;
|
|
328
|
-
createSignedTransaction(chain: Address, elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], nbf: number, exp: number, fees: TransactionFeesBigInt, from?: Address): Promise<Signed<TransactionBoundWitness>>;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
declare class JsonRpcXyoViewer implements XyoViewer {
|
|
332
|
-
protected readonly transport: RpcTransport<typeof XyoViewerRpcSchemas>;
|
|
333
|
-
constructor(transport: RpcTransport<typeof XyoViewerRpcSchemas>);
|
|
334
|
-
accountBalance(address: Address): Promise<bigint>;
|
|
335
|
-
accountHistory(address: Address): Promise<[TransactionBoundWitness[], Transfer[]]>;
|
|
336
|
-
blockByHash(hash: Hash): Promise<HydratedBlock | null>;
|
|
337
|
-
blockByNumber(blockNumber: number): Promise<HydratedBlock | null>;
|
|
338
|
-
blocksByHash(hash: Hash, limit?: number): Promise<HydratedBlock[]>;
|
|
339
|
-
chainId(): Promise<Address>;
|
|
340
|
-
currentBlock(): Promise<HydratedBlock>;
|
|
341
|
-
currentBlockHash(): Promise<Hash>;
|
|
342
|
-
currentBlockNumber(): Promise<number>;
|
|
343
|
-
transactionByBlockHashAndIndex(blockHash: Hash, transactionIndex: number): Promise<HydratedTransaction | null>;
|
|
344
|
-
transactionByBlockNumberAndIndex(blockNumber: number, transactionIndex: number): Promise<HydratedTransaction | null>;
|
|
345
|
-
transactionByHash(transactionHash: Hash): Promise<HydratedTransaction | null>;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export { AllRpcSchemas, CaveatTypesSchema, CaveatsSchema, ChainConnectionSchema, HttpRpcTransport, InvokerPermissionSchema, JsonRpcErrorCodes, JsonRpcXyoHost, JsonRpcXyoRunner, JsonRpcXyoSigner, JsonRpcXyoViewer, MemoryRpcTransport, MemoryXyoNetwork, MemoryXyoProvider, MemoryXyoRunner, MemoryXyoSigner, NodeXyoRunner, PermissionSchema, PostMessageRpcTransport, XyoHostRpcSchemas, XyoProviderRpcSchemas, XyoRunnerRpcSchemas, XyoSignerRpcSchemas, XyoViewerRpcSchemas, buildSessionMessageRequest, createRequestSchema, createResponseSchema, jsonrpc, requestSchemas, rpcMethodHandlersFromProvider };
|
|
349
|
-
export type { ChainConnection, RequestResponseSchemas, RpcSchemaMap, RpcTransport, SessionMessageEnvelope, XyoHostMethodName, XyoHostMethodPrefix, XyoHostRpcMethodName, XyoHostRpcRpcMethodHandlers, XyoProviderMethodName, XyoProviderRpcMethodHandlers, XyoProviderRpcMethodName, XyoRunnerMethodName, XyoRunnerRpcMethodHandlers, XyoRunnerRpcMethodName, XyoSignerMethodName, XyoSignerRpcMethodHandlers, XyoSignerRpcMethodName, XyoViewerMethodName, XyoViewerRpcMethodHandlers, XyoViewerRpcMethodName };
|
|
1
|
+
export * from './engine/index.ts';
|
|
2
|
+
export * from './provider/index.ts';
|
|
3
|
+
export * from './transport/index.ts';
|
|
4
|
+
export * from './types/index.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -58,29 +58,35 @@ var rpcMethodHandlersFromProvider = /* @__PURE__ */ __name((provider) => {
|
|
|
58
58
|
return result;
|
|
59
59
|
}, "rpcMethodHandlersFromProvider");
|
|
60
60
|
|
|
61
|
-
// src/provider/host/
|
|
62
|
-
var
|
|
61
|
+
// src/provider/host/JsonRpcXyoGateway.ts
|
|
62
|
+
var JsonRpcXyoGateway = class {
|
|
63
63
|
static {
|
|
64
|
-
__name(this, "
|
|
64
|
+
__name(this, "JsonRpcXyoGateway");
|
|
65
65
|
}
|
|
66
66
|
transport;
|
|
67
67
|
constructor(transport) {
|
|
68
68
|
this.transport = transport;
|
|
69
69
|
}
|
|
70
|
+
activeChain() {
|
|
71
|
+
throw new Error("getter not implemented.");
|
|
72
|
+
}
|
|
70
73
|
addChain(chainConnectionInfo) {
|
|
71
|
-
return this.transport.sendRequest("
|
|
74
|
+
return this.transport.sendRequest("xyoGateway_addChain", chainConnectionInfo);
|
|
72
75
|
}
|
|
73
76
|
chains() {
|
|
74
|
-
return this.transport.sendRequest("
|
|
77
|
+
return this.transport.sendRequest("xyoGateway_chains");
|
|
75
78
|
}
|
|
76
79
|
getPermissions() {
|
|
77
|
-
return this.transport.sendRequest("
|
|
80
|
+
return this.transport.sendRequest("xyoGateway_getPermissions");
|
|
78
81
|
}
|
|
79
82
|
requestPermissions(permissions) {
|
|
80
|
-
return this.transport.sendRequest("
|
|
83
|
+
return this.transport.sendRequest("xyoGateway_requestPermissions", permissions);
|
|
81
84
|
}
|
|
82
85
|
revokePermissions(permissions) {
|
|
83
|
-
return this.transport.sendRequest("
|
|
86
|
+
return this.transport.sendRequest("xyoGateway_revokePermissions", permissions);
|
|
87
|
+
}
|
|
88
|
+
submitTransaction(_tx) {
|
|
89
|
+
throw new Error("Method not implemented.");
|
|
84
90
|
}
|
|
85
91
|
};
|
|
86
92
|
|
|
@@ -971,8 +977,8 @@ var PermissionSchema = z20.object({
|
|
|
971
977
|
var InvokerPermissionSchema = PermissionSchema.extend({
|
|
972
978
|
date: z20.number().optional()
|
|
973
979
|
});
|
|
974
|
-
var
|
|
975
|
-
|
|
980
|
+
var XyoGatewayRpcSchemas = {
|
|
981
|
+
xyoGateway_addChain: {
|
|
976
982
|
params: {
|
|
977
983
|
to: z20.tuple([
|
|
978
984
|
ChainConnectionSchema
|
|
@@ -990,7 +996,7 @@ var XyoHostRpcSchemas = {
|
|
|
990
996
|
])
|
|
991
997
|
}
|
|
992
998
|
},
|
|
993
|
-
|
|
999
|
+
xyoGateway_chains: {
|
|
994
1000
|
params: {
|
|
995
1001
|
to: z20.array(z20.any()).length(0).optional(),
|
|
996
1002
|
from: z20.array(z20.any()).length(0).optional()
|
|
@@ -1000,7 +1006,7 @@ var XyoHostRpcSchemas = {
|
|
|
1000
1006
|
from: z20.array(ChainConnectionSchema)
|
|
1001
1007
|
}
|
|
1002
1008
|
},
|
|
1003
|
-
|
|
1009
|
+
xyoGateway_getPermissions: {
|
|
1004
1010
|
params: {
|
|
1005
1011
|
to: z20.array(z20.any()).length(0).optional(),
|
|
1006
1012
|
from: z20.array(z20.any()).length(0).optional()
|
|
@@ -1010,7 +1016,7 @@ var XyoHostRpcSchemas = {
|
|
|
1010
1016
|
from: z20.array(InvokerPermissionSchema)
|
|
1011
1017
|
}
|
|
1012
1018
|
},
|
|
1013
|
-
|
|
1019
|
+
xyoGateway_requestPermissions: {
|
|
1014
1020
|
params: {
|
|
1015
1021
|
to: z20.array(PermissionSchema),
|
|
1016
1022
|
from: z20.array(PermissionSchema)
|
|
@@ -1020,7 +1026,7 @@ var XyoHostRpcSchemas = {
|
|
|
1020
1026
|
from: z20.boolean()
|
|
1021
1027
|
}
|
|
1022
1028
|
},
|
|
1023
|
-
|
|
1029
|
+
xyoGateway_revokePermissions: {
|
|
1024
1030
|
params: {
|
|
1025
1031
|
to: z20.array(PermissionSchema),
|
|
1026
1032
|
from: z20.array(PermissionSchema)
|
|
@@ -1029,6 +1035,26 @@ var XyoHostRpcSchemas = {
|
|
|
1029
1035
|
to: z20.boolean(),
|
|
1030
1036
|
from: z20.boolean()
|
|
1031
1037
|
}
|
|
1038
|
+
},
|
|
1039
|
+
xyoGateway_activeChain: {
|
|
1040
|
+
params: {
|
|
1041
|
+
from: z20.string().optional(),
|
|
1042
|
+
to: z20.string().optional()
|
|
1043
|
+
},
|
|
1044
|
+
result: {
|
|
1045
|
+
from: z20.string().optional(),
|
|
1046
|
+
to: z20.string().optional()
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
xyoGateway_submitTransaction: {
|
|
1050
|
+
params: {
|
|
1051
|
+
from: z20.array(HydratedTransactionSchema),
|
|
1052
|
+
to: z20.array(HydratedTransactionSchema)
|
|
1053
|
+
},
|
|
1054
|
+
result: {
|
|
1055
|
+
from: BlockBoundWitnessSchema,
|
|
1056
|
+
to: BlockBoundWitnessSchema
|
|
1057
|
+
}
|
|
1032
1058
|
}
|
|
1033
1059
|
};
|
|
1034
1060
|
|
|
@@ -1130,7 +1156,7 @@ var PostMessageRpcTransport = class {
|
|
|
1130
1156
|
}
|
|
1131
1157
|
destination;
|
|
1132
1158
|
schemas;
|
|
1133
|
-
constructor(defaultDestination, schemas =
|
|
1159
|
+
constructor(defaultDestination, schemas = XyoGatewayRpcSchemas) {
|
|
1134
1160
|
this.schemas = schemas;
|
|
1135
1161
|
this.destination = defaultDestination;
|
|
1136
1162
|
}
|
|
@@ -1170,7 +1196,7 @@ export {
|
|
|
1170
1196
|
HttpRpcTransport,
|
|
1171
1197
|
InvokerPermissionSchema,
|
|
1172
1198
|
JsonRpcErrorCodes,
|
|
1173
|
-
|
|
1199
|
+
JsonRpcXyoGateway,
|
|
1174
1200
|
JsonRpcXyoRunner,
|
|
1175
1201
|
JsonRpcXyoSigner,
|
|
1176
1202
|
JsonRpcXyoViewer,
|
|
@@ -1182,7 +1208,7 @@ export {
|
|
|
1182
1208
|
NodeXyoRunner,
|
|
1183
1209
|
PermissionSchema,
|
|
1184
1210
|
PostMessageRpcTransport,
|
|
1185
|
-
|
|
1211
|
+
XyoGatewayRpcSchemas,
|
|
1186
1212
|
XyoProviderRpcSchemas,
|
|
1187
1213
|
XyoRunnerRpcSchemas,
|
|
1188
1214
|
XyoSignerRpcSchemas,
|