@xyo-network/xl1-rpc 1.7.15 → 1.7.16
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/provider/client/MemoryXyoClient.d.ts +8 -0
- package/dist/neutral/provider/client/MemoryXyoClient.d.ts.map +1 -0
- package/dist/neutral/provider/client/XyoClient.d.ts +6 -0
- package/dist/neutral/provider/client/XyoClient.d.ts.map +1 -0
- package/dist/neutral/provider/client/index.d.ts +3 -0
- package/dist/neutral/provider/client/index.d.ts.map +1 -0
- package/dist/neutral/provider/client/spec/MemoryXyoClient.spec.d.ts +2 -0
- package/dist/neutral/provider/client/spec/MemoryXyoClient.spec.d.ts.map +1 -0
- package/dist/node/provider/client/MemoryXyoClient.d.ts +8 -0
- package/dist/node/provider/client/MemoryXyoClient.d.ts.map +1 -0
- package/dist/node/provider/client/XyoClient.d.ts +6 -0
- package/dist/node/provider/client/XyoClient.d.ts.map +1 -0
- package/dist/node/provider/client/index.d.ts +3 -0
- package/dist/node/provider/client/index.d.ts.map +1 -0
- package/dist/node/provider/client/spec/MemoryXyoClient.spec.d.ts +2 -0
- package/dist/node/provider/client/spec/MemoryXyoClient.spec.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/provider/client/MemoryXyoClient.ts +12 -0
- package/src/provider/client/XyoClient.ts +6 -0
- package/src/provider/client/index.ts +2 -0
- package/src/provider/client/spec/MemoryXyoClient.spec.ts +44 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MemoryXyoGateway, PermissionsStore } from '../host/index.ts';
|
|
2
|
+
import type { XyoClient } from './XyoClient.ts';
|
|
3
|
+
export declare class MemoryXyoClient implements XyoClient {
|
|
4
|
+
readonly gateways: Readonly<Record<string, MemoryXyoGateway>>;
|
|
5
|
+
readonly permissionsStore: PermissionsStore;
|
|
6
|
+
constructor(permissionsStore: PermissionsStore, gateways: Readonly<Record<string, MemoryXyoGateway>>);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MemoryXyoClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryXyoClient.d.ts","sourceRoot":"","sources":["../../../../src/provider/client/MemoryXyoClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,qBAAa,eAAgB,YAAW,SAAS;IAC/C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAA;IAC7D,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAA;gBAE/B,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAIrG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XyoClient.d.ts","sourceRoot":"","sources":["../../../../src/provider/client/XyoClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE1E,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAA;IACpD,gBAAgB,EAAE,gBAAgB,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryXyoClient.spec.d.ts","sourceRoot":"","sources":["../../../../../src/provider/client/spec/MemoryXyoClient.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MemoryXyoGateway, PermissionsStore } from '../host/index.ts';
|
|
2
|
+
import type { XyoClient } from './XyoClient.ts';
|
|
3
|
+
export declare class MemoryXyoClient implements XyoClient {
|
|
4
|
+
readonly gateways: Readonly<Record<string, MemoryXyoGateway>>;
|
|
5
|
+
readonly permissionsStore: PermissionsStore;
|
|
6
|
+
constructor(permissionsStore: PermissionsStore, gateways: Readonly<Record<string, MemoryXyoGateway>>);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MemoryXyoClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryXyoClient.d.ts","sourceRoot":"","sources":["../../../../src/provider/client/MemoryXyoClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,qBAAa,eAAgB,YAAW,SAAS;IAC/C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAA;IAC7D,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAA;gBAE/B,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAIrG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XyoClient.d.ts","sourceRoot":"","sources":["../../../../src/provider/client/XyoClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE1E,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAA;IACpD,gBAAgB,EAAE,gBAAgB,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryXyoClient.spec.d.ts","sourceRoot":"","sources":["../../../../../src/provider/client/spec/MemoryXyoClient.spec.ts"],"names":[],"mappings":""}
|
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.7.
|
|
4
|
+
"version": "1.7.16",
|
|
5
5
|
"description": "XYO Layer One API",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"@xyo-network/payload-builder": "^4.1.7",
|
|
76
76
|
"@xyo-network/payload-model": "^4.1.7",
|
|
77
77
|
"@xyo-network/payload-wrapper": "^4.1.7",
|
|
78
|
-
"@xyo-network/xl1-protocol": "^1.7.
|
|
79
|
-
"@xyo-network/xl1-protocol-sdk": "^1.7.
|
|
80
|
-
"@xyo-network/xl1-wrappers": "^1.7.
|
|
78
|
+
"@xyo-network/xl1-protocol": "^1.7.20",
|
|
79
|
+
"@xyo-network/xl1-protocol-sdk": "^1.7.16",
|
|
80
|
+
"@xyo-network/xl1-wrappers": "^1.7.16",
|
|
81
81
|
"axios": "^1.11.0",
|
|
82
82
|
"uuid": "^11.1.0",
|
|
83
83
|
"zod": "^3.25.76"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MemoryXyoGateway, PermissionsStore } from '../host/index.ts'
|
|
2
|
+
import type { XyoClient } from './XyoClient.ts'
|
|
3
|
+
|
|
4
|
+
export class MemoryXyoClient implements XyoClient {
|
|
5
|
+
readonly gateways: Readonly<Record<string, MemoryXyoGateway>>
|
|
6
|
+
readonly permissionsStore: PermissionsStore
|
|
7
|
+
|
|
8
|
+
constructor(permissionsStore: PermissionsStore, gateways: Readonly<Record<string, MemoryXyoGateway>>) {
|
|
9
|
+
this.permissionsStore = permissionsStore
|
|
10
|
+
this.gateways = gateways
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Account } from '@xyo-network/account'
|
|
2
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
3
|
+
import {
|
|
4
|
+
beforeEach, describe, expect, it,
|
|
5
|
+
} from 'vitest'
|
|
6
|
+
|
|
7
|
+
import { MemoryPermissionsStore, MemoryXyoGateway } from '../../host/index.ts'
|
|
8
|
+
import { RpcXyoConnection } from '../../provider/index.ts'
|
|
9
|
+
import { MemoryXyoSigner } from '../../signer/index.ts'
|
|
10
|
+
import { MemoryXyoClient } from '../MemoryXyoClient.ts'
|
|
11
|
+
import type { XyoClient } from '../XyoClient.ts'
|
|
12
|
+
|
|
13
|
+
describe('Client', () => {
|
|
14
|
+
const endpoint = 'http://localhost:8080/rpc'
|
|
15
|
+
const dataLakeEndpoint = 'http://localhost:8080/chain/archivist'
|
|
16
|
+
let account: AccountInstance
|
|
17
|
+
let signer: MemoryXyoSigner
|
|
18
|
+
let store: MemoryPermissionsStore
|
|
19
|
+
let gateway: MemoryXyoGateway
|
|
20
|
+
let sut: XyoClient
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
account = await Account.random()
|
|
24
|
+
signer = new MemoryXyoSigner(account)
|
|
25
|
+
|
|
26
|
+
store = new MemoryPermissionsStore()
|
|
27
|
+
gateway = new MemoryXyoGateway(signer, store)
|
|
28
|
+
await gateway.addConnection('localhost', new RpcXyoConnection({ endpoint }))
|
|
29
|
+
sut = new MemoryXyoClient(store, { localhost: gateway })
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('gateways', () => {
|
|
33
|
+
describe('activeConnection', () => {
|
|
34
|
+
it('should be defined', () => {
|
|
35
|
+
const gateway = sut.gateways.localhost.activeConnection()
|
|
36
|
+
expect(gateway).toBeDefined()
|
|
37
|
+
})
|
|
38
|
+
it('should allow retrieving the chain ID', async () => {
|
|
39
|
+
const chainId = await sut.gateways.localhost?.activeConnection()?.viewer?.chainId()
|
|
40
|
+
expect(chainId).toBeDefined()
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
})
|