@xyo-network/xl1-rpc 1.8.3 → 1.8.4
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/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/package.json +13 -13
- 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
|
@@ -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,
|