Skip to content

Commit 8a94724

Browse files
authored
Merge pull request #9 from XYOracleNetwork/feature/xl1-sdk-updates
SDK Updates
2 parents eee1574 + 3051559 commit 8a94724

4 files changed

Lines changed: 26 additions & 29 deletions

File tree

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,25 @@
2525
"updo": "npx npm-check-updates -i"
2626
},
2727
"dependencies": {
28-
"@xylabs/assert": "5.0.63",
29-
"@xylabs/delay": "5.0.63",
30-
"@xylabs/tsconfig": "7.2.32",
31-
"@xylabs/typeof": "5.0.63",
32-
"@xyo-network/payload-builder": "5.2.25",
33-
"@xyo-network/wallet": "5.2.25",
34-
"@xyo-network/xl1-sdk": "1.18.33",
35-
"dotenv": "17.2.3"
28+
"@xylabs/assert": "5.0.65",
29+
"@xylabs/delay": "5.0.65",
30+
"@xylabs/tsconfig": "7.3.2",
31+
"@xylabs/typeof": "5.0.65",
32+
"@xyo-network/payload-builder": "5.3.2",
33+
"@xyo-network/wallet": "5.3.2",
34+
"@xyo-network/xl1-sdk": "1.21.10",
35+
"dotenv": "17.2.3",
36+
"zod": "4.3.6"
3637
},
3738
"devDependencies": {
38-
"@types/node": "25.0.9",
39-
"@xylabs/eslint-config-flat": "7.2.32",
40-
"@xyo-network/account-model": "5.2.25",
41-
"@xyo-network/payload-model": "5.2.25",
42-
"@xyo-network/xl1-cli": "1.18.1",
39+
"@types/node": "25.2.0",
40+
"@xylabs/eslint-config-flat": "7.3.2",
41+
"@xyo-network/account-model": "5.3.2",
42+
"@xyo-network/payload-model": "5.3.2",
43+
"@xyo-network/xl1-cli": "1.19.6",
4344
"eslint": "9.39.2",
4445
"eslint-import-resolver-typescript": "4.4.4",
45-
"npm-check-updates": "19.3.1",
46+
"npm-check-updates": "19.3.2",
4647
"tsx": "4.21.0",
4748
"typedoc": "0.28.16",
4849
"typedoc-plugin-markdown": "4.9.0",
@@ -53,7 +54,7 @@
5354
},
5455
"volta": {
5556
"node": "22.5.1",
56-
"yarn": "4.9.2",
57+
"yarn": "4.12.0",
5758
"npm": "10.9.2"
5859
},
5960
"publishConfig": {

src/getGateway.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { isDefined } from '@xylabs/typeof'
2-
import type { SimpleXyoSigner, XyoConnection } from '@xyo-network/xl1-sdk'
3-
import {
4-
SimpleXyoGatewayRunner, XyoConnectionMoniker, XyoSignerMoniker,
5-
} from '@xyo-network/xl1-sdk'
2+
import { SimpleXyoGatewayRunner } from '@xyo-network/xl1-sdk'
63

74
import { getLocator } from './getLocator.ts'
85

@@ -17,11 +14,7 @@ export const getGateway = async () => {
1714
// Get locator
1815
const locator = await getLocator()
1916

20-
// Use locator to get connection and signer
21-
const connection = await locator.getInstance<XyoConnection>(XyoConnectionMoniker)
22-
const signer = await locator.getInstance<SimpleXyoSigner>(XyoSignerMoniker)
23-
2417
// Create gateway from connection and signer
25-
gateway = new SimpleXyoGatewayRunner(connection, signer)
18+
gateway = await locator.getInstance<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.defaultMoniker)
2619
return gateway
2720
}

src/getLocator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { isDefined } from '@xylabs/typeof'
22
import type { ProviderFactoryLocator } from '@xyo-network/xl1-sdk'
3-
import { buildJsonRpcProviderLocator, SimpleXyoSigner } from '@xyo-network/xl1-sdk'
3+
import {
4+
buildJsonRpcProviderLocator, SimpleXyoGatewayRunner, SimpleXyoSigner,
5+
} from '@xyo-network/xl1-sdk'
46

57
import { getSignerAccount } from './getSignerAccount.ts'
68
import { getTransportFactory } from './getTransportFactory.ts'
@@ -18,6 +20,7 @@ export const getLocator = async () => {
1820
// Register the signer with the locator
1921
const account = await getSignerAccount()
2022
locator.register(SimpleXyoSigner.factory<SimpleXyoSigner>(SimpleXyoSigner.dependencies, { account }))
23+
locator.register(SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies))
2124

2225
// Return the locator
2326
return locator

src/getRandomTransactionData.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PayloadBuilder } from '@xyo-network/payload-builder'
2-
import type { Payload } from '@xyo-network/payload-model'
3-
import type { HashPayload } from '@xyo-network/xl1-sdk'
2+
import { asSchema, type Payload } from '@xyo-network/payload-model'
3+
import { type HashPayload, HashSchema } from '@xyo-network/xl1-sdk'
44

55
/**
66
* Generates random data for a transaction.
@@ -9,11 +9,11 @@ import type { HashPayload } from '@xyo-network/xl1-sdk'
99
export const getRandomTransactionData = async () => {
1010
// Data to store off-chain
1111
const salt = `Hello from Sample - ${new Date().toISOString()}`
12-
const idPayload: Payload<{ salt: string }> = { schema: 'network.xyo.id', salt }
12+
const idPayload: Payload<{ salt: string }> = { schema: asSchema('network.xyo.id', true), salt }
1313

1414
// Data to store on-chain (can reference the off-chain data)
1515
const hash = await PayloadBuilder.hash(idPayload)
16-
const hashPayload: HashPayload = { schema: 'network.xyo.hash', hash }
16+
const hashPayload: HashPayload = { schema: HashSchema, hash }
1717

1818
return {
1919
offChainData: [idPayload],

0 commit comments

Comments
 (0)