@xyo-network/chain-bridge 1.19.14 → 1.19.16
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 +3 -2
- package/dist/node/BridgeActor.d.ts.map +1 -1
- package/dist/node/config/getBridgeEscrowAddress.d.ts +3 -3
- package/dist/node/config/getBridgeEscrowAddress.d.ts.map +1 -1
- package/dist/node/config/getBridgeFeesAddress.d.ts +3 -3
- package/dist/node/config/getBridgeFeesAddress.d.ts.map +1 -1
- package/dist/node/config/getBridgeSettings.d.ts +2 -2
- package/dist/node/config/getBridgeSettings.d.ts.map +1 -1
- package/dist/node/config/getBridgeWalletAccount.d.ts +3 -3
- package/dist/node/config/getBridgeWalletAccount.d.ts.map +1 -1
- package/dist/node/config/getFeeStructure.d.ts +2 -2
- package/dist/node/config/getFeeStructure.d.ts.map +1 -1
- package/dist/node/config/getGateway.d.ts +3 -2
- package/dist/node/config/getGateway.d.ts.map +1 -1
- package/dist/node/config/getMaxBridgeAmount.d.ts +2 -2
- package/dist/node/config/getMaxBridgeAmount.d.ts.map +1 -1
- package/dist/node/config/getMinBridgeAmount.d.ts +2 -2
- package/dist/node/config/getMinBridgeAmount.d.ts.map +1 -1
- package/dist/node/config/getRemoteChainId.d.ts +3 -2
- package/dist/node/config/getRemoteChainId.d.ts.map +1 -1
- package/dist/node/config/getRemoteTokenAddress.d.ts +2 -2
- package/dist/node/config/getRemoteTokenAddress.d.ts.map +1 -1
- package/dist/node/config/getTransferAddresses.d.ts +2 -2
- package/dist/node/config/getTransferAddresses.d.ts.map +1 -1
- package/dist/node/config/getXl1ChainId.d.ts +3 -2
- package/dist/node/config/getXl1ChainId.d.ts.map +1 -1
- package/dist/node/config/getXl1TokenAddress.d.ts +2 -2
- package/dist/node/config/getXl1TokenAddress.d.ts.map +1 -1
- package/dist/node/index.mjs +178 -624
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/interface/service/Relay/LiquidityPoolBridgeRelay/LiquidityPoolBridgeRelay.d.ts +1 -1
- package/dist/node/interface/service/Relay/LiquidityPoolBridgeRelay/LiquidityPoolBridgeRelay.d.ts.map +1 -1
- package/dist/node/modules/EVMLiquidityBridgeTransactionCompletionMonitorSentinel/EVMLiquidityBridgeTransactionCompletionMonitorSentinel.d.ts +1 -2
- package/dist/node/modules/EVMLiquidityBridgeTransactionCompletionMonitorSentinel/EVMLiquidityBridgeTransactionCompletionMonitorSentinel.d.ts.map +1 -1
- package/dist/node/modules/XL1TransactionCompletionMonitorSentinel/XL1TransactionCompletionMonitorSentinel.d.ts +1 -2
- package/dist/node/modules/XL1TransactionCompletionMonitorSentinel/XL1TransactionCompletionMonitorSentinel.d.ts.map +1 -1
- package/dist/node/queue/connection.d.ts +2 -2
- package/dist/node/queue/connection.d.ts.map +1 -1
- package/dist/node/queue/workers/EthTransactionPreparation.d.ts.map +1 -1
- package/dist/node/queue/workers/util/index.d.ts +2 -0
- package/dist/node/queue/workers/util/index.d.ts.map +1 -1
- package/dist/node/queue/workers/util/validateSufficientAllowance.d.ts +19 -0
- package/dist/node/queue/workers/util/validateSufficientAllowance.d.ts.map +1 -0
- package/dist/node/queue/workers/util/validateSufficientBalance.d.ts +19 -0
- package/dist/node/queue/workers/util/validateSufficientBalance.d.ts.map +1 -0
- package/dist/node/server/addFlowProducer.d.ts +2 -2
- package/dist/node/server/addFlowProducer.d.ts.map +1 -1
- package/dist/node/server/addWorkers.d.ts +2 -2
- package/dist/node/server/addWorkers.d.ts.map +1 -1
- package/dist/node/server/app.d.ts +3 -3
- package/dist/node/server/app.d.ts.map +1 -1
- package/dist/node/server/index.d.ts +0 -2
- package/dist/node/server/index.d.ts.map +1 -1
- package/dist/node/server/routes/addRoutes.d.ts +3 -2
- package/dist/node/server/routes/addRoutes.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/addBridgeRoutes.d.ts +3 -2
- package/dist/node/server/routes/bridge/addBridgeRoutes.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/getRouteDefinitions.d.ts +3 -2
- package/dist/node/server/routes/bridge/routeDefinitions/getRouteDefinitions.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.d.ts +2 -2
- package/dist/node/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeConfig.d.ts +2 -2
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeConfig.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeFromRemoteStatus.d.ts +2 -2
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeFromRemoteStatus.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemote.d.ts +3 -3
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemote.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts +4 -3
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteStatus.d.ts +2 -2
- package/dist/node/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteStatus.d.ts.map +1 -1
- package/dist/node/server/server.d.ts +3 -10
- package/dist/node/server/server.d.ts.map +1 -1
- package/dist/node/{manifest → services}/getIterableMap.d.ts +2 -2
- package/dist/node/services/getIterableMap.d.ts.map +1 -0
- package/dist/node/services/getServices.d.ts +9 -0
- package/dist/node/services/getServices.d.ts.map +1 -0
- package/dist/node/services/index.d.ts +1 -0
- package/dist/node/services/index.d.ts.map +1 -1
- package/dist/node/util/BridgeFees.d.ts +7 -0
- package/dist/node/util/BridgeFees.d.ts.map +1 -0
- package/dist/node/util/bridgeFeesAsBigInt.d.ts +7 -0
- package/dist/node/util/bridgeFeesAsBigInt.d.ts.map +1 -0
- package/dist/node/util/calculateBridgeFees.d.ts +4 -8
- package/dist/node/util/calculateBridgeFees.d.ts.map +1 -1
- package/dist/node/util/createBridgeTransfer.d.ts +14 -0
- package/dist/node/util/createBridgeTransfer.d.ts.map +1 -0
- package/dist/node/util/generateBridgeEstimate.d.ts +3 -2
- package/dist/node/util/generateBridgeEstimate.d.ts.map +1 -1
- package/dist/node/util/index.d.ts +3 -0
- package/dist/node/util/index.d.ts.map +1 -1
- package/dist/node/util/validateBridgeEstimate.d.ts +3 -2
- package/dist/node/util/validateBridgeEstimate.d.ts.map +1 -1
- package/dist/node/util/validateBridgeEstimateExact.d.ts +3 -2
- package/dist/node/util/validateBridgeEstimateExact.d.ts.map +1 -1
- package/dist/node/util/validateBridgeTransaction.d.ts +3 -2
- package/dist/node/util/validateBridgeTransaction.d.ts.map +1 -1
- package/package.json +46 -59
- package/src/BridgeActor.ts +3 -3
- package/src/config/getBridgeEscrowAddress.ts +5 -5
- package/src/config/getBridgeFeesAddress.ts +5 -5
- package/src/config/getBridgeSettings.ts +2 -2
- package/src/config/getBridgeWalletAccount.ts +7 -4
- package/src/config/getFeeStructure.ts +3 -3
- package/src/config/getGateway.ts +5 -4
- package/src/config/getMaxBridgeAmount.ts +3 -3
- package/src/config/getMinBridgeAmount.ts +3 -3
- package/src/config/getRemoteChainId.ts +4 -3
- package/src/config/getRemoteTokenAddress.ts +3 -3
- package/src/config/getTransferAddresses.ts +2 -2
- package/src/config/getXl1ChainId.ts +4 -3
- package/src/config/getXl1TokenAddress.ts +3 -3
- package/src/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.ts +1 -1
- package/src/interface/service/Relay/LiquidityPoolBridgeRelay/LiquidityPoolBridgeRelay.ts +1 -1
- package/src/interface/util/getBridgeIntentIdentifier.ts +1 -1
- package/src/modules/EVMLiquidityBridgeTransactionCompletionMonitorSentinel/EVMLiquidityBridgeTransactionCompletionMonitorSentinel.ts +2 -3
- package/src/modules/XL1TransactionCompletionMonitorSentinel/XL1TransactionCompletionMonitorSentinel.ts +2 -3
- package/src/queue/connection.ts +3 -3
- package/src/queue/workers/EthTransactionMonitor.ts +1 -1
- package/src/queue/workers/EthTransactionPreparation.ts +14 -4
- package/src/queue/workers/EthTransactionSubmission.ts +1 -1
- package/src/queue/workers/Xl1TransactionMonitor.ts +1 -1
- package/src/queue/workers/Xl1TransactionPreparation.ts +1 -1
- package/src/queue/workers/Xl1TransactionSubmission.ts +1 -1
- package/src/queue/workers/util/index.ts +2 -0
- package/src/queue/workers/util/submitEthTransaction.ts +1 -1
- package/src/queue/workers/util/validateSufficientAllowance.ts +38 -0
- package/src/queue/workers/util/validateSufficientBalance.ts +37 -0
- package/src/server/addFlowProducer.ts +2 -2
- package/src/server/addWorkers.ts +2 -2
- package/src/server/app.ts +3 -4
- package/src/server/index.ts +2 -2
- package/src/server/routes/addRoutes.ts +3 -2
- package/src/server/routes/bridge/addBridgeRoutes.ts +3 -2
- package/src/server/routes/bridge/routeDefinitions/getRouteDefinitions.ts +3 -2
- package/src/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.ts +3 -2
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeConfig.ts +3 -2
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeFromRemoteStatus.ts +4 -3
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemote.ts +6 -4
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteEstimate.ts +4 -3
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteStatus.ts +4 -5
- package/src/server/server.ts +7 -48
- package/src/{manifest → services}/getIterableMap.ts +2 -2
- package/src/{manifest → services}/getServices.ts +9 -13
- package/src/services/index.ts +1 -0
- package/src/util/BridgeFees.ts +7 -0
- package/src/util/bridgeFeesAsBigInt.ts +15 -0
- package/src/util/calculateBridgeFees.ts +5 -11
- package/src/util/createBridgeTransfer.ts +31 -0
- package/src/util/generateBridgeEstimate.ts +9 -17
- package/src/util/index.ts +3 -0
- package/src/util/validateBridgeEstimate.ts +4 -5
- package/src/util/validateBridgeEstimateExact.ts +4 -5
- package/src/util/validateBridgeTransaction.ts +4 -3
- package/dist/node/indexers/index.d.ts +0 -2
- package/dist/node/indexers/index.d.ts.map +0 -1
- package/dist/node/manifest/getIterableMap.d.ts.map +0 -1
- package/dist/node/manifest/getModuleLocator.d.ts +0 -15
- package/dist/node/manifest/getModuleLocator.d.ts.map +0 -1
- package/dist/node/manifest/getNode.d.ts +0 -15
- package/dist/node/manifest/getNode.d.ts.map +0 -1
- package/dist/node/manifest/getServices.d.ts +0 -13
- package/dist/node/manifest/getServices.d.ts.map +0 -1
- package/dist/node/manifest/index.d.ts +0 -7
- package/dist/node/manifest/index.d.ts.map +0 -1
- package/dist/node/manifest/nodeManifest.d.ts +0 -6
- package/dist/node/manifest/nodeManifest.d.ts.map +0 -1
- package/dist/node/manifest/private/index.d.ts +0 -5
- package/dist/node/manifest/private/index.d.ts.map +0 -1
- package/dist/node/manifest/public/index.d.ts +0 -14
- package/dist/node/manifest/public/index.d.ts.map +0 -1
- package/dist/node/server/routes/dataLake/addDataLakeRoutes.d.ts +0 -3
- package/dist/node/server/routes/dataLake/addDataLakeRoutes.d.ts.map +0 -1
- package/dist/node/server/routes/dataLake/archivistMiddleware.d.ts +0 -10
- package/dist/node/server/routes/dataLake/archivistMiddleware.d.ts.map +0 -1
- package/dist/node/server/routes/dataLake/index.d.ts +0 -2
- package/dist/node/server/routes/dataLake/index.d.ts.map +0 -1
- package/src/indexers/index.ts +0 -1
- package/src/manifest/getModuleLocator.ts +0 -153
- package/src/manifest/getNode.ts +0 -40
- package/src/manifest/index.ts +0 -6
- package/src/manifest/node.json +0 -17
- package/src/manifest/nodeManifest.ts +0 -8
- package/src/manifest/private/index.ts +0 -4
- package/src/manifest/public/Ethereum.json +0 -48
- package/src/manifest/public/XL1.json +0 -48
- package/src/manifest/public/index.ts +0 -23
- package/src/server/routes/dataLake/addDataLakeRoutes.ts +0 -9
- package/src/server/routes/dataLake/archivistMiddleware.ts +0 -85
- package/src/server/routes/dataLake/index.ts +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration';
|
|
2
|
+
import type { BridgeIntent, Transfer } from '@xyo-network/xl1-sdk';
|
|
2
3
|
/**
|
|
3
4
|
* Validates a bridge estimate by checking the intent and transfer against the provided configuration. This method
|
|
4
5
|
* exists to allow for "at least" validation of a bridge estimates in case we want to allow for some flexibility in
|
|
@@ -8,5 +9,5 @@ import type { BridgeIntent, Config, Transfer } from '@xyo-network/xl1-sdk';
|
|
|
8
9
|
* @param config The Config
|
|
9
10
|
* @returns True if the bridge estimate satisfies bridging conditions, false otherwise.
|
|
10
11
|
*/
|
|
11
|
-
export declare const validateBridgeEstimate: (intent: BridgeIntent, transfer: Transfer, config:
|
|
12
|
+
export declare const validateBridgeEstimate: (intent: BridgeIntent, transfer: Transfer, config: BridgeConfig) => Promise<boolean>;
|
|
12
13
|
//# sourceMappingURL=validateBridgeEstimate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateBridgeEstimate.d.ts","sourceRoot":"","sources":["../../../src/util/validateBridgeEstimate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"validateBridgeEstimate.d.ts","sourceRoot":"","sources":["../../../src/util/validateBridgeEstimate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAKlE;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,YAAY,EACpB,UAAU,QAAQ,EAClB,QAAQ,YAAY,KACnB,OAAO,CAAC,OAAO,CAuCjB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration';
|
|
2
|
+
import type { BridgeIntent, Transfer } from '@xyo-network/xl1-sdk';
|
|
2
3
|
/**
|
|
3
4
|
* Validates a bridge estimate by checking the intent and transfer against the provided configuration. This method
|
|
4
5
|
* only returns true if the bridge estimate matches exactly.
|
|
@@ -7,5 +8,5 @@ import type { BridgeIntent, Config, Transfer } from '@xyo-network/xl1-sdk';
|
|
|
7
8
|
* @param config The Config
|
|
8
9
|
* @returns True if the bridge estimate satisfies bridging conditions, false otherwise.
|
|
9
10
|
*/
|
|
10
|
-
export declare const validateBridgeEstimateExact: (intent: BridgeIntent, transfer: Transfer, config:
|
|
11
|
+
export declare const validateBridgeEstimateExact: (intent: BridgeIntent, transfer: Transfer, config: BridgeConfig) => Promise<boolean>;
|
|
11
12
|
//# sourceMappingURL=validateBridgeEstimateExact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateBridgeEstimateExact.d.ts","sourceRoot":"","sources":["../../../src/util/validateBridgeEstimateExact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateBridgeEstimateExact.d.ts","sourceRoot":"","sources":["../../../src/util/validateBridgeEstimateExact.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAIlE;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,YAAY,EACpB,UAAU,QAAQ,EAClB,QAAQ,YAAY,KACnB,OAAO,CAAC,OAAO,CAcjB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration';
|
|
2
|
+
import type { BridgeIntent, TransactionBoundWitness, Transfer } from '@xyo-network/xl1-sdk';
|
|
2
3
|
/**
|
|
3
4
|
* Validates a bridge estimate by checking the intent and transfer against the provided configuration. This method
|
|
4
5
|
* exists to allow for "at least" validation of a bridge estimates in case we want to allow for some flexibility in
|
|
@@ -10,5 +11,5 @@ import type { BridgeIntent, Config, TransactionBoundWitness, Transfer } from '@x
|
|
|
10
11
|
* @param config The Config
|
|
11
12
|
* @returns True if the bridge estimate satisfies bridging conditions, false otherwise.
|
|
12
13
|
*/
|
|
13
|
-
export declare const validateBridgeTransaction: (signedTxBw: TransactionBoundWitness, intent: BridgeIntent, transfer: Transfer, config:
|
|
14
|
+
export declare const validateBridgeTransaction: (signedTxBw: TransactionBoundWitness, intent: BridgeIntent, transfer: Transfer, config: BridgeConfig) => Promise<boolean>;
|
|
14
15
|
//# sourceMappingURL=validateBridgeTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateBridgeTransaction.d.ts","sourceRoot":"","sources":["../../../src/util/validateBridgeTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateBridgeTransaction.d.ts","sourceRoot":"","sources":["../../../src/util/validateBridgeTransaction.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAEpE,OAAO,KAAK,EACV,YAAY,EACZ,uBAAuB,EAAE,QAAQ,EAClC,MAAM,sBAAsB,CAAA;AAI7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GACpC,YAAY,uBAAuB,EACnC,QAAQ,YAAY,EACpB,UAAU,QAAQ,EAClB,QAAQ,YAAY,KACnB,OAAO,CAAC,OAAO,CAgBjB,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.16",
|
|
4
4
|
"description": "XYO Layer One Bridge",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -49,43 +49,30 @@
|
|
|
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/
|
|
59
|
-
"@xyo-network/
|
|
60
|
-
"@xyo-network/
|
|
61
|
-
"@xyo-network/
|
|
62
|
-
"@xyo-network/
|
|
63
|
-
"@xyo-network/
|
|
64
|
-
"@xyo-network/
|
|
65
|
-
"@xyo-network/chain-services": "~1.19.14",
|
|
66
|
-
"@xyo-network/chain-telemetry": "~1.19.14",
|
|
67
|
-
"@xyo-network/manifest-model": "~5.3.2",
|
|
68
|
-
"@xyo-network/manifest-wrapper": "~5.3.2",
|
|
69
|
-
"@xyo-network/module-abstract": "~5.3.2",
|
|
70
|
-
"@xyo-network/module-factory-locator": "~5.3.2",
|
|
71
|
-
"@xyo-network/module-model": "~5.3.2",
|
|
72
|
-
"@xyo-network/node-model": "~5.3.2",
|
|
73
|
-
"@xyo-network/payload-builder": "~5.3.2",
|
|
74
|
-
"@xyo-network/payload-model": "~5.3.2",
|
|
75
|
-
"@xyo-network/sentinel-abstract": "~5.3.2",
|
|
76
|
-
"@xyo-network/sentinel-memory": "~5.3.2",
|
|
77
|
-
"@xyo-network/sentinel-model": "~5.3.2",
|
|
52
|
+
"@opentelemetry/instrumentation": "~0.212.0",
|
|
53
|
+
"@opentelemetry/instrumentation-express": "~0.60.0",
|
|
54
|
+
"@opentelemetry/instrumentation-http": "~0.212.0",
|
|
55
|
+
"@xylabs/express": "~5.0.80",
|
|
56
|
+
"@xylabs/mongo": "~5.0.80",
|
|
57
|
+
"@xylabs/sdk-js": "~5.0.80",
|
|
58
|
+
"@xyo-network/boundwitness-validator": "~5.3.7",
|
|
59
|
+
"@xyo-network/chain-orchestration": "~1.19.16",
|
|
60
|
+
"@xyo-network/chain-protocol": "~1.19.16",
|
|
61
|
+
"@xyo-network/chain-services": "~1.19.16",
|
|
62
|
+
"@xyo-network/sdk-js": "~5.3.7",
|
|
63
|
+
"@xyo-network/sentinel-abstract": "~5.3.7",
|
|
64
|
+
"@xyo-network/sentinel-model": "~5.3.7",
|
|
78
65
|
"@xyo-network/typechain": "~4.1.1",
|
|
79
|
-
"@xyo-network/wallet": "~5.3.
|
|
80
|
-
"@xyo-network/wallet-model": "~5.3.
|
|
81
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
66
|
+
"@xyo-network/wallet": "~5.3.7",
|
|
67
|
+
"@xyo-network/wallet-model": "~5.3.7",
|
|
68
|
+
"@xyo-network/xl1-sdk": "~1.24.24",
|
|
82
69
|
"async-mutex": "~0.5.0",
|
|
83
|
-
"bullmq": "~5.
|
|
70
|
+
"bullmq": "~5.69.3",
|
|
84
71
|
"compression": "~1.8.1",
|
|
85
72
|
"cors": "~2.8.6",
|
|
86
73
|
"ethers": "^6.16.0",
|
|
87
74
|
"express": "~5.2.1",
|
|
88
|
-
"ioredis": "
|
|
75
|
+
"ioredis": "5.9.2",
|
|
89
76
|
"uuid": "~13.0.0",
|
|
90
77
|
"yargs-parser": "~22.0.0"
|
|
91
78
|
},
|
|
@@ -95,43 +82,42 @@
|
|
|
95
82
|
"@types/cors": "~2.8.19",
|
|
96
83
|
"@types/express": "5.0.6",
|
|
97
84
|
"@types/express-serve-static-core": "~5.1.1",
|
|
98
|
-
"@types/node": "~25.
|
|
99
|
-
"@xylabs/axios": "~5.0.
|
|
100
|
-
"@xylabs/mongo": "~5.0.
|
|
101
|
-
"@xylabs/sdk-js": "~5.0.
|
|
85
|
+
"@types/node": "~25.3.0",
|
|
86
|
+
"@xylabs/axios": "~5.0.80",
|
|
87
|
+
"@xylabs/mongo": "~5.0.80",
|
|
88
|
+
"@xylabs/sdk-js": "~5.0.80",
|
|
102
89
|
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
103
90
|
"@xylabs/tsconfig": "~7.3.2",
|
|
104
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
105
|
-
"@xyo-network/account": "~5.3.
|
|
106
|
-
"@xyo-network/account-model": "~5.3.
|
|
107
|
-
"@xyo-network/archivist-abstract": "~5.3.
|
|
108
|
-
"@xyo-network/archivist-memory": "~5.3.
|
|
109
|
-
"@xyo-network/archivist-
|
|
110
|
-
"@xyo-network/archivist-
|
|
111
|
-
"@xyo-network/archivist-view": "~5.3.2",
|
|
91
|
+
"@xylabs/vitest-extended": "~5.0.80",
|
|
92
|
+
"@xyo-network/account": "~5.3.7",
|
|
93
|
+
"@xyo-network/account-model": "~5.3.7",
|
|
94
|
+
"@xyo-network/archivist-abstract": "~5.3.7",
|
|
95
|
+
"@xyo-network/archivist-memory": "~5.3.7",
|
|
96
|
+
"@xyo-network/archivist-mongodb": "~5.3.7",
|
|
97
|
+
"@xyo-network/archivist-view": "~5.3.7",
|
|
112
98
|
"@xyo-network/bios": "~7.2.1",
|
|
113
99
|
"@xyo-network/bios-model": "~7.2.1",
|
|
114
|
-
"@xyo-network/boundwitness-builder": "~5.3.
|
|
115
|
-
"@xyo-network/chain-protocol": "~1.19.
|
|
116
|
-
"@xyo-network/chain-services": "~1.19.
|
|
117
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
118
|
-
"@xyo-network/manifest-wrapper": "~5.3.
|
|
119
|
-
"@xyo-network/module-abstract": "~5.3.
|
|
120
|
-
"@xyo-network/module-abstract-mongodb": "~5.3.
|
|
121
|
-
"@xyo-network/
|
|
122
|
-
"@xyo-network/
|
|
123
|
-
"@xyo-network/
|
|
124
|
-
"@xyo-network/sentinel-memory": "~5.3.
|
|
125
|
-
"@xyo-network/wallet": "~5.3.
|
|
126
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
100
|
+
"@xyo-network/boundwitness-builder": "~5.3.7",
|
|
101
|
+
"@xyo-network/chain-protocol": "~1.19.16",
|
|
102
|
+
"@xyo-network/chain-services": "~1.19.16",
|
|
103
|
+
"@xyo-network/chain-telemetry": "~1.19.16",
|
|
104
|
+
"@xyo-network/manifest-wrapper": "~5.3.7",
|
|
105
|
+
"@xyo-network/module-abstract": "~5.3.7",
|
|
106
|
+
"@xyo-network/module-abstract-mongodb": "~5.3.7",
|
|
107
|
+
"@xyo-network/node-memory": "~5.3.7",
|
|
108
|
+
"@xyo-network/payload-builder": "~5.3.7",
|
|
109
|
+
"@xyo-network/sdk-js": "~5.3.7",
|
|
110
|
+
"@xyo-network/sentinel-memory": "~5.3.7",
|
|
111
|
+
"@xyo-network/wallet": "~5.3.7",
|
|
112
|
+
"@xyo-network/xl1-sdk": "~1.24.24",
|
|
127
113
|
"async-mutex": "~0.5.0",
|
|
128
114
|
"axios": "~1.13.5",
|
|
129
|
-
"dotenv": "~17.
|
|
115
|
+
"dotenv": "~17.3.1",
|
|
130
116
|
"eslint": "^9.39.2",
|
|
131
117
|
"ethers": "^6.16.0",
|
|
132
118
|
"http-status-codes": "~2.3.0",
|
|
133
119
|
"mongodb": "~7.1.0",
|
|
134
|
-
"nodemon": "~3.1.
|
|
120
|
+
"nodemon": "~3.1.13",
|
|
135
121
|
"tslib": "~2.8.1",
|
|
136
122
|
"typescript": "~5.9.3",
|
|
137
123
|
"vitest": "~4.0.18",
|
|
@@ -139,6 +125,7 @@
|
|
|
139
125
|
"zod": "~4.3.6"
|
|
140
126
|
},
|
|
141
127
|
"peerDependencies": {
|
|
128
|
+
"@xyo-network/sdk-js": "~5.3.2",
|
|
142
129
|
"zod": "^4"
|
|
143
130
|
},
|
|
144
131
|
"engines": {
|
package/src/BridgeActor.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Server } from 'node:http'
|
|
2
2
|
|
|
3
3
|
import { creatable } from '@xylabs/sdk-js'
|
|
4
|
+
import { asBridgeConfigContext, BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
4
5
|
import {
|
|
5
6
|
ActorParamsV3,
|
|
6
7
|
ActorV3,
|
|
7
|
-
Config,
|
|
8
8
|
XyoGatewayRunner,
|
|
9
9
|
XyoGatewayRunnerMoniker,
|
|
10
10
|
} from '@xyo-network/xl1-sdk'
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import { getServer } from './server/index.ts'
|
|
13
13
|
|
|
14
14
|
export type BridgeActorParams = ActorParamsV3<{
|
|
15
|
-
config:
|
|
15
|
+
config: BridgeConfig
|
|
16
16
|
}>
|
|
17
17
|
|
|
18
18
|
@creatable()
|
|
@@ -41,7 +41,7 @@ export class BridgeActor extends ActorV3<BridgeActorParams> {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
private async startServer() {
|
|
44
|
-
this.server = await getServer(this.context, this._gatewayRunner)
|
|
44
|
+
this.server = await getServer(asBridgeConfigContext(this.context, true), this._gatewayRunner)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
private stopServer() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/sdk-js'
|
|
2
2
|
import { asAddress, assertEx } from '@xylabs/sdk-js'
|
|
3
|
-
import type {
|
|
3
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
4
4
|
|
|
5
|
-
export const tryGetBridgeEscrowAddress = (config:
|
|
6
|
-
const address = asAddress(config.
|
|
5
|
+
export const tryGetBridgeEscrowAddress = (config: BridgeConfig): Address | undefined => {
|
|
6
|
+
const address = asAddress(config.escrowAddress)
|
|
7
7
|
return address
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const getBridgeEscrowAddress = (config:
|
|
11
|
-
const address = assertEx(tryGetBridgeEscrowAddress(config), () => `Invalid bridge escrow address: ${config.
|
|
10
|
+
export const getBridgeEscrowAddress = (config: BridgeConfig): Address => {
|
|
11
|
+
const address = assertEx(tryGetBridgeEscrowAddress(config), () => `Invalid bridge escrow address: ${config.escrowAddress}`)
|
|
12
12
|
return address
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/sdk-js'
|
|
2
2
|
import { asAddress, assertEx } from '@xylabs/sdk-js'
|
|
3
|
-
import type {
|
|
3
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
4
4
|
|
|
5
|
-
export const tryGetBridgeFeesAddress = (config:
|
|
6
|
-
const address = asAddress(config.
|
|
5
|
+
export const tryGetBridgeFeesAddress = (config: BridgeConfig): Address | undefined => {
|
|
6
|
+
const address = asAddress(config.feesAddress)
|
|
7
7
|
return address
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const getBridgeFeesAddress = (config:
|
|
11
|
-
const address = assertEx(tryGetBridgeFeesAddress(config), () => `Invalid bridge fees address: ${config.
|
|
10
|
+
export const getBridgeFeesAddress = (config: BridgeConfig): Address => {
|
|
11
|
+
const address = assertEx(tryGetBridgeFeesAddress(config), () => `Invalid bridge fees address: ${config.feesAddress}`)
|
|
12
12
|
return address
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BridgeConfig, BridgeSettings } from '@xyo-network/chain-orchestration'
|
|
2
2
|
|
|
3
3
|
import { getFeeStructure } from './getFeeStructure.ts'
|
|
4
4
|
import { getMaxBridgeAmount } from './getMaxBridgeAmount.ts'
|
|
@@ -9,7 +9,7 @@ import { getTransferAddresses } from './getTransferAddresses.ts'
|
|
|
9
9
|
import { getXl1ChainId } from './getXl1ChainId.ts'
|
|
10
10
|
import { getXl1TokenAddress } from './getXl1TokenAddress.ts'
|
|
11
11
|
|
|
12
|
-
export const getBridgeSettings = async (config:
|
|
12
|
+
export const getBridgeSettings = async (config: BridgeConfig): Promise<BridgeSettings> => {
|
|
13
13
|
const { feeFixed, feeRateBasisPoints } = getFeeStructure(config)
|
|
14
14
|
const { feesAddress, escrowAddress } = await getTransferAddresses(config)
|
|
15
15
|
const maxBridgeAmount = getMaxBridgeAmount(config)
|
|
@@ -2,14 +2,14 @@ import type { Address, Promisable } from '@xylabs/sdk-js'
|
|
|
2
2
|
import { isDefined, isUndefined } from '@xylabs/sdk-js'
|
|
3
3
|
import { HDWallet } from '@xyo-network/wallet'
|
|
4
4
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
5
|
-
import type {
|
|
5
|
+
import type { ActorConfig } from '@xyo-network/xl1-sdk'
|
|
6
6
|
import { ADDRESS_INDEX, generateXyoBaseWalletFromPhrase } from '@xyo-network/xl1-sdk'
|
|
7
7
|
|
|
8
8
|
let accountServiceSingleton: Promisable<WalletInstance> | undefined
|
|
9
9
|
|
|
10
|
-
export const getBridgeWalletAccount = async (config:
|
|
10
|
+
export const getBridgeWalletAccount = async (config: ActorConfig): Promise<WalletInstance> => {
|
|
11
11
|
if (accountServiceSingleton) return accountServiceSingleton
|
|
12
|
-
let walletPhrase = config.
|
|
12
|
+
let walletPhrase = config.mnemonic
|
|
13
13
|
if (isUndefined(walletPhrase)) {
|
|
14
14
|
console.log('[Bridge] No wallet mnemonic specified!')
|
|
15
15
|
const randomMnemonic = HDWallet.generateMnemonic()
|
|
@@ -26,7 +26,10 @@ ${randomMnemonic}
|
|
|
26
26
|
return accountServiceSingleton
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const getAddressOrBridgeWalletAccountAddress = async (
|
|
29
|
+
export const getAddressOrBridgeWalletAccountAddress = async (
|
|
30
|
+
getConfigAccount: (config: ActorConfig) => Address | undefined,
|
|
31
|
+
config: ActorConfig,
|
|
32
|
+
): Promise<Address> => {
|
|
30
33
|
const address = getConfigAccount(config)
|
|
31
34
|
if (isDefined(address)) return address
|
|
32
35
|
const walletAccount = await getBridgeWalletAccount(config)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
2
2
|
|
|
3
3
|
import type { FeeStructure } from '../util/index.ts'
|
|
4
4
|
|
|
5
|
-
export const getFeeStructure = (config:
|
|
6
|
-
const { feeFixed, feeRateBasisPoints } = config
|
|
5
|
+
export const getFeeStructure = (config: BridgeConfig): FeeStructure => {
|
|
6
|
+
const { feeFixed, feeRateBasisPoints } = config
|
|
7
7
|
return { feeFixed, feeRateBasisPoints }
|
|
8
8
|
}
|
package/src/config/getGateway.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { assertEx, isDefined } from '@xylabs/sdk-js'
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
2
3
|
import { HDWallet } from '@xyo-network/wallet'
|
|
3
4
|
import type {
|
|
4
|
-
|
|
5
|
+
RpcSchemaMap, TransportFactory, XyoGatewayRunner,
|
|
5
6
|
} from '@xyo-network/xl1-sdk'
|
|
6
7
|
import {
|
|
7
8
|
ADDRESS_INDEX, buildJsonRpcProviderLocator, generateXyoBaseWalletFromPhrase, HttpRpcTransport, XyoGatewayRunnerMoniker,
|
|
@@ -9,10 +10,10 @@ import {
|
|
|
9
10
|
|
|
10
11
|
let gatewayInstance: XyoGatewayRunner | undefined
|
|
11
12
|
|
|
12
|
-
export const getGateway = async (config:
|
|
13
|
+
export const getGateway = async (config: BridgeConfig): Promise<XyoGatewayRunner> => {
|
|
13
14
|
if (isDefined(gatewayInstance)) return gatewayInstance
|
|
14
|
-
const { mnemonic } = config
|
|
15
|
-
const endpoint = assertEx(config.
|
|
15
|
+
const { mnemonic } = config
|
|
16
|
+
const endpoint = assertEx(config.remote?.rpc?.url ?? config.remote?.rpc?.url, () => 'RPC URL is required for gateway')
|
|
16
17
|
const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()
|
|
17
18
|
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)
|
|
18
19
|
const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Hex } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
3
|
|
|
4
|
-
export const getMaxBridgeAmount = (config:
|
|
5
|
-
const { maxBridgeAmount } = config
|
|
4
|
+
export const getMaxBridgeAmount = (config: BridgeConfig): Hex => {
|
|
5
|
+
const { maxBridgeAmount } = config
|
|
6
6
|
return maxBridgeAmount
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Hex } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
3
|
|
|
4
|
-
export const getMinBridgeAmount = (config:
|
|
5
|
-
const { minBridgeAmount } = config
|
|
4
|
+
export const getMinBridgeAmount = (config: BridgeConfig): Hex => {
|
|
5
|
+
const { minBridgeAmount } = config
|
|
6
6
|
return minBridgeAmount
|
|
7
7
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
|
+
import type { ChainId } from '@xyo-network/xl1-sdk'
|
|
3
4
|
|
|
4
5
|
import { asChainId } from './asChainId.ts'
|
|
5
6
|
|
|
6
|
-
export const getRemoteChainId = (config:
|
|
7
|
-
const remoteChainId = assertEx(asChainId(config.
|
|
7
|
+
export const getRemoteChainId = (config: BridgeConfig): ChainId => {
|
|
8
|
+
const remoteChainId = assertEx(asChainId(config.remoteChainId), () => 'Invalid remote chain ID in config')
|
|
8
9
|
return remoteChainId
|
|
9
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/sdk-js'
|
|
2
2
|
import { assertEx } from '@xylabs/sdk-js'
|
|
3
|
-
import type {
|
|
3
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
4
4
|
|
|
5
5
|
import { asToken } from './asToken.ts'
|
|
6
6
|
|
|
7
|
-
export const getRemoteTokenAddress = (config:
|
|
8
|
-
const token = asToken(config.
|
|
7
|
+
export const getRemoteTokenAddress = (config: BridgeConfig): Address => {
|
|
8
|
+
const token = asToken(config.remoteTokenAddress)
|
|
9
9
|
return assertEx(token, () => 'Remote token address is not defined in bridge configuration')
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
3
|
|
|
4
4
|
import { tryGetBridgeEscrowAddress } from './getBridgeEscrowAddress.ts'
|
|
5
5
|
import { tryGetBridgeFeesAddress } from './getBridgeFeesAddress.ts'
|
|
@@ -10,7 +10,7 @@ export interface TransferAddresses {
|
|
|
10
10
|
feesAddress: Address
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const getTransferAddresses = async (config:
|
|
13
|
+
export const getTransferAddresses = async (config: BridgeConfig): Promise<TransferAddresses> => {
|
|
14
14
|
const escrowAddress = tryGetBridgeEscrowAddress(config) ?? (await getBridgeWalletAccount(config)).address
|
|
15
15
|
const feesAddress = tryGetBridgeFeesAddress(config) ?? (await getBridgeWalletAccount(config)).address
|
|
16
16
|
return { escrowAddress, feesAddress }
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { assertEx, isDefined } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
|
+
import type { ChainId } from '@xyo-network/xl1-sdk'
|
|
3
4
|
|
|
4
5
|
import { asChainId } from './asChainId.ts'
|
|
5
6
|
|
|
6
|
-
export const getXl1ChainId = (config:
|
|
7
|
-
const xl1ChainId = config.
|
|
7
|
+
export const getXl1ChainId = (config: BridgeConfig): ChainId => {
|
|
8
|
+
const xl1ChainId = config.xl1ChainId
|
|
8
9
|
if (isDefined(xl1ChainId)) {
|
|
9
10
|
return assertEx(asChainId(xl1ChainId), () => 'Invalid xl1ChainId in bridge config')
|
|
10
11
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Hex } from '@xylabs/sdk-js'
|
|
2
2
|
import { isDefined } from '@xylabs/sdk-js'
|
|
3
|
-
import type {
|
|
3
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
4
4
|
|
|
5
5
|
import { asToken } from './asToken.ts'
|
|
6
6
|
import { getXl1ChainId } from './getXl1ChainId.ts'
|
|
7
7
|
|
|
8
|
-
export const getXl1TokenAddress = (config:
|
|
9
|
-
const token = asToken(config.
|
|
8
|
+
export const getXl1TokenAddress = (config: BridgeConfig): Hex => {
|
|
9
|
+
const token = asToken(config.xl1TokenAddress)
|
|
10
10
|
if (isDefined(token)) return token
|
|
11
11
|
return getXl1ChainId(config)
|
|
12
12
|
}
|
package/src/interface/service/Observer/LiquidityPoolBridgeObserver/LiquidityPoolBridgeObserver.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Address, Hex } from '@xylabs/sdk-js'
|
|
|
2
2
|
import {
|
|
3
3
|
asAddress, asHex, assertEx, hexFromBigInt, hexToBigInt, isNull, isUndefined, toAddress,
|
|
4
4
|
} from '@xylabs/sdk-js'
|
|
5
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
5
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
6
6
|
import type { ILiquidityPoolBridge } from '@xyo-network/typechain'
|
|
7
7
|
import { ILiquidityPoolBridge__factory } from '@xyo-network/typechain'
|
|
8
8
|
import type {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
asHex, assertEx, hexFromBigInt, hexToBigInt, isNull,
|
|
4
4
|
toAddress,
|
|
5
5
|
} from '@xylabs/sdk-js'
|
|
6
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
6
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
7
7
|
import type { LiquidityPoolBridge } from '@xyo-network/typechain'
|
|
8
8
|
import { LiquidityPoolBridge__factory } from '@xyo-network/typechain'
|
|
9
9
|
import { AbstractCreatableProvider } from '@xyo-network/xl1-sdk'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
3
3
|
import {
|
|
4
4
|
type BridgeDestinationObservation, type BridgeIntent, BridgeIntentSchema, type BridgeSourceObservation,
|
|
5
5
|
} from '@xyo-network/xl1-sdk'
|
|
@@ -5,9 +5,8 @@ import type {
|
|
|
5
5
|
import {
|
|
6
6
|
asAddress, asHex, assertEx, delay, hexFromBigInt, hexToBigInt, isDefined, isUndefined,
|
|
7
7
|
} from '@xylabs/sdk-js'
|
|
8
|
-
import type { AnyConfigSchema } from '@xyo-network/
|
|
9
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
10
|
-
import { asSchema, type Payload } from '@xyo-network/payload-model'
|
|
8
|
+
import type { AnyConfigSchema, Payload } from '@xyo-network/sdk-js'
|
|
9
|
+
import { asSchema, PayloadBuilder } from '@xyo-network/sdk-js'
|
|
11
10
|
import { AbstractSentinel } from '@xyo-network/sentinel-abstract'
|
|
12
11
|
import type {
|
|
13
12
|
SentinelConfig, SentinelInstance, SentinelModuleEventData, SentinelParams,
|
|
@@ -3,9 +3,8 @@ import type { Hash } from '@xylabs/sdk-js'
|
|
|
3
3
|
import {
|
|
4
4
|
assertEx, delay, isDefined, isNull, isUndefined,
|
|
5
5
|
} from '@xylabs/sdk-js'
|
|
6
|
-
import type { AnyConfigSchema } from '@xyo-network/
|
|
7
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
8
|
-
import { asSchema, type Payload } from '@xyo-network/payload-model'
|
|
6
|
+
import type { AnyConfigSchema, Payload } from '@xyo-network/sdk-js'
|
|
7
|
+
import { asSchema, PayloadBuilder } from '@xyo-network/sdk-js'
|
|
9
8
|
import { AbstractSentinel } from '@xyo-network/sentinel-abstract'
|
|
10
9
|
import type {
|
|
11
10
|
SentinelConfig, SentinelInstance, SentinelModuleEventData, SentinelParams,
|
package/src/queue/connection.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isDefined } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
3
|
import { Redis } from 'ioredis'
|
|
4
4
|
|
|
5
5
|
let connection: Redis | undefined
|
|
6
6
|
|
|
7
7
|
const maxRetriesPerRequest = null
|
|
8
8
|
|
|
9
|
-
export const getConnection = (config:
|
|
9
|
+
export const getConnection = (config: BridgeConfig) => {
|
|
10
10
|
if (isDefined(connection)) return connection
|
|
11
|
-
const { redisHost: host, redisPort: port } = config
|
|
11
|
+
const { redisHost: host, redisPort: port } = config
|
|
12
12
|
connection = new Redis({
|
|
13
13
|
host, port, maxRetriesPerRequest,
|
|
14
14
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
3
3
|
import type { SignedHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
4
4
|
import type { Job } from 'bullmq'
|
|
5
5
|
import { Worker } from 'bullmq'
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { assertEx, hexToBigInt } from '@xylabs/sdk-js'
|
|
2
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
3
|
-
import {
|
|
4
|
-
isBridgeIntent, isSignedTransactionBoundWitness, type SignedHydratedTransaction,
|
|
5
|
-
} from '@xyo-network/xl1-sdk'
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
3
|
+
import { isBridgeIntent, type SignedHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
6
4
|
import type { Job } from 'bullmq'
|
|
7
5
|
import { Worker } from 'bullmq'
|
|
8
6
|
import { getAddress } from 'ethers'
|
|
9
7
|
import type { Redis } from 'ioredis'
|
|
10
8
|
|
|
11
9
|
import type { IBridgeServiceCollection } from '../../services/index.ts'
|
|
10
|
+
import { validateSufficientAllowance, validateSufficientBalance } from './util/index.ts'
|
|
12
11
|
import type { WorkerDescription } from './WorkerDescription.ts'
|
|
13
12
|
|
|
14
13
|
type JobData = { tx: SignedHydratedTransaction }
|
|
@@ -20,6 +19,7 @@ const queueName = 'eth-tx-prepare'
|
|
|
20
19
|
|
|
21
20
|
export const createWorker = (connection: Redis, services?: IBridgeServiceCollection) => {
|
|
22
21
|
const bridge = assertEx(services?.bridge, () => 'bridge service not provided')
|
|
22
|
+
const bridgeableToken = assertEx(services?.bridgeableToken, () => 'bridgeableToken service not provided')
|
|
23
23
|
const stateMap = assertEx(services?.ethTxStateMap, () => 'ethTxStateMap service not provided')
|
|
24
24
|
|
|
25
25
|
const worker = new Worker(
|
|
@@ -28,6 +28,16 @@ export const createWorker = (connection: Redis, services?: IBridgeServiceCollect
|
|
|
28
28
|
const { tx } = job.data
|
|
29
29
|
const hash = await PayloadBuilder.hash(tx[0])
|
|
30
30
|
await job.log(`[${hash}] preparing ETH transaction`)
|
|
31
|
+
await job.log(`[${hash}] validating liquiditySource has sufficient allowance`)
|
|
32
|
+
if (!await validateSufficientAllowance(tx, bridgeableToken, bridge, job)) {
|
|
33
|
+
throw new Error('Liquidity source does not have sufficient allowance for the bridge to execute the transaction')
|
|
34
|
+
}
|
|
35
|
+
await job.log(`[${hash}] validated liquiditySource has sufficient allowance`)
|
|
36
|
+
await job.log(`[${hash}] validating liquiditySource has sufficient balance`)
|
|
37
|
+
if (!await validateSufficientBalance(tx, bridgeableToken, bridge, job)) {
|
|
38
|
+
throw new Error('Liquidity source does not have sufficient balance for the bridge to execute the transaction')
|
|
39
|
+
}
|
|
40
|
+
await job.log(`[${hash}] validated liquiditySource has sufficient balance`)
|
|
31
41
|
await job.log(`[${hash}] building ETH transaction`)
|
|
32
42
|
const bridgeIntent = assertEx(tx[1].find(isBridgeIntent), () => 'No bridge intent found')
|
|
33
43
|
const amount = hexToBigInt(bridgeIntent.destAmount)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertEx, isDefined } from '@xylabs/sdk-js'
|
|
2
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
3
3
|
import { type SignedHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
4
4
|
import type { Job } from 'bullmq'
|
|
5
5
|
import { Worker } from 'bullmq'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertEx, isDefined, isNull,
|
|
3
3
|
} from '@xylabs/sdk-js'
|
|
4
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
4
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
5
5
|
import type { SignedHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
6
6
|
import type { Job } from 'bullmq'
|
|
7
7
|
import { UnrecoverableError, Worker } from 'bullmq'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import { PayloadBuilder } from '@xyo-network/
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
3
3
|
import type { SignedHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
4
4
|
import type { Job } from 'bullmq'
|
|
5
5
|
import { Worker } from 'bullmq'
|