@@ -26,111 +26,32 @@ export function _isAcrossTestnetBridge (srcChain: string): boolean {
26
26
return srcChain === 'base_sepolia' || srcChain === 'arbitrum_sepolia' || srcChain === COMMON_CHAIN_SLUGS . ETHEREUM_SEPOLIA ;
27
27
}
28
28
29
- export const SpokePoolMapping : Record < number , { SpokePool : { address : string ; blockNumber : number } } > = {
30
- 1 : {
31
- SpokePool : { address : '0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5' , blockNumber : 17117454 }
32
- } ,
33
- 10 : {
34
- SpokePool : { address : '0x6f26Bf09B1C792e3228e5467807a900A503c0281' , blockNumber : 93903076 }
35
- } ,
36
- 11155111 : {
37
- SpokePool : { address : '0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662' , blockNumber : 5288470 }
38
- } ,
39
- 11155420 : {
40
- SpokePool : { address : '0x4e8E101924eDE233C13e2D8622DC8aED2872d505' , blockNumber : 7762656 }
41
- } ,
42
- 1135 : {
43
- SpokePool : { address : '0x9552a0a6624A23B848060AE5901659CDDa1f83f8' , blockNumber : 2602337 }
44
- } ,
45
- 130 : {
46
- SpokePool : { address : '0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64' , blockNumber : 7915488 }
47
- } ,
48
- 137 : {
49
- SpokePool : { address : '0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096' , blockNumber : 41908657 }
50
- } ,
51
- 168587773 : {
52
- SpokePool : { address : '0x5545092553Cf5Bf786e87a87192E902D50D8f022' , blockNumber : 7634204 }
53
- } ,
54
- 1868 : {
55
- SpokePool : { address : '0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96' , blockNumber : 1709997 }
56
- } ,
57
- 288 : {
58
- SpokePool : { address : '0xBbc6009fEfFc27ce705322832Cb2068F8C1e0A58' , blockNumber : 619993 }
59
- } ,
60
- 324 : {
61
- SpokePool : { address : '0xE0B015E54d54fc84a6cB9B666099c46adE9335FF' , blockNumber : 10352565 }
62
- } ,
63
- 34443 : {
64
- SpokePool : { address : '0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96' , blockNumber : 8043187 }
65
- } ,
66
- 37111 : {
67
- SpokePool : { address : '0x6A0a7f39530923911832Dd60667CE5da5449967B' , blockNumber : 156275 }
68
- } ,
69
- 41455 : {
70
- SpokePool : { address : '0x13fDac9F9b4777705db45291bbFF3c972c6d1d97' , blockNumber : 4240318 }
71
- } ,
72
- 4202 : {
73
- SpokePool : { address : '0xeF684C38F94F48775959ECf2012D7E864ffb9dd4' , blockNumber : 7267988 }
74
- } ,
75
- 42161 : {
76
- SpokePool : { address : '0xe35e9842fceaCA96570B734083f4a58e8F7C5f2A' , blockNumber : 83868041 }
77
- } ,
78
- 421614 : {
79
- SpokePool : { address : '0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75' , blockNumber : 12411026 }
80
- } ,
81
- 480 : {
82
- SpokePool : { address : '0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64' , blockNumber : 4524742 }
83
- } ,
84
- 534352 : {
85
- SpokePool : { address : '0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96' , blockNumber : 7489705 }
86
- } ,
87
- 57073 : {
88
- SpokePool : { address : '0xeF684C38F94F48775959ECf2012D7E864ffb9dd4' , blockNumber : 1139240 }
89
- } ,
90
- 59144 : {
91
- SpokePool : { address : '0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75' , blockNumber : 2721169 }
92
- } ,
93
- 690 : {
94
- SpokePool : { address : '0x13fDac9F9b4777705db45291bbFF3c972c6d1d97' , blockNumber : 5512122 }
95
- } ,
96
- 7777777 : {
97
- SpokePool : { address : '0x13fDac9F9b4777705db45291bbFF3c972c6d1d97' , blockNumber : 18382867 }
98
- } ,
99
- 80002 : {
100
- SpokePool : { address : '0xd08baaE74D6d2eAb1F3320B2E1a53eeb391ce8e5' , blockNumber : 7529960 }
101
- } ,
102
- 81457 : {
103
- SpokePool : { address : '0x2D509190Ed0172ba588407D4c2df918F955Cc6E1' , blockNumber : 5574280 }
104
- } ,
105
- 8453 : {
106
- SpokePool : { address : '0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64' , blockNumber : 2164878 }
107
- } ,
108
- 84532 : {
109
- SpokePool : { address : '0x82B564983aE7274c86695917BBf8C99ECb6F0F8F' , blockNumber : 6082004 }
110
- } ,
111
- 919 : {
112
- SpokePool : { address : '0xbd886FC0725Cc459b55BbFEb3E4278610331f83b' , blockNumber : 13999465 }
113
- }
114
- } ;
115
-
116
29
export const AcrossErrorMsg = {
117
30
AMOUNT_TOO_LOW : 'amount too low' ,
118
31
AMOUNT_TOO_HIGH : 'amount too high'
119
32
} ;
120
33
121
- interface AcrossQuote {
34
+ export interface AcrossQuote {
122
35
outputAmount : string ;
123
36
rate : string ;
124
37
}
125
38
39
+ interface XcmApiResponse {
40
+ sender : string ;
41
+ to : string ;
42
+ transferEncodedCall : string ;
43
+ value : string ;
44
+ metadata ?: any ;
45
+ }
46
+
126
47
// Calculate fee for across bridge transfer
127
48
export const getAcrossQuote = async ( { destinationChain,
128
49
destinationTokenInfo,
129
50
originChain,
130
51
originTokenInfo,
131
52
recipient,
132
53
sender,
133
- sendingValue } : CreateXcmExtrinsicProps ) : Promise < AcrossQuote > => {
54
+ sendingValue } : CreateXcmExtrinsicProps ) => {
134
55
const isAcrossBridgeXcm = _isAcrossBridgeXcm ( originChain , destinationChain ) ;
135
56
136
57
if ( ! isAcrossBridgeXcm ) {
@@ -144,12 +65,99 @@ export const getAcrossQuote = async ({ destinationChain,
144
65
try {
145
66
const data = await subwalletApiSdk . xcmApi ?. fetchXcmData ( sender , originTokenInfo . slug , destinationTokenInfo . slug , recipient , sendingValue ) ;
146
67
147
- if ( ! data || ! data . metadata ) {
148
- throw new Error ( 'Failed to get AcrossBridge quote ' ) ;
68
+ if ( ! data ) {
69
+ throw new Error ( 'Failed to fetch Across Bridge Data. Please try again later ' ) ;
149
70
}
150
71
151
- return data . metadata as AcrossQuote ;
72
+ return data as XcmApiResponse ;
152
73
} catch ( error ) {
153
74
return Promise . reject ( error ) ;
154
75
}
155
76
} ;
77
+
78
+ // export const SpokePoolMapping: Record<number, { SpokePool: { address: string; blockNumber: number } }> = {
79
+ // 1: {
80
+ // SpokePool: { address: '0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5', blockNumber: 17117454 }
81
+ // },
82
+ // 10: {
83
+ // SpokePool: { address: '0x6f26Bf09B1C792e3228e5467807a900A503c0281', blockNumber: 93903076 }
84
+ // },
85
+ // 11155111: {
86
+ // SpokePool: { address: '0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662', blockNumber: 5288470 }
87
+ // },
88
+ // 11155420: {
89
+ // SpokePool: { address: '0x4e8E101924eDE233C13e2D8622DC8aED2872d505', blockNumber: 7762656 }
90
+ // },
91
+ // 1135: {
92
+ // SpokePool: { address: '0x9552a0a6624A23B848060AE5901659CDDa1f83f8', blockNumber: 2602337 }
93
+ // },
94
+ // 130: {
95
+ // SpokePool: { address: '0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64', blockNumber: 7915488 }
96
+ // },
97
+ // 137: {
98
+ // SpokePool: { address: '0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096', blockNumber: 41908657 }
99
+ // },
100
+ // 168587773: {
101
+ // SpokePool: { address: '0x5545092553Cf5Bf786e87a87192E902D50D8f022', blockNumber: 7634204 }
102
+ // },
103
+ // 1868: {
104
+ // SpokePool: { address: '0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96', blockNumber: 1709997 }
105
+ // },
106
+ // 288: {
107
+ // SpokePool: { address: '0xBbc6009fEfFc27ce705322832Cb2068F8C1e0A58', blockNumber: 619993 }
108
+ // },
109
+ // 324: {
110
+ // SpokePool: { address: '0xE0B015E54d54fc84a6cB9B666099c46adE9335FF', blockNumber: 10352565 }
111
+ // },
112
+ // 34443: {
113
+ // SpokePool: { address: '0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96', blockNumber: 8043187 }
114
+ // },
115
+ // 37111: {
116
+ // SpokePool: { address: '0x6A0a7f39530923911832Dd60667CE5da5449967B', blockNumber: 156275 }
117
+ // },
118
+ // 41455: {
119
+ // SpokePool: { address: '0x13fDac9F9b4777705db45291bbFF3c972c6d1d97', blockNumber: 4240318 }
120
+ // },
121
+ // 4202: {
122
+ // SpokePool: { address: '0xeF684C38F94F48775959ECf2012D7E864ffb9dd4', blockNumber: 7267988 }
123
+ // },
124
+ // 42161: {
125
+ // SpokePool: { address: '0xe35e9842fceaCA96570B734083f4a58e8F7C5f2A', blockNumber: 83868041 }
126
+ // },
127
+ // 421614: {
128
+ // SpokePool: { address: '0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75', blockNumber: 12411026 }
129
+ // },
130
+ // 480: {
131
+ // SpokePool: { address: '0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64', blockNumber: 4524742 }
132
+ // },
133
+ // 534352: {
134
+ // SpokePool: { address: '0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96', blockNumber: 7489705 }
135
+ // },
136
+ // 57073: {
137
+ // SpokePool: { address: '0xeF684C38F94F48775959ECf2012D7E864ffb9dd4', blockNumber: 1139240 }
138
+ // },
139
+ // 59144: {
140
+ // SpokePool: { address: '0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75', blockNumber: 2721169 }
141
+ // },
142
+ // 690: {
143
+ // SpokePool: { address: '0x13fDac9F9b4777705db45291bbFF3c972c6d1d97', blockNumber: 5512122 }
144
+ // },
145
+ // 7777777: {
146
+ // SpokePool: { address: '0x13fDac9F9b4777705db45291bbFF3c972c6d1d97', blockNumber: 18382867 }
147
+ // },
148
+ // 80002: {
149
+ // SpokePool: { address: '0xd08baaE74D6d2eAb1F3320B2E1a53eeb391ce8e5', blockNumber: 7529960 }
150
+ // },
151
+ // 81457: {
152
+ // SpokePool: { address: '0x2D509190Ed0172ba588407D4c2df918F955Cc6E1', blockNumber: 5574280 }
153
+ // },
154
+ // 8453: {
155
+ // SpokePool: { address: '0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64', blockNumber: 2164878 }
156
+ // },
157
+ // 84532: {
158
+ // SpokePool: { address: '0x82B564983aE7274c86695917BBf8C99ECb6F0F8F', blockNumber: 6082004 }
159
+ // },
160
+ // 919: {
161
+ // SpokePool: { address: '0xbd886FC0725Cc459b55BbFEb3E4278610331f83b', blockNumber: 13999465 }
162
+ // }
163
+ // };
0 commit comments