Skip to content

Commit d4022b3

Browse files
committed
updated spec for anchorage service
1 parent e70aca1 commit d4022b3

File tree

1 file changed

+93
-55
lines changed

1 file changed

+93
-55
lines changed

tests/integration/anchorage.spec.ts

Lines changed: 93 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -40,74 +40,88 @@ const l1NetworkMap = [
4040
{
4141
fromAddress: "0x3256bd6fc8b5fa48db95914d0df314465f3f7879",
4242
chainId: 1,
43-
networkName: 'ETH Mainnet'
43+
networkName: 'ETH Mainnet',
44+
withdrawalHash: ["0xf9ee30fb9e9da3b68ed392927bf7fdfc07239c2ac91cde3b30296b326ddf2333"]
4445
},
4546
{
4647
fromAddress: "0x9703d3b2521f3de2d56831f3df9490cbb1487428",
4748
chainId: 11155111,
48-
networkName: 'Sepolia'
49+
networkName: 'Sepolia',
50+
withdrawalHash: ["0x93af1218baa50ff136e9b231360ad727828add096d6035eeae64416194706b11"]
4951
},
5052
{
5153
fromAddress: "0x9703d3b2521f3de2d56831f3df9490cbb1487428",
5254
chainId: 97,
53-
networkName: 'BNB Testnet'
55+
networkName: 'BNB Testnet',
56+
withdrawalHash: ["0x0a41cc0067341b3cf425c14183ffce33d1f1c454587d949b1ee00d9fffd2d243"]
5457
},
5558
]
5659

57-
describe('Anchorage: Integration Test', function () {
58-
it('should find: WithdrawalProven Events', async () => {
59-
const res = await anchorageGraphQLService
60-
.findWithdrawalsProven(
61-
["0x5af94d274be0e1a51f32e056deaa3d9dcd6749af3507a9f457985271d971474a"],
62-
1)
60+
const depositNeworkMap = [
61+
{
62+
fromAddress: "0xd134a7d9485c1aac0cbf82718cf6d6e3fd130945",
63+
name: "Mainnet L1 => L2",
64+
config: {
65+
L1: {
66+
chainId: 1,
67+
name: "ETH Mainnet"
68+
},
69+
L2: {
70+
chainId: 288,
71+
name: "Boba ETH"
72+
}
73+
}
74+
},
75+
{
76+
fromAddress: "0xcba34cb1524a00cda30de92e373261f76abd5014",
77+
name: "Sepolia L1 => L2",
78+
config: {
79+
L1: {
80+
chainId: 11155111,
81+
name: "ETH Sepolia"
82+
},
83+
L2: {
84+
chainId: 28882,
85+
name: "Boba ETH Sepolia"
86+
}
87+
}
88+
},
89+
{
90+
fromAddress: "0x9703d3b2521f3de2d56831f3df9490cbb1487428",
91+
name: "BNB Testnet L1 => L2",
92+
config: {
93+
L1: {
94+
chainId: 97,
95+
name: "BNB Testnet"
96+
},
97+
L2: {
98+
chainId: 9728,
99+
name: "Boba BNB Testnet"
100+
}
101+
}
102+
}
103+
]
63104

64-
expect(res[0].__typename).toEqual('WithdrawalProven')
65-
expect(res[0].transactionHash_).toBeDefined();
66-
expect(res[0].withdrawalHash).toEqual('0x5af94d274be0e1a51f32e056deaa3d9dcd6749af3507a9f457985271d971474a');
67-
});
68-
it('should find: WithdrawalFinalized Events', async () => {
69-
const res = await anchorageGraphQLService
70-
.findWithdrawalsFinalized(
71-
["0xf9ee30fb9e9da3b68ed392927bf7fdfc07239c2ac91cde3b30296b326ddf2333", "0x10b3b0f1b2d20017e1c1036e1f57a7f0876c62dbf93a2bbeea8010a3fcffe4b2"],
72-
1)
105+
describe('Anchorage Service: Integration Test', function () {
73106

74-
expect(res[0].__typename).toEqual('WithdrawalFinalized')
75-
expect(res[0].transactionHash_).toBeDefined();
76-
expect(res[0].block_number).toBeDefined();
77-
expect(res[0].timestamp_).toBeDefined();
78-
expect(res[0].withdrawalHash).toEqual('0xf9ee30fb9e9da3b68ed392927bf7fdfc07239c2ac91cde3b30296b326ddf2333');
79-
});
80-
it('should find: MessagePassed Events via WithdrawalHash', async () => {
81-
const res = await anchorageGraphQLService.findWithdrawalMessagedPassed(
82-
'0x15fd4589111a601b83ce513c508ceb0fb6dbafa5b4f5b42f24bc793eebc67e72',
83-
288)
107+
describe('should find: DepositFinalized txs', () => {
108+
depositNeworkMap.forEach((info) => {
109+
it(`${info.name}`, async () => {
110+
const res = await anchorageGraphQLService.queryDepositTransactions(
111+
new JsonRpcProvider("https://boba-ethereum.gateway.tenderly.co"),
112+
info.fromAddress,
113+
info.config
114+
)
84115

85-
expect(res[0].__typename).toEqual("MessagePassed");
86-
expect(res[0].transactionHash_).toEqual("0x00182e7e904c2a1947c372c21cd1e0efde36badfa249552869861c588c5facf9")
87-
expect(res[0].timestamp_).toEqual("1717425069")
88-
});
89-
it('should find: DepositTransactions, map them and return the transactions', async () => {
90-
const res = await anchorageGraphQLService.queryDepositTransactions(
91-
new JsonRpcProvider("https://boba-ethereum.gateway.tenderly.co"),
92-
"0xd134a7d9485c1aac0cbf82718cf6d6e3fd130945",
93-
{
94-
L1: {
95-
chainId: 1,
96-
name: "name"
97-
},
98-
L2: {
99-
chainId: 288,
100-
name: "name"
101-
}
102-
}
103-
)
116+
expect(res[0].originChainId).toBeDefined();
117+
expect(res[0].destinationChainId).toBeDefined();
118+
expect(res[0].from).toEqual(info.fromAddress);
119+
expect(res[0].to).toEqual(info.fromAddress);
120+
expect(res[0].action.status).toEqual("succeeded");
121+
});
122+
})
123+
})
104124

105-
expect(res[0].originChainId).toEqual(1);
106-
expect(res[0].destinationChainId).toEqual(288);
107-
expect(res[0].from).toEqual("0xd134a7d9485c1aac0cbf82718cf6d6e3fd130945");
108-
expect(res[0].to).toEqual("0xd134a7d9485c1aac0cbf82718cf6d6e3fd130945");
109-
expect(res[0].action.status).toEqual("succeeded");
110-
});
111125

112126
describe('should find WithdrawalsInitiated events', () => {
113127
l2NetworkMap.forEach((info) => {
@@ -140,7 +154,6 @@ describe('Anchorage: Integration Test', function () {
140154
info.chainId)
141155
const ethRes = res.find((d: any) => d.__typename === "ETHBridgeInitiated")
142156
const ercRes = res.find((d: any) => d.__typename === "ERC20BridgeInitiated")
143-
console.log(ethRes);
144157
expect(ethRes.__typename).toEqual('ETHBridgeInitiated')
145158
expect(ethRes.block_number).toBeDefined();
146159
expect(ethRes.timestamp_).toBeDefined();
@@ -152,7 +165,7 @@ describe('Anchorage: Integration Test', function () {
152165
})
153166
})
154167

155-
describe('MessagePassed Events', () => {
168+
describe('should find MessagePassed Events', () => {
156169
l2NetworkMap.forEach((info) => {
157170
if (info.chainId === 56288) {
158171
// skip incase of mainnet bnb as anchorage yet to be release on bnb mainnet.
@@ -179,4 +192,29 @@ describe('Anchorage: Integration Test', function () {
179192
})
180193
})
181194

195+
describe('should find: WithdrawalProven Events', () => {
196+
l1NetworkMap.forEach((info) => {
197+
it(`${info.networkName}`, async () => {
198+
const res = await anchorageGraphQLService
199+
.findWithdrawalsProven(info.withdrawalHash, info.chainId)
200+
201+
expect(res[0].__typename).toEqual('WithdrawalProven')
202+
expect(res[0].transactionHash_).toBeDefined();
203+
expect(res[0].withdrawalHash).toEqual(info.withdrawalHash[0]);
204+
});
205+
})
206+
})
207+
describe('should find: WithdrawalFinalized Events', () => {
208+
l1NetworkMap.forEach((info) => {
209+
it(`${info.networkName}`, async () => {
210+
const res = await anchorageGraphQLService
211+
.findWithdrawalsFinalized(info.withdrawalHash, info.chainId)
212+
213+
expect(res[0].__typename).toEqual('WithdrawalFinalized')
214+
expect(res[0].transactionHash_).toBeDefined();
215+
expect(res[0].withdrawalHash).toEqual(info.withdrawalHash[0]);
216+
expect(res[0].success).toBeTruthy();
217+
});
218+
})
219+
})
182220
});

0 commit comments

Comments
 (0)