@xyo-network/xl1-rpc 1.8.0 → 1.8.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/index.mjs +21 -9
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/provider/{RpcXyoConnection.d.ts → HttpRpcXyoConnection.d.ts} +7 -2
- package/dist/neutral/provider/provider/HttpRpcXyoConnection.d.ts.map +1 -0
- package/dist/neutral/provider/provider/index.d.ts +1 -1
- package/dist/neutral/provider/provider/index.d.ts.map +1 -1
- package/dist/node/index-node.mjs +155 -145
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/provider/{RpcXyoConnection.d.ts → HttpRpcXyoConnection.d.ts} +7 -2
- package/dist/node/provider/provider/HttpRpcXyoConnection.d.ts.map +1 -0
- package/dist/node/provider/provider/index.d.ts +1 -1
- package/dist/node/provider/provider/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/provider/provider/HttpRpcXyoConnection.ts +32 -0
- package/src/provider/provider/index.ts +1 -1
- package/dist/neutral/provider/provider/RpcXyoConnection.d.ts.map +0 -1
- package/dist/node/provider/provider/RpcXyoConnection.d.ts.map +0 -1
- package/src/provider/provider/RpcXyoConnection.ts +0 -26
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isDefined } from '@xylabs/typeof'
|
|
2
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
3
|
+
|
|
4
|
+
import { HttpRpcTransport } from '../../transport/index.ts'
|
|
5
|
+
import { XyoRunnerRpcSchemas, XyoViewerRpcSchemas } from '../../types/index.ts'
|
|
6
|
+
import { JsonRpcXyoRunner } from '../runner/index.ts'
|
|
7
|
+
import { MemoryXyoSigner } from '../signer/index.ts'
|
|
8
|
+
import { JsonRpcXyoViewer } from '../viewer/index.ts'
|
|
9
|
+
import { XyoConnection } from './XyoConnection.ts'
|
|
10
|
+
|
|
11
|
+
export interface RpcXyoProviderParams {
|
|
12
|
+
account?: AccountInstance
|
|
13
|
+
endpoint: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class HttpRpcXyoConnection extends XyoConnection {
|
|
17
|
+
constructor(params: RpcXyoProviderParams) {
|
|
18
|
+
const { account, endpoint } = params
|
|
19
|
+
const signer = isDefined(account) ? new MemoryXyoSigner(account) : undefined
|
|
20
|
+
const transport = new HttpRpcTransport(endpoint, { ...XyoRunnerRpcSchemas, ...XyoViewerRpcSchemas })
|
|
21
|
+
const runner = new JsonRpcXyoRunner(transport)
|
|
22
|
+
const viewer = new JsonRpcXyoViewer(transport)
|
|
23
|
+
super({
|
|
24
|
+
signer, runner, viewer,
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use `HttpRpcXyoConnection` instead.
|
|
31
|
+
*/
|
|
32
|
+
export class RpcXyoConnection extends HttpRpcXyoConnection {}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RpcXyoConnection.d.ts","sourceRoot":"","sources":["../../../../src/provider/provider/RpcXyoConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAQjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,qBAAa,gBAAiB,SAAQ,aAAa;gBACrC,MAAM,EAAE,oBAAoB;CASzC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RpcXyoConnection.d.ts","sourceRoot":"","sources":["../../../../src/provider/provider/RpcXyoConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAQjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,qBAAa,gBAAiB,SAAQ,aAAa;gBACrC,MAAM,EAAE,oBAAoB;CASzC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { AccountInstance } from '@xyo-network/account-model'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
HttpRpcTransport, XyoRunnerRpcSchemas, XyoViewerRpcSchemas,
|
|
5
|
-
} from '../../index-node.ts'
|
|
6
|
-
import { JsonRpcXyoRunner } from '../runner/index.ts'
|
|
7
|
-
import { MemoryXyoSigner } from '../signer/index.ts'
|
|
8
|
-
import { JsonRpcXyoViewer } from '../viewer/index.ts'
|
|
9
|
-
import { XyoConnection } from './XyoConnection.ts'
|
|
10
|
-
|
|
11
|
-
export interface RpcXyoProviderParams {
|
|
12
|
-
account?: AccountInstance
|
|
13
|
-
endpoint: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export class RpcXyoConnection extends XyoConnection {
|
|
17
|
-
constructor(params: RpcXyoProviderParams) {
|
|
18
|
-
const transport = new HttpRpcTransport(params.endpoint, { ...XyoRunnerRpcSchemas, ...XyoViewerRpcSchemas })
|
|
19
|
-
const signer = params.account ? new MemoryXyoSigner(params.account) : undefined
|
|
20
|
-
const runner = new JsonRpcXyoRunner(transport)
|
|
21
|
-
const viewer = new JsonRpcXyoViewer(transport)
|
|
22
|
-
super({
|
|
23
|
-
signer, runner, viewer,
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
}
|