File tree Expand file tree Collapse file tree 5 files changed +51
-48
lines changed
packages/thirdweb/src/bridge Expand file tree Collapse file tree 5 files changed +51
-48
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ describe("Bridge.Buy.quote", () => {
29
29
buyAmountWei : toWei ( "1000000000" ) ,
30
30
client : TEST_CLIENT ,
31
31
} ) ,
32
- ) . rejects . toThrowErrorMatchingInlineSnapshot (
33
- `[Error: AmountTooHigh | The provided amount is too high for the requested route.]` ,
34
- ) ;
32
+ ) . rejects . toThrowErrorMatchingInlineSnapshot ( `[Error: AMOUNT_TOO_HIGH | The provided amount is too high for the requested route.]` ) ;
35
33
} ) ;
36
34
} ) ;
37
35
@@ -67,8 +65,6 @@ describe("Bridge.Buy.prepare", () => {
67
65
receiver : "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" ,
68
66
client : TEST_CLIENT ,
69
67
} ) ,
70
- ) . rejects . toThrowErrorMatchingInlineSnapshot (
71
- `[Error: AmountTooHigh | The provided amount is too high for the requested route.]` ,
72
- ) ;
68
+ ) . rejects . toThrowErrorMatchingInlineSnapshot ( `[Error: AMOUNT_TOO_HIGH | The provided amount is too high for the requested route.]` ) ;
73
69
} ) ;
74
70
} ) ;
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ describe("Bridge.Sell.quote", () => {
29
29
sellAmountWei : toWei ( "1000000000" ) ,
30
30
client : TEST_CLIENT ,
31
31
} ) ,
32
- ) . rejects . toThrowErrorMatchingInlineSnapshot (
33
- `[Error: AmountTooHigh | The provided amount is too high for the requested route.]` ,
34
- ) ;
32
+ ) . rejects . toThrowErrorMatchingInlineSnapshot ( `[Error: AMOUNT_TOO_HIGH | The provided amount is too high for the requested route.]` ) ;
35
33
} ) ;
36
34
} ) ;
37
35
@@ -67,8 +65,6 @@ describe("Bridge.Sell.prepare", () => {
67
65
receiver : "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" ,
68
66
client : TEST_CLIENT ,
69
67
} ) ,
70
- ) . rejects . toThrowErrorMatchingInlineSnapshot (
71
- `[Error: AmountTooHigh | The provided amount is too high for the requested route.]` ,
72
- ) ;
68
+ ) . rejects . toThrowErrorMatchingInlineSnapshot ( `[Error: AMOUNT_TOO_HIGH | The provided amount is too high for the requested route.]` ) ;
73
69
} ) ;
74
70
} ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ describe("Bridge.status", () => {
12
12
} ) ;
13
13
14
14
expect ( result ) . toBeDefined ( ) ;
15
- expect ( result . status ) . toBe ( "completed " ) ;
15
+ expect ( result . status ) . toBe ( "COMPLETED " ) ;
16
16
expect ( result ) . toMatchInlineSnapshot ( `
17
17
{
18
18
"destinationAmount": 188625148000000n,
@@ -21,7 +21,7 @@ describe("Bridge.status", () => {
21
21
"originAmount": 200000000000000n,
22
22
"originChainId": 8453,
23
23
"originTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
24
- "status": "completed ",
24
+ "status": "COMPLETED ",
25
25
"transactions": [
26
26
{
27
27
"chainId": 8453,
Original file line number Diff line number Diff line change @@ -114,16 +114,16 @@ export async function status(options: status.Options): Promise<status.Result> {
114
114
}
115
115
116
116
const { data } : { data : Status } = await response . json ( ) ;
117
- if ( data . status === "failed " ) {
117
+ if ( data . status === "FAILED " ) {
118
118
return {
119
- status : "failed " ,
119
+ status : "FAILED " ,
120
120
transactions : data . transactions ,
121
121
} ;
122
122
}
123
123
124
- if ( data . status === "pending " ) {
124
+ if ( data . status === "PENDING " ) {
125
125
return {
126
- status : "pending " ,
126
+ status : "PENDING " ,
127
127
originAmount : BigInt ( data . originAmount ) ,
128
128
originChainId : data . originChainId ,
129
129
destinationChainId : data . destinationChainId ,
@@ -133,8 +133,15 @@ export async function status(options: status.Options): Promise<status.Result> {
133
133
} ;
134
134
}
135
135
136
+ if ( data . status === "NOT_FOUND" ) {
137
+ return {
138
+ status : "NOT_FOUND" ,
139
+ transactions : [ ] ,
140
+ } ;
141
+ }
142
+
136
143
return {
137
- status : "completed " ,
144
+ status : "COMPLETED " ,
138
145
originAmount : BigInt ( data . originAmount ) ,
139
146
destinationAmount : BigInt ( data . destinationAmount ) ,
140
147
originChainId : data . originChainId ,
Original file line number Diff line number Diff line change @@ -2,34 +2,38 @@ import type { Address as ox__Address, Hex as ox__Hex } from "ox";
2
2
3
3
export type Status =
4
4
| {
5
- status : "completed " ;
6
- originAmount : bigint ;
7
- destinationAmount : bigint ;
8
- originChainId : number ;
9
- destinationChainId : number ;
10
- originTokenAddress : ox__Address . Address ;
11
- destinationTokenAddress : ox__Address . Address ;
12
- transactions : Array < {
13
- chainId : number ;
14
- transactionHash : ox__Hex . Hex ;
15
- } > ;
16
- }
5
+ status : "COMPLETED " ;
6
+ originAmount : bigint ;
7
+ destinationAmount : bigint ;
8
+ originChainId : number ;
9
+ destinationChainId : number ;
10
+ originTokenAddress : ox__Address . Address ;
11
+ destinationTokenAddress : ox__Address . Address ;
12
+ transactions : Array < {
13
+ chainId : number ;
14
+ transactionHash : ox__Hex . Hex ;
15
+ } > ;
16
+ }
17
17
| {
18
- status : "pending " ;
19
- originAmount : bigint ;
20
- originChainId : number ;
21
- destinationChainId : number ;
22
- originTokenAddress : ox__Address . Address ;
23
- destinationTokenAddress : ox__Address . Address ;
24
- transactions : Array < {
25
- chainId : number ;
26
- transactionHash : ox__Hex . Hex ;
27
- } > ;
28
- }
18
+ status : "PENDING " ;
19
+ originAmount : bigint ;
20
+ originChainId : number ;
21
+ destinationChainId : number ;
22
+ originTokenAddress : ox__Address . Address ;
23
+ destinationTokenAddress : ox__Address . Address ;
24
+ transactions : Array < {
25
+ chainId : number ;
26
+ transactionHash : ox__Hex . Hex ;
27
+ } > ;
28
+ }
29
29
| {
30
- status : "failed" ;
31
- transactions : Array < {
32
- chainId : number ;
33
- transactionHash : ox__Hex . Hex ;
34
- } > ;
35
- } ;
30
+ status : "FAILED" ;
31
+ transactions : Array < {
32
+ chainId : number ;
33
+ transactionHash : ox__Hex . Hex ;
34
+ } > ;
35
+ }
36
+ | {
37
+ status : "NOT_FOUND" ;
38
+ transactions : [ ] ;
39
+ } ;
You can’t perform that action at this time.
0 commit comments