@xyo-network/chain-bridge 1.19.8 → 1.19.10

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.
Files changed (33) hide show
  1. package/dist/node/BridgeActor.d.ts +15 -0
  2. package/dist/node/BridgeActor.d.ts.map +1 -0
  3. package/dist/node/index.d.ts +1 -1
  4. package/dist/node/index.d.ts.map +1 -1
  5. package/dist/node/index.mjs +140 -115
  6. package/dist/node/index.mjs.map +1 -1
  7. package/dist/node/manifest/getServices.d.ts +2 -2
  8. package/dist/node/manifest/getServices.d.ts.map +1 -1
  9. package/dist/node/queue/workers/util/submitXl1Transaction.d.ts +3 -42
  10. package/dist/node/queue/workers/util/submitXl1Transaction.d.ts.map +1 -1
  11. package/dist/node/server/app.d.ts +2 -2
  12. package/dist/node/server/app.d.ts.map +1 -1
  13. package/dist/node/server/routes/addRoutes.d.ts +2 -2
  14. package/dist/node/server/routes/addRoutes.d.ts.map +1 -1
  15. package/dist/node/server/routes/bridge/addBridgeRoutes.d.ts +2 -2
  16. package/dist/node/server/routes/bridge/addBridgeRoutes.d.ts.map +1 -1
  17. package/dist/node/server/routes/bridge/routeDefinitions/getRouteDefinitions.d.ts +2 -2
  18. package/dist/node/server/routes/bridge/routeDefinitions/getRouteDefinitions.d.ts.map +1 -1
  19. package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts +2 -2
  20. package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts.map +1 -1
  21. package/dist/node/server/server.d.ts +2 -2
  22. package/dist/node/server/server.d.ts.map +1 -1
  23. package/package.json +17 -17
  24. package/src/BridgeActor.ts +51 -0
  25. package/src/index.ts +1 -1
  26. package/src/manifest/getServices.ts +2 -4
  27. package/src/queue/workers/util/submitXl1Transaction.ts +23 -7
  28. package/src/server/app.ts +3 -3
  29. package/src/server/routes/addRoutes.ts +3 -3
  30. package/src/server/routes/bridge/addBridgeRoutes.ts +3 -3
  31. package/src/server/routes/bridge/routeDefinitions/getRouteDefinitions.ts +3 -3
  32. package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.ts +4 -7
  33. package/src/server/server.ts +4 -4
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from '@xylabs/sdk-js';
2
- import type { Config } from '@xyo-network/xl1-sdk';
2
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
3
3
  import type { IBridgeServiceCollection } from '../services/index.ts';
4
4
  export interface GetServicesContext {
5
5
  config: Config;
@@ -9,5 +9,5 @@ export interface GetServicesContext {
9
9
  * Used for retrieving a service collection
10
10
  * @returns A service collection
11
11
  */
12
- export declare const getServices: (context: GetServicesContext) => Promise<IBridgeServiceCollection>;
12
+ export declare const getServices: (context: GetServicesContext, gateway: XyoGatewayRunner) => Promise<IBridgeServiceCollection>;
13
13
  //# sourceMappingURL=getServices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../src/manifest/getServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAIlD,OAAO,KAAK,EACE,wBAAwB,EACrC,MAAM,sBAAsB,CAAA;AAG7B,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,SAAS,kBAAkB,KAAG,OAAO,CAAC,wBAAwB,CAuB/F,CAAA"}
1
+ {"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../src/manifest/getServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGpE,OAAO,KAAK,EACE,wBAAwB,EACrC,MAAM,sBAAsB,CAAA;AAG7B,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,SAAS,kBAAkB,EAAE,SAAS,gBAAgB,KAAG,OAAO,CAAC,wBAAwB,CAsB1H,CAAA"}
@@ -1,43 +1,4 @@
1
- import type { SignedHydratedTransaction, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
2
- export declare const submitXl1Transaction: (preparedTx: SignedHydratedTransaction, gateway: XyoGatewayRunner) => Promise<[import("@xylabs/hex").BrandedHash, [{
3
- schema: "network.xyo.boundwitness" & {
4
- readonly __schema: true;
5
- };
6
- addresses: (Lowercase<string> & {
7
- readonly __hex: true;
8
- } & {
9
- readonly __address: true;
10
- })[];
11
- payload_hashes: import("@xylabs/hex").BrandedHash[];
12
- payload_schemas: import("@xyo-network/payload-model").BrandedSchema<string>[];
13
- previous_hashes: (import("@xylabs/hex").BrandedHash | null)[];
14
- $signatures: import("@xylabs/hex").BrandedHex[];
15
- nbf: import("@xyo-network/xl1-sdk").XL1BlockNumber;
16
- exp: import("@xyo-network/xl1-sdk").XL1BlockNumber;
17
- fees: {
18
- base: import("@xylabs/hex").BrandedHex;
19
- gasLimit: import("@xylabs/hex").BrandedHex;
20
- gasPrice: import("@xylabs/hex").BrandedHex;
21
- priority: import("@xylabs/hex").BrandedHex;
22
- };
23
- chain: import("@xylabs/hex").BrandedHex;
24
- from: Lowercase<string> & {
25
- readonly __hex: true;
26
- } & {
27
- readonly __address: true;
28
- };
29
- _hash: import("@xylabs/hex").BrandedHash;
30
- _dataHash: import("@xylabs/hex").BrandedHash;
31
- $destination?: (Lowercase<string> & {
32
- readonly __hex: true;
33
- } & {
34
- readonly __address: true;
35
- }) | undefined;
36
- $sourceQuery?: import("@xylabs/hex").BrandedHash | undefined;
37
- script?: string[] | undefined;
38
- }, {
39
- schema: import("@xyo-network/payload-model").BrandedSchema<string>;
40
- _hash: import("@xylabs/hex").BrandedHash;
41
- _dataHash: import("@xylabs/hex").BrandedHash;
42
- }[]]]>;
1
+ import { type BrandedHash } from '@xylabs/sdk-js';
2
+ import { type SignedHydratedTransaction, type XyoGatewayRunner } from '@xyo-network/xl1-sdk';
3
+ export declare const submitXl1Transaction: (preparedTx: SignedHydratedTransaction, gateway: XyoGatewayRunner) => Promise<[BrandedHash, SignedHydratedTransaction]>;
43
4
  //# sourceMappingURL=submitXl1Transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"submitXl1Transaction.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/submitXl1Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvF,eAAO,MAAM,oBAAoB,GAAU,YAAY,yBAAyB,EAAE,SAAS,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAK1G,CAAA"}
1
+ {"version":3,"file":"submitXl1Transaction.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/submitXl1Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5F,eAAO,MAAM,oBAAoB,GAC/B,YAAY,yBAAyB,EACrC,SAAS,gBAAgB,KACxB,OAAO,CAAC,CAAC,WAAW,EAAE,yBAAyB,CAAC,CAkBlD,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { NodeInstance } from '@xyo-network/node-model';
2
- import type { Config } from '@xyo-network/xl1-sdk';
2
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
3
3
  import type { Express } from 'express';
4
- export declare const getApp: (node: NodeInstance, config: Config) => Express;
4
+ export declare const getApp: (node: NodeInstance, config: Config, gateway: XyoGatewayRunner) => Express;
5
5
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/server/app.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAOtC,eAAO,MAAM,MAAM,GAAI,MAAM,YAAY,EAAE,QAAQ,MAAM,KAAG,OAiB3D,CAAA"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/server/app.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAOtC,eAAO,MAAM,MAAM,GAAI,MAAM,YAAY,EAAE,QAAQ,MAAM,EAAE,SAAS,gBAAgB,KAAG,OAiBtF,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Config } from '@xyo-network/xl1-sdk';
1
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
2
2
  import type { Express } from 'express';
3
- export declare const addRoutes: (app: Express, config: Config) => void;
3
+ export declare const addRoutes: (app: Express, config: Config, gateway: XyoGatewayRunner) => void;
4
4
  //# sourceMappingURL=addRoutes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addRoutes.d.ts","sourceRoot":"","sources":["../../../../src/server/routes/addRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAItC,eAAO,MAAM,SAAS,GAAI,KAAK,OAAO,EAAE,QAAQ,MAAM,SAErD,CAAA"}
1
+ {"version":3,"file":"addRoutes.d.ts","sourceRoot":"","sources":["../../../../src/server/routes/addRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAItC,eAAO,MAAM,SAAS,GAAI,KAAK,OAAO,EAAE,QAAQ,MAAM,EAAE,SAAS,gBAAgB,SAEhF,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Config } from '@xyo-network/xl1-sdk';
1
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
2
2
  import type { Express } from 'express';
3
- export declare const addBridgeRoutes: (app: Express, config: Config) => void;
3
+ export declare const addBridgeRoutes: (app: Express, config: Config, gateway: XyoGatewayRunner) => void;
4
4
  //# sourceMappingURL=addBridgeRoutes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addBridgeRoutes.d.ts","sourceRoot":"","sources":["../../../../../src/server/routes/bridge/addBridgeRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAItC,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,EAAE,QAAQ,MAAM,SAK3D,CAAA"}
1
+ {"version":3,"file":"addBridgeRoutes.d.ts","sourceRoot":"","sources":["../../../../../src/server/routes/bridge/addBridgeRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAItC,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,EAAE,QAAQ,MAAM,EAAE,SAAS,gBAAgB,SAKtF,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import type { RouteDefinition } from '@xylabs/express';
2
- import type { Config } from '@xyo-network/xl1-sdk';
3
- export declare const getRouteDefinitions: (config: Config) => RouteDefinition[];
2
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
3
+ export declare const getRouteDefinitions: (config: Config, gateway: XyoGatewayRunner) => RouteDefinition[];
4
4
  //# sourceMappingURL=getRouteDefinitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRouteDefinitions.d.ts","sourceRoot":"","sources":["../../../../../../src/server/routes/bridge/routeDefinitions/getRouteDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAMlD,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,eAAe,EAQnE,CAAA"}
1
+ {"version":3,"file":"getRouteDefinitions.d.ts","sourceRoot":"","sources":["../../../../../../src/server/routes/bridge/routeDefinitions/getRouteDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAMpE,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,SAAS,gBAAgB,KAAG,eAAe,EAQ9F,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { RouteDefinition } from '@xylabs/express';
2
- import { type Config } from '@xyo-network/xl1-sdk';
2
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
3
3
  import { z } from 'zod';
4
4
  export declare const BridgeToRemoteEstimateBodyZod: z.ZodObject<{
5
5
  srcAddress: z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>;
@@ -72,5 +72,5 @@ export declare const BridgeToRemoteEstimateResponseZod: z.ZodTuple<[z.ZodObject<
72
72
  }, string>>, z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
73
73
  }, z.core.$strip>], null>;
74
74
  export type BridgeToRemoteEstimateResponse = z.infer<typeof BridgeToRemoteEstimateResponseZod>;
75
- export declare const makeBridgeToRemoteEstimateRoute: (config: Config) => RouteDefinition;
75
+ export declare const makeBridgeToRemoteEstimateRoute: (config: Config, gateway: XyoGatewayRunner) => RouteDefinition;
76
76
  //# sourceMappingURL=bridgeToRemoteEstimate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridgeToRemoteEstimate.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,OAAO,EACqB,KAAK,MAAM,EACtC,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,6BAA6B;;;;iBAIxC,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAEtF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAI5C,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAE9F,eAAO,MAAM,+BAA+B,GAAI,QAAQ,MAAM,KAAG,eA8BhE,CAAA"}
1
+ {"version":3,"file":"bridgeToRemoteEstimate.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAIpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,6BAA6B;;;;iBAIxC,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAEtF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAI5C,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAE9F,eAAO,MAAM,+BAA+B,GAAI,QAAQ,MAAM,EAAE,SAAS,gBAAgB,KAAG,eA6B3F,CAAA"}
@@ -1,11 +1,11 @@
1
1
  import { type Logger } from '@xylabs/sdk-js';
2
2
  import type { NodeInstance } from '@xyo-network/node-model';
3
- import { type Config } from '@xyo-network/xl1-sdk';
3
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk';
4
4
  interface GetServerContext {
5
5
  config: Config;
6
6
  logger?: Logger;
7
7
  node?: NodeInstance;
8
8
  }
9
- export declare const getServer: (context: GetServerContext) => Promise<import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>>;
9
+ export declare const getServer: (context: GetServerContext, gateway: XyoGatewayRunner) => Promise<import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>>;
10
10
  export {};
11
11
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAC0B,KAAK,MAAM,EAC3C,MAAM,gBAAgB,CAAA;AAGvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AA+BlD,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,+HAgBxD,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAC0B,KAAK,MAAM,EAC3C,MAAM,gBAAgB,CAAA;AAGvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AA+BpE,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,EAAE,SAAS,gBAAgB,+HAgBnF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/chain-bridge",
3
- "version": "1.19.8",
3
+ "version": "1.19.10",
4
4
  "description": "XYO Layer One Bridge",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -52,18 +52,18 @@
52
52
  "@opentelemetry/instrumentation": "~0.211.0",
53
53
  "@opentelemetry/instrumentation-express": "~0.59.0",
54
54
  "@opentelemetry/instrumentation-http": "~0.211.0",
55
- "@xylabs/express": "~5.0.78",
56
- "@xylabs/mongo": "~5.0.78",
57
- "@xylabs/sdk-js": "~5.0.78",
55
+ "@xylabs/express": "~5.0.79",
56
+ "@xylabs/mongo": "~5.0.79",
57
+ "@xylabs/sdk-js": "~5.0.79",
58
58
  "@xyo-network/archivist-memory": "~5.3.2",
59
59
  "@xyo-network/archivist-mongodb": "~5.3.2",
60
60
  "@xyo-network/archivist-view": "~5.3.2",
61
61
  "@xyo-network/bios": "~7.2.1",
62
62
  "@xyo-network/boundwitness-validator": "~5.3.2",
63
- "@xyo-network/chain-orchestration": "~1.19.8",
64
- "@xyo-network/chain-protocol": "~1.19.8",
65
- "@xyo-network/chain-services": "~1.19.8",
66
- "@xyo-network/chain-telemetry": "~1.19.8",
63
+ "@xyo-network/chain-orchestration": "~1.19.10",
64
+ "@xyo-network/chain-protocol": "~1.19.10",
65
+ "@xyo-network/chain-services": "~1.19.10",
66
+ "@xyo-network/chain-telemetry": "~1.19.10",
67
67
  "@xyo-network/manifest-model": "~5.3.2",
68
68
  "@xyo-network/manifest-wrapper": "~5.3.2",
69
69
  "@xyo-network/module-abstract": "~5.3.2",
@@ -78,7 +78,7 @@
78
78
  "@xyo-network/typechain": "~4.1.1",
79
79
  "@xyo-network/wallet": "~5.3.2",
80
80
  "@xyo-network/wallet-model": "~5.3.2",
81
- "@xyo-network/xl1-sdk": "~1.23.6",
81
+ "@xyo-network/xl1-sdk": "~1.23.14",
82
82
  "async-mutex": "~0.5.0",
83
83
  "bullmq": "~5.67.3",
84
84
  "compression": "~1.8.1",
@@ -96,12 +96,12 @@
96
96
  "@types/express": "5.0.6",
97
97
  "@types/express-serve-static-core": "~5.1.1",
98
98
  "@types/node": "~25.2.3",
99
- "@xylabs/axios": "~5.0.78",
100
- "@xylabs/mongo": "~5.0.78",
101
- "@xylabs/sdk-js": "~5.0.78",
99
+ "@xylabs/axios": "~5.0.79",
100
+ "@xylabs/mongo": "~5.0.79",
101
+ "@xylabs/sdk-js": "~5.0.79",
102
102
  "@xylabs/ts-scripts-yarn3": "~7.3.2",
103
103
  "@xylabs/tsconfig": "~7.3.2",
104
- "@xylabs/vitest-extended": "~5.0.78",
104
+ "@xylabs/vitest-extended": "~5.0.79",
105
105
  "@xyo-network/account": "~5.3.2",
106
106
  "@xyo-network/account-model": "~5.3.2",
107
107
  "@xyo-network/archivist-abstract": "~5.3.2",
@@ -112,9 +112,9 @@
112
112
  "@xyo-network/bios": "~7.2.1",
113
113
  "@xyo-network/bios-model": "~7.2.1",
114
114
  "@xyo-network/boundwitness-builder": "~5.3.2",
115
- "@xyo-network/chain-protocol": "~1.19.8",
116
- "@xyo-network/chain-services": "~1.19.8",
117
- "@xyo-network/chain-telemetry": "~1.19.8",
115
+ "@xyo-network/chain-protocol": "~1.19.10",
116
+ "@xyo-network/chain-services": "~1.19.10",
117
+ "@xyo-network/chain-telemetry": "~1.19.10",
118
118
  "@xyo-network/manifest-wrapper": "~5.3.2",
119
119
  "@xyo-network/module-abstract": "~5.3.2",
120
120
  "@xyo-network/module-abstract-mongodb": "~5.3.2",
@@ -123,7 +123,7 @@
123
123
  "@xyo-network/payload-builder": "~5.3.2",
124
124
  "@xyo-network/sentinel-memory": "~5.3.2",
125
125
  "@xyo-network/wallet": "~5.3.2",
126
- "@xyo-network/xl1-sdk": "~1.23.6",
126
+ "@xyo-network/xl1-sdk": "~1.23.14",
127
127
  "async-mutex": "~0.5.0",
128
128
  "axios": "~1.13.5",
129
129
  "dotenv": "~17.2.4",
@@ -0,0 +1,51 @@
1
+ import { Server } from 'node:http'
2
+
3
+ import { creatable } from '@xylabs/sdk-js'
4
+ import {
5
+ ActorParamsV3,
6
+ ActorV3,
7
+ Config,
8
+ XyoGatewayRunner,
9
+ XyoGatewayRunnerMoniker,
10
+ } from '@xyo-network/xl1-sdk'
11
+
12
+ import { getServer } from './server/index.ts'
13
+
14
+ export type BridgeActorParams = ActorParamsV3<{
15
+ config: Config
16
+ }>
17
+
18
+ @creatable()
19
+ export class BridgeActor extends ActorV3<BridgeActorParams> {
20
+ protected _gatewayRunner!: XyoGatewayRunner
21
+ private server?: Server
22
+
23
+ protected get gatewayRunner() {
24
+ return this._gatewayRunner
25
+ }
26
+
27
+ override async createHandler() {
28
+ await super.createHandler()
29
+ this._gatewayRunner = await this.locator.getInstance(XyoGatewayRunnerMoniker)
30
+ }
31
+
32
+ override async startHandler() {
33
+ await super.startHandler()
34
+ this.stopServer()
35
+ await this.startServer()
36
+ }
37
+
38
+ override async stopHandler() {
39
+ await super.stopHandler()
40
+ this.stopServer()
41
+ }
42
+
43
+ private async startServer() {
44
+ this.server = await getServer(this.context, this._gatewayRunner)
45
+ }
46
+
47
+ private stopServer() {
48
+ this.server?.close()
49
+ this.server = undefined
50
+ }
51
+ }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './server/index.ts'
1
+ export * from './BridgeActor.ts'
@@ -3,10 +3,9 @@ import { assertEx, isDefined } from '@xylabs/sdk-js'
3
3
  import { initEvmProvider } from '@xyo-network/chain-orchestration'
4
4
  import { BridgeableToken__factory, LiquidityPoolBridge__factory } from '@xyo-network/typechain'
5
5
  import { HDWallet } from '@xyo-network/wallet'
6
- import type { Config } from '@xyo-network/xl1-sdk'
6
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
7
7
  import { getAddress, Wallet } from 'ethers'
8
8
 
9
- import { getGateway } from '../config/index.ts'
10
9
  import type {
11
10
  EthTxState, IBridgeServiceCollection, Xl1TxState,
12
11
  } from '../services/index.ts'
@@ -21,10 +20,9 @@ export interface GetServicesContext {
21
20
  * Used for retrieving a service collection
22
21
  * @returns A service collection
23
22
  */
24
- export const getServices = async (context: GetServicesContext): Promise<IBridgeServiceCollection> => {
23
+ export const getServices = async (context: GetServicesContext, gateway: XyoGatewayRunner): Promise<IBridgeServiceCollection> => {
25
24
  const { config } = context
26
25
 
27
- const gateway = await getGateway(config)
28
26
  const ethTxStateMap = await getIterableMap<Hash, EthTxState>(config, 'liquidity_bridge_xl1_to_eth_eth_tx_state')
29
27
  const xl1TxStateMap = await getIterableMap<Hash, Xl1TxState>(config, 'liquidity_bridge_xl1_to_eth_xl1_tx_state')
30
28
  const provider = await initEvmProvider({ config })
@@ -1,9 +1,25 @@
1
- import type { SignedHydratedTransaction, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
2
- import { isAllowedBlockPayload } from '@xyo-network/xl1-sdk'
1
+ import { assertEx, type BrandedHash } from '@xylabs/sdk-js'
2
+ import { type SignedHydratedTransaction, type XyoGatewayRunner } from '@xyo-network/xl1-sdk'
3
3
 
4
- export const submitXl1Transaction = async (preparedTx: SignedHydratedTransaction, gateway: XyoGatewayRunner) => {
5
- const onChain = preparedTx[1].filter(isAllowedBlockPayload)
6
- const offChainPayloads = preparedTx[1].filter(p => !isAllowedBlockPayload(p))
7
- const result = await gateway.addPayloadsToChain(onChain, offChainPayloads)
8
- return result
4
+ export const submitXl1Transaction = async (
5
+ preparedTx: SignedHydratedTransaction,
6
+ gateway: XyoGatewayRunner,
7
+ ): Promise<[BrandedHash, SignedHydratedTransaction]> => {
8
+ // Option 1: Add payloads to chain with addPayloadsToChain
9
+ // Not optimal as it requires reconstructing the transaction from the on-chain payloads, which changes the tx hash
10
+ // const offChainPayloads = preparedTx[1].filter(p => !isAllowedBlockPayload(p))
11
+ // const onChainPayloads = preparedTx[1].filter(isAllowedBlockPayload)
12
+ // const result = await gateway.addPayloadsToChain(onChainPayloads, offChainPayloads)
13
+ // return result
14
+
15
+ // Option 2: Add transaction to chain with addTransactionToChain
16
+ // Fails due to resigning of transaction in addTransactionToChain, which causes `from` to be invalid
17
+ // const offChainPayloads = preparedTx[1].filter(p => !isAllowedBlockPayload(p))
18
+ // const result = await gateway.addTransactionToChain(preparedTx, offChainPayloads)
19
+ // return result
20
+
21
+ // Option 3: Add transaction to chain with addTransactionToChain, but bypass resigning by passing the preparedTx as an unsigned transaction
22
+ const runner = assertEx(gateway.connection.runner, () => 'No runner available on gateway connection')
23
+ const result = await runner.broadcastTransaction(preparedTx)
24
+ return [result, preparedTx]
9
25
  }
package/src/server/app.ts CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  standardErrors, standardResponses,
4
4
  } from '@xylabs/express'
5
5
  import type { NodeInstance } from '@xyo-network/node-model'
6
- import type { Config } from '@xyo-network/xl1-sdk'
6
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
7
7
  import compression from 'compression'
8
8
  import cors from 'cors'
9
9
  import type { Express } from 'express'
@@ -13,7 +13,7 @@ import { addFlowProducer } from './addFlowProducer.ts'
13
13
  import { addInstrumentation } from './instrumentation.ts'
14
14
  import { addRoutes } from './routes/index.ts'
15
15
 
16
- export const getApp = (node: NodeInstance, config: Config): Express => {
16
+ export const getApp = (node: NodeInstance, config: Config, gateway: XyoGatewayRunner): Express => {
17
17
  addInstrumentation()
18
18
  const app = express()
19
19
  app.set('etag', false)
@@ -27,7 +27,7 @@ export const getApp = (node: NodeInstance, config: Config): Express => {
27
27
  disableCaseSensitiveRouting(app)
28
28
  app.node = node
29
29
  addFlowProducer(app, config)
30
- addRoutes(app, config)
30
+ addRoutes(app, config, gateway)
31
31
  app.use(standardErrors)
32
32
  return app
33
33
  }
@@ -1,8 +1,8 @@
1
- import type { Config } from '@xyo-network/xl1-sdk'
1
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
2
2
  import type { Express } from 'express'
3
3
 
4
4
  import { addBridgeRoutes } from './bridge/index.ts'
5
5
 
6
- export const addRoutes = (app: Express, config: Config) => {
7
- addBridgeRoutes(app, config)
6
+ export const addRoutes = (app: Express, config: Config, gateway: XyoGatewayRunner) => {
7
+ addBridgeRoutes(app, config, gateway)
8
8
  }
@@ -1,10 +1,10 @@
1
- import type { Config } from '@xyo-network/xl1-sdk'
1
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
2
2
  import type { Express } from 'express'
3
3
 
4
4
  import { getRouteDefinitions } from './routeDefinitions/index.ts'
5
5
 
6
- export const addBridgeRoutes = (app: Express, config: Config) => {
7
- const routeDefinitions = getRouteDefinitions(config)
6
+ export const addBridgeRoutes = (app: Express, config: Config, gateway: XyoGatewayRunner) => {
7
+ const routeDefinitions = getRouteDefinitions(config, gateway)
8
8
  for (const definition of routeDefinitions) {
9
9
  app[definition.method](definition.path, definition.handlers)
10
10
  }
@@ -1,14 +1,14 @@
1
1
  import type { RouteDefinition } from '@xylabs/express'
2
- import type { Config } from '@xyo-network/xl1-sdk'
2
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
3
3
 
4
4
  import {
5
5
  makeBridgeConfigRoute, makeBridgeFromRemoteStatusRoute, makeBridgeToRemoteEstimateRoute, makeBridgeToRemoteRoute, makeBridgeToRemoteStatusRoute,
6
6
  } from './routes/index.ts'
7
7
 
8
- export const getRouteDefinitions = (config: Config): RouteDefinition[] => {
8
+ export const getRouteDefinitions = (config: Config, gateway: XyoGatewayRunner): RouteDefinition[] => {
9
9
  return [
10
10
  makeBridgeConfigRoute(config),
11
- makeBridgeToRemoteEstimateRoute(config),
11
+ makeBridgeToRemoteEstimateRoute(config, gateway),
12
12
  makeBridgeToRemoteRoute(config),
13
13
  makeBridgeToRemoteStatusRoute(config),
14
14
  makeBridgeFromRemoteStatusRoute(config),
@@ -2,15 +2,13 @@ import type { RouteDefinition } from '@xylabs/express'
2
2
  import { requestHandlerValidator } from '@xylabs/express'
3
3
  import { assertEx, toAddress } from '@xylabs/sdk-js'
4
4
  import { PayloadZodStrictOfSchema } from '@xyo-network/payload-model'
5
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
5
6
  import {
6
- buildUnsignedTransaction, type Config, TransferZod,
7
- } from '@xyo-network/xl1-sdk'
8
- import {
9
- BridgeIntentFieldsZod, BridgeIntentSchema, toXL1BlockNumber, TransactionBoundWitnessZod,
7
+ BridgeIntentFieldsZod, BridgeIntentSchema, buildUnsignedTransaction, toXL1BlockNumber, TransactionBoundWitnessZod, TransferZod,
10
8
  } from '@xyo-network/xl1-sdk'
11
9
  import { z } from 'zod'
12
10
 
13
- import { getGateway, getXl1ChainId } from '../../../../../config/index.ts'
11
+ import { getXl1ChainId } from '../../../../../config/index.ts'
14
12
  import { generateBridgeEstimate } from '../../../../../util/index.ts'
15
13
  import { getRemoteChainIdZod } from '../pathParams/index.ts'
16
14
 
@@ -29,7 +27,7 @@ export const BridgeToRemoteEstimateResponseZod = z.tuple([
29
27
 
30
28
  export type BridgeToRemoteEstimateResponse = z.infer<typeof BridgeToRemoteEstimateResponseZod>
31
29
 
32
- export const makeBridgeToRemoteEstimateRoute = (config: Config): RouteDefinition => {
30
+ export const makeBridgeToRemoteEstimateRoute = (config: Config, gateway: XyoGatewayRunner): RouteDefinition => {
33
31
  const params = z.object({ chainId: getRemoteChainIdZod(config) })
34
32
  const validateRequest = requestHandlerValidator({
35
33
  params, body: BridgeToRemoteEstimateBodyZod, response: BridgeToRemoteEstimateResponseZod,
@@ -46,7 +44,6 @@ export const makeBridgeToRemoteEstimateRoute = (config: Config): RouteDefinition
46
44
  const sender = toAddress(srcAddress)
47
45
 
48
46
  // Use viewer to get current block
49
- const gateway = await getGateway(config)
50
47
  const viewer = assertEx(gateway.connection.viewer, () => new Error('Viewer not available on gateway connection'))
51
48
  const currentBlockNumber = await viewer.currentBlockNumber()
52
49
  // Calculate nbf/exp
@@ -5,7 +5,7 @@ import { boot } from '@xyo-network/bios'
5
5
  import type { BiosExternalInterface } from '@xyo-network/bios-model'
6
6
  import type { NodeInstance } from '@xyo-network/node-model'
7
7
  import { HDWallet } from '@xyo-network/wallet'
8
- import { type Config } from '@xyo-network/xl1-sdk'
8
+ import type { Config, XyoGatewayRunner } from '@xyo-network/xl1-sdk'
9
9
 
10
10
  import { getNode, getServices } from '../manifest/index.ts'
11
11
  import { addWorkers } from './addWorkers.ts'
@@ -42,7 +42,7 @@ interface GetServerContext {
42
42
  node?: NodeInstance
43
43
  }
44
44
 
45
- export const getServer = async (context: GetServerContext) => {
45
+ export const getServer = async (context: GetServerContext, gateway: XyoGatewayRunner) => {
46
46
  const { logger, config } = context
47
47
  const { port, mnemonic } = config.actors.bridge
48
48
  const bios = await boot()
@@ -52,8 +52,8 @@ export const getServer = async (context: GetServerContext) => {
52
52
  wallet, logger, config,
53
53
  }
54
54
  const node = context.node ?? await getNode(nodeContext)
55
- const app = getApp(node, config)
56
- const services = await getServices({ config, logger })
55
+ const app = getApp(node, config, gateway)
56
+ const services = await getServices({ config, logger }, gateway)
57
57
  addWorkers(config, services)
58
58
  const server = app.listen(port, hostname, () => logger?.log(`[Bridge] Server listening at http://${hostname}:${port}`))
59
59
  server.setTimeout(20_000)