@xyo-network/xl1-protocol-sdk 1.18.39 → 1.19.0
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/neutral/config/Bridge.d.ts +15 -15
- package/dist/neutral/index.mjs +21 -11
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/ChainQualification.d.ts +7 -7
- package/dist/neutral/simple/blockValidation/SimpleBlockValidationViewer.d.ts +4 -2
- package/dist/neutral/simple/blockValidation/SimpleBlockValidationViewer.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts +1 -1
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts +1 -1
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
- package/dist/neutral/viewers/ChainContract.d.ts +11 -7
- package/dist/neutral/viewers/ChainContract.d.ts.map +1 -1
- package/dist/neutral/viewers/Finalization.d.ts +1 -1
- package/dist/neutral/viewers/Finalization.d.ts.map +1 -1
- package/dist/neutral/viewers/WindowedBlock.d.ts +1 -2
- package/dist/neutral/viewers/WindowedBlock.d.ts.map +1 -1
- package/package.json +8 -9
- package/src/config/Bridge.ts +1 -1
- package/src/model/ChainQualification.ts +1 -1
- package/src/simple/blockValidation/SimpleBlockValidationViewer.ts +27 -8
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +1 -1
- package/src/validation/block/HydratedBlockValidationFunction.ts +1 -1
- package/src/viewers/ChainContract.ts +15 -8
- package/src/viewers/Finalization.ts +1 -1
- package/src/viewers/WindowedBlock.ts +1 -2
|
@@ -13,11 +13,11 @@ export declare const BridgeConfigZod: z.ZodObject<{
|
|
|
13
13
|
} & {
|
|
14
14
|
readonly __address: true;
|
|
15
15
|
}, string>>>;
|
|
16
|
-
feeFixed: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
16
|
+
feeFixed: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
17
17
|
feeRateBasisPoints: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
18
18
|
host: z.ZodDefault<z.ZodString>;
|
|
19
|
-
maxBridgeAmount: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
20
|
-
minBridgeAmount: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
19
|
+
maxBridgeAmount: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
20
|
+
minBridgeAmount: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
21
21
|
mnemonic: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
22
22
|
port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
23
23
|
redisHost: z.ZodDefault<z.ZodString>;
|
|
@@ -27,11 +27,11 @@ export declare const BridgeConfigZod: z.ZodObject<{
|
|
|
27
27
|
} & {
|
|
28
28
|
readonly __address: true;
|
|
29
29
|
}, string>>>;
|
|
30
|
-
remoteChainId: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
31
|
-
remoteTokenAddress: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
32
|
-
remoteChainWalletPrivateKey: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
33
|
-
xl1ChainId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
34
|
-
xl1TokenAddress: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
30
|
+
remoteChainId: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
31
|
+
remoteTokenAddress: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
32
|
+
remoteChainWalletPrivateKey: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
33
|
+
xl1ChainId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
34
|
+
xl1TokenAddress: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export type BridgeConfig = z.infer<typeof BridgeConfigZod>;
|
|
37
37
|
export declare const BridgeSettingsZod: z.ZodObject<{
|
|
@@ -45,14 +45,14 @@ export declare const BridgeSettingsZod: z.ZodObject<{
|
|
|
45
45
|
} & {
|
|
46
46
|
readonly __address: true;
|
|
47
47
|
}, string>>>>;
|
|
48
|
-
feeFixed: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
48
|
+
feeFixed: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
49
49
|
feeRateBasisPoints: z.ZodNonOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
50
|
-
maxBridgeAmount: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
51
|
-
minBridgeAmount: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
52
|
-
remoteChainId: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
53
|
-
remoteTokenAddress: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
54
|
-
xl1ChainId: z.ZodNonOptional<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
55
|
-
xl1TokenAddress: z.ZodNonOptional<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/
|
|
50
|
+
maxBridgeAmount: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
51
|
+
minBridgeAmount: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
52
|
+
remoteChainId: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
53
|
+
remoteTokenAddress: z.ZodNonOptional<z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
54
|
+
xl1ChainId: z.ZodNonOptional<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
55
|
+
xl1TokenAddress: z.ZodNonOptional<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>>;
|
|
56
56
|
}, z.core.$strip>;
|
|
57
57
|
export type BridgeSettings = z.infer<typeof BridgeSettingsZod>;
|
|
58
58
|
//# sourceMappingURL=Bridge.d.ts.map
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
HexZod,
|
|
29
29
|
toAddress,
|
|
30
30
|
toHex
|
|
31
|
-
} from "@xylabs/
|
|
31
|
+
} from "@xylabs/sdk-js";
|
|
32
32
|
import { AttoXL1ConvertFactor, XL1 } from "@xyo-network/xl1-protocol";
|
|
33
33
|
import { globalRegistry, z as z2 } from "zod";
|
|
34
34
|
|
|
@@ -2217,7 +2217,7 @@ async function withContextCacheResponse(context, name, key, func, { max = 1e4, t
|
|
|
2217
2217
|
}
|
|
2218
2218
|
|
|
2219
2219
|
// src/model/ChainQualification.ts
|
|
2220
|
-
import { HashZod } from "@xylabs/
|
|
2220
|
+
import { HashZod } from "@xylabs/sdk-js";
|
|
2221
2221
|
import { zodIsFactory } from "@xylabs/zod";
|
|
2222
2222
|
import { XL1BlockRangeZod } from "@xyo-network/xl1-protocol";
|
|
2223
2223
|
import { z as z17 } from "zod";
|
|
@@ -3902,7 +3902,10 @@ SimpleBlockRewardViewer = __decorateClass([
|
|
|
3902
3902
|
], SimpleBlockRewardViewer);
|
|
3903
3903
|
|
|
3904
3904
|
// src/simple/blockValidation/SimpleBlockValidationViewer.ts
|
|
3905
|
-
import {
|
|
3905
|
+
import {
|
|
3906
|
+
assertEx as assertEx30,
|
|
3907
|
+
exists as exists5
|
|
3908
|
+
} from "@xylabs/sdk-js";
|
|
3906
3909
|
import {
|
|
3907
3910
|
asXL1BlockRange as asXL1BlockRange11
|
|
3908
3911
|
} from "@xyo-network/xl1-protocol";
|
|
@@ -3910,16 +3913,22 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3910
3913
|
moniker = SimpleBlockValidationViewer.defaultMoniker;
|
|
3911
3914
|
_accountBalanceViewer;
|
|
3912
3915
|
_blockViewer;
|
|
3916
|
+
_chainContractViewer;
|
|
3913
3917
|
_uncleWindowedChainCache = null;
|
|
3914
3918
|
get blockViewer() {
|
|
3915
3919
|
return this._blockViewer;
|
|
3916
3920
|
}
|
|
3921
|
+
get chainContractViewer() {
|
|
3922
|
+
return this._chainContractViewer;
|
|
3923
|
+
}
|
|
3917
3924
|
get maxUncleWindowSize() {
|
|
3918
3925
|
return this.params.maxUncleWindowSize;
|
|
3919
3926
|
}
|
|
3920
3927
|
static async paramsHandler(params) {
|
|
3921
3928
|
return {
|
|
3922
3929
|
...await super.paramsHandler(params),
|
|
3930
|
+
protocol: params.protocol,
|
|
3931
|
+
state: params.state,
|
|
3923
3932
|
maxUncleWindowSize: params.maxUncleWindowSize ?? 100
|
|
3924
3933
|
};
|
|
3925
3934
|
}
|
|
@@ -3927,6 +3936,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3927
3936
|
await super.createHandler();
|
|
3928
3937
|
this._accountBalanceViewer = await this.locator.getInstance(AccountBalanceViewerMoniker);
|
|
3929
3938
|
this._blockViewer = await this.locator.getInstance(BlockViewerMoniker);
|
|
3939
|
+
this._chainContractViewer = await this.locator.getInstance(ChainContractViewerMoniker);
|
|
3930
3940
|
}
|
|
3931
3941
|
async qualifiedValidateBlock(block, config) {
|
|
3932
3942
|
return await this.qualifiedValidateBlocks([block], config);
|
|
@@ -3943,12 +3953,12 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3943
3953
|
() => `Specified a head that is not in the chain [${config.head}]`
|
|
3944
3954
|
) : void 0;
|
|
3945
3955
|
const headBlock = head ?? (await this.blockViewer.currentBlock())[0];
|
|
3946
|
-
const chainId = headBlock.chain;
|
|
3947
3956
|
const validateProtocol = value ? this.doValidateProtocol.bind(this) : void 0;
|
|
3948
3957
|
const validateState = state ? this.doValidateState.bind(this) : void 0;
|
|
3958
|
+
const chainIdAtBlockNumber = (blockNumber) => this.chainContractViewer.chainIdAtBlockNumber(blockNumber);
|
|
3949
3959
|
return [(await Promise.all([
|
|
3950
|
-
validateProtocol?.(blocks,
|
|
3951
|
-
validateState?.(blocks,
|
|
3960
|
+
validateProtocol?.(blocks, chainIdAtBlockNumber),
|
|
3961
|
+
validateState?.(blocks, chainIdAtBlockNumber)
|
|
3952
3962
|
].filter(exists5))).flat(), { head: headBlock._hash, range: asXL1BlockRange11([0, headBlock.block], true) }];
|
|
3953
3963
|
}
|
|
3954
3964
|
async validateBlock(block, config) {
|
|
@@ -3957,15 +3967,15 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3957
3967
|
async validateBlocks(blocks, config) {
|
|
3958
3968
|
return (await this.qualifiedValidateBlocks(blocks, config))[0];
|
|
3959
3969
|
}
|
|
3960
|
-
async doValidateProtocol(blocks,
|
|
3970
|
+
async doValidateProtocol(blocks, chainIdAtBlockNumber) {
|
|
3961
3971
|
return (await Promise.all(blocks.map(async (block) => {
|
|
3962
3972
|
return await this.params.protocol(
|
|
3963
3973
|
block,
|
|
3964
|
-
|
|
3974
|
+
chainIdAtBlockNumber
|
|
3965
3975
|
);
|
|
3966
3976
|
}))).flat();
|
|
3967
3977
|
}
|
|
3968
|
-
async doValidateState(blocks,
|
|
3978
|
+
async doValidateState(blocks, chainIdAtBlockNumber) {
|
|
3969
3979
|
const windowedUncleChain = await this.updateWindowedChainCache();
|
|
3970
3980
|
const uncles = findUncles(this.context, windowedUncleChain, blocks);
|
|
3971
3981
|
if (uncles.length !== 1) {
|
|
@@ -3976,7 +3986,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3976
3986
|
return (await Promise.all(uncles[0].map(async (block) => {
|
|
3977
3987
|
return await this.params.state(
|
|
3978
3988
|
block,
|
|
3979
|
-
|
|
3989
|
+
chainIdAtBlockNumber,
|
|
3980
3990
|
{ accountBalance: this._accountBalanceViewer }
|
|
3981
3991
|
);
|
|
3982
3992
|
}))).flat();
|
|
@@ -3987,7 +3997,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3987
3997
|
}
|
|
3988
3998
|
};
|
|
3989
3999
|
__publicField(SimpleBlockValidationViewer, "defaultMoniker", BlockValidationViewerMoniker);
|
|
3990
|
-
__publicField(SimpleBlockValidationViewer, "dependencies", [AccountBalanceViewerMoniker, BlockViewerMoniker]);
|
|
4000
|
+
__publicField(SimpleBlockValidationViewer, "dependencies", [AccountBalanceViewerMoniker, BlockViewerMoniker, ChainContractViewerMoniker]);
|
|
3991
4001
|
__publicField(SimpleBlockValidationViewer, "monikers", [BlockValidationViewerMoniker]);
|
|
3992
4002
|
SimpleBlockValidationViewer = __decorateClass([
|
|
3993
4003
|
creatableProvider()
|