@xyo-network/xl1-protocol-sdk 1.16.3 → 1.16.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 +24 -11
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/XyoGateway.d.ts +7 -2
- package/dist/neutral/provider/XyoGateway.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts +5 -2
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +6 -2
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/provider/XyoGateway.ts +10 -2
- package/src/simple/gateway/SimpleXyoGateway.ts +12 -2
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +24 -9
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise';
|
|
1
2
|
import type { XyoSigner } from './signer/index.ts';
|
|
2
3
|
import type { XyoConnection } from './XyoConnection.ts';
|
|
3
4
|
export interface XyoGateway {
|
|
4
5
|
/**
|
|
5
6
|
* Returns the connection provider for this gateway.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
connectionInstance: XyoConnection;
|
|
8
9
|
/**
|
|
9
10
|
* Returns the signer for this gateway.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
signerInstance: XyoSigner;
|
|
13
|
+
/** @deprecated use connectionInstance */
|
|
14
|
+
connection(): Promisable<XyoConnection>;
|
|
15
|
+
/** @deprecated use signerInstance */
|
|
16
|
+
signer(): Promisable<XyoSigner>;
|
|
12
17
|
}
|
|
13
18
|
//# sourceMappingURL=XyoGateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyoGateway.d.ts","sourceRoot":"","sources":["../../../src/provider/XyoGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"XyoGateway.d.ts","sourceRoot":"","sources":["../../../src/provider/XyoGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,kBAAkB,EAAE,aAAa,CAAA;IACjC;;OAEG;IACH,cAAc,EAAE,SAAS,CAAA;IAEzB,yCAAyC;IACzC,UAAU,IAAI,UAAU,CAAC,aAAa,CAAC,CAAA;IAEvC,qCAAqC;IACrC,MAAM,IAAI,UAAU,CAAC,SAAS,CAAC,CAAA;CAChC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise';
|
|
1
2
|
import type { XyoConnection, XyoGateway, XyoSigner } from '../../provider/index.ts';
|
|
2
3
|
export declare class SimpleXyoGateway implements XyoGateway {
|
|
3
4
|
private readonly _connection;
|
|
4
5
|
private readonly _signer;
|
|
5
6
|
constructor(signer: XyoSigner, connection: XyoConnection);
|
|
6
|
-
get
|
|
7
|
-
get
|
|
7
|
+
get connectionInstance(): XyoConnection;
|
|
8
|
+
get signerInstance(): XyoSigner;
|
|
9
|
+
connection(): Promisable<XyoConnection>;
|
|
10
|
+
signer(): Promisable<XyoSigner>;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=SimpleXyoGateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleXyoGateway.d.ts","sourceRoot":"","sources":["../../../../src/simple/gateway/SimpleXyoGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,UAAU,EAAE,SAAS,EACrC,MAAM,yBAAyB,CAAA;AAEhC,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;gBAEvB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa;IAKxD,IAAI,
|
|
1
|
+
{"version":3,"file":"SimpleXyoGateway.d.ts","sourceRoot":"","sources":["../../../../src/simple/gateway/SimpleXyoGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EACV,aAAa,EAAE,UAAU,EAAE,SAAS,EACrC,MAAM,yBAAyB,CAAA;AAEhC,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;gBAEvB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa;IAKxD,IAAI,kBAAkB,IAAI,aAAa,CAEtC;IAED,IAAI,cAAc,IAAI,SAAS,CAE9B;IAED,UAAU,IAAI,UAAU,CAAC,aAAa,CAAC;IAIvC,MAAM,IAAI,UAAU,CAAC,SAAS,CAAC;CAGhC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address, Hash } from '@xylabs/hex';
|
|
2
|
+
import type { Promisable } from '@xylabs/promise';
|
|
2
3
|
import type { Payload, WithHashMeta } from '@xyo-network/payload-model';
|
|
3
4
|
import { type AllowedBlockPayload, type AttoXL1, type SignedHydratedTransaction, type SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-protocol';
|
|
4
5
|
import type { DataLakeRunner, TransactionOptions, XyoConnection, XyoGateway, XyoGatewayRunner, XyoSigner } from '../../provider/index.ts';
|
|
@@ -6,15 +7,18 @@ export declare class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
6
7
|
protected readonly gateway: XyoGateway;
|
|
7
8
|
private _dataLakes;
|
|
8
9
|
constructor(gateway: XyoGateway, dataLakes?: DataLakeRunner[]);
|
|
9
|
-
get
|
|
10
|
+
get connectionInstance(): XyoConnection;
|
|
10
11
|
get dataLakes(): DataLakeRunner[];
|
|
11
|
-
get
|
|
12
|
+
get signerInstance(): XyoSigner;
|
|
12
13
|
addDataLake(dataLake: DataLakeRunner): number;
|
|
13
14
|
addPayloadsToChain(onChain: AllowedBlockPayload[], offChain: Payload[], options?: TransactionOptions): Promise<[Hash, SignedHydratedTransactionWithHashMeta]>;
|
|
14
15
|
addTransactionToChain(tx: SignedHydratedTransaction): Promise<[Hash, SignedHydratedTransactionWithHashMeta]>;
|
|
16
|
+
connection(): Promisable<XyoConnection>;
|
|
15
17
|
removeDataLake(index: number): void;
|
|
16
18
|
send(to: Address, amount: AttoXL1, options?: TransactionOptions): Promise<Hash>;
|
|
17
19
|
sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promise<Hash>;
|
|
20
|
+
/** @deprecated use signerInstance instead */
|
|
21
|
+
signer(): Promisable<XyoSigner>;
|
|
18
22
|
protected addPayloadsToDataLakes(payloads: WithHashMeta<Payload>[]): Promise<void>;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=SimpleXyoGatewayRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleXyoGatewayRunner.d.ts","sourceRoot":"","sources":["../../../../src/simple/gateway/SimpleXyoGatewayRunner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EAAE,IAAI,EACd,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"SimpleXyoGatewayRunner.d.ts","sourceRoot":"","sources":["../../../../src/simple/gateway/SimpleXyoGatewayRunner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,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C,IAAI,CAAC;IAI/E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBhG,6CAA6C;IAC7C,MAAM,IAAI,UAAU,CAAC,SAAS,CAAC;cAKf,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOzF"}
|
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.4",
|
|
5
5
|
"description": "XYO Layer One SDK Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"@xylabs/promise": "~5.0.22",
|
|
50
50
|
"@xylabs/telemetry": "~5.0.22",
|
|
51
51
|
"@xylabs/typeof": "~5.0.22",
|
|
52
|
-
"@xyo-network/account-model": "~5.1.
|
|
53
|
-
"@xyo-network/archivist-memory": "~5.1.
|
|
54
|
-
"@xyo-network/archivist-model": "~5.1.
|
|
55
|
-
"@xyo-network/boundwitness-builder": "~5.1.
|
|
56
|
-
"@xyo-network/boundwitness-model": "~5.1.
|
|
57
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
58
|
-
"@xyo-network/payload-model": "~5.1.
|
|
59
|
-
"@xyo-network/wallet": "~5.1.
|
|
60
|
-
"@xyo-network/wallet-model": "~5.1.
|
|
52
|
+
"@xyo-network/account-model": "~5.1.19",
|
|
53
|
+
"@xyo-network/archivist-memory": "~5.1.19",
|
|
54
|
+
"@xyo-network/archivist-model": "~5.1.19",
|
|
55
|
+
"@xyo-network/boundwitness-builder": "~5.1.19",
|
|
56
|
+
"@xyo-network/boundwitness-model": "~5.1.19",
|
|
57
|
+
"@xyo-network/payload-builder": "~5.1.19",
|
|
58
|
+
"@xyo-network/payload-model": "~5.1.19",
|
|
59
|
+
"@xyo-network/wallet": "~5.1.19",
|
|
60
|
+
"@xyo-network/wallet-model": "~5.1.19",
|
|
61
61
|
"@xyo-network/xl1-protocol": "~1.13.1",
|
|
62
62
|
"async-mutex": "~0.5.0",
|
|
63
63
|
"ethers": "~6.15.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@types/node": "~24.10.0",
|
|
69
69
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
70
70
|
"@xylabs/tsconfig": "~7.2.8",
|
|
71
|
-
"@xyo-network/account": "~5.1.
|
|
72
|
-
"@xyo-network/boundwitness-validator": "~5.1.
|
|
71
|
+
"@xyo-network/account": "~5.1.19",
|
|
72
|
+
"@xyo-network/boundwitness-validator": "~5.1.19",
|
|
73
73
|
"axios": "^1.13.2",
|
|
74
74
|
"eslint": "^9.39.1",
|
|
75
75
|
"typescript": "~5.9.3",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise'
|
|
2
|
+
|
|
1
3
|
import type { XyoSigner } from './signer/index.ts'
|
|
2
4
|
import type { XyoConnection } from './XyoConnection.ts'
|
|
3
5
|
|
|
@@ -5,9 +7,15 @@ export interface XyoGateway {
|
|
|
5
7
|
/**
|
|
6
8
|
* Returns the connection provider for this gateway.
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
connectionInstance: XyoConnection
|
|
9
11
|
/**
|
|
10
12
|
* Returns the signer for this gateway.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
signerInstance: XyoSigner
|
|
15
|
+
|
|
16
|
+
/** @deprecated use connectionInstance */
|
|
17
|
+
connection(): Promisable<XyoConnection>
|
|
18
|
+
|
|
19
|
+
/** @deprecated use signerInstance */
|
|
20
|
+
signer(): Promisable<XyoSigner>
|
|
13
21
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise'
|
|
2
|
+
|
|
1
3
|
import type {
|
|
2
4
|
XyoConnection, XyoGateway, XyoSigner,
|
|
3
5
|
} from '../../provider/index.ts'
|
|
@@ -11,11 +13,19 @@ export class SimpleXyoGateway implements XyoGateway {
|
|
|
11
13
|
this._connection = connection
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
get
|
|
16
|
+
get connectionInstance(): XyoConnection {
|
|
17
|
+
return this._connection
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get signerInstance(): XyoSigner {
|
|
21
|
+
return this._signer
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
connection(): Promisable<XyoConnection> {
|
|
15
25
|
return this._connection
|
|
16
26
|
}
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
signer(): Promisable<XyoSigner> {
|
|
19
29
|
return this._signer
|
|
20
30
|
}
|
|
21
31
|
}
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
Address, Hash, Hex,
|
|
4
4
|
} from '@xylabs/hex'
|
|
5
5
|
import { BigIntToJsonZod } from '@xylabs/hex'
|
|
6
|
+
import type { Promisable } from '@xylabs/promise'
|
|
6
7
|
import { isDefined } from '@xylabs/typeof'
|
|
7
8
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
8
9
|
import type { Payload, WithHashMeta } from '@xyo-network/payload-model'
|
|
@@ -32,16 +33,16 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
32
33
|
this._dataLakes = [...dataLakes]
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
get
|
|
36
|
-
return this.gateway.
|
|
36
|
+
get connectionInstance(): XyoConnection {
|
|
37
|
+
return this.gateway.connectionInstance
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
get dataLakes(): DataLakeRunner[] {
|
|
40
41
|
throw new Error('Method not implemented.')
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
get
|
|
44
|
-
return this.gateway.
|
|
44
|
+
get signerInstance(): XyoSigner {
|
|
45
|
+
return this.gateway.signerInstance
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
addDataLake(dataLake: DataLakeRunner): number {
|
|
@@ -55,7 +56,7 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
55
56
|
options?: TransactionOptions,
|
|
56
57
|
): Promise<[Hash, SignedHydratedTransactionWithHashMeta]> {
|
|
57
58
|
// Get chain providers
|
|
58
|
-
const viewer = assertEx(this.
|
|
59
|
+
const viewer = assertEx(this.connectionInstance.viewer, () => 'No viewer available on connection')
|
|
59
60
|
|
|
60
61
|
// Resolve transaction options
|
|
61
62
|
const {
|
|
@@ -66,13 +67,16 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
66
67
|
const resolvedExp = isDefined(exp) ? exp : resolvedNbf + 10
|
|
67
68
|
|
|
68
69
|
// Build, sign, and broadcast the transaction
|
|
69
|
-
|
|
70
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
71
|
+
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await (await this.signer()).address(), fees)
|
|
70
72
|
return await this.addTransactionToChain(tx)
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
async addTransactionToChain(tx: SignedHydratedTransaction): Promise<[Hash, SignedHydratedTransactionWithHashMeta]> {
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
77
|
+
const connection = await this.gateway.connection()
|
|
78
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
79
|
+
const signer = await this.gateway.signer()
|
|
76
80
|
const runner = assertEx(connection.runner, () => 'No runner available on connection')
|
|
77
81
|
const signedTx = await signer.signTransaction(tx)
|
|
78
82
|
await this.addPayloadsToDataLakes(signedTx[1])
|
|
@@ -82,6 +86,10 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
82
86
|
), signedTx]
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
connection(): Promisable<XyoConnection> {
|
|
90
|
+
throw new Error('Method not implemented.')
|
|
91
|
+
}
|
|
92
|
+
|
|
85
93
|
removeDataLake(index: number): void {
|
|
86
94
|
this._dataLakes[index] = null
|
|
87
95
|
}
|
|
@@ -91,7 +99,8 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
async sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promise<Hash> {
|
|
94
|
-
|
|
102
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
103
|
+
const from = await (await this.signer()).address()
|
|
95
104
|
const hexTransfers: Record<Address, Hex> = Object.fromEntries(
|
|
96
105
|
Object.entries(transfers).map(([address, amount]) => ([
|
|
97
106
|
address, BigIntToJsonZod.parse(amount),
|
|
@@ -106,6 +115,12 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
106
115
|
return hash
|
|
107
116
|
}
|
|
108
117
|
|
|
118
|
+
/** @deprecated use signerInstance instead */
|
|
119
|
+
signer(): Promisable<XyoSigner> {
|
|
120
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
121
|
+
return this.gateway.signer()
|
|
122
|
+
}
|
|
123
|
+
|
|
109
124
|
protected async addPayloadsToDataLakes(payloads: WithHashMeta<Payload>[]): Promise<void> {
|
|
110
125
|
await Promise.all(this._dataLakes.map(async (dataLake) => {
|
|
111
126
|
await Promise.all(payloads.map(async (payload) => {
|