@xyo-network/chain-bridge 1.18.1 → 1.18.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/node/config/getGateway.d.ts.map +1 -1
- package/dist/node/index.mjs +44 -65
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.d.ts +4 -4
- package/dist/node/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.d.ts.map +1 -1
- package/dist/node/manifest/{getLocator.d.ts → getModuleLocator.d.ts} +4 -3
- package/dist/node/manifest/getModuleLocator.d.ts.map +1 -0
- package/dist/node/manifest/getNode.d.ts.map +1 -1
- package/dist/node/manifest/getServices.d.ts.map +1 -1
- package/dist/node/manifest/index.d.ts +1 -1
- package/dist/node/manifest/index.d.ts.map +1 -1
- package/package.json +66 -63
- package/src/config/getGateway.ts +6 -6
- package/src/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.ts +6 -6
- package/src/interface/service/Relay/LiquidityPoolBridgeRelay/LiquidityPoolBridgeRelay.ts +2 -2
- package/src/manifest/{getLocator.ts → getModuleLocator.ts} +18 -28
- package/src/manifest/getNode.ts +10 -4
- package/src/manifest/getServices.ts +4 -23
- package/src/manifest/index.ts +1 -1
- package/src/modules/EVMLiquidityBridgeTransactionCompletionMonitorSentinel/EVMLiquidityBridgeTransactionCompletionMonitorSentinel.ts +1 -1
- package/src/queue/workers/ethTransactionPreparation.ts +1 -1
- package/src/queue/workers/xl1TransactionMonitor.ts +1 -1
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.ts +1 -1
- package/dist/node/manifest/getLocator.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, Hex } from '@xylabs/sdk-js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ILiquidityPoolBridge } from '@xyo-network/typechain';
|
|
3
3
|
import type { WebSocketProvider } from 'ethers';
|
|
4
4
|
import type { BridgeServiceParams } from '../../../interface/index.ts';
|
|
5
5
|
import { AbstractBridgeObserverService } from '../Observer.ts';
|
|
@@ -7,7 +7,7 @@ export type LiquidityPoolBridgeObserverParams = BridgeServiceParams & {
|
|
|
7
7
|
/**
|
|
8
8
|
* The address to watch for incoming or outgoing ERC-20 token transfers.
|
|
9
9
|
*/
|
|
10
|
-
bridgeAddress:
|
|
10
|
+
bridgeAddress: Address;
|
|
11
11
|
/**
|
|
12
12
|
* An ethers.js WebSocketProvider connected to the Ethereum network to monitor for ERC-20 transfers.
|
|
13
13
|
*/
|
|
@@ -19,11 +19,11 @@ export type LiquidityPoolBridgeObserverParams = BridgeServiceParams & {
|
|
|
19
19
|
};
|
|
20
20
|
export declare class LiquidityPoolBridgeObserver extends AbstractBridgeObserverService<LiquidityPoolBridgeObserverParams> {
|
|
21
21
|
moniker: string;
|
|
22
|
-
protected _bridge:
|
|
22
|
+
protected _bridge: ILiquidityPoolBridge | undefined;
|
|
23
23
|
protected _bridgeChainId: Hex | undefined;
|
|
24
24
|
protected _bridgeRemoteChainId: Hex | undefined;
|
|
25
25
|
protected _bridgeTokenAddress: Address | undefined;
|
|
26
|
-
protected get bridge():
|
|
26
|
+
protected get bridge(): ILiquidityPoolBridge;
|
|
27
27
|
protected get bridgeChainId(): Hex;
|
|
28
28
|
protected get bridgeRemoteChainId(): Hex;
|
|
29
29
|
protected get bridgeTokenAddress(): Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidityPoolBridgeObserver.d.ts","sourceRoot":"","sources":["../../../../../../src/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAKlD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"LiquidityPoolBridgeObserver.d.ts","sourceRoot":"","sources":["../../../../../../src/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAKlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAQlE,OAAO,KAAK,EAAwB,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAGrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAE9D,MAAM,MAAM,iCAAiC,GAAG,mBAAmB,GAAG;IACpE;;OAEG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,qBAAa,2BAA4B,SAAQ,6BAA6B,CAAC,iCAAiC,CAAC;IAC/G,OAAO,SAAgC;IACvC,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACnD,SAAS,CAAC,cAAc,EAAE,GAAG,GAAG,SAAS,CAAA;IACzC,SAAS,CAAC,oBAAoB,EAAE,GAAG,GAAG,SAAS,CAAA;IAC/C,SAAS,CAAC,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAA;IAElD,SAAS,KAAK,MAAM,IAAI,oBAAoB,CAE3C;IAED,SAAS,KAAK,aAAa,IAAI,GAAG,CAEjC;IAED,SAAS,KAAK,mBAAmB,IAAI,GAAG,CAEvC;IAED,SAAS,KAAK,kBAAkB,IAAI,OAAO,CAE1C;IAED,SAAS,KAAK,QAAQ,IAAI,iBAAiB,CAE1C;IAED,SAAS,KAAK,UAAU,IAAI,MAAM,CAEjC;IAEc,aAAa;YAsCd,sBAAsB;YAmDtB,oBAAoB;YAsCpB,gBAAgB;CAiB/B"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Logger } from '@xylabs/sdk-js';
|
|
2
2
|
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator';
|
|
3
|
-
import type { Config } from '@xyo-network/xl1-sdk';
|
|
3
|
+
import type { Config, ProviderFactoryLocator } from '@xyo-network/xl1-sdk';
|
|
4
4
|
export interface GetLocatorContext {
|
|
5
5
|
config: Config;
|
|
6
|
+
locator: ProviderFactoryLocator;
|
|
6
7
|
logger?: Logger;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
@@ -10,5 +11,5 @@ export interface GetLocatorContext {
|
|
|
10
11
|
* operation of the node (entirely in memory)
|
|
11
12
|
* @returns A locator with the necessary modules registered
|
|
12
13
|
*/
|
|
13
|
-
export declare const
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
export declare const getModuleLocator: (context: GetLocatorContext) => Promise<ModuleFactoryLocator>;
|
|
15
|
+
//# sourceMappingURL=getModuleLocator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getModuleLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getModuleLocator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AASlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAG1E,OAAO,KAAK,EACoB,MAAM,EAAe,sBAAsB,EAE1E,MAAM,sBAAsB,CAAA;AAa7B,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,sBAAsB,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAU,SAAS,iBAAiB,kCAuFhE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNode.d.ts","sourceRoot":"","sources":["../../../src/manifest/getNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getNode.d.ts","sourceRoot":"","sources":["../../../src/manifest/getNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EACV,MAAM,EACP,MAAM,sBAAsB,CAAA;AAQ7B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,cAAc,CAAA;CACvB;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAU,SAAS,cAAc,uKAapD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../src/manifest/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAMlD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../src/manifest/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAMlD,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,sBAAsB,CAAA;AAS/D,OAAO,KAAK,EACE,wBAAwB,EACrC,MAAM,sBAAsB,CAAA;AAE7B,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,CA0B/F,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/chain-bridge",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.4",
|
|
4
4
|
"description": "XYO Layer One Bridge",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -49,44 +49,43 @@
|
|
|
49
49
|
"types": "tsc --noEmit -p tsconfig.test.json"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@opentelemetry/instrumentation": "~0.
|
|
53
|
-
"@opentelemetry/instrumentation-express": "~0.
|
|
54
|
-
"@opentelemetry/instrumentation-http": "~0.
|
|
55
|
-
"@xylabs/express": "~5.0.
|
|
56
|
-
"@xylabs/mongo": "~5.0.
|
|
57
|
-
"@xylabs/sdk-js": "~5.0.
|
|
58
|
-
"@xyo-network/archivist-memory": "~5.2.
|
|
59
|
-
"@xyo-network/archivist-mongodb": "~5.2.
|
|
60
|
-
"@xyo-network/archivist-view": "~5.2.
|
|
52
|
+
"@opentelemetry/instrumentation": "~0.211.0",
|
|
53
|
+
"@opentelemetry/instrumentation-express": "~0.59.0",
|
|
54
|
+
"@opentelemetry/instrumentation-http": "~0.211.0",
|
|
55
|
+
"@xylabs/express": "~5.0.64",
|
|
56
|
+
"@xylabs/mongo": "~5.0.64",
|
|
57
|
+
"@xylabs/sdk-js": "~5.0.64",
|
|
58
|
+
"@xyo-network/archivist-memory": "~5.2.25",
|
|
59
|
+
"@xyo-network/archivist-mongodb": "~5.2.25",
|
|
60
|
+
"@xyo-network/archivist-view": "~5.2.25",
|
|
61
61
|
"@xyo-network/bios": "~7.2.0",
|
|
62
|
-
"@xyo-network/boundwitness-validator": "~5.2.
|
|
63
|
-
"@xyo-network/chain-protocol": "~1.18.
|
|
64
|
-
"@xyo-network/chain-services": "~1.18.
|
|
65
|
-
"@xyo-network/chain-telemetry": "~1.18.
|
|
66
|
-
"@xyo-network/manifest-model": "~5.2.
|
|
67
|
-
"@xyo-network/manifest-wrapper": "~5.2.
|
|
68
|
-
"@xyo-network/module-abstract": "~5.2.
|
|
69
|
-
"@xyo-network/module-factory-locator": "~5.2.
|
|
70
|
-
"@xyo-network/module-model": "~5.2.
|
|
71
|
-
"@xyo-network/node-model": "~5.2.
|
|
72
|
-
"@xyo-network/payload-builder": "~5.2.
|
|
73
|
-
"@xyo-network/payload-model": "~5.2.
|
|
74
|
-
"@xyo-network/sentinel-abstract": "~5.2.
|
|
75
|
-
"@xyo-network/sentinel-memory": "~5.2.
|
|
76
|
-
"@xyo-network/sentinel-model": "~5.2.
|
|
77
|
-
"@xyo-network/typechain": "~4.
|
|
78
|
-
"@xyo-network/wallet": "~5.2.
|
|
79
|
-
"@xyo-network/wallet-model": "~5.2.
|
|
80
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
62
|
+
"@xyo-network/boundwitness-validator": "~5.2.25",
|
|
63
|
+
"@xyo-network/chain-protocol": "~1.18.4",
|
|
64
|
+
"@xyo-network/chain-services": "~1.18.4",
|
|
65
|
+
"@xyo-network/chain-telemetry": "~1.18.4",
|
|
66
|
+
"@xyo-network/manifest-model": "~5.2.25",
|
|
67
|
+
"@xyo-network/manifest-wrapper": "~5.2.25",
|
|
68
|
+
"@xyo-network/module-abstract": "~5.2.25",
|
|
69
|
+
"@xyo-network/module-factory-locator": "~5.2.25",
|
|
70
|
+
"@xyo-network/module-model": "~5.2.25",
|
|
71
|
+
"@xyo-network/node-model": "~5.2.25",
|
|
72
|
+
"@xyo-network/payload-builder": "~5.2.25",
|
|
73
|
+
"@xyo-network/payload-model": "~5.2.25",
|
|
74
|
+
"@xyo-network/sentinel-abstract": "~5.2.25",
|
|
75
|
+
"@xyo-network/sentinel-memory": "~5.2.25",
|
|
76
|
+
"@xyo-network/sentinel-model": "~5.2.25",
|
|
77
|
+
"@xyo-network/typechain": "~4.1.1",
|
|
78
|
+
"@xyo-network/wallet": "~5.2.25",
|
|
79
|
+
"@xyo-network/wallet-model": "~5.2.25",
|
|
80
|
+
"@xyo-network/xl1-sdk": "~1.19.4",
|
|
81
81
|
"async-mutex": "~0.5.0",
|
|
82
|
-
"bullmq": "~5.
|
|
82
|
+
"bullmq": "~5.67.1",
|
|
83
83
|
"compression": "~1.8.1",
|
|
84
|
-
"cors": "~2.8.
|
|
84
|
+
"cors": "~2.8.6",
|
|
85
85
|
"ethers": "^6.16.0",
|
|
86
86
|
"express": "~5.2.1",
|
|
87
|
-
"ioredis": "5.9.
|
|
88
|
-
"uuid": "~13.0.0"
|
|
89
|
-
"zod": "~4.2.1"
|
|
87
|
+
"ioredis": "~5.9.2",
|
|
88
|
+
"uuid": "~13.0.0"
|
|
90
89
|
},
|
|
91
90
|
"devDependencies": {
|
|
92
91
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -94,45 +93,49 @@
|
|
|
94
93
|
"@types/cors": "~2.8.19",
|
|
95
94
|
"@types/express": "5.0.6",
|
|
96
95
|
"@types/express-serve-static-core": "~5.1.1",
|
|
97
|
-
"@types/node": "~25.0.
|
|
98
|
-
"@xylabs/mongo": "~5.0.
|
|
99
|
-
"@xylabs/sdk-js": "~5.0.
|
|
100
|
-
"@xylabs/ts-scripts-yarn3": "~7.2
|
|
101
|
-
"@xylabs/tsconfig": "~7.2
|
|
102
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
103
|
-
"@xyo-network/account": "~5.2.
|
|
104
|
-
"@xyo-network/account-model": "~5.2.
|
|
105
|
-
"@xyo-network/archivist-abstract": "~5.2.
|
|
106
|
-
"@xyo-network/archivist-memory": "~5.2.
|
|
107
|
-
"@xyo-network/archivist-model": "~5.2.
|
|
108
|
-
"@xyo-network/archivist-mongodb": "~5.2.
|
|
109
|
-
"@xyo-network/archivist-view": "~5.2.
|
|
96
|
+
"@types/node": "~25.0.10",
|
|
97
|
+
"@xylabs/mongo": "~5.0.64",
|
|
98
|
+
"@xylabs/sdk-js": "~5.0.64",
|
|
99
|
+
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
100
|
+
"@xylabs/tsconfig": "~7.3.2",
|
|
101
|
+
"@xylabs/vitest-extended": "~5.0.64",
|
|
102
|
+
"@xyo-network/account": "~5.2.25",
|
|
103
|
+
"@xyo-network/account-model": "~5.2.25",
|
|
104
|
+
"@xyo-network/archivist-abstract": "~5.2.25",
|
|
105
|
+
"@xyo-network/archivist-memory": "~5.2.25",
|
|
106
|
+
"@xyo-network/archivist-model": "~5.2.25",
|
|
107
|
+
"@xyo-network/archivist-mongodb": "~5.2.25",
|
|
108
|
+
"@xyo-network/archivist-view": "~5.2.25",
|
|
110
109
|
"@xyo-network/bios": "~7.2.0",
|
|
111
110
|
"@xyo-network/bios-model": "~7.2.0",
|
|
112
|
-
"@xyo-network/boundwitness-builder": "~5.2.
|
|
113
|
-
"@xyo-network/chain-protocol": "~1.18.
|
|
114
|
-
"@xyo-network/chain-services": "~1.18.
|
|
115
|
-
"@xyo-network/chain-telemetry": "~1.18.
|
|
116
|
-
"@xyo-network/manifest-wrapper": "~5.2.
|
|
117
|
-
"@xyo-network/module-abstract": "~5.2.
|
|
118
|
-
"@xyo-network/module-abstract-mongodb": "~5.2.
|
|
119
|
-
"@xyo-network/module-model-mongodb": "~5.2.
|
|
120
|
-
"@xyo-network/node-memory": "~5.2.
|
|
121
|
-
"@xyo-network/payload-builder": "~5.2.
|
|
122
|
-
"@xyo-network/sentinel-memory": "~5.2.
|
|
123
|
-
"@xyo-network/wallet": "~5.2.
|
|
124
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
111
|
+
"@xyo-network/boundwitness-builder": "~5.2.25",
|
|
112
|
+
"@xyo-network/chain-protocol": "~1.18.4",
|
|
113
|
+
"@xyo-network/chain-services": "~1.18.4",
|
|
114
|
+
"@xyo-network/chain-telemetry": "~1.18.4",
|
|
115
|
+
"@xyo-network/manifest-wrapper": "~5.2.25",
|
|
116
|
+
"@xyo-network/module-abstract": "~5.2.25",
|
|
117
|
+
"@xyo-network/module-abstract-mongodb": "~5.2.25",
|
|
118
|
+
"@xyo-network/module-model-mongodb": "~5.2.25",
|
|
119
|
+
"@xyo-network/node-memory": "~5.2.25",
|
|
120
|
+
"@xyo-network/payload-builder": "~5.2.25",
|
|
121
|
+
"@xyo-network/sentinel-memory": "~5.2.25",
|
|
122
|
+
"@xyo-network/wallet": "~5.2.25",
|
|
123
|
+
"@xyo-network/xl1-sdk": "~1.19.4",
|
|
125
124
|
"async-mutex": "~0.5.0",
|
|
126
125
|
"dotenv": "~17.2.3",
|
|
127
126
|
"eslint": "^9.39.2",
|
|
128
127
|
"ethers": "^6.16.0",
|
|
129
128
|
"http-status-codes": "~2.3.0",
|
|
130
|
-
"mongodb": "~
|
|
129
|
+
"mongodb": "~7.0.0",
|
|
131
130
|
"nodemon": "~3.1.11",
|
|
132
131
|
"tslib": "~2.8.1",
|
|
133
132
|
"typescript": "~5.9.3",
|
|
134
|
-
"vitest": "~4.0.
|
|
135
|
-
"vitest-mock-extended": "~3.1.0"
|
|
133
|
+
"vitest": "~4.0.18",
|
|
134
|
+
"vitest-mock-extended": "~3.1.0",
|
|
135
|
+
"zod": "~4.3.6"
|
|
136
|
+
},
|
|
137
|
+
"peerDependencies": {
|
|
138
|
+
"zod": "^4"
|
|
136
139
|
},
|
|
137
140
|
"engines": {
|
|
138
141
|
"node": ">=22.3 <23"
|
package/src/config/getGateway.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { isDefined } from '@xylabs/sdk-js'
|
|
|
2
2
|
import { HDWallet } from '@xyo-network/wallet'
|
|
3
3
|
import type {
|
|
4
4
|
Config, RpcSchemaMap, TransportFactory,
|
|
5
|
-
|
|
5
|
+
XyoGatewayRunner,
|
|
6
6
|
} from '@xyo-network/xl1-sdk'
|
|
7
7
|
import {
|
|
8
8
|
buildJsonRpcProviderLocator,
|
|
9
9
|
HttpRpcTransport,
|
|
10
|
-
SimpleXyoGatewayRunner, SimpleXyoSigner,
|
|
10
|
+
SimpleXyoGatewayRunner, SimpleXyoSigner,
|
|
11
|
+
XyoGatewayRunnerMoniker,
|
|
11
12
|
} from '@xyo-network/xl1-sdk'
|
|
12
13
|
|
|
13
14
|
let gatewayInstance: XyoGatewayRunner | undefined
|
|
@@ -17,10 +18,9 @@ export const getGateway = async (config: Config): Promise<XyoGatewayRunner> => {
|
|
|
17
18
|
const { mnemonic, chainRpcApiUrl: endpoint } = config.bridge
|
|
18
19
|
const walletPromise = isDefined(mnemonic) ? HDWallet.fromPhrase(mnemonic) : HDWallet.random()
|
|
19
20
|
const account = await walletPromise
|
|
20
|
-
const signer = await SimpleXyoSigner.create({ account })
|
|
21
21
|
const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(endpoint, schemas)
|
|
22
22
|
const locator = await buildJsonRpcProviderLocator({ transportFactory })
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
23
|
+
locator.register(SimpleXyoSigner.factory<SimpleXyoSigner>(SimpleXyoSigner.dependencies, { account }))
|
|
24
|
+
locator.register(SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies))
|
|
25
|
+
return await locator.getInstance<XyoGatewayRunner>(XyoGatewayRunnerMoniker)
|
|
26
26
|
}
|
package/src/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.ts
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
asAddress, asHex, assertEx, hexFromBigInt, hexToBigInt, isNull, isUndefined, toAddress,
|
|
4
4
|
} from '@xylabs/sdk-js'
|
|
5
5
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
6
|
+
import type { ILiquidityPoolBridge } from '@xyo-network/typechain'
|
|
7
|
+
import { ILiquidityPoolBridge__factory } from '@xyo-network/typechain'
|
|
8
8
|
import type {
|
|
9
9
|
BridgeDestinationObservation, BridgeIntent, BridgeSourceObservation,
|
|
10
10
|
} from '@xyo-network/xl1-sdk'
|
|
@@ -21,7 +21,7 @@ export type LiquidityPoolBridgeObserverParams = BridgeServiceParams & {
|
|
|
21
21
|
/**
|
|
22
22
|
* The address to watch for incoming or outgoing ERC-20 token transfers.
|
|
23
23
|
*/
|
|
24
|
-
bridgeAddress:
|
|
24
|
+
bridgeAddress: Address
|
|
25
25
|
/**
|
|
26
26
|
* An ethers.js WebSocketProvider connected to the Ethereum network to monitor for ERC-20 transfers.
|
|
27
27
|
*/
|
|
@@ -34,12 +34,12 @@ export type LiquidityPoolBridgeObserverParams = BridgeServiceParams & {
|
|
|
34
34
|
|
|
35
35
|
export class LiquidityPoolBridgeObserver extends AbstractBridgeObserverService<LiquidityPoolBridgeObserverParams> {
|
|
36
36
|
moniker = 'LiquidityPoolBridgeObserver'
|
|
37
|
-
protected _bridge:
|
|
37
|
+
protected _bridge: ILiquidityPoolBridge | undefined
|
|
38
38
|
protected _bridgeChainId: Hex | undefined
|
|
39
39
|
protected _bridgeRemoteChainId: Hex | undefined
|
|
40
40
|
protected _bridgeTokenAddress: Address | undefined
|
|
41
41
|
|
|
42
|
-
protected get bridge():
|
|
42
|
+
protected get bridge(): ILiquidityPoolBridge {
|
|
43
43
|
return assertEx(this._bridge, () => new Error('Bridge contract not initialized'))
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -67,7 +67,7 @@ export class LiquidityPoolBridgeObserver extends AbstractBridgeObserverService<L
|
|
|
67
67
|
const { provider, bridgeAddress } = this.params
|
|
68
68
|
|
|
69
69
|
// Connect to the bridge contract
|
|
70
|
-
this._bridge =
|
|
70
|
+
this._bridge = ILiquidityPoolBridge__factory.connect(getAddress(bridgeAddress), provider)
|
|
71
71
|
|
|
72
72
|
// Parse bridge network chain ID
|
|
73
73
|
const network = await provider.getNetwork()
|
|
@@ -108,7 +108,7 @@ export class LiquidityPoolBridgeRelay<TParams extends LiquidityPoolBridgeRelayPa
|
|
|
108
108
|
getAddress(bridgeIntent.srcAddress),
|
|
109
109
|
getAddress(bridgeIntent.destAddress),
|
|
110
110
|
amount,
|
|
111
|
-
|
|
111
|
+
nonce,
|
|
112
112
|
)
|
|
113
113
|
return true
|
|
114
114
|
}
|
|
@@ -204,7 +204,7 @@ export class LiquidityPoolBridgeRelay<TParams extends LiquidityPoolBridgeRelayPa
|
|
|
204
204
|
getAddress(bridgeIntent.srcAddress),
|
|
205
205
|
getAddress(bridgeIntent.destAddress),
|
|
206
206
|
amount,
|
|
207
|
-
|
|
207
|
+
nonce,
|
|
208
208
|
)
|
|
209
209
|
const confirmation = await tx.wait()
|
|
210
210
|
const transactionResponse = await confirmation?.getTransaction()
|
|
@@ -11,14 +11,13 @@ import { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-
|
|
|
11
11
|
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
12
12
|
import type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'
|
|
13
13
|
import { MemorySentinel } from '@xyo-network/sentinel-memory'
|
|
14
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
15
14
|
import type {
|
|
16
|
-
BridgeDestinationObservation, Config, IterableMap, SignedHydratedTransaction,
|
|
15
|
+
BridgeDestinationObservation, Config, IterableMap, ProviderFactoryLocator, SignedHydratedTransaction,
|
|
17
16
|
XyoGatewayRunner,
|
|
18
17
|
} from '@xyo-network/xl1-sdk'
|
|
19
18
|
import {
|
|
20
|
-
hasMongoConfig, mapToMapType,
|
|
21
|
-
|
|
19
|
+
hasMongoConfig, mapToMapType,
|
|
20
|
+
XyoGatewayRunnerMoniker,
|
|
22
21
|
} from '@xyo-network/xl1-sdk'
|
|
23
22
|
import type { Document } from 'mongodb'
|
|
24
23
|
|
|
@@ -30,6 +29,7 @@ import {
|
|
|
30
29
|
|
|
31
30
|
export interface GetLocatorContext {
|
|
32
31
|
config: Config
|
|
32
|
+
locator: ProviderFactoryLocator
|
|
33
33
|
logger?: Logger
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -38,8 +38,10 @@ export interface GetLocatorContext {
|
|
|
38
38
|
* operation of the node (entirely in memory)
|
|
39
39
|
* @returns A locator with the necessary modules registered
|
|
40
40
|
*/
|
|
41
|
-
export const
|
|
42
|
-
const {
|
|
41
|
+
export const getModuleLocator = async (context: GetLocatorContext) => {
|
|
42
|
+
const {
|
|
43
|
+
config, locator, logger,
|
|
44
|
+
} = context
|
|
43
45
|
const { otlpEndpoint } = config.telemetry?.otel ?? {}
|
|
44
46
|
const { path: endpoint = '/metrics', port: port = 9468 } = config.telemetry?.metrics?.scrape ?? {}
|
|
45
47
|
const { traceProvider, meterProvider } = await initTelemetry({
|
|
@@ -54,7 +56,7 @@ export const getLocator = async (context: GetLocatorContext) => {
|
|
|
54
56
|
if (isDefined(logger)) AbstractModule.defaultLogger = logger
|
|
55
57
|
const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : undefined
|
|
56
58
|
|
|
57
|
-
const
|
|
59
|
+
const moduleLocator = new ModuleFactoryLocator()
|
|
58
60
|
// If there's a MongoDB configuration
|
|
59
61
|
const mongoConfig = config.storage?.mongo
|
|
60
62
|
if (hasMongoConfig(mongoConfig)) {
|
|
@@ -69,21 +71,21 @@ export const getLocator = async (context: GetLocatorContext) => {
|
|
|
69
71
|
meterProvider, payloadSdkConfig, statusReporter, traceProvider,
|
|
70
72
|
}
|
|
71
73
|
// Register the MongoDB Archivist as the default
|
|
72
|
-
|
|
74
|
+
moduleLocator.register(MongoDBArchivistV2.factory(params), undefined, true)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
moduleLocator.register(MemoryArchivist.factory({
|
|
76
78
|
traceProvider, meterProvider, statusReporter,
|
|
77
79
|
}))
|
|
78
|
-
|
|
80
|
+
moduleLocator.register(MemorySentinel.factory({
|
|
79
81
|
traceProvider, meterProvider, statusReporter,
|
|
80
82
|
}))
|
|
81
|
-
|
|
83
|
+
moduleLocator.register(ViewArchivist.factory({
|
|
82
84
|
traceProvider, meterProvider, statusReporter,
|
|
83
85
|
}))
|
|
84
86
|
|
|
85
|
-
const gateway = await
|
|
86
|
-
const viewer = assertEx(gateway.
|
|
87
|
+
const gateway = await locator.getInstance<XyoGatewayRunner>(XyoGatewayRunnerMoniker)
|
|
88
|
+
const viewer = assertEx(gateway.connection.viewer, () => 'Gateway viewer is not defined')
|
|
87
89
|
const pendingXl1ToEthXl1BridgeIntentTransactions = await getIterableMap<Hash, SignedHydratedTransaction>(
|
|
88
90
|
config,
|
|
89
91
|
'liquidity_bridge_xl1_to_eth_xl1_pending',
|
|
@@ -102,7 +104,7 @@ export const getLocator = async (context: GetLocatorContext) => {
|
|
|
102
104
|
traceProvider,
|
|
103
105
|
viewer,
|
|
104
106
|
}
|
|
105
|
-
|
|
107
|
+
moduleLocator.register(XL1TransactionCompletionMonitorSentinel.factory(xl1TransactionCompletionMonitorSentinelParams))
|
|
106
108
|
|
|
107
109
|
const completedEthXl1BridgeTransactions = await getIterableMap<Hash, BridgeDestinationObservation>(
|
|
108
110
|
config,
|
|
@@ -120,21 +122,9 @@ export const getLocator = async (context: GetLocatorContext) => {
|
|
|
120
122
|
statusReporter,
|
|
121
123
|
traceProvider,
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
moduleLocator.register(EVMLiquidityBridgeTransactionCompletionMonitorSentinel.factory(evmLiquidityBridgeTransactionCompletionMonitorSentinelParams))
|
|
124
126
|
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const getGateway = async (
|
|
129
|
-
config: Config,
|
|
130
|
-
): Promise<XyoGatewayRunner> => {
|
|
131
|
-
const { mnemonic, chainRpcApiUrl: endpoint } = config.bridge
|
|
132
|
-
const walletPromise = isDefined(mnemonic) ? HDWallet.fromPhrase(mnemonic) : HDWallet.random()
|
|
133
|
-
const account = await walletPromise
|
|
134
|
-
const signer = await SimpleXyoSigner.create({ account })
|
|
135
|
-
const connection = await SimpleXyoConnection.create()
|
|
136
|
-
const gateway = new SimpleXyoGatewayRunner(connection, signer)
|
|
137
|
-
return gateway
|
|
127
|
+
return moduleLocator
|
|
138
128
|
}
|
|
139
129
|
|
|
140
130
|
/**
|
package/src/manifest/getNode.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Logger } from '@xylabs/sdk-js'
|
|
2
2
|
import { ManifestWrapper } from '@xyo-network/manifest-wrapper'
|
|
3
3
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
Config, RpcSchemaMap, TransportFactory,
|
|
6
|
+
} from '@xyo-network/xl1-sdk'
|
|
7
|
+
import { buildJsonRpcProviderLocator, HttpRpcTransport } from '@xyo-network/xl1-sdk'
|
|
5
8
|
|
|
6
|
-
import {
|
|
9
|
+
import { getModuleLocator } from './getModuleLocator.ts'
|
|
7
10
|
import { NodeManifest } from './nodeManifest.ts'
|
|
8
11
|
import { PrivateChildManifests } from './private/index.ts'
|
|
9
12
|
import { PublicChildManifests } from './public/index.ts'
|
|
@@ -21,8 +24,11 @@ export interface GetNodeContext {
|
|
|
21
24
|
*/
|
|
22
25
|
export const getNode = async (context: GetNodeContext) => {
|
|
23
26
|
const { wallet } = context
|
|
24
|
-
const
|
|
25
|
-
const
|
|
27
|
+
const { chainRpcApiUrl: endpoint } = context.config.bridge
|
|
28
|
+
const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(endpoint, schemas)
|
|
29
|
+
const locator = await buildJsonRpcProviderLocator({ transportFactory })
|
|
30
|
+
const moduleLocator = await getModuleLocator({ ...context, locator })
|
|
31
|
+
const wrapper = new ManifestWrapper(NodeManifest, wallet, moduleLocator, PublicChildManifests, PrivateChildManifests)
|
|
26
32
|
const [node, ...childNodes] = await wrapper.loadNodes()
|
|
27
33
|
if (childNodes?.length > 0) {
|
|
28
34
|
await Promise.all(childNodes.map(childNode => node.register(childNode)))
|
|
@@ -5,20 +5,15 @@ import { MongoMap } from '@xyo-network/chain-protocol'
|
|
|
5
5
|
import { initEvmProvider } from '@xyo-network/chain-services'
|
|
6
6
|
import { LiquidityPoolBridge__factory } from '@xyo-network/typechain'
|
|
7
7
|
import { HDWallet } from '@xyo-network/wallet'
|
|
8
|
-
import type {
|
|
9
|
-
Config, IterableMap, RpcSchemaMap, SimpleXyoConnection,
|
|
10
|
-
TransportFactory,
|
|
11
|
-
XyoGatewayRunner,
|
|
12
|
-
} from '@xyo-network/xl1-sdk'
|
|
8
|
+
import type { Config, IterableMap } from '@xyo-network/xl1-sdk'
|
|
13
9
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mapToMapType, SimpleXyoGatewayRunner, SimpleXyoSigner,
|
|
17
|
-
XyoConnectionMoniker,
|
|
10
|
+
hasMongoConfig,
|
|
11
|
+
mapToMapType,
|
|
18
12
|
} from '@xyo-network/xl1-sdk'
|
|
19
13
|
import { getAddress, Wallet } from 'ethers'
|
|
20
14
|
import type { Document } from 'mongodb'
|
|
21
15
|
|
|
16
|
+
import { getGateway } from '../config/index.ts'
|
|
22
17
|
import type {
|
|
23
18
|
EthTxState, IBridgeServiceCollection, Xl1TxState,
|
|
24
19
|
} from '../services/index.ts'
|
|
@@ -60,20 +55,6 @@ export const getServices = async (context: GetServicesContext): Promise<IBridgeS
|
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
const getGateway = async (
|
|
64
|
-
config: Config,
|
|
65
|
-
): Promise<XyoGatewayRunner> => {
|
|
66
|
-
const { mnemonic, chainRpcApiUrl: endpoint } = config.bridge
|
|
67
|
-
const walletPromise = isDefined(mnemonic) ? HDWallet.fromPhrase(mnemonic) : HDWallet.random()
|
|
68
|
-
const account = await walletPromise
|
|
69
|
-
const signer = await SimpleXyoSigner.create({ account })
|
|
70
|
-
const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(endpoint, schemas)
|
|
71
|
-
const locator = await buildJsonRpcProviderLocator({ transportFactory })
|
|
72
|
-
const connection = await locator.getInstance<SimpleXyoConnection>(XyoConnectionMoniker)
|
|
73
|
-
const gateway = new SimpleXyoGatewayRunner(connection, signer)
|
|
74
|
-
return gateway
|
|
75
|
-
}
|
|
76
|
-
|
|
77
58
|
/**
|
|
78
59
|
* Gets an iterable map based on the storage instructions in the config
|
|
79
60
|
* @param config The config containing storage instructions
|
package/src/manifest/index.ts
CHANGED
|
@@ -223,7 +223,7 @@ export class EVMLiquidityBridgeTransactionCompletionMonitorSentinel<
|
|
|
223
223
|
const nonce = await this.wallet.getNonce()
|
|
224
224
|
const srcAddress = getAddress(bridgeIntent.srcAddress)
|
|
225
225
|
const destAddress = getAddress(bridgeIntent.destAddress)
|
|
226
|
-
const tx = await this.bridge.bridgeFromRemote(srcAddress, destAddress, amount,
|
|
226
|
+
const tx = await this.bridge.bridgeFromRemote(srcAddress, destAddress, amount, nonce)
|
|
227
227
|
const confirmation = await tx.wait()
|
|
228
228
|
const transactionResponse = await confirmation?.getTransaction()
|
|
229
229
|
const destConfirmation = asHex(transactionResponse?.hash ?? '', true)
|
|
@@ -30,7 +30,7 @@ export const createWorker = (connection: Redis) => {
|
|
|
30
30
|
const amount = hexToBigInt(bridgeIntent.destAmount)
|
|
31
31
|
const srcAddress = getAddress(bridgeIntent.srcAddress)
|
|
32
32
|
const destAddress = getAddress(bridgeIntent.destAddress)
|
|
33
|
-
const preparedTx = await bridge.getFunction('bridgeFromRemote').populateTransaction(srcAddress, destAddress, amount)
|
|
33
|
+
const preparedTx = await bridge.getFunction('bridgeFromRemote').populateTransaction(srcAddress, destAddress, amount, 0n)
|
|
34
34
|
await job.log(`[${hash}] built ETH transaction`)
|
|
35
35
|
await job.log(`[${hash}] storing ETH preparedTx`)
|
|
36
36
|
await stateMap.set(hash, { preparedTx })
|
|
@@ -27,7 +27,7 @@ const createWorker = (connection: Redis) => {
|
|
|
27
27
|
// Get the hash of the transaction
|
|
28
28
|
const hash = await PayloadBuilder.hash(tx[0])
|
|
29
29
|
// Get the state of the transaction
|
|
30
|
-
const viewer = assertEx(gateway.
|
|
30
|
+
const viewer = assertEx(gateway.connection.viewer, () => `[${hash}] viewer not defined on gateway`)
|
|
31
31
|
const state = assertEx(await stateMap.get(hash), () => `[${hash}] state not found`)
|
|
32
32
|
|
|
33
33
|
// Check for transaction inclusion on chain
|
|
@@ -41,7 +41,7 @@ export const makeBridgeToRemoteEstimateRoute = (config: Config): RouteDefinition
|
|
|
41
41
|
|
|
42
42
|
// Use viewer to get current block
|
|
43
43
|
const gateway = await getGateway(config)
|
|
44
|
-
const viewer = assertEx(gateway.
|
|
44
|
+
const viewer = assertEx(gateway.connection.viewer, () => new Error('Viewer not available on gateway connection'))
|
|
45
45
|
const currentBlockNumber = await viewer.currentBlockNumber()
|
|
46
46
|
// Calculate nbf/exp
|
|
47
47
|
const nbf = toXL1BlockNumber(currentBlockNumber, true)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AASlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAI1E,OAAO,KAAK,EACoB,MAAM,EAErC,MAAM,sBAAsB,CAAA;AAa7B,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,iBAAiB,kCAqF1D,CAAA"}
|