@xyo-network/chain-bridge 1.19.7 → 1.19.9
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/node/BridgeActor.d.ts +15 -0
- package/dist/node/BridgeActor.d.ts.map +1 -0
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.mjs +155 -130
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/manifest/getServices.d.ts +2 -2
- package/dist/node/manifest/getServices.d.ts.map +1 -1
- package/dist/node/queue/workers/util/submitXl1Transaction.d.ts +3 -42
- package/dist/node/queue/workers/util/submitXl1Transaction.d.ts.map +1 -1
- package/dist/node/server/app.d.ts +2 -2
- package/dist/node/server/app.d.ts.map +1 -1
- package/dist/node/server/routes/addRoutes.d.ts +2 -2
- package/dist/node/server/routes/addRoutes.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/addBridgeRoutes.d.ts +2 -2
- package/dist/node/server/routes/bridge/addBridgeRoutes.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/getRouteDefinitions.d.ts +2 -2
- package/dist/node/server/routes/bridge/routeDefinitions/getRouteDefinitions.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts +2 -2
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts.map +1 -1
- package/dist/node/server/server.d.ts +2 -2
- package/dist/node/server/server.d.ts.map +1 -1
- package/dist/node/util/calculateBridgeFees.d.ts +1 -1
- package/dist/node/util/calculateBridgeFees.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/BridgeActor.ts +51 -0
- package/src/config/getBridgeEscrowAddress.ts +2 -2
- package/src/config/getBridgeFeesAddress.ts +2 -2
- package/src/config/getBridgeWalletAccount.ts +1 -1
- package/src/config/getFeeStructure.ts +1 -1
- package/src/config/getGateway.ts +1 -1
- package/src/config/getMaxBridgeAmount.ts +1 -1
- package/src/config/getMinBridgeAmount.ts +1 -1
- package/src/config/getRemoteChainId.ts +1 -1
- package/src/config/getRemoteTokenAddress.ts +1 -1
- package/src/config/getXl1ChainId.ts +1 -1
- package/src/config/getXl1TokenAddress.ts +1 -1
- package/src/index.ts +1 -1
- package/src/manifest/getModuleLocator.ts +1 -1
- package/src/manifest/getNode.ts +1 -1
- package/src/manifest/getServices.ts +3 -5
- package/src/queue/connection.ts +1 -1
- package/src/queue/workers/util/submitXl1Transaction.ts +23 -7
- package/src/server/app.ts +3 -3
- package/src/server/routes/addRoutes.ts +3 -3
- package/src/server/routes/bridge/addBridgeRoutes.ts +3 -3
- package/src/server/routes/bridge/routeDefinitions/getRouteDefinitions.ts +3 -3
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.ts +4 -7
- package/src/server/server.ts +6 -6
- package/src/util/calculateBridgeFees.ts +1 -1
|
@@ -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;
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
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;
|
|
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;
|
|
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;
|
|
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;
|
|
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 {
|
|
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
|
package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts.map
CHANGED
|
@@ -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,
|
|
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 {
|
|
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,
|
|
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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Hex } from '@xylabs/sdk-js';
|
|
2
2
|
import type { Config } from '@xyo-network/xl1-sdk';
|
|
3
|
-
export type FeeStructure = Pick<Config['bridge'], 'feeFixed' | 'feeRateBasisPoints'>;
|
|
3
|
+
export type FeeStructure = Pick<Config['actors']['bridge'], 'feeFixed' | 'feeRateBasisPoints'>;
|
|
4
4
|
export interface FeeCalculationResult {
|
|
5
5
|
destAmount: Hex;
|
|
6
6
|
feeFixed: Hex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateBridgeFees.d.ts","sourceRoot":"","sources":["../../../src/util/calculateBridgeFees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,oBAAoB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"calculateBridgeFees.d.ts","sourceRoot":"","sources":["../../../src/util/calculateBridgeFees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,oBAAoB,CAAC,CAAA;AAE9F,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,GAAG,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;IACb,WAAW,EAAE,GAAG,CAAA;CACjB;AAED,eAAO,MAAM,mBAAmB,GAAI,WAAW,GAAG,EAAE,cAAc,YAAY,KAAG,oBA0BhF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/chain-bridge",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.9",
|
|
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.
|
|
56
|
-
"@xylabs/mongo": "~5.0.
|
|
57
|
-
"@xylabs/sdk-js": "~5.0.
|
|
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.
|
|
64
|
-
"@xyo-network/chain-protocol": "~1.19.
|
|
65
|
-
"@xyo-network/chain-services": "~1.19.
|
|
66
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
63
|
+
"@xyo-network/chain-orchestration": "~1.19.9",
|
|
64
|
+
"@xyo-network/chain-protocol": "~1.19.9",
|
|
65
|
+
"@xyo-network/chain-services": "~1.19.9",
|
|
66
|
+
"@xyo-network/chain-telemetry": "~1.19.9",
|
|
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.
|
|
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",
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
"@types/cors": "~2.8.19",
|
|
96
96
|
"@types/express": "5.0.6",
|
|
97
97
|
"@types/express-serve-static-core": "~5.1.1",
|
|
98
|
-
"@types/node": "~25.2.
|
|
99
|
-
"@xylabs/axios": "~5.0.
|
|
100
|
-
"@xylabs/mongo": "~5.0.
|
|
101
|
-
"@xylabs/sdk-js": "~5.0.
|
|
98
|
+
"@types/node": "~25.2.3",
|
|
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.
|
|
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.
|
|
116
|
-
"@xyo-network/chain-services": "~1.19.
|
|
117
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
115
|
+
"@xyo-network/chain-protocol": "~1.19.9",
|
|
116
|
+
"@xyo-network/chain-services": "~1.19.9",
|
|
117
|
+
"@xyo-network/chain-telemetry": "~1.19.9",
|
|
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,14 +123,14 @@
|
|
|
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.
|
|
126
|
+
"@xyo-network/xl1-sdk": "~1.23.14",
|
|
127
127
|
"async-mutex": "~0.5.0",
|
|
128
|
-
"axios": "~1.13.
|
|
128
|
+
"axios": "~1.13.5",
|
|
129
129
|
"dotenv": "~17.2.4",
|
|
130
130
|
"eslint": "^9.39.2",
|
|
131
131
|
"ethers": "^6.16.0",
|
|
132
132
|
"http-status-codes": "~2.3.0",
|
|
133
|
-
"mongodb": "~7.
|
|
133
|
+
"mongodb": "~7.1.0",
|
|
134
134
|
"nodemon": "~3.1.11",
|
|
135
135
|
"tslib": "~2.8.1",
|
|
136
136
|
"typescript": "~5.9.3",
|
|
@@ -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
|
+
}
|
|
@@ -3,11 +3,11 @@ import { asAddress, assertEx } from '@xylabs/sdk-js'
|
|
|
3
3
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
4
4
|
|
|
5
5
|
export const tryGetBridgeEscrowAddress = (config: Config): Address | undefined => {
|
|
6
|
-
const address = asAddress(config.bridge.escrowAddress)
|
|
6
|
+
const address = asAddress(config.actors.bridge.escrowAddress)
|
|
7
7
|
return address
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const getBridgeEscrowAddress = (config: Config): Address => {
|
|
11
|
-
const address = assertEx(tryGetBridgeEscrowAddress(config), () => `Invalid bridge escrow address: ${config.bridge.escrowAddress}`)
|
|
11
|
+
const address = assertEx(tryGetBridgeEscrowAddress(config), () => `Invalid bridge escrow address: ${config.actors.bridge.escrowAddress}`)
|
|
12
12
|
return address
|
|
13
13
|
}
|
|
@@ -3,11 +3,11 @@ import { asAddress, assertEx } from '@xylabs/sdk-js'
|
|
|
3
3
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
4
4
|
|
|
5
5
|
export const tryGetBridgeFeesAddress = (config: Config): Address | undefined => {
|
|
6
|
-
const address = asAddress(config.bridge.feesAddress)
|
|
6
|
+
const address = asAddress(config.actors.bridge.feesAddress)
|
|
7
7
|
return address
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const getBridgeFeesAddress = (config: Config): Address => {
|
|
11
|
-
const address = assertEx(tryGetBridgeFeesAddress(config), () => `Invalid bridge fees address: ${config.bridge.feesAddress}`)
|
|
11
|
+
const address = assertEx(tryGetBridgeFeesAddress(config), () => `Invalid bridge fees address: ${config.actors.bridge.feesAddress}`)
|
|
12
12
|
return address
|
|
13
13
|
}
|
|
@@ -9,7 +9,7 @@ let accountServiceSingleton: Promisable<WalletInstance> | undefined
|
|
|
9
9
|
|
|
10
10
|
export const getBridgeWalletAccount = async (config: Config): Promise<WalletInstance> => {
|
|
11
11
|
if (accountServiceSingleton) return accountServiceSingleton
|
|
12
|
-
let walletPhrase = config.bridge.mnemonic
|
|
12
|
+
let walletPhrase = config.actors.bridge.mnemonic
|
|
13
13
|
if (isUndefined(walletPhrase)) {
|
|
14
14
|
console.log('[Bridge] No wallet mnemonic specified!')
|
|
15
15
|
const randomMnemonic = HDWallet.generateMnemonic()
|
|
@@ -3,6 +3,6 @@ import type { Config } from '@xyo-network/xl1-sdk'
|
|
|
3
3
|
import type { FeeStructure } from '../util/index.ts'
|
|
4
4
|
|
|
5
5
|
export const getFeeStructure = (config: Config): FeeStructure => {
|
|
6
|
-
const { feeFixed, feeRateBasisPoints } = config.bridge
|
|
6
|
+
const { feeFixed, feeRateBasisPoints } = config.actors.bridge
|
|
7
7
|
return { feeFixed, feeRateBasisPoints }
|
|
8
8
|
}
|
package/src/config/getGateway.ts
CHANGED
|
@@ -11,7 +11,7 @@ let gatewayInstance: XyoGatewayRunner | undefined
|
|
|
11
11
|
|
|
12
12
|
export const getGateway = async (config: Config): Promise<XyoGatewayRunner> => {
|
|
13
13
|
if (isDefined(gatewayInstance)) return gatewayInstance
|
|
14
|
-
const { mnemonic, chainRpcApiUrl: endpoint } = config.bridge
|
|
14
|
+
const { mnemonic, chainRpcApiUrl: endpoint } = config.actors.bridge
|
|
15
15
|
const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()
|
|
16
16
|
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)
|
|
17
17
|
const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)
|
|
@@ -2,6 +2,6 @@ import type { Hex } from '@xylabs/sdk-js'
|
|
|
2
2
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export const getMaxBridgeAmount = (config: Config): Hex => {
|
|
5
|
-
const { maxBridgeAmount } = config.bridge
|
|
5
|
+
const { maxBridgeAmount } = config.actors.bridge
|
|
6
6
|
return maxBridgeAmount
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@ import type { Hex } from '@xylabs/sdk-js'
|
|
|
2
2
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export const getMinBridgeAmount = (config: Config): Hex => {
|
|
5
|
-
const { minBridgeAmount } = config.bridge
|
|
5
|
+
const { minBridgeAmount } = config.actors.bridge
|
|
6
6
|
return minBridgeAmount
|
|
7
7
|
}
|
|
@@ -4,6 +4,6 @@ import type { ChainId, Config } from '@xyo-network/xl1-sdk'
|
|
|
4
4
|
import { asChainId } from './asChainId.ts'
|
|
5
5
|
|
|
6
6
|
export const getRemoteChainId = (config: Config): ChainId => {
|
|
7
|
-
const remoteChainId = assertEx(asChainId(config.bridge.remoteChainId), () => 'Invalid remote chain ID in config')
|
|
7
|
+
const remoteChainId = assertEx(asChainId(config.actors.bridge.remoteChainId), () => 'Invalid remote chain ID in config')
|
|
8
8
|
return remoteChainId
|
|
9
9
|
}
|
|
@@ -5,6 +5,6 @@ import type { Config } from '@xyo-network/xl1-sdk'
|
|
|
5
5
|
import { asToken } from './asToken.ts'
|
|
6
6
|
|
|
7
7
|
export const getRemoteTokenAddress = (config: Config): Address => {
|
|
8
|
-
const token = asToken(config.bridge.remoteTokenAddress)
|
|
8
|
+
const token = asToken(config.actors.bridge.remoteTokenAddress)
|
|
9
9
|
return assertEx(token, () => 'Remote token address is not defined in bridge configuration')
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import type { ChainId, Config } from '@xyo-network/xl1-sdk'
|
|
|
4
4
|
import { asChainId } from './asChainId.ts'
|
|
5
5
|
|
|
6
6
|
export const getXl1ChainId = (config: Config): ChainId => {
|
|
7
|
-
const xl1ChainId = config.bridge.xl1ChainId
|
|
7
|
+
const xl1ChainId = config.actors.bridge.xl1ChainId
|
|
8
8
|
if (isDefined(xl1ChainId)) {
|
|
9
9
|
return assertEx(asChainId(xl1ChainId), () => 'Invalid xl1ChainId in bridge config')
|
|
10
10
|
}
|
|
@@ -6,7 +6,7 @@ import { asToken } from './asToken.ts'
|
|
|
6
6
|
import { getXl1ChainId } from './getXl1ChainId.ts'
|
|
7
7
|
|
|
8
8
|
export const getXl1TokenAddress = (config: Config): Hex => {
|
|
9
|
-
const token = asToken(config.bridge.xl1TokenAddress)
|
|
9
|
+
const token = asToken(config.actors.bridge.xl1TokenAddress)
|
|
10
10
|
if (isDefined(token)) return token
|
|
11
11
|
return getXl1ChainId(config)
|
|
12
12
|
}
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './BridgeActor.ts'
|
|
@@ -109,7 +109,7 @@ export const getModuleLocator = async (context: GetLocatorContext) => {
|
|
|
109
109
|
'liquidity_bridge_eth_xl1_bridge_completed',
|
|
110
110
|
)
|
|
111
111
|
const provider = await initEvmProvider({ config })
|
|
112
|
-
const bridgeAddress = config.bridge.remoteBridgeContractAddress
|
|
112
|
+
const bridgeAddress = config.actors.bridge.remoteBridgeContractAddress
|
|
113
113
|
const evmLiquidityBridgeTransactionCompletionMonitorSentinelParams: EVMLiquidityBridgeTransactionCompletionMonitorSentinelParams = {
|
|
114
114
|
bridgeAddress,
|
|
115
115
|
completedTransactions: completedEthXl1BridgeTransactions,
|
package/src/manifest/getNode.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface GetNodeContext {
|
|
|
23
23
|
*/
|
|
24
24
|
export const getNode = async (context: GetNodeContext) => {
|
|
25
25
|
const { config, wallet } = context
|
|
26
|
-
const { chainRpcApiUrl: endpoint } = config.bridge
|
|
26
|
+
const { chainRpcApiUrl: endpoint } = config.actors.bridge
|
|
27
27
|
const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(endpoint, schemas)
|
|
28
28
|
const signerAccount = await getBridgeWalletAccount(config)
|
|
29
29
|
const locator = await buildJsonRpcProviderLocator({ signerAccount, transportFactory })
|
|
@@ -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,16 +20,15 @@ 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 })
|
|
31
29
|
const {
|
|
32
30
|
remoteBridgeContractAddress, remoteChainWalletPrivateKey, remoteTokenAddress, mnemonic,
|
|
33
|
-
} = config.bridge
|
|
31
|
+
} = config.actors.bridge
|
|
34
32
|
const account = isDefined(mnemonic) ? await HDWallet.fromPhrase(mnemonic) : await HDWallet.random()
|
|
35
33
|
const wallet = new Wallet(remoteChainWalletPrivateKey, provider)
|
|
36
34
|
const bridgeableToken = BridgeableToken__factory.connect(getAddress(remoteTokenAddress), wallet)
|
package/src/queue/connection.ts
CHANGED
|
@@ -8,7 +8,7 @@ const maxRetriesPerRequest = null
|
|
|
8
8
|
|
|
9
9
|
export const getConnection = (config: Config) => {
|
|
10
10
|
if (isDefined(connection)) return connection
|
|
11
|
-
const { redisHost: host, redisPort: port } = config.bridge
|
|
11
|
+
const { redisHost: host, redisPort: port } = config.actors.bridge
|
|
12
12
|
connection = new Redis({
|
|
13
13
|
host, port, maxRetriesPerRequest,
|
|
14
14
|
})
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
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 (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
}
|