@xyo-network/xl1-protocol-sdk 1.16.1 → 1.16.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/config/Config.d.ts +6 -18
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Producer.d.ts +2 -6
- package/dist/neutral/config/Producer.d.ts.map +1 -1
- package/dist/neutral/config/Validation.d.ts +4 -12
- package/dist/neutral/config/Validation.d.ts.map +1 -1
- package/dist/neutral/driver/cache/LruCacheMap.d.ts +1 -0
- package/dist/neutral/driver/cache/LruCacheMap.d.ts.map +1 -1
- package/dist/neutral/driver/memory/MemoryMap.d.ts +1 -0
- package/dist/neutral/driver/memory/MemoryMap.d.ts.map +1 -1
- package/dist/neutral/eip-712/Payloads/EIP712Signature.d.ts +1 -9
- package/dist/neutral/eip-712/Payloads/EIP712Signature.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +1 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +462 -21
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/map/AsynchronousMap.d.ts +1 -0
- package/dist/neutral/map/AsynchronousMap.d.ts.map +1 -1
- package/dist/neutral/map/SynchronousMap.d.ts +1 -0
- package/dist/neutral/map/SynchronousMap.d.ts.map +1 -1
- package/dist/neutral/payloads/netBalancesForPayloads.d.ts +2 -3
- package/dist/neutral/payloads/netBalancesForPayloads.d.ts.map +1 -1
- package/dist/neutral/provider/DataLake.d.ts +6 -2
- package/dist/neutral/provider/DataLake.d.ts.map +1 -1
- package/dist/neutral/provider/XyoClient.d.ts +3 -3
- package/dist/neutral/provider/XyoClient.d.ts.map +1 -1
- package/dist/neutral/provider/XyoConnection.d.ts +1 -23
- package/dist/neutral/provider/XyoConnection.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGateway.d.ts +4 -10
- package/dist/neutral/provider/XyoGateway.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGatewayRunner.d.ts +25 -0
- package/dist/neutral/provider/XyoGatewayRunner.d.ts.map +1 -0
- package/dist/neutral/provider/index.d.ts +2 -2
- package/dist/neutral/provider/index.d.ts.map +1 -1
- package/dist/neutral/provider/{XyoSigner.d.ts → signer/XyoSigner.d.ts} +2 -2
- package/dist/neutral/provider/signer/XyoSigner.d.ts.map +1 -0
- package/dist/neutral/provider/signer/index.d.ts +2 -0
- package/dist/neutral/provider/signer/index.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/StepViewer.d.ts +1 -1
- package/dist/neutral/provider/viewer/StepViewer.d.ts.map +1 -1
- package/dist/neutral/simple/client/SimpleXyoClient.d.ts +7 -0
- package/dist/neutral/simple/client/SimpleXyoClient.d.ts.map +1 -0
- package/dist/neutral/simple/client/index.d.ts +2 -0
- package/dist/neutral/simple/client/index.d.ts.map +1 -0
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts +15 -0
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts.map +1 -0
- package/dist/neutral/simple/datalake/SimpleDataLakeViewer.d.ts +23 -0
- package/dist/neutral/simple/datalake/SimpleDataLakeViewer.d.ts.map +1 -0
- package/dist/neutral/simple/datalake/index.d.ts +3 -0
- package/dist/neutral/simple/datalake/index.d.ts.map +1 -0
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts +9 -0
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts.map +1 -0
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +20 -0
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -0
- package/dist/neutral/simple/gateway/index.d.ts +3 -0
- package/dist/neutral/simple/gateway/index.d.ts.map +1 -0
- package/dist/neutral/simple/index.d.ts +8 -0
- package/dist/neutral/simple/index.d.ts.map +1 -0
- package/dist/neutral/simple/network/SimpleXyoNetwork.d.ts +9 -0
- package/dist/neutral/simple/network/SimpleXyoNetwork.d.ts.map +1 -0
- package/dist/neutral/simple/network/index.d.ts +2 -0
- package/dist/neutral/simple/network/index.d.ts.map +1 -0
- package/dist/neutral/simple/network/lib/FailedNetworkStatusPayloads.d.ts +4 -0
- package/dist/neutral/simple/network/lib/FailedNetworkStatusPayloads.d.ts.map +1 -0
- package/dist/neutral/simple/network/lib/StatusNetworks.d.ts +10 -0
- package/dist/neutral/simple/network/lib/StatusNetworks.d.ts.map +1 -0
- package/dist/neutral/simple/network/lib/index.d.ts +3 -0
- package/dist/neutral/simple/network/lib/index.d.ts.map +1 -0
- package/dist/neutral/simple/network/spec/XyoNetwork.spec.d.ts +2 -0
- package/dist/neutral/simple/network/spec/XyoNetwork.spec.d.ts.map +1 -0
- package/dist/neutral/simple/permissions/SimpleXyoPermissions.d.ts +17 -0
- package/dist/neutral/simple/permissions/SimpleXyoPermissions.d.ts.map +1 -0
- package/dist/neutral/simple/permissions/index.d.ts +3 -0
- package/dist/neutral/simple/permissions/index.d.ts.map +1 -0
- package/dist/neutral/simple/permissions/spec/SimpleXyoPermissions.spec.d.ts +2 -0
- package/dist/neutral/simple/permissions/spec/SimpleXyoPermissions.spec.d.ts.map +1 -0
- package/dist/neutral/simple/permissions/store/MemoryPermissions.d.ts +16 -0
- package/dist/neutral/simple/permissions/store/MemoryPermissions.d.ts.map +1 -0
- package/dist/neutral/simple/permissions/store/PermissionsStore.d.ts +12 -0
- package/dist/neutral/simple/permissions/store/PermissionsStore.d.ts.map +1 -0
- package/dist/neutral/simple/permissions/store/index.d.ts +3 -0
- package/dist/neutral/simple/permissions/store/index.d.ts.map +1 -0
- package/dist/neutral/simple/runner/SimpleXyoRunner.d.ts +11 -0
- package/dist/neutral/simple/runner/SimpleXyoRunner.d.ts.map +1 -0
- package/dist/neutral/simple/runner/index.d.ts +2 -0
- package/dist/neutral/simple/runner/index.d.ts.map +1 -0
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts +15 -0
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts.map +1 -0
- package/dist/neutral/simple/signer/index.d.ts +2 -0
- package/dist/neutral/simple/signer/index.d.ts.map +1 -0
- package/package.json +20 -15
- package/src/driver/cache/LruCacheMap.ts +6 -0
- package/src/driver/memory/MemoryMap.ts +6 -0
- package/src/index.ts +1 -0
- package/src/map/AsynchronousMap.ts +1 -0
- package/src/map/SynchronousMap.ts +1 -0
- package/src/provider/DataLake.ts +8 -3
- package/src/provider/XyoClient.ts +3 -3
- package/src/provider/XyoConnection.ts +1 -43
- package/src/provider/XyoGateway.ts +4 -12
- package/src/provider/XyoGatewayRunner.ts +42 -0
- package/src/provider/index.ts +2 -2
- package/src/provider/{XyoSigner.ts → signer/XyoSigner.ts} +2 -2
- package/src/provider/signer/index.ts +1 -0
- package/src/provider/viewer/StepViewer.ts +1 -1
- package/src/simple/client/SimpleXyoClient.ts +13 -0
- package/src/simple/client/index.ts +1 -0
- package/src/simple/datalake/SimpleDataLakeRunner.ts +36 -0
- package/src/simple/datalake/SimpleDataLakeViewer.ts +74 -0
- package/src/simple/datalake/index.ts +2 -0
- package/src/simple/gateway/SimpleXyoGateway.ts +21 -0
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +116 -0
- package/src/simple/gateway/index.ts +2 -0
- package/src/simple/index.ts +7 -0
- package/src/simple/network/SimpleXyoNetwork.ts +48 -0
- package/src/simple/network/index.ts +1 -0
- package/src/simple/network/lib/FailedNetworkStatusPayloads.ts +14 -0
- package/src/simple/network/lib/StatusNetworks.ts +27 -0
- package/src/simple/network/lib/index.ts +2 -0
- package/src/simple/network/spec/XyoNetwork.spec.ts +77 -0
- package/src/simple/permissions/SimpleXyoPermissions.ts +82 -0
- package/src/simple/permissions/index.ts +2 -0
- package/src/simple/permissions/spec/SimpleXyoPermissions.spec.ts +93 -0
- package/src/simple/permissions/store/MemoryPermissions.ts +32 -0
- package/src/simple/permissions/store/PermissionsStore.ts +15 -0
- package/src/simple/permissions/store/index.ts +2 -0
- package/src/simple/runner/SimpleXyoRunner.ts +29 -0
- package/src/simple/runner/index.ts +1 -0
- package/src/simple/signer/SimpleXyoSigner.ts +52 -0
- package/src/simple/signer/index.ts +1 -0
- package/dist/neutral/provider/XyoGatewayHelpers.d.ts +0 -16
- package/dist/neutral/provider/XyoGatewayHelpers.d.ts.map +0 -1
- package/dist/neutral/provider/XyoSigner.d.ts.map +0 -1
- package/src/provider/XyoGatewayHelpers.ts +0 -30
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex';
|
|
2
|
+
import type { ArchivistInstance } from '@xyo-network/archivist-model';
|
|
3
|
+
import type { SignedHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-protocol';
|
|
4
|
+
import type { XyoRunner } from '../../provider/index.ts';
|
|
5
|
+
export declare class SimpleXyoRunner implements XyoRunner {
|
|
6
|
+
private _mempoolArchivist?;
|
|
7
|
+
constructor(mempoolArchivist?: ArchivistInstance);
|
|
8
|
+
broadcastTransaction(transaction: SignedHydratedTransactionWithStorageMeta): Promise<Hash>;
|
|
9
|
+
protected getMempoolArchivist(): Promise<ArchivistInstance>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=SimpleXyoRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleXyoRunner.d.ts","sourceRoot":"","sources":["../../../../src/simple/runner/SimpleXyoRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAErE,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAAA;AAEzF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGxD,qBAAa,eAAgB,YAAW,SAAS;IAC/C,OAAO,CAAC,iBAAiB,CAAC,CAAmB;gBAEjC,gBAAgB,CAAC,EAAE,iBAAiB;IAI1C,oBAAoB,CAAC,WAAW,EAAE,wCAAwC,GAAG,OAAO,CAAC,IAAI,CAAC;cAMhF,mBAAmB,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAMlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/simple/runner/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex';
|
|
2
|
+
import type { Promisable } from '@xylabs/promise';
|
|
3
|
+
import type { AccountInstance } from '@xyo-network/account-model';
|
|
4
|
+
import type { Signed, UnsignedBoundWitness } from '@xyo-network/boundwitness-model';
|
|
5
|
+
import { type Payload } from '@xyo-network/payload-model';
|
|
6
|
+
import type { AllowedBlockPayload, ChainId, SignedHydratedTransactionWithHashMeta, TransactionBoundWitness, TransactionFeesBigInt } from '@xyo-network/xl1-protocol';
|
|
7
|
+
import type { XyoSigner } from '../../provider/index.ts';
|
|
8
|
+
export declare class SimpleXyoSigner implements XyoSigner {
|
|
9
|
+
protected readonly _account: AccountInstance;
|
|
10
|
+
constructor(account: AccountInstance);
|
|
11
|
+
address(): Promisable<Address>;
|
|
12
|
+
createSignedTransaction(chain: ChainId, elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], nbf: number, exp: number, fees: TransactionFeesBigInt, from?: Address): Promise<Signed<TransactionBoundWitness>>;
|
|
13
|
+
signTransaction(tx: [UnsignedBoundWitness<TransactionBoundWitness>, Payload[]]): Promise<SignedHydratedTransactionWithHashMeta>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=SimpleXyoSigner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleXyoSigner.d.ts","sourceRoot":"","sources":["../../../../src/simple/signer/SimpleXyoSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAEnF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EACV,mBAAmB,EAAE,OAAO,EAAE,qCAAqC,EAAE,uBAAuB,EAAE,qBAAqB,EACpH,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGxD,qBAAa,eAAgB,YAAW,SAAS;IAC/C,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;gBAEhC,OAAO,EAAE,eAAe;IAIpC,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC;IAIxB,uBAAuB,CAC3B,KAAK,EAAE,OAAO,EACd,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,kBAAkB,EAAE,OAAO,EAAE,EAC7B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,EAC3B,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAerC,eAAe,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,qCAAqC,CAAC;CAItI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/simple/signer/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
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-protocol-sdk",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.2",
|
|
5
5
|
"description": "XYO Layer One SDK Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -36,20 +36,21 @@
|
|
|
36
36
|
"src"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xylabs/array": "~5.0.
|
|
40
|
-
"@xylabs/arraybuffer": "~5.0.
|
|
41
|
-
"@xylabs/assert": "~5.0.
|
|
42
|
-
"@xylabs/base": "~5.0.
|
|
43
|
-
"@xylabs/creatable": "~5.0.
|
|
44
|
-
"@xylabs/delay": "~5.0.
|
|
45
|
-
"@xylabs/events": "~5.0.
|
|
46
|
-
"@xylabs/hex": "~5.0.
|
|
47
|
-
"@xylabs/logger": "~5.0.
|
|
48
|
-
"@xylabs/object": "~5.0.
|
|
49
|
-
"@xylabs/promise": "~5.0.
|
|
50
|
-
"@xylabs/telemetry": "~5.0.
|
|
51
|
-
"@xylabs/typeof": "~5.0.
|
|
39
|
+
"@xylabs/array": "~5.0.22",
|
|
40
|
+
"@xylabs/arraybuffer": "~5.0.22",
|
|
41
|
+
"@xylabs/assert": "~5.0.22",
|
|
42
|
+
"@xylabs/base": "~5.0.22",
|
|
43
|
+
"@xylabs/creatable": "~5.0.22",
|
|
44
|
+
"@xylabs/delay": "~5.0.22",
|
|
45
|
+
"@xylabs/events": "~5.0.22",
|
|
46
|
+
"@xylabs/hex": "~5.0.22",
|
|
47
|
+
"@xylabs/logger": "~5.0.22",
|
|
48
|
+
"@xylabs/object": "~5.0.22",
|
|
49
|
+
"@xylabs/promise": "~5.0.22",
|
|
50
|
+
"@xylabs/telemetry": "~5.0.22",
|
|
51
|
+
"@xylabs/typeof": "~5.0.22",
|
|
52
52
|
"@xyo-network/account-model": "~5.1.18",
|
|
53
|
+
"@xyo-network/archivist-memory": "~5.1.18",
|
|
53
54
|
"@xyo-network/archivist-model": "~5.1.18",
|
|
54
55
|
"@xyo-network/boundwitness-builder": "~5.1.18",
|
|
55
56
|
"@xyo-network/boundwitness-model": "~5.1.18",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"@xyo-network/payload-model": "~5.1.18",
|
|
58
59
|
"@xyo-network/wallet": "~5.1.18",
|
|
59
60
|
"@xyo-network/wallet-model": "~5.1.18",
|
|
60
|
-
"@xyo-network/xl1-protocol": "~1.13.
|
|
61
|
+
"@xyo-network/xl1-protocol": "~1.13.1",
|
|
61
62
|
"async-mutex": "~0.5.0",
|
|
62
63
|
"ethers": "~6.15.0",
|
|
63
64
|
"lru-cache": "^11.2.2",
|
|
@@ -69,10 +70,14 @@
|
|
|
69
70
|
"@xylabs/tsconfig": "~7.2.8",
|
|
70
71
|
"@xyo-network/account": "~5.1.18",
|
|
71
72
|
"@xyo-network/boundwitness-validator": "~5.1.18",
|
|
73
|
+
"axios": "^1.13.2",
|
|
72
74
|
"eslint": "^9.39.1",
|
|
73
75
|
"typescript": "~5.9.3",
|
|
74
76
|
"vitest": "~4.0.8"
|
|
75
77
|
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"axios": "^1.13.2"
|
|
80
|
+
},
|
|
76
81
|
"engines": {
|
|
77
82
|
"node": ">=22.3 <23"
|
|
78
83
|
},
|
|
@@ -39,4 +39,10 @@ export class LruCacheMap<K extends {}, V extends {} | string | number | bigint,
|
|
|
39
39
|
set(id: K, data: V) {
|
|
40
40
|
this.lruCache.set(id, data)
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
setMany(entries: [K, V][]): void {
|
|
44
|
+
for (const [key, value] of entries) {
|
|
45
|
+
this.lruCache.set(key, value)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
42
48
|
}
|
|
@@ -39,4 +39,10 @@ export class MemoryMap<K extends {}, V = {}> implements SynchronousMap<K, V> {
|
|
|
39
39
|
set(id: K, data: V) {
|
|
40
40
|
this.map.set(id, data)
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
setMany(entries: [K, V][]): void {
|
|
44
|
+
for (const [key, value] of entries) {
|
|
45
|
+
this.map.set(key, value)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
42
48
|
}
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './primitives/index.ts'
|
|
|
14
14
|
export * from './provider/index.ts'
|
|
15
15
|
export * from './services/index.ts'
|
|
16
16
|
export * from './SignedBigInt.ts'
|
|
17
|
+
export * from './simple/index.ts'
|
|
17
18
|
export * from './time/index.ts'
|
|
18
19
|
export * from './transaction/index.ts'
|
|
19
20
|
export * from './validation/index.ts'
|
|
@@ -10,6 +10,7 @@ export interface AsynchronousMapWrite<K, V> {
|
|
|
10
10
|
clear(): Promisable<void>
|
|
11
11
|
delete(id: K): Promisable<boolean>
|
|
12
12
|
set(id: K, data: V): Promisable<void>
|
|
13
|
+
setMany(entries: [K, V][]): Promisable<void>
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface AsynchronousMap<K, V> extends AsynchronousMapRead<K, V>, AsynchronousMapWrite<K, V> {}
|
package/src/provider/DataLake.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/hex'
|
|
2
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
2
|
+
import type { Payload, Schema } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
import type { MapType } from '../map/index.ts'
|
|
5
5
|
|
|
@@ -7,8 +7,13 @@ export type DataLakeData = Payload | ArrayBuffer
|
|
|
7
7
|
|
|
8
8
|
export type DataLakeViewerMethods = Pick<MapType<Hash, DataLakeData>, 'get' | 'getMany' | 'has'>
|
|
9
9
|
|
|
10
|
-
export interface DataLakeViewer extends DataLakeViewerMethods {
|
|
10
|
+
export interface DataLakeViewer extends DataLakeViewerMethods {
|
|
11
|
+
allowedSchemas?: Schema[]
|
|
12
|
+
disallowedSchemas?: Schema[]
|
|
13
|
+
}
|
|
11
14
|
|
|
12
|
-
export type DataLakeRunnerMethods = Pick<MapType<Hash, DataLakeData>, 'set' | 'delete' | 'clear'>
|
|
15
|
+
export type DataLakeRunnerMethods = Pick<MapType<Hash, DataLakeData>, 'set' | 'delete' | 'clear'> & {
|
|
16
|
+
setMany(entries: [Hash, DataLakeData][]): Promise<void>
|
|
17
|
+
}
|
|
13
18
|
|
|
14
19
|
export interface DataLakeRunner extends DataLakeViewerMethods, DataLakeRunnerMethods {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { XyoPermissions } from './permissions/index.ts'
|
|
2
|
-
import type {
|
|
2
|
+
import type { XyoGateway } from './XyoGateway.ts'
|
|
3
3
|
|
|
4
4
|
export type GatewayName = string & { __gatewayName: true }
|
|
5
5
|
|
|
@@ -13,9 +13,9 @@ export interface XyoRpcGatewayConfig extends XyoGatewayConfig {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface XyoClient {
|
|
16
|
-
gateways: Readonly<Record<GatewayName,
|
|
16
|
+
gateways: Readonly<Record<GatewayName, XyoGateway>>
|
|
17
17
|
permissions: XyoPermissions
|
|
18
18
|
|
|
19
|
-
addGateway?(providerOrConfig: XyoGatewayConfig | XyoRpcGatewayConfig |
|
|
19
|
+
addGateway?(providerOrConfig: XyoGatewayConfig | XyoRpcGatewayConfig | XyoGateway): Promise<XyoGateway>
|
|
20
20
|
removeGateway?(name: GatewayName): Promise<void>
|
|
21
21
|
}
|
|
@@ -1,54 +1,12 @@
|
|
|
1
|
-
import type { Address, Hex } from '@xylabs/hex'
|
|
2
|
-
import type { Signed } from '@xyo-network/boundwitness-model'
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
-
import type {
|
|
5
|
-
AllowedBlockPayload, TransactionBoundWitness, TransactionFeesBigInt,
|
|
6
|
-
} from '@xyo-network/xl1-protocol'
|
|
7
|
-
|
|
8
1
|
import type { DataLakeRunner, DataLakeViewer } from './DataLake.ts'
|
|
9
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
10
|
-
import type { TransactionSubmitter } from './TransactionSubmitter.ts'
|
|
11
2
|
import type { NetworkStakeViewer, XyoViewer } from './viewer/index.ts'
|
|
12
3
|
import type { XyoNetwork } from './XyoNetwork.ts'
|
|
13
4
|
import type { XyoRunner } from './XyoRunner.ts'
|
|
14
|
-
import type { XyoSigner } from './XyoSigner.ts'
|
|
15
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
16
|
-
import type { XyoWallet } from './XyoWallet.ts'
|
|
17
|
-
|
|
18
|
-
/** @deprecated use XyoConnectionProvider instead */
|
|
19
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
20
|
-
export interface XyoConnectionProviderDeprecated extends TransactionSubmitter {
|
|
21
|
-
|
|
22
|
-
/** @deprecated - use from gateway instead */
|
|
23
|
-
signer: XyoSigner
|
|
24
|
-
|
|
25
|
-
/** @deprecated - use host instead */
|
|
26
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
27
|
-
wallet: XyoWallet
|
|
28
5
|
|
|
29
|
-
|
|
30
|
-
send(
|
|
31
|
-
elevatedPayloads: AllowedBlockPayload[],
|
|
32
|
-
additionalPayloads: Payload[],
|
|
33
|
-
chain?: Hex,
|
|
34
|
-
nbf?: number,
|
|
35
|
-
exp?: number,
|
|
36
|
-
from?: Address,
|
|
37
|
-
fees?: TransactionFeesBigInt,
|
|
38
|
-
): Promise<Signed<TransactionBoundWitness>>
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
42
|
-
export interface XyoConnection extends Partial<XyoConnectionProviderDeprecated> {
|
|
6
|
+
export interface XyoConnection {
|
|
43
7
|
network?: XyoNetwork
|
|
44
8
|
networkStake?: NetworkStakeViewer
|
|
45
9
|
runner?: XyoRunner
|
|
46
10
|
storage?: DataLakeRunner | DataLakeViewer | (DataLakeRunner & DataLakeViewer)
|
|
47
11
|
viewer?: XyoViewer
|
|
48
12
|
}
|
|
49
|
-
|
|
50
|
-
/** @deprecated use XyoConnectionProvider */
|
|
51
|
-
export interface XyoConnectionProvider extends XyoConnection {}
|
|
52
|
-
|
|
53
|
-
/** @deprecated use XyoConnectionProvider */
|
|
54
|
-
export interface XyoProvider extends XyoConnection {}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { XyoSigner } from './signer/index.ts'
|
|
3
2
|
import type { XyoConnection } from './XyoConnection.ts'
|
|
4
|
-
import type { XyoGatewayHelpers } from './XyoGatewayHelpers.ts'
|
|
5
|
-
import type { XyoSigner } from './XyoSigner.ts'
|
|
6
|
-
|
|
7
|
-
/** @deprecated use XyoConnectionConfig instead */
|
|
8
|
-
export interface XyoConnectionConfigDeprecated {
|
|
9
|
-
name: string
|
|
10
|
-
}
|
|
11
3
|
|
|
12
|
-
export interface
|
|
4
|
+
export interface XyoGateway {
|
|
13
5
|
/**
|
|
14
6
|
* Returns the connection provider for this gateway.
|
|
15
7
|
*/
|
|
16
|
-
connection
|
|
8
|
+
connection: XyoConnection
|
|
17
9
|
/**
|
|
18
10
|
* Returns the signer for this gateway.
|
|
19
11
|
*/
|
|
20
|
-
signer
|
|
12
|
+
signer: XyoSigner
|
|
21
13
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Address, Hash, Hex,
|
|
3
|
+
} from '@xylabs/hex'
|
|
4
|
+
import type { Promisable } from '@xylabs/promise'
|
|
5
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
6
|
+
import type {
|
|
7
|
+
AllowedBlockPayload, AttoXL1, SignedHydratedTransaction, SignedHydratedTransactionWithHashMeta, TransactionFeesBigInt,
|
|
8
|
+
UnsignedHydratedTransaction,
|
|
9
|
+
} from '@xyo-network/xl1-protocol'
|
|
10
|
+
|
|
11
|
+
import type { DataLakeRunner } from './DataLake.ts'
|
|
12
|
+
import type { XyoGateway } from './XyoGateway.ts'
|
|
13
|
+
|
|
14
|
+
export interface TransactionOptions {
|
|
15
|
+
chain?: Hex
|
|
16
|
+
exp?: number
|
|
17
|
+
fees?: TransactionFeesBigInt
|
|
18
|
+
from?: Address
|
|
19
|
+
nbf?: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface XyoGatewayRunnerMethods {
|
|
23
|
+
|
|
24
|
+
addPayloadsToChain(
|
|
25
|
+
onChain: AllowedBlockPayload[],
|
|
26
|
+
offChain: Payload[],
|
|
27
|
+
options?: TransactionOptions
|
|
28
|
+
): Promisable<[Hash, SignedHydratedTransactionWithHashMeta]>
|
|
29
|
+
|
|
30
|
+
addTransactionToChain(
|
|
31
|
+
tx: UnsignedHydratedTransaction | SignedHydratedTransaction,
|
|
32
|
+
): Promisable<[Hash, SignedHydratedTransactionWithHashMeta]>
|
|
33
|
+
|
|
34
|
+
send(to: Address, amount: AttoXL1, options?: TransactionOptions): Promisable<Hash>
|
|
35
|
+
sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promisable<Hash>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface XyoGatewayRunner extends XyoGatewayRunnerMethods, XyoGateway {
|
|
39
|
+
dataLakes: DataLakeRunner[]
|
|
40
|
+
addDataLake(dataLake: DataLakeRunner): number
|
|
41
|
+
removeDataLake(index: number): void
|
|
42
|
+
}
|
package/src/provider/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from './DataLake.ts'
|
|
2
2
|
export * from './permissions/index.ts'
|
|
3
|
+
export * from './signer/index.ts'
|
|
3
4
|
export * from './TransactionSubmitter.ts'
|
|
4
5
|
export * from './viewer/index.ts'
|
|
5
6
|
export * from './XyoClient.ts'
|
|
6
7
|
export * from './XyoConnection.ts'
|
|
7
8
|
export * from './XyoGateway.ts'
|
|
8
|
-
export * from './
|
|
9
|
+
export * from './XyoGatewayRunner.ts'
|
|
9
10
|
export * from './XyoNetwork.ts'
|
|
10
11
|
export * from './XyoRunner.ts'
|
|
11
|
-
export * from './XyoSigner.ts'
|
|
12
12
|
export * from './XyoWallet.ts'
|
|
@@ -3,7 +3,7 @@ import type { Promisable } from '@xylabs/promise'
|
|
|
3
3
|
import type { Signed, UnsignedBoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
4
|
import type { Payload } from '@xyo-network/payload-model'
|
|
5
5
|
import type {
|
|
6
|
-
AllowedBlockPayload, ChainId, TransactionBoundWitness,
|
|
6
|
+
AllowedBlockPayload, ChainId, SignedHydratedTransactionWithHashMeta, TransactionBoundWitness,
|
|
7
7
|
TransactionFeesBigInt,
|
|
8
8
|
} from '@xyo-network/xl1-protocol'
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ export interface XyoSigner {
|
|
|
12
12
|
// The tx passed in must have all the payloads (on and off chain) in the payloads array
|
|
13
13
|
// Returns the signed transaction and the payloads array excluding the off-chain payloads.
|
|
14
14
|
// The return value is ready to be broadcast to block producers
|
|
15
|
-
signTransaction(tx: [UnsignedBoundWitness<TransactionBoundWitness>, Payload[]]): Promisable<
|
|
15
|
+
signTransaction(tx: [UnsignedBoundWitness<TransactionBoundWitness>, Payload[]]): Promisable<SignedHydratedTransactionWithHashMeta>
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface XyoSignerDeprecated {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './XyoSigner.ts'
|
|
@@ -3,7 +3,7 @@ import type { Promisable } from '@xylabs/promise'
|
|
|
3
3
|
import type { PositionId, StepIdentity } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
5
|
import type { Position } from '../../interfaces/index.ts'
|
|
6
|
-
import type { NetworkStakeStepRewardsViewer } from './NetworkStake/
|
|
6
|
+
import type { NetworkStakeStepRewardsViewer } from './NetworkStake/index.ts'
|
|
7
7
|
|
|
8
8
|
export interface PagedPositionsOptions {
|
|
9
9
|
cursor?: PositionId
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
XyoClient, XyoGateway, XyoPermissions,
|
|
3
|
+
} from '../../provider/index.ts'
|
|
4
|
+
|
|
5
|
+
export class SimpleXyoClient implements XyoClient {
|
|
6
|
+
gateways: Readonly<Record<string, XyoGateway>>
|
|
7
|
+
permissions: XyoPermissions
|
|
8
|
+
|
|
9
|
+
constructor(gateways: Readonly<Record<string, XyoGateway>>, permissions: XyoPermissions) {
|
|
10
|
+
this.gateways = gateways
|
|
11
|
+
this.permissions = permissions
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SimpleXyoClient.ts'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
|
|
3
|
+
import type { MapType } from '../../map/index.ts'
|
|
4
|
+
import type {
|
|
5
|
+
DataLakeData,
|
|
6
|
+
DataLakeRunner,
|
|
7
|
+
} from '../../provider/index.ts'
|
|
8
|
+
import type { DataLakeViewerParams } from './SimpleDataLakeViewer.ts'
|
|
9
|
+
import { SimpleDataLakeViewer } from './SimpleDataLakeViewer.ts'
|
|
10
|
+
|
|
11
|
+
export interface DataLakeRunnerParams extends DataLakeViewerParams<MapType<Hash, DataLakeData>> {}
|
|
12
|
+
|
|
13
|
+
export class SimpleDataLakeRunner<TParams extends DataLakeRunnerParams> extends SimpleDataLakeViewer<MapType<Hash, DataLakeData>> implements DataLakeRunner {
|
|
14
|
+
constructor(params: TParams) {
|
|
15
|
+
super(params)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async clear(): Promise<void> {
|
|
19
|
+
await this.map.clear()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async delete(hash: Hash): Promise<boolean> {
|
|
23
|
+
return await this.map.delete(hash)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async set(hash: Hash, data: DataLakeData): Promise<void> {
|
|
27
|
+
if (this.isAllowed(data)) {
|
|
28
|
+
await this.map.set(hash, data)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async setMany(entries: [Hash, DataLakeData][]): Promise<void> {
|
|
33
|
+
const allowed = entries.filter(([_, data]) => this.isAllowed(data))
|
|
34
|
+
return await this.map.setMany(allowed)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import { isAnyPayload, type Schema } from '@xyo-network/payload-model'
|
|
3
|
+
|
|
4
|
+
import type { MapTypeRead } from '../../map/index.ts'
|
|
5
|
+
import type {
|
|
6
|
+
DataLakeData,
|
|
7
|
+
DataLakeViewer,
|
|
8
|
+
} from '../../provider/index.ts'
|
|
9
|
+
|
|
10
|
+
export interface DataLakeViewerParams<TMap extends MapTypeRead<Hash, DataLakeData> = MapTypeRead<Hash, DataLakeData>> {
|
|
11
|
+
allowedSchemas?: Schema[]
|
|
12
|
+
disallowedSchemas?: Schema[]
|
|
13
|
+
map: TMap
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class SimpleDataLakeViewer<TMap extends MapTypeRead<Hash, DataLakeData> = MapTypeRead<Hash, DataLakeData>,
|
|
17
|
+
TParams extends DataLakeViewerParams<TMap> = DataLakeViewerParams<TMap>> implements DataLakeViewer {
|
|
18
|
+
private readonly _params: TParams
|
|
19
|
+
|
|
20
|
+
constructor(params: TParams) {
|
|
21
|
+
this._params = params
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get allowedSchemas(): Schema[] | undefined {
|
|
25
|
+
return this._params.allowedSchemas
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get disallowedSchemas(): Schema[] | undefined {
|
|
29
|
+
return this._params.disallowedSchemas
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected get map(): TMap {
|
|
33
|
+
return this._params.map
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected get params() {
|
|
37
|
+
return this._params
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async get(hash: Hash): Promise<DataLakeData | undefined> {
|
|
41
|
+
const result = await this.map.get(hash)
|
|
42
|
+
return this.isAllowed(result) ? result : undefined
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getMany(hashes: Hash[]): Promise<DataLakeData[]> {
|
|
46
|
+
const result = await this.map.getMany(hashes)
|
|
47
|
+
return result.filter(data => this.isAllowed(data))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async has(hash: Hash): Promise<boolean> {
|
|
51
|
+
const value = await this.get(hash)
|
|
52
|
+
if (isAnyPayload(value)) {
|
|
53
|
+
return this.isAllowed(value)
|
|
54
|
+
}
|
|
55
|
+
return value !== undefined
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected isAllowed(value: DataLakeData | undefined): boolean {
|
|
59
|
+
if (isAnyPayload(value)) {
|
|
60
|
+
return this.isAllowedSchema(value.schema)
|
|
61
|
+
}
|
|
62
|
+
return true
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
protected isAllowedSchema(schema: Schema): boolean {
|
|
66
|
+
if (this.allowedSchemas && !this.allowedSchemas.includes(schema)) {
|
|
67
|
+
return false
|
|
68
|
+
}
|
|
69
|
+
if (this.disallowedSchemas && this.disallowedSchemas.includes(schema)) {
|
|
70
|
+
return false
|
|
71
|
+
}
|
|
72
|
+
return true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
XyoConnection, XyoGateway, XyoSigner,
|
|
3
|
+
} from '../../provider/index.ts'
|
|
4
|
+
|
|
5
|
+
export class SimpleXyoGateway implements XyoGateway {
|
|
6
|
+
private readonly _connection: XyoConnection
|
|
7
|
+
private readonly _signer: XyoSigner
|
|
8
|
+
|
|
9
|
+
constructor(signer: XyoSigner, connection: XyoConnection) {
|
|
10
|
+
this._signer = signer
|
|
11
|
+
this._connection = connection
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get connection(): XyoConnection {
|
|
15
|
+
return this._connection
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get signer(): XyoSigner {
|
|
19
|
+
return this._signer
|
|
20
|
+
}
|
|
21
|
+
}
|