@xyo-network/chain-bridge 1.19.7 → 1.19.8
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 +17 -17
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/util/calculateBridgeFees.d.ts +1 -1
- package/dist/node/util/calculateBridgeFees.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/config/getBridgeEscrowAddress.ts +2 -2
- package/src/config/getBridgeFeesAddress.ts +2 -2
- package/src/config/getBridgeWalletAccount.ts +1 -1
- package/src/config/getFeeStructure.ts +1 -1
- package/src/config/getGateway.ts +1 -1
- package/src/config/getMaxBridgeAmount.ts +1 -1
- package/src/config/getMinBridgeAmount.ts +1 -1
- package/src/config/getRemoteChainId.ts +1 -1
- package/src/config/getRemoteTokenAddress.ts +1 -1
- package/src/config/getXl1ChainId.ts +1 -1
- package/src/config/getXl1TokenAddress.ts +1 -1
- package/src/manifest/getModuleLocator.ts +1 -1
- package/src/manifest/getNode.ts +1 -1
- package/src/manifest/getServices.ts +1 -1
- package/src/queue/connection.ts +1 -1
- package/src/server/server.ts +2 -2
- package/src/util/calculateBridgeFees.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Hex } from '@xylabs/sdk-js';
|
|
2
2
|
import type { Config } from '@xyo-network/xl1-sdk';
|
|
3
|
-
export type FeeStructure = Pick<Config['bridge'], 'feeFixed' | 'feeRateBasisPoints'>;
|
|
3
|
+
export type FeeStructure = Pick<Config['actors']['bridge'], 'feeFixed' | 'feeRateBasisPoints'>;
|
|
4
4
|
export interface FeeCalculationResult {
|
|
5
5
|
destAmount: Hex;
|
|
6
6
|
feeFixed: Hex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateBridgeFees.d.ts","sourceRoot":"","sources":["../../../src/util/calculateBridgeFees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,oBAAoB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"calculateBridgeFees.d.ts","sourceRoot":"","sources":["../../../src/util/calculateBridgeFees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,oBAAoB,CAAC,CAAA;AAE9F,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,GAAG,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;IACb,WAAW,EAAE,GAAG,CAAA;CACjB;AAED,eAAO,MAAM,mBAAmB,GAAI,WAAW,GAAG,EAAE,cAAc,YAAY,KAAG,oBA0BhF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/chain-bridge",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.8",
|
|
4
4
|
"description": "XYO Layer One Bridge",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"@opentelemetry/instrumentation": "~0.211.0",
|
|
53
53
|
"@opentelemetry/instrumentation-express": "~0.59.0",
|
|
54
54
|
"@opentelemetry/instrumentation-http": "~0.211.0",
|
|
55
|
-
"@xylabs/express": "~5.0.
|
|
56
|
-
"@xylabs/mongo": "~5.0.
|
|
57
|
-
"@xylabs/sdk-js": "~5.0.
|
|
55
|
+
"@xylabs/express": "~5.0.78",
|
|
56
|
+
"@xylabs/mongo": "~5.0.78",
|
|
57
|
+
"@xylabs/sdk-js": "~5.0.78",
|
|
58
58
|
"@xyo-network/archivist-memory": "~5.3.2",
|
|
59
59
|
"@xyo-network/archivist-mongodb": "~5.3.2",
|
|
60
60
|
"@xyo-network/archivist-view": "~5.3.2",
|
|
61
61
|
"@xyo-network/bios": "~7.2.1",
|
|
62
62
|
"@xyo-network/boundwitness-validator": "~5.3.2",
|
|
63
|
-
"@xyo-network/chain-orchestration": "~1.19.
|
|
64
|
-
"@xyo-network/chain-protocol": "~1.19.
|
|
65
|
-
"@xyo-network/chain-services": "~1.19.
|
|
66
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
63
|
+
"@xyo-network/chain-orchestration": "~1.19.8",
|
|
64
|
+
"@xyo-network/chain-protocol": "~1.19.8",
|
|
65
|
+
"@xyo-network/chain-services": "~1.19.8",
|
|
66
|
+
"@xyo-network/chain-telemetry": "~1.19.8",
|
|
67
67
|
"@xyo-network/manifest-model": "~5.3.2",
|
|
68
68
|
"@xyo-network/manifest-wrapper": "~5.3.2",
|
|
69
69
|
"@xyo-network/module-abstract": "~5.3.2",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@xyo-network/typechain": "~4.1.1",
|
|
79
79
|
"@xyo-network/wallet": "~5.3.2",
|
|
80
80
|
"@xyo-network/wallet-model": "~5.3.2",
|
|
81
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
81
|
+
"@xyo-network/xl1-sdk": "~1.23.6",
|
|
82
82
|
"async-mutex": "~0.5.0",
|
|
83
83
|
"bullmq": "~5.67.3",
|
|
84
84
|
"compression": "~1.8.1",
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
"@types/cors": "~2.8.19",
|
|
96
96
|
"@types/express": "5.0.6",
|
|
97
97
|
"@types/express-serve-static-core": "~5.1.1",
|
|
98
|
-
"@types/node": "~25.2.
|
|
99
|
-
"@xylabs/axios": "~5.0.
|
|
100
|
-
"@xylabs/mongo": "~5.0.
|
|
101
|
-
"@xylabs/sdk-js": "~5.0.
|
|
98
|
+
"@types/node": "~25.2.3",
|
|
99
|
+
"@xylabs/axios": "~5.0.78",
|
|
100
|
+
"@xylabs/mongo": "~5.0.78",
|
|
101
|
+
"@xylabs/sdk-js": "~5.0.78",
|
|
102
102
|
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
103
103
|
"@xylabs/tsconfig": "~7.3.2",
|
|
104
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
104
|
+
"@xylabs/vitest-extended": "~5.0.78",
|
|
105
105
|
"@xyo-network/account": "~5.3.2",
|
|
106
106
|
"@xyo-network/account-model": "~5.3.2",
|
|
107
107
|
"@xyo-network/archivist-abstract": "~5.3.2",
|
|
@@ -112,9 +112,9 @@
|
|
|
112
112
|
"@xyo-network/bios": "~7.2.1",
|
|
113
113
|
"@xyo-network/bios-model": "~7.2.1",
|
|
114
114
|
"@xyo-network/boundwitness-builder": "~5.3.2",
|
|
115
|
-
"@xyo-network/chain-protocol": "~1.19.
|
|
116
|
-
"@xyo-network/chain-services": "~1.19.
|
|
117
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
115
|
+
"@xyo-network/chain-protocol": "~1.19.8",
|
|
116
|
+
"@xyo-network/chain-services": "~1.19.8",
|
|
117
|
+
"@xyo-network/chain-telemetry": "~1.19.8",
|
|
118
118
|
"@xyo-network/manifest-wrapper": "~5.3.2",
|
|
119
119
|
"@xyo-network/module-abstract": "~5.3.2",
|
|
120
120
|
"@xyo-network/module-abstract-mongodb": "~5.3.2",
|
|
@@ -123,14 +123,14 @@
|
|
|
123
123
|
"@xyo-network/payload-builder": "~5.3.2",
|
|
124
124
|
"@xyo-network/sentinel-memory": "~5.3.2",
|
|
125
125
|
"@xyo-network/wallet": "~5.3.2",
|
|
126
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
126
|
+
"@xyo-network/xl1-sdk": "~1.23.6",
|
|
127
127
|
"async-mutex": "~0.5.0",
|
|
128
|
-
"axios": "~1.13.
|
|
128
|
+
"axios": "~1.13.5",
|
|
129
129
|
"dotenv": "~17.2.4",
|
|
130
130
|
"eslint": "^9.39.2",
|
|
131
131
|
"ethers": "^6.16.0",
|
|
132
132
|
"http-status-codes": "~2.3.0",
|
|
133
|
-
"mongodb": "~7.
|
|
133
|
+
"mongodb": "~7.1.0",
|
|
134
134
|
"nodemon": "~3.1.11",
|
|
135
135
|
"tslib": "~2.8.1",
|
|
136
136
|
"typescript": "~5.9.3",
|
|
@@ -3,11 +3,11 @@ import { asAddress, assertEx } from '@xylabs/sdk-js'
|
|
|
3
3
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
4
4
|
|
|
5
5
|
export const tryGetBridgeEscrowAddress = (config: Config): Address | undefined => {
|
|
6
|
-
const address = asAddress(config.bridge.escrowAddress)
|
|
6
|
+
const address = asAddress(config.actors.bridge.escrowAddress)
|
|
7
7
|
return address
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const getBridgeEscrowAddress = (config: Config): Address => {
|
|
11
|
-
const address = assertEx(tryGetBridgeEscrowAddress(config), () => `Invalid bridge escrow address: ${config.bridge.escrowAddress}`)
|
|
11
|
+
const address = assertEx(tryGetBridgeEscrowAddress(config), () => `Invalid bridge escrow address: ${config.actors.bridge.escrowAddress}`)
|
|
12
12
|
return address
|
|
13
13
|
}
|
|
@@ -3,11 +3,11 @@ import { asAddress, assertEx } from '@xylabs/sdk-js'
|
|
|
3
3
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
4
4
|
|
|
5
5
|
export const tryGetBridgeFeesAddress = (config: Config): Address | undefined => {
|
|
6
|
-
const address = asAddress(config.bridge.feesAddress)
|
|
6
|
+
const address = asAddress(config.actors.bridge.feesAddress)
|
|
7
7
|
return address
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const getBridgeFeesAddress = (config: Config): Address => {
|
|
11
|
-
const address = assertEx(tryGetBridgeFeesAddress(config), () => `Invalid bridge fees address: ${config.bridge.feesAddress}`)
|
|
11
|
+
const address = assertEx(tryGetBridgeFeesAddress(config), () => `Invalid bridge fees address: ${config.actors.bridge.feesAddress}`)
|
|
12
12
|
return address
|
|
13
13
|
}
|
|
@@ -9,7 +9,7 @@ let accountServiceSingleton: Promisable<WalletInstance> | undefined
|
|
|
9
9
|
|
|
10
10
|
export const getBridgeWalletAccount = async (config: Config): Promise<WalletInstance> => {
|
|
11
11
|
if (accountServiceSingleton) return accountServiceSingleton
|
|
12
|
-
let walletPhrase = config.bridge.mnemonic
|
|
12
|
+
let walletPhrase = config.actors.bridge.mnemonic
|
|
13
13
|
if (isUndefined(walletPhrase)) {
|
|
14
14
|
console.log('[Bridge] No wallet mnemonic specified!')
|
|
15
15
|
const randomMnemonic = HDWallet.generateMnemonic()
|
|
@@ -3,6 +3,6 @@ import type { Config } from '@xyo-network/xl1-sdk'
|
|
|
3
3
|
import type { FeeStructure } from '../util/index.ts'
|
|
4
4
|
|
|
5
5
|
export const getFeeStructure = (config: Config): FeeStructure => {
|
|
6
|
-
const { feeFixed, feeRateBasisPoints } = config.bridge
|
|
6
|
+
const { feeFixed, feeRateBasisPoints } = config.actors.bridge
|
|
7
7
|
return { feeFixed, feeRateBasisPoints }
|
|
8
8
|
}
|
package/src/config/getGateway.ts
CHANGED
|
@@ -11,7 +11,7 @@ let gatewayInstance: XyoGatewayRunner | undefined
|
|
|
11
11
|
|
|
12
12
|
export const getGateway = async (config: Config): Promise<XyoGatewayRunner> => {
|
|
13
13
|
if (isDefined(gatewayInstance)) return gatewayInstance
|
|
14
|
-
const { mnemonic, chainRpcApiUrl: endpoint } = config.bridge
|
|
14
|
+
const { mnemonic, chainRpcApiUrl: endpoint } = config.actors.bridge
|
|
15
15
|
const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()
|
|
16
16
|
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)
|
|
17
17
|
const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)
|
|
@@ -2,6 +2,6 @@ import type { Hex } from '@xylabs/sdk-js'
|
|
|
2
2
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export const getMaxBridgeAmount = (config: Config): Hex => {
|
|
5
|
-
const { maxBridgeAmount } = config.bridge
|
|
5
|
+
const { maxBridgeAmount } = config.actors.bridge
|
|
6
6
|
return maxBridgeAmount
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@ import type { Hex } from '@xylabs/sdk-js'
|
|
|
2
2
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export const getMinBridgeAmount = (config: Config): Hex => {
|
|
5
|
-
const { minBridgeAmount } = config.bridge
|
|
5
|
+
const { minBridgeAmount } = config.actors.bridge
|
|
6
6
|
return minBridgeAmount
|
|
7
7
|
}
|
|
@@ -4,6 +4,6 @@ import type { ChainId, Config } from '@xyo-network/xl1-sdk'
|
|
|
4
4
|
import { asChainId } from './asChainId.ts'
|
|
5
5
|
|
|
6
6
|
export const getRemoteChainId = (config: Config): ChainId => {
|
|
7
|
-
const remoteChainId = assertEx(asChainId(config.bridge.remoteChainId), () => 'Invalid remote chain ID in config')
|
|
7
|
+
const remoteChainId = assertEx(asChainId(config.actors.bridge.remoteChainId), () => 'Invalid remote chain ID in config')
|
|
8
8
|
return remoteChainId
|
|
9
9
|
}
|
|
@@ -5,6 +5,6 @@ import type { Config } from '@xyo-network/xl1-sdk'
|
|
|
5
5
|
import { asToken } from './asToken.ts'
|
|
6
6
|
|
|
7
7
|
export const getRemoteTokenAddress = (config: Config): Address => {
|
|
8
|
-
const token = asToken(config.bridge.remoteTokenAddress)
|
|
8
|
+
const token = asToken(config.actors.bridge.remoteTokenAddress)
|
|
9
9
|
return assertEx(token, () => 'Remote token address is not defined in bridge configuration')
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import type { ChainId, Config } from '@xyo-network/xl1-sdk'
|
|
|
4
4
|
import { asChainId } from './asChainId.ts'
|
|
5
5
|
|
|
6
6
|
export const getXl1ChainId = (config: Config): ChainId => {
|
|
7
|
-
const xl1ChainId = config.bridge.xl1ChainId
|
|
7
|
+
const xl1ChainId = config.actors.bridge.xl1ChainId
|
|
8
8
|
if (isDefined(xl1ChainId)) {
|
|
9
9
|
return assertEx(asChainId(xl1ChainId), () => 'Invalid xl1ChainId in bridge config')
|
|
10
10
|
}
|
|
@@ -6,7 +6,7 @@ import { asToken } from './asToken.ts'
|
|
|
6
6
|
import { getXl1ChainId } from './getXl1ChainId.ts'
|
|
7
7
|
|
|
8
8
|
export const getXl1TokenAddress = (config: Config): Hex => {
|
|
9
|
-
const token = asToken(config.bridge.xl1TokenAddress)
|
|
9
|
+
const token = asToken(config.actors.bridge.xl1TokenAddress)
|
|
10
10
|
if (isDefined(token)) return token
|
|
11
11
|
return getXl1ChainId(config)
|
|
12
12
|
}
|
|
@@ -109,7 +109,7 @@ export const getModuleLocator = async (context: GetLocatorContext) => {
|
|
|
109
109
|
'liquidity_bridge_eth_xl1_bridge_completed',
|
|
110
110
|
)
|
|
111
111
|
const provider = await initEvmProvider({ config })
|
|
112
|
-
const bridgeAddress = config.bridge.remoteBridgeContractAddress
|
|
112
|
+
const bridgeAddress = config.actors.bridge.remoteBridgeContractAddress
|
|
113
113
|
const evmLiquidityBridgeTransactionCompletionMonitorSentinelParams: EVMLiquidityBridgeTransactionCompletionMonitorSentinelParams = {
|
|
114
114
|
bridgeAddress,
|
|
115
115
|
completedTransactions: completedEthXl1BridgeTransactions,
|
package/src/manifest/getNode.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface GetNodeContext {
|
|
|
23
23
|
*/
|
|
24
24
|
export const getNode = async (context: GetNodeContext) => {
|
|
25
25
|
const { config, wallet } = context
|
|
26
|
-
const { chainRpcApiUrl: endpoint } = config.bridge
|
|
26
|
+
const { chainRpcApiUrl: endpoint } = config.actors.bridge
|
|
27
27
|
const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(endpoint, schemas)
|
|
28
28
|
const signerAccount = await getBridgeWalletAccount(config)
|
|
29
29
|
const locator = await buildJsonRpcProviderLocator({ signerAccount, transportFactory })
|
|
@@ -30,7 +30,7 @@ export const getServices = async (context: GetServicesContext): Promise<IBridgeS
|
|
|
30
30
|
const provider = await initEvmProvider({ config })
|
|
31
31
|
const {
|
|
32
32
|
remoteBridgeContractAddress, remoteChainWalletPrivateKey, remoteTokenAddress, mnemonic,
|
|
33
|
-
} = config.bridge
|
|
33
|
+
} = config.actors.bridge
|
|
34
34
|
const account = isDefined(mnemonic) ? await HDWallet.fromPhrase(mnemonic) : await HDWallet.random()
|
|
35
35
|
const wallet = new Wallet(remoteChainWalletPrivateKey, provider)
|
|
36
36
|
const bridgeableToken = BridgeableToken__factory.connect(getAddress(remoteTokenAddress), wallet)
|
package/src/queue/connection.ts
CHANGED
|
@@ -8,7 +8,7 @@ const maxRetriesPerRequest = null
|
|
|
8
8
|
|
|
9
9
|
export const getConnection = (config: Config) => {
|
|
10
10
|
if (isDefined(connection)) return connection
|
|
11
|
-
const { redisHost: host, redisPort: port } = config.bridge
|
|
11
|
+
const { redisHost: host, redisPort: port } = config.actors.bridge
|
|
12
12
|
connection = new Redis({
|
|
13
13
|
host, port, maxRetriesPerRequest,
|
|
14
14
|
})
|
package/src/server/server.ts
CHANGED
|
@@ -18,7 +18,7 @@ const hostname = '::'
|
|
|
18
18
|
const getSeedPhrase = async (bios: BiosExternalInterface, config: Config, logger?: Logger): Promise<string> => {
|
|
19
19
|
const storedSeedPhrase = await bios.seedPhraseStore.get('os')
|
|
20
20
|
logger?.debug(`[Bridge] Stored mnemonic: ${storedSeedPhrase}`)
|
|
21
|
-
const { mnemonic } = config.api
|
|
21
|
+
const { mnemonic } = config.actors.api
|
|
22
22
|
if (isString(storedSeedPhrase) && isString(mnemonic)) {
|
|
23
23
|
logger?.warn('[Bridge] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.')
|
|
24
24
|
await bios.seedPhraseStore.set('os', mnemonic)
|
|
@@ -44,7 +44,7 @@ interface GetServerContext {
|
|
|
44
44
|
|
|
45
45
|
export const getServer = async (context: GetServerContext) => {
|
|
46
46
|
const { logger, config } = context
|
|
47
|
-
const { port, mnemonic } = config.bridge
|
|
47
|
+
const { port, mnemonic } = config.actors.bridge
|
|
48
48
|
const bios = await boot()
|
|
49
49
|
const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)
|
|
50
50
|
const wallet = await HDWallet.fromPhrase(seedPhrase)
|
|
@@ -2,7 +2,7 @@ import type { Hex } from '@xylabs/sdk-js'
|
|
|
2
2
|
import { hexToBigInt, toHex } from '@xylabs/sdk-js'
|
|
3
3
|
import type { Config } from '@xyo-network/xl1-sdk'
|
|
4
4
|
|
|
5
|
-
export type FeeStructure = Pick<Config['bridge'], 'feeFixed' | 'feeRateBasisPoints'>
|
|
5
|
+
export type FeeStructure = Pick<Config['actors']['bridge'], 'feeFixed' | 'feeRateBasisPoints'>
|
|
6
6
|
|
|
7
7
|
export interface FeeCalculationResult {
|
|
8
8
|
destAmount: Hex
|