@xyo-network/chain-bridge 1.19.17 → 1.19.18
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/index.mjs +145 -92
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/queue/flowProducer.d.ts +2 -1
- package/dist/node/queue/flowProducer.d.ts.map +1 -1
- package/dist/node/queue/index.d.ts +1 -0
- package/dist/node/queue/index.d.ts.map +1 -1
- package/dist/node/queue/telemetry.d.ts +3 -0
- package/dist/node/queue/telemetry.d.ts.map +1 -0
- package/dist/node/queue/workers/EthTransactionMonitor.d.ts +9 -0
- package/dist/node/queue/workers/EthTransactionMonitor.d.ts.map +1 -1
- package/dist/node/queue/workers/EthTransactionPreparation.d.ts +7 -1
- package/dist/node/queue/workers/EthTransactionPreparation.d.ts.map +1 -1
- package/dist/node/queue/workers/EthTransactionSubmission.d.ts +8 -0
- package/dist/node/queue/workers/EthTransactionSubmission.d.ts.map +1 -1
- package/dist/node/queue/workers/WorkerDescription.d.ts +2 -1
- package/dist/node/queue/workers/WorkerDescription.d.ts.map +1 -1
- package/dist/node/queue/workers/Xl1ToEthBridgeParent.d.ts +3 -0
- package/dist/node/queue/workers/Xl1ToEthBridgeParent.d.ts.map +1 -1
- package/dist/node/queue/workers/Xl1TransactionMonitor.d.ts +6 -0
- package/dist/node/queue/workers/Xl1TransactionMonitor.d.ts.map +1 -1
- package/dist/node/queue/workers/Xl1TransactionPreparation.d.ts +7 -0
- package/dist/node/queue/workers/Xl1TransactionPreparation.d.ts.map +1 -1
- package/dist/node/queue/workers/Xl1TransactionSubmission.d.ts +8 -0
- package/dist/node/queue/workers/Xl1TransactionSubmission.d.ts.map +1 -1
- package/dist/node/queue/workers/createWorkers.d.ts +2 -1
- package/dist/node/queue/workers/createWorkers.d.ts.map +1 -1
- package/dist/node/queue/workers/util/AsyncLogger.d.ts +5 -0
- package/dist/node/queue/workers/util/AsyncLogger.d.ts.map +1 -0
- package/dist/node/queue/workers/util/index.d.ts +3 -2
- package/dist/node/queue/workers/util/index.d.ts.map +1 -1
- package/dist/node/queue/workers/util/{validateSufficientAllowance.d.ts → validateSufficientLiquiditySourceAllowance.d.ts} +3 -7
- package/dist/node/queue/workers/util/validateSufficientLiquiditySourceAllowance.d.ts.map +1 -0
- package/dist/node/queue/workers/util/{validateSufficientBalance.d.ts → validateSufficientLiquiditySourceBalance.d.ts} +3 -7
- package/dist/node/queue/workers/util/validateSufficientLiquiditySourceBalance.d.ts.map +1 -0
- package/dist/node/queue/workers/util/validateSufficientRunnerEthBalanceForGas.d.ts +14 -0
- package/dist/node/queue/workers/util/validateSufficientRunnerEthBalanceForGas.d.ts.map +1 -0
- package/dist/node/server/addFlowProducer.d.ts.map +1 -1
- package/dist/node/server/addWorkers.d.ts.map +1 -1
- package/package.json +26 -30
- package/src/config/getBridgeWalletAccount.ts +1 -1
- package/src/config/getGateway.ts +1 -1
- package/src/queue/flowProducer.ts +3 -2
- package/src/queue/index.ts +1 -0
- package/src/queue/telemetry.ts +12 -0
- package/src/queue/workers/EthTransactionMonitor.ts +10 -6
- package/src/queue/workers/EthTransactionPreparation.ts +17 -9
- package/src/queue/workers/EthTransactionSubmission.ts +8 -28
- package/src/queue/workers/WorkerDescription.ts +2 -1
- package/src/queue/workers/Xl1ToEthBridgeParent.ts +8 -5
- package/src/queue/workers/Xl1TransactionMonitor.ts +7 -5
- package/src/queue/workers/Xl1TransactionPreparation.ts +7 -7
- package/src/queue/workers/Xl1TransactionSubmission.ts +6 -5
- package/src/queue/workers/createWorkers.ts +9 -8
- package/src/queue/workers/util/AsyncLogger.ts +5 -0
- package/src/queue/workers/util/index.ts +3 -2
- package/src/queue/workers/util/{validateSufficientAllowance.ts → validateSufficientLiquiditySourceAllowance.ts} +3 -6
- package/src/queue/workers/util/{validateSufficientBalance.ts → validateSufficientLiquiditySourceBalance.ts} +3 -6
- package/src/queue/workers/util/validateSufficientRunnerEthBalanceForGas.ts +57 -0
- package/src/server/addFlowProducer.ts +5 -2
- package/src/server/addWorkers.ts +6 -2
- package/src/server/routes/bridge/routeDefinitions/routes/bridgeToRemoteStatus.ts +3 -3
- package/src/services/getServices.ts +1 -1
- package/dist/node/queue/workers/util/validateSufficientAllowance.d.ts.map +0 -1
- package/dist/node/queue/workers/util/validateSufficientBalance.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FlowProducer } from 'bullmq';
|
|
2
|
+
import type { BullMQOtel } from 'bullmq-otel';
|
|
2
3
|
import type { Redis } from 'ioredis';
|
|
3
|
-
export declare const getFlowProducer: (connection: Redis) => FlowProducer;
|
|
4
|
+
export declare const getFlowProducer: (connection: Redis, telemetry?: BullMQOtel) => FlowProducer;
|
|
4
5
|
//# sourceMappingURL=flowProducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowProducer.d.ts","sourceRoot":"","sources":["../../../src/queue/flowProducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,eAAO,MAAM,eAAe,GAAI,YAAY,KAAK,
|
|
1
|
+
{"version":3,"file":"flowProducer.d.ts","sourceRoot":"","sources":["../../../src/queue/flowProducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,eAAO,MAAM,eAAe,GAAI,YAAY,KAAK,EAAE,YAAY,UAAU,iBAIxE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/queue/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/queue/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../../src/queue/telemetry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,eAAO,MAAM,YAAY,kBAIxB,CAAA"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
1
2
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
3
|
+
export type EthTransactionMonitorJobData = {
|
|
4
|
+
tx: SignedHydratedTransaction;
|
|
5
|
+
};
|
|
6
|
+
export interface EthTransactionMonitorJobReturn {
|
|
7
|
+
blockHash: string;
|
|
8
|
+
blockNumber: number;
|
|
9
|
+
submissionHash: string;
|
|
10
|
+
}
|
|
2
11
|
export declare const EthTransactionMonitor: WorkerDescription;
|
|
3
12
|
//# sourceMappingURL=EthTransactionMonitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthTransactionMonitor.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/EthTransactionMonitor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthTransactionMonitor.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/EthTransactionMonitor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAOrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,4BAA4B,GAAG;IAAE,EAAE,EAAE,yBAAyB,CAAA;CAAE,CAAA;AAC5E,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;CACvB;AAoCD,eAAO,MAAM,qBAAqB,EAAE,iBAEnC,CAAA"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { type SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
2
|
+
import type { BullMQOtel } from 'bullmq-otel';
|
|
1
3
|
import type { Redis } from 'ioredis';
|
|
2
4
|
import type { IBridgeServiceCollection } from '../../services/index.ts';
|
|
3
5
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
4
|
-
export
|
|
6
|
+
export type EthTransactionPrepareJobData = {
|
|
7
|
+
tx: SignedHydratedTransaction;
|
|
8
|
+
};
|
|
9
|
+
export type EthTransactionPrepareJobReturn = Record<string, never>;
|
|
10
|
+
export declare const createWorker: (connection: Redis, telemetry?: BullMQOtel, services?: IBridgeServiceCollection) => void;
|
|
5
11
|
export declare const EthTransactionPreparation: WorkerDescription;
|
|
6
12
|
//# sourceMappingURL=EthTransactionPreparation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthTransactionPreparation.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/EthTransactionPreparation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthTransactionPreparation.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/EthTransactionPreparation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAGrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAIvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,4BAA4B,GAAG;IAAE,EAAE,EAAE,yBAAyB,CAAA;CAAE,CAAA;AAC5E,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAKlE,eAAO,MAAM,YAAY,GAAI,YAAY,KAAK,EAAE,YAAY,UAAU,EAAE,WAAW,wBAAwB,SAmD1G,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,iBAEvC,CAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { type SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
2
|
+
import type { EthTxState } from '../../services/index.ts';
|
|
1
3
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
4
|
+
export type EthTransactionSubmissionJobData = {
|
|
5
|
+
tx: SignedHydratedTransaction;
|
|
6
|
+
};
|
|
7
|
+
export interface EthTransactionSubmissionJobReturn {
|
|
8
|
+
submissionHash: Required<EthTxState>['submissionHash'];
|
|
9
|
+
}
|
|
2
10
|
export declare const EthTransactionSubmission: WorkerDescription;
|
|
3
11
|
//# sourceMappingURL=EthTransactionSubmission.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthTransactionSubmission.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/EthTransactionSubmission.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthTransactionSubmission.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/EthTransactionSubmission.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAMrE,OAAO,KAAK,EAAE,UAAU,EAA4B,MAAM,yBAAyB,CAAA;AAEnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,+BAA+B,GAAG;IAAE,EAAE,EAAE,yBAAyB,CAAA;CAAE,CAAA;AAE/E,MAAM,WAAW,iCAAiC;IAChD,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACvD;AAqDD,eAAO,MAAM,wBAAwB,EAAE,iBAEtC,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { BullMQOtel } from 'bullmq-otel';
|
|
1
2
|
import type { Redis } from 'ioredis';
|
|
2
3
|
import type { IBridgeServiceCollection } from '../../services/index.ts';
|
|
3
4
|
export interface WorkerDescription {
|
|
4
|
-
createWorker: (connection: Redis, services?: IBridgeServiceCollection) => void;
|
|
5
|
+
createWorker: (connection: Redis, telemetry?: BullMQOtel, services?: IBridgeServiceCollection) => void;
|
|
5
6
|
name: string;
|
|
6
7
|
queueName: string;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerDescription.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/WorkerDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAEvE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"WorkerDescription.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/WorkerDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAEvE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAA;IACtG,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
2
|
+
export type Xl1ToEthBridgeParentJobData = {};
|
|
3
|
+
export interface Xl1ToEthBridgeParentJobReturn {
|
|
4
|
+
}
|
|
2
5
|
export declare const Xl1ToEthBridgeParent: WorkerDescription;
|
|
3
6
|
//# sourceMappingURL=Xl1ToEthBridgeParent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Xl1ToEthBridgeParent.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1ToEthBridgeParent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Xl1ToEthBridgeParent.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1ToEthBridgeParent.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,2BAA2B,GAAG,EAAE,CAAA;AAC5C,MAAM,WAAW,6BAA6B;CAAI;AAyBlD,eAAO,MAAM,oBAAoB,EAAE,iBAElC,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
1
2
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
3
|
+
export type Xl1TransactionMonitorJobData = {
|
|
4
|
+
tx: SignedHydratedTransaction;
|
|
5
|
+
};
|
|
6
|
+
export interface Xl1TransactionMonitorJobReturn {
|
|
7
|
+
}
|
|
2
8
|
export declare const Xl1TransactionMonitor: WorkerDescription;
|
|
3
9
|
//# sourceMappingURL=Xl1TransactionMonitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Xl1TransactionMonitor.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1TransactionMonitor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Xl1TransactionMonitor.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1TransactionMonitor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAOrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,4BAA4B,GAAG;IAAE,EAAE,EAAE,yBAAyB,CAAA;CAAE,CAAA;AAE5E,MAAM,WAAW,8BAA8B;CAC9C;AA2DD,eAAO,MAAM,qBAAqB,EAAE,iBAEnC,CAAA"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
1
2
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
3
|
+
export type Xl1TransactionPreparationJobData = {
|
|
4
|
+
tx: SignedHydratedTransaction;
|
|
5
|
+
};
|
|
6
|
+
export interface Xl1TransactionPreparationJobReturn {
|
|
7
|
+
preparedTx: SignedHydratedTransaction;
|
|
8
|
+
}
|
|
2
9
|
export declare const Xl1TransactionPreparation: WorkerDescription;
|
|
3
10
|
//# sourceMappingURL=Xl1TransactionPreparation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Xl1TransactionPreparation.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1TransactionPreparation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Xl1TransactionPreparation.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1TransactionPreparation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAOrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,gCAAgC,GAAG;IAAE,EAAE,EAAE,yBAAyB,CAAA;CAAE,CAAA;AAChF,MAAM,WAAW,kCAAkC;IAAG,UAAU,EAAE,yBAAyB,CAAA;CAAE;AAgC7F,eAAO,MAAM,yBAAyB,EAAE,iBAEvC,CAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { type SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
2
|
+
import type { Xl1TxState } from '../../services/index.ts';
|
|
1
3
|
import type { WorkerDescription } from './WorkerDescription.ts';
|
|
4
|
+
export type Xl1TransactionSubmissionJobData = {
|
|
5
|
+
tx: SignedHydratedTransaction;
|
|
6
|
+
};
|
|
7
|
+
export interface Xl1TransactionSubmissionJobReturn {
|
|
8
|
+
submissionHash: Required<Xl1TxState>['submissionHash'];
|
|
9
|
+
}
|
|
2
10
|
export declare const Xl1TransactionSubmission: WorkerDescription;
|
|
3
11
|
//# sourceMappingURL=Xl1TransactionSubmission.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Xl1TransactionSubmission.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1TransactionSubmission.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Xl1TransactionSubmission.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/Xl1TransactionSubmission.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAMrE,OAAO,KAAK,EAA4B,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,MAAM,MAAM,+BAA+B,GAAG;IAAE,EAAE,EAAE,yBAAyB,CAAA;CAAE,CAAA;AAE/E,MAAM,WAAW,iCAAiC;IAChD,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACvD;AAqDD,eAAO,MAAM,wBAAwB,EAAE,iBAEtC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { BullMQOtel } from 'bullmq-otel';
|
|
1
2
|
import type { Redis } from 'ioredis';
|
|
2
3
|
import type { IBridgeServiceCollection } from '../../services/index.ts';
|
|
3
|
-
export declare const createWorkers: (connection: Redis, services: IBridgeServiceCollection) => void;
|
|
4
|
+
export declare const createWorkers: (connection: Redis, telemetry: BullMQOtel, services: IBridgeServiceCollection) => void;
|
|
4
5
|
//# sourceMappingURL=createWorkers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWorkers.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/createWorkers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAWvE,eAAO,MAAM,aAAa,GAAI,YAAY,KAAK,EAAE,UAAU,wBAAwB,
|
|
1
|
+
{"version":3,"file":"createWorkers.d.ts","sourceRoot":"","sources":["../../../../src/queue/workers/createWorkers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAWvE,eAAO,MAAM,aAAa,GAAI,YAAY,KAAK,EAAE,WAAW,UAAU,EAAE,UAAU,wBAAwB,SAQzG,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncLogger.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/AsyncLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,UAAU,CAAC,OAAO,CAAC,CAAA;CAC9C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './submitEthTransaction.ts';
|
|
2
2
|
export * from './submitXl1Transaction.ts';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './validateSufficientLiquiditySourceAllowance.ts';
|
|
4
|
+
export * from './validateSufficientLiquiditySourceBalance.ts';
|
|
5
|
+
export * from './validateSufficientRunnerEthBalanceForGas.ts';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iDAAiD,CAAA;AAC/D,cAAc,+CAA+C,CAAA;AAC7D,cAAc,+CAA+C,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/sdk-js';
|
|
2
1
|
import type { BridgeableToken, LiquidityPoolBridge } from '@xyo-network/typechain';
|
|
3
2
|
import { type SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
4
|
-
|
|
5
|
-
log: (message: string) => Promisable<unknown>;
|
|
6
|
-
}
|
|
3
|
+
import type { AsyncLogger } from './AsyncLogger.ts';
|
|
7
4
|
/**
|
|
8
5
|
* Checks if the liquidity source has sufficient allowance for the bridge to execute the transaction. This doesn't
|
|
9
6
|
* ensure that (due to race conditions) the transaction will succeed, but is a quick check to avoid
|
|
@@ -14,6 +11,5 @@ interface IAsyncLogger {
|
|
|
14
11
|
* @param logger Optional logger for asynchronous logging
|
|
15
12
|
* @returns True if the liquidity source allowance is sufficient to execute the bridge
|
|
16
13
|
*/
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=validateSufficientAllowance.d.ts.map
|
|
14
|
+
export declare const validateSufficientLiquiditySourceAllowance: (tx: SignedHydratedTransaction, bridgeableToken: BridgeableToken, bridge: LiquidityPoolBridge, logger?: AsyncLogger) => Promise<boolean>;
|
|
15
|
+
//# sourceMappingURL=validateSufficientLiquiditySourceAllowance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSufficientLiquiditySourceAllowance.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/validateSufficientLiquiditySourceAllowance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,EAAkB,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAErF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM,0CAA0C,GACrD,IAAI,yBAAyB,EAC7B,iBAAiB,eAAe,EAChC,QAAQ,mBAAmB,EAC3B,SAAS,WAAW,qBAcrB,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/sdk-js';
|
|
2
1
|
import type { BridgeableToken, LiquidityPoolBridge } from '@xyo-network/typechain';
|
|
3
2
|
import { type SignedHydratedTransaction } from '@xyo-network/xl1-sdk';
|
|
4
|
-
|
|
5
|
-
log: (message: string) => Promisable<unknown>;
|
|
6
|
-
}
|
|
3
|
+
import type { AsyncLogger } from './AsyncLogger.ts';
|
|
7
4
|
/**
|
|
8
5
|
* Checks if the liquidity source has sufficient balance for the bridge to execute the transaction. This doesn't
|
|
9
6
|
* ensure that (due to race conditions) the transaction will succeed, but is a quick check to avoid
|
|
@@ -14,6 +11,5 @@ interface IAsyncLogger {
|
|
|
14
11
|
* @param logger Optional logger for asynchronous logging
|
|
15
12
|
* @returns True if the liquidity source balance is sufficient to execute the bridge
|
|
16
13
|
*/
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=validateSufficientBalance.d.ts.map
|
|
14
|
+
export declare const validateSufficientLiquiditySourceBalance: (tx: SignedHydratedTransaction, bridgeableToken: BridgeableToken, bridge: LiquidityPoolBridge, logger?: AsyncLogger) => Promise<boolean>;
|
|
15
|
+
//# sourceMappingURL=validateSufficientLiquiditySourceBalance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSufficientLiquiditySourceBalance.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/validateSufficientLiquiditySourceBalance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,EAAkB,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAErF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM,wCAAwC,GACnD,IAAI,yBAAyB,EAC7B,iBAAiB,eAAe,EAChC,QAAQ,mBAAmB,EAC3B,SAAS,WAAW,qBAarB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContractTransaction, Wallet } from 'ethers';
|
|
2
|
+
import type { AsyncLogger } from './AsyncLogger.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Validates that the wallet (the account that will submit the tx) has enough ETH
|
|
5
|
+
* to cover the estimated gas cost (plus a buffer) for the transaction.
|
|
6
|
+
* @param preparedTx The transaction that is being prepared for submission.
|
|
7
|
+
* This should be a fully populated transaction (to/from/data/value) except for gas fields.
|
|
8
|
+
* @param wallet The wallet that will be used to submit the transaction.
|
|
9
|
+
* @param logger Optional logger for asynchronous logging.
|
|
10
|
+
* @param bufferBps The buffer to apply to the estimated gas cost, in basis points (1/100th of a percent).
|
|
11
|
+
* @returns A boolean indicating whether the wallet has sufficient ETH to cover the estimated gas cost with the buffer applied.
|
|
12
|
+
*/
|
|
13
|
+
export declare const validateSufficientRunnerEthBalanceForGas: (preparedTx: ContractTransaction, wallet: Wallet, logger?: AsyncLogger, bufferBps?: bigint) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=validateSufficientRunnerEthBalanceForGas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSufficientRunnerEthBalanceForGas.d.ts","sourceRoot":"","sources":["../../../../../src/queue/workers/util/validateSufficientRunnerEthBalanceForGas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAInD;;;;;;;;;GASG;AACH,eAAO,MAAM,wCAAwC,GACnD,YAAY,mBAAmB,EAC/B,QAAQ,MAAM,EACd,SAAS,WAAW,EACpB,YAAW,MAA+B,qBAmC3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addFlowProducer.d.ts","sourceRoot":"","sources":["../../../src/server/addFlowProducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"addFlowProducer.d.ts","sourceRoot":"","sources":["../../../src/server/addFlowProducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAMtC,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,EAAE,QAAQ,YAAY,KAAG,OAMpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addWorkers.d.ts","sourceRoot":"","sources":["../../../src/server/addWorkers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"addWorkers.d.ts","sourceRoot":"","sources":["../../../src/server/addWorkers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAMpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAEpE,eAAO,MAAM,UAAU,GAAI,QAAQ,YAAY,EAAE,UAAU,wBAAwB,SAIlF,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.18",
|
|
4
4
|
"description": "XYO Layer One Bridge",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -55,19 +55,19 @@
|
|
|
55
55
|
"@xylabs/express": "~5.0.80",
|
|
56
56
|
"@xylabs/mongo": "~5.0.80",
|
|
57
57
|
"@xylabs/sdk-js": "~5.0.80",
|
|
58
|
-
"@xyo-network/boundwitness-validator": "~5.3.
|
|
59
|
-
"@xyo-network/chain-orchestration": "~1.19.
|
|
60
|
-
"@xyo-network/chain-protocol": "~1.19.
|
|
61
|
-
"@xyo-network/chain-services": "~1.19.
|
|
62
|
-
"@xyo-network/sdk-js": "~5.3.
|
|
63
|
-
"@xyo-network/sentinel-abstract": "~5.3.
|
|
64
|
-
"@xyo-network/sentinel-model": "~5.3.
|
|
58
|
+
"@xyo-network/boundwitness-validator": "~5.3.10",
|
|
59
|
+
"@xyo-network/chain-orchestration": "~1.19.18",
|
|
60
|
+
"@xyo-network/chain-protocol": "~1.19.18",
|
|
61
|
+
"@xyo-network/chain-services": "~1.19.18",
|
|
62
|
+
"@xyo-network/sdk-js": "~5.3.10",
|
|
63
|
+
"@xyo-network/sentinel-abstract": "~5.3.10",
|
|
64
|
+
"@xyo-network/sentinel-model": "~5.3.10",
|
|
65
65
|
"@xyo-network/typechain": "~4.1.1",
|
|
66
|
-
"@xyo-network/wallet": "~5.3.
|
|
67
|
-
"@xyo-network/
|
|
68
|
-
"@xyo-network/xl1-sdk": "~1.24.27",
|
|
66
|
+
"@xyo-network/wallet-model": "~5.3.10",
|
|
67
|
+
"@xyo-network/xl1-sdk": "~1.24.29",
|
|
69
68
|
"async-mutex": "~0.5.0",
|
|
70
69
|
"bullmq": "~5.70.1",
|
|
70
|
+
"bullmq-otel": "~1.3.0",
|
|
71
71
|
"compression": "~1.8.1",
|
|
72
72
|
"cors": "~2.8.6",
|
|
73
73
|
"ethers": "^6.16.0",
|
|
@@ -83,32 +83,28 @@
|
|
|
83
83
|
"@types/express": "5.0.6",
|
|
84
84
|
"@types/express-serve-static-core": "~5.1.1",
|
|
85
85
|
"@types/node": "~25.3.0",
|
|
86
|
-
"@xylabs/axios": "~5.0.80",
|
|
87
86
|
"@xylabs/mongo": "~5.0.80",
|
|
88
87
|
"@xylabs/sdk-js": "~5.0.80",
|
|
89
88
|
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
90
89
|
"@xylabs/tsconfig": "~7.3.2",
|
|
91
90
|
"@xylabs/vitest-extended": "~5.0.80",
|
|
92
|
-
"@xyo-network/account": "~5.3.
|
|
93
|
-
"@xyo-network/account-model": "~5.3.
|
|
94
|
-
"@xyo-network/archivist-abstract": "~5.3.
|
|
95
|
-
"@xyo-network/archivist-
|
|
96
|
-
"@xyo-network/archivist-
|
|
97
|
-
"@xyo-network/archivist-view": "~5.3.8",
|
|
91
|
+
"@xyo-network/account": "~5.3.10",
|
|
92
|
+
"@xyo-network/account-model": "~5.3.10",
|
|
93
|
+
"@xyo-network/archivist-abstract": "~5.3.10",
|
|
94
|
+
"@xyo-network/archivist-mongodb": "~5.3.10",
|
|
95
|
+
"@xyo-network/archivist-view": "~5.3.10",
|
|
98
96
|
"@xyo-network/bios": "~7.2.1",
|
|
99
97
|
"@xyo-network/bios-model": "~7.2.1",
|
|
100
|
-
"@xyo-network/boundwitness-builder": "~5.3.
|
|
101
|
-
"@xyo-network/chain-protocol": "~1.19.
|
|
102
|
-
"@xyo-network/chain-services": "~1.19.
|
|
103
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
104
|
-
"@xyo-network/
|
|
105
|
-
"@xyo-network/module-abstract": "~5.3.
|
|
106
|
-
"@xyo-network/
|
|
107
|
-
"@xyo-network/
|
|
108
|
-
"@xyo-network/
|
|
109
|
-
"@xyo-network/
|
|
110
|
-
"@xyo-network/wallet": "~5.3.8",
|
|
111
|
-
"@xyo-network/xl1-sdk": "~1.24.27",
|
|
98
|
+
"@xyo-network/boundwitness-builder": "~5.3.10",
|
|
99
|
+
"@xyo-network/chain-protocol": "~1.19.18",
|
|
100
|
+
"@xyo-network/chain-services": "~1.19.18",
|
|
101
|
+
"@xyo-network/chain-telemetry": "~1.19.18",
|
|
102
|
+
"@xyo-network/module-abstract": "~5.3.10",
|
|
103
|
+
"@xyo-network/module-abstract-mongodb": "~5.3.10",
|
|
104
|
+
"@xyo-network/node-memory": "~5.3.10",
|
|
105
|
+
"@xyo-network/sdk-js": "~5.3.10",
|
|
106
|
+
"@xyo-network/sentinel-memory": "~5.3.10",
|
|
107
|
+
"@xyo-network/xl1-sdk": "~1.24.29",
|
|
112
108
|
"async-mutex": "~0.5.0",
|
|
113
109
|
"axios": "~1.13.5",
|
|
114
110
|
"dotenv": "~17.3.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Promisable } from '@xylabs/sdk-js'
|
|
2
2
|
import { isDefined, isUndefined } from '@xylabs/sdk-js'
|
|
3
|
-
import { HDWallet } from '@xyo-network/
|
|
3
|
+
import { HDWallet } from '@xyo-network/sdk-js'
|
|
4
4
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
5
5
|
import type { ActorConfig } from '@xyo-network/xl1-sdk'
|
|
6
6
|
import { ADDRESS_INDEX, generateXyoBaseWalletFromPhrase } from '@xyo-network/xl1-sdk'
|
package/src/config/getGateway.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx, isDefined } from '@xylabs/sdk-js'
|
|
2
2
|
import type { BridgeConfig } from '@xyo-network/chain-orchestration'
|
|
3
|
-
import { HDWallet } from '@xyo-network/
|
|
3
|
+
import { HDWallet } from '@xyo-network/sdk-js'
|
|
4
4
|
import type {
|
|
5
5
|
RpcSchemaMap, TransportFactory, XyoGatewayRunner,
|
|
6
6
|
} from '@xyo-network/xl1-sdk'
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { isDefined } from '@xylabs/sdk-js'
|
|
2
2
|
import { FlowProducer } from 'bullmq'
|
|
3
|
+
import type { BullMQOtel } from 'bullmq-otel'
|
|
3
4
|
import type { Redis } from 'ioredis'
|
|
4
5
|
|
|
5
6
|
let flowProducer: FlowProducer | undefined
|
|
6
7
|
|
|
7
|
-
export const getFlowProducer = (connection: Redis) => {
|
|
8
|
+
export const getFlowProducer = (connection: Redis, telemetry?: BullMQOtel) => {
|
|
8
9
|
if (isDefined(flowProducer)) return flowProducer
|
|
9
|
-
flowProducer = new FlowProducer({ connection })
|
|
10
|
+
flowProducer = new FlowProducer({ connection, telemetry })
|
|
10
11
|
return flowProducer
|
|
11
12
|
}
|
package/src/queue/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isDefined } from '@xylabs/sdk-js'
|
|
2
|
+
import type { BullMQOtelOptions } from 'bullmq-otel'
|
|
3
|
+
import { BullMQOtel } from 'bullmq-otel'
|
|
4
|
+
|
|
5
|
+
let telemetry: BullMQOtel | undefined
|
|
6
|
+
const options: BullMQOtelOptions = { enableMetrics: true }
|
|
7
|
+
|
|
8
|
+
export const getTelemetry = () => {
|
|
9
|
+
if (isDefined(telemetry)) return telemetry
|
|
10
|
+
telemetry = new BullMQOtel(options)
|
|
11
|
+
return telemetry
|
|
12
|
+
}
|
|
@@ -3,26 +3,28 @@ 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'
|
|
6
|
+
import type { BullMQOtel } from 'bullmq-otel'
|
|
6
7
|
import type { Redis } from 'ioredis'
|
|
7
8
|
|
|
8
9
|
import type { IBridgeServiceCollection } from '../../services/index.ts'
|
|
9
10
|
import type { WorkerDescription } from './WorkerDescription.ts'
|
|
10
11
|
|
|
11
|
-
type
|
|
12
|
-
interface
|
|
12
|
+
export type EthTransactionMonitorJobData = { tx: SignedHydratedTransaction }
|
|
13
|
+
export interface EthTransactionMonitorJobReturn {
|
|
13
14
|
blockHash: string
|
|
14
15
|
blockNumber: number
|
|
16
|
+
submissionHash: string
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const name = 'Monitor Submitted ETH Transaction'
|
|
18
20
|
const queueName = 'eth-tx-monitor'
|
|
19
|
-
const createWorker = (connection: Redis, services?: IBridgeServiceCollection) => {
|
|
21
|
+
const createWorker = (connection: Redis, telemetry?: BullMQOtel, services?: IBridgeServiceCollection) => {
|
|
20
22
|
const provider = assertEx(services?.provider, () => 'provider service not provided')
|
|
21
23
|
const stateMap = assertEx(services?.ethTxStateMap, () => 'ethTxStateMap service not provided')
|
|
22
24
|
|
|
23
25
|
const worker = new Worker(
|
|
24
26
|
queueName,
|
|
25
|
-
async (job: Job<
|
|
27
|
+
async (job: Job<EthTransactionMonitorJobData, EthTransactionMonitorJobReturn>) => {
|
|
26
28
|
const { tx } = job.data
|
|
27
29
|
const hash = await PayloadBuilder.hash(tx[0])
|
|
28
30
|
const state = assertEx(await stateMap.get(hash), () => 'State not found')
|
|
@@ -32,9 +34,11 @@ const createWorker = (connection: Redis, services?: IBridgeServiceCollection) =>
|
|
|
32
34
|
const { blockHash, blockNumber } = receipt
|
|
33
35
|
state.confirmationHash = blockHash
|
|
34
36
|
await stateMap.set(hash, state)
|
|
35
|
-
return {
|
|
37
|
+
return {
|
|
38
|
+
blockHash, blockNumber, submissionHash,
|
|
39
|
+
}
|
|
36
40
|
},
|
|
37
|
-
{ connection },
|
|
41
|
+
{ connection, telemetry },
|
|
38
42
|
)
|
|
39
43
|
|
|
40
44
|
worker.on('failed', (job, err) => {
|
|
@@ -3,38 +3,41 @@ import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
|
3
3
|
import { isBridgeIntent, type SignedHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
4
4
|
import type { Job } from 'bullmq'
|
|
5
5
|
import { Worker } from 'bullmq'
|
|
6
|
+
import type { BullMQOtel } from 'bullmq-otel'
|
|
6
7
|
import { getAddress } from 'ethers'
|
|
7
8
|
import type { Redis } from 'ioredis'
|
|
8
9
|
|
|
9
10
|
import type { IBridgeServiceCollection } from '../../services/index.ts'
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
validateSufficientLiquiditySourceAllowance, validateSufficientLiquiditySourceBalance, validateSufficientRunnerEthBalanceForGas,
|
|
13
|
+
} from './util/index.ts'
|
|
11
14
|
import type { WorkerDescription } from './WorkerDescription.ts'
|
|
12
15
|
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
interface ReturnType {}
|
|
16
|
+
export type EthTransactionPrepareJobData = { tx: SignedHydratedTransaction }
|
|
17
|
+
export type EthTransactionPrepareJobReturn = Record<string, never>
|
|
16
18
|
|
|
17
19
|
const name = 'Prepare ETH Transaction'
|
|
18
20
|
const queueName = 'eth-tx-prepare'
|
|
19
21
|
|
|
20
|
-
export const createWorker = (connection: Redis, services?: IBridgeServiceCollection) => {
|
|
22
|
+
export const createWorker = (connection: Redis, telemetry?: BullMQOtel, services?: IBridgeServiceCollection) => {
|
|
21
23
|
const bridge = assertEx(services?.bridge, () => 'bridge service not provided')
|
|
22
24
|
const bridgeableToken = assertEx(services?.bridgeableToken, () => 'bridgeableToken service not provided')
|
|
23
25
|
const stateMap = assertEx(services?.ethTxStateMap, () => 'ethTxStateMap service not provided')
|
|
26
|
+
const wallet = assertEx(services?.wallet, () => 'wallet service not provided')
|
|
24
27
|
|
|
25
28
|
const worker = new Worker(
|
|
26
29
|
queueName,
|
|
27
|
-
async (job: Job<
|
|
30
|
+
async (job: Job<EthTransactionPrepareJobData, EthTransactionPrepareJobReturn>) => {
|
|
28
31
|
const { tx } = job.data
|
|
29
32
|
const hash = await PayloadBuilder.hash(tx[0])
|
|
30
33
|
await job.log(`[${hash}] preparing ETH transaction`)
|
|
31
34
|
await job.log(`[${hash}] validating liquiditySource has sufficient allowance`)
|
|
32
|
-
if (!await
|
|
35
|
+
if (!await validateSufficientLiquiditySourceAllowance(tx, bridgeableToken, bridge, job)) {
|
|
33
36
|
throw new Error('Liquidity source does not have sufficient allowance for the bridge to execute the transaction')
|
|
34
37
|
}
|
|
35
38
|
await job.log(`[${hash}] validated liquiditySource has sufficient allowance`)
|
|
36
39
|
await job.log(`[${hash}] validating liquiditySource has sufficient balance`)
|
|
37
|
-
if (!await
|
|
40
|
+
if (!await validateSufficientLiquiditySourceBalance(tx, bridgeableToken, bridge, job)) {
|
|
38
41
|
throw new Error('Liquidity source does not have sufficient balance for the bridge to execute the transaction')
|
|
39
42
|
}
|
|
40
43
|
await job.log(`[${hash}] validated liquiditySource has sufficient balance`)
|
|
@@ -46,13 +49,18 @@ export const createWorker = (connection: Redis, services?: IBridgeServiceCollect
|
|
|
46
49
|
const nonce = hexToBigInt(await PayloadBuilder.hash(tx[0]))
|
|
47
50
|
const preparedTx = await bridge.getFunction('bridgeFromRemote').populateTransaction(srcAddress, destAddress, amount, nonce)
|
|
48
51
|
await job.log(`[${hash}] built ETH transaction`)
|
|
52
|
+
await job.log(`[${hash}] validating tx runner has sufficient ETH for gas`)
|
|
53
|
+
if (!await validateSufficientRunnerEthBalanceForGas(preparedTx, wallet, job)) {
|
|
54
|
+
throw new Error('Transaction runner does not have sufficient ETH to cover estimated gas (with buffer)')
|
|
55
|
+
}
|
|
56
|
+
await job.log(`[${hash}] validated tx runner has sufficient ETH for gas`)
|
|
49
57
|
await job.log(`[${hash}] storing ETH preparedTx`)
|
|
50
58
|
await stateMap.set(hash, { preparedTx })
|
|
51
59
|
await job.log(`[${hash}] stored ETH preparedTx`)
|
|
52
60
|
await job.log(`[${hash}] prepared ETH transaction`)
|
|
53
61
|
return {}
|
|
54
62
|
},
|
|
55
|
-
{ connection },
|
|
63
|
+
{ connection, telemetry },
|
|
56
64
|
)
|
|
57
65
|
|
|
58
66
|
worker.on('failed', (job, err) => {
|