@xyo-network/xl1-rpc 1.8.3 → 1.9.0
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 +4 -1
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/host/Abstract.d.ts.map +1 -1
- package/dist/neutral/transport/post-message/SessionEnvelope.d.ts +1 -1
- package/dist/neutral/transport/post-message/SessionEnvelope.d.ts.map +1 -1
- package/dist/neutral/types/schema/common/SequenceSchema.d.ts.map +1 -1
- package/dist/node/index-node.mjs +4 -1
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/host/Abstract.d.ts.map +1 -1
- package/dist/node/transport/post-message/SessionEnvelope.d.ts +1 -1
- package/dist/node/transport/post-message/SessionEnvelope.d.ts.map +1 -1
- package/dist/node/types/schema/common/SequenceSchema.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/provider/host/Abstract.ts +5 -14
- package/src/provider/host/spec/MemoryXyoGateway.spec.ts +13 -3
- package/src/transport/post-message/SessionEnvelope.ts +1 -1
- package/src/types/schema/common/SequenceSchema.ts +2 -2
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.
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"description": "XYO Layer One API",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -59,24 +59,24 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@metamask/json-rpc-engine": "^10.0.3",
|
|
61
61
|
"@metamask/utils": "^11.4.2",
|
|
62
|
-
"@xylabs/assert": "^
|
|
63
|
-
"@xylabs/axios": "^
|
|
64
|
-
"@xylabs/hex": "^
|
|
65
|
-
"@xylabs/object": "^
|
|
66
|
-
"@xylabs/promise": "^
|
|
67
|
-
"@xylabs/typeof": "^
|
|
68
|
-
"@xyo-network/account-model": "^
|
|
69
|
-
"@xyo-network/archivist-memory": "^
|
|
70
|
-
"@xyo-network/archivist-model": "^
|
|
71
|
-
"@xyo-network/boundwitness-model": "^
|
|
72
|
-
"@xyo-network/module-model": "^
|
|
73
|
-
"@xyo-network/node-model": "^
|
|
74
|
-
"@xyo-network/payload-builder": "^
|
|
75
|
-
"@xyo-network/payload-model": "^
|
|
76
|
-
"@xyo-network/payload-wrapper": "^
|
|
77
|
-
"@xyo-network/xl1-protocol": "^1.
|
|
78
|
-
"@xyo-network/xl1-protocol-sdk": "^1.
|
|
79
|
-
"@xyo-network/xl1-wrappers": "^1.
|
|
62
|
+
"@xylabs/assert": "^5.0.0",
|
|
63
|
+
"@xylabs/axios": "^5.0.0",
|
|
64
|
+
"@xylabs/hex": "^5.0.0",
|
|
65
|
+
"@xylabs/object": "^5.0.0",
|
|
66
|
+
"@xylabs/promise": "^5.0.0",
|
|
67
|
+
"@xylabs/typeof": "^5.0.0",
|
|
68
|
+
"@xyo-network/account-model": "^5.0.0",
|
|
69
|
+
"@xyo-network/archivist-memory": "^5.0.0",
|
|
70
|
+
"@xyo-network/archivist-model": "^5.0.0",
|
|
71
|
+
"@xyo-network/boundwitness-model": "^5.0.0",
|
|
72
|
+
"@xyo-network/module-model": "^5.0.0",
|
|
73
|
+
"@xyo-network/node-model": "^5.0.0",
|
|
74
|
+
"@xyo-network/payload-builder": "^5.0.0",
|
|
75
|
+
"@xyo-network/payload-model": "^5.0.0",
|
|
76
|
+
"@xyo-network/payload-wrapper": "^5.0.0",
|
|
77
|
+
"@xyo-network/xl1-protocol": "^1.8.0",
|
|
78
|
+
"@xyo-network/xl1-protocol-sdk": "^1.9.0",
|
|
79
|
+
"@xyo-network/xl1-wrappers": "^1.9.0",
|
|
80
80
|
"axios": "^1.11.0",
|
|
81
81
|
"uuid": "^11.1.0",
|
|
82
82
|
"zod": "^3.25.76"
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@metamask/utils": "^11.4.2",
|
|
86
86
|
"@types/node": "^24.1.0",
|
|
87
|
-
"@xylabs/logger": "^
|
|
88
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.
|
|
89
|
-
"@xylabs/tsconfig": "^7.0.
|
|
90
|
-
"@xylabs/vitest-extended": "^
|
|
91
|
-
"@xyo-network/account": "^
|
|
92
|
-
"@xyo-network/wallet": "^
|
|
87
|
+
"@xylabs/logger": "^5.0.0",
|
|
88
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.2",
|
|
89
|
+
"@xylabs/tsconfig": "^7.0.2",
|
|
90
|
+
"@xylabs/vitest-extended": "^5.0.0",
|
|
91
|
+
"@xyo-network/account": "^5.0.0",
|
|
92
|
+
"@xyo-network/wallet": "^5.0.0",
|
|
93
93
|
"dotenv": "^17.2.1",
|
|
94
94
|
"knip": "^5.62.0",
|
|
95
95
|
"typescript": "^5.8.3",
|
|
@@ -2,13 +2,7 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { Payload } from '@xyo-network/payload-model'
|
|
4
4
|
import type {
|
|
5
|
-
AllowedBlockPayload,
|
|
6
|
-
HydratedTransaction,
|
|
7
|
-
InvokerPermission, Permission,
|
|
8
|
-
XyoConnectionProvider,
|
|
9
|
-
XyoGatewayProvider,
|
|
10
|
-
XyoRpcConnectionConfig,
|
|
11
|
-
XyoSigner,
|
|
5
|
+
AllowedBlockPayload, HydratedTransaction, InvokerPermission, Permission, XyoConnectionProvider, XyoGatewayProvider, XyoRpcConnectionConfig, XyoSigner,
|
|
12
6
|
} from '@xyo-network/xl1-protocol'
|
|
13
7
|
|
|
14
8
|
export abstract class AbstractXyoGateway implements XyoGatewayProvider {
|
|
@@ -37,13 +31,10 @@ export abstract class AbstractXyoGateway implements XyoGatewayProvider {
|
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
async submitTransaction(elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[]): Promise<HydratedTransaction> {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
).submitTransaction,
|
|
45
|
-
() => 'Active connection does not support transaction submission',
|
|
46
|
-
)(elevatedPayloads, additionalPayloads)
|
|
34
|
+
const connection = await this.connection()
|
|
35
|
+
assertEx(connection.submitTransaction, () => 'Active connection does not support transaction submission')
|
|
36
|
+
const tx = await connection.submitTransaction?.(elevatedPayloads, additionalPayloads)
|
|
37
|
+
return assertEx(tx, () => 'Transaction submission failed')
|
|
47
38
|
}
|
|
48
39
|
|
|
49
40
|
abstract connection(): Promisable<XyoConnectionProvider>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Account } from '@xyo-network/account'
|
|
2
2
|
import type { AccountInstance } from '@xyo-network/account-model'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import type { AllowedBlockPayload } from '@xyo-network/xl1-protocol'
|
|
3
5
|
import {
|
|
4
6
|
beforeEach, describe, expect, it,
|
|
5
7
|
} from 'vitest'
|
|
6
8
|
|
|
7
|
-
import {
|
|
9
|
+
import { HttpRpcXyoConnection } from '../../provider/index.ts'
|
|
8
10
|
import { MemoryXyoSigner } from '../../signer/index.ts'
|
|
9
11
|
import { MemoryXyoGateway } from '../MemoryXyoGateway.ts'
|
|
10
12
|
|
|
@@ -13,14 +15,14 @@ describe('MemoryXyoGateway', () => {
|
|
|
13
15
|
const dataLakeEndpoint = 'http://localhost:8080/chain/archivist'
|
|
14
16
|
let account: AccountInstance
|
|
15
17
|
let signer: MemoryXyoSigner
|
|
16
|
-
let connection:
|
|
18
|
+
let connection: HttpRpcXyoConnection
|
|
17
19
|
let sut: MemoryXyoGateway
|
|
18
20
|
|
|
19
21
|
beforeEach(async () => {
|
|
20
22
|
account = await Account.random()
|
|
21
23
|
signer = new MemoryXyoSigner(account)
|
|
22
24
|
|
|
23
|
-
connection = new
|
|
25
|
+
connection = new HttpRpcXyoConnection({ endpoint, account })
|
|
24
26
|
sut = new MemoryXyoGateway(signer, connection)
|
|
25
27
|
})
|
|
26
28
|
|
|
@@ -34,4 +36,12 @@ describe('MemoryXyoGateway', () => {
|
|
|
34
36
|
expect(sut.signer()).toBeDefined()
|
|
35
37
|
})
|
|
36
38
|
})
|
|
39
|
+
describe.skip('submitTransaction', () => {
|
|
40
|
+
it('should submit the transaction', async () => {
|
|
41
|
+
const elevatedPayloads: AllowedBlockPayload[] = []
|
|
42
|
+
const additionalPayloads: Payload[] = []
|
|
43
|
+
const tx = await sut.submitTransaction(elevatedPayloads, additionalPayloads)
|
|
44
|
+
expect(tx).toBeDefined()
|
|
45
|
+
})
|
|
46
|
+
})
|
|
37
47
|
})
|
|
@@ -8,7 +8,7 @@ export interface SessionMessageEnvelope<T extends JsonValue> {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/** Only intended for web pages where the xyo global object was injected */
|
|
11
|
-
/** @deprecated -
|
|
11
|
+
/** @deprecated - this is now handled in the wallet extension */
|
|
12
12
|
export const buildSessionMessageRequest = <T extends JsonRpcRequest>(data: T, destination?: string) => {
|
|
13
13
|
const request: SessionMessageEnvelope<T> = {
|
|
14
14
|
data,
|
|
@@ -9,11 +9,11 @@ import { z } from 'zod'
|
|
|
9
9
|
|
|
10
10
|
const LocalSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.localSequenceBytes, SequenceConstants.localSequenceBytes))
|
|
11
11
|
export const LocalSequenceToStringSchema = z.string().regex(LocalSequenceRegex)
|
|
12
|
-
export const LocalSequenceFromStringSchema = z.string().regex(LocalSequenceRegex).transform<LocalSequence>(v => toHex(v))
|
|
12
|
+
export const LocalSequenceFromStringSchema = z.string().regex(LocalSequenceRegex).transform<LocalSequence>(v => toHex(v) as LocalSequence)
|
|
13
13
|
|
|
14
14
|
const QualifiedSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.qualifiedSequenceBytes, SequenceConstants.qualifiedSequenceBytes))
|
|
15
15
|
export const QualifiedSequenceToStringSchema = z.string().regex(QualifiedSequenceRegex)
|
|
16
|
-
export const QualifiedSequenceFromStringSchema = z.string().regex(QualifiedSequenceRegex).transform<QualifiedSequence>(v => toHex(v))
|
|
16
|
+
export const QualifiedSequenceFromStringSchema = z.string().regex(QualifiedSequenceRegex).transform<QualifiedSequence>(v => toHex(v) as QualifiedSequence)
|
|
17
17
|
|
|
18
18
|
export const SequenceToStringSchema = z.union([LocalSequenceToStringSchema, QualifiedSequenceToStringSchema])
|
|
19
19
|
export const SequenceFromStringSchema = z.union([LocalSequenceFromStringSchema, QualifiedSequenceFromStringSchema])
|