1
- import { Address } from 'ox'
2
1
import {
3
2
Precondition ,
4
3
NativeBalancePrecondition ,
@@ -41,52 +40,37 @@ export function decodePrecondition(p: IntentPrecondition): Precondition | undefi
41
40
switch ( p . type ) {
42
41
case 'native-balance' :
43
42
precondition = new NativeBalancePrecondition (
44
- Address . from ( data . address ) ,
43
+ data . address ,
45
44
data . min ? BigInt ( data . min ) : undefined ,
46
45
data . max ? BigInt ( data . max ) : undefined ,
47
46
)
48
47
break
49
48
50
49
case 'erc20-balance' :
51
50
precondition = new Erc20BalancePrecondition (
52
- Address . from ( data . address ) ,
53
- Address . from ( data . token ) ,
51
+ data . address ,
52
+ data . token ,
54
53
data . min ? BigInt ( data . min ) : undefined ,
55
54
data . max ? BigInt ( data . max ) : undefined ,
56
55
)
57
56
break
58
57
59
58
case 'erc20-approval' :
60
- precondition = new Erc20ApprovalPrecondition (
61
- Address . from ( data . address ) ,
62
- Address . from ( data . token ) ,
63
- Address . from ( data . operator ) ,
64
- BigInt ( data . min ) ,
65
- )
59
+ precondition = new Erc20ApprovalPrecondition ( data . address , data . token , data . operator , BigInt ( data . min ) )
66
60
break
67
61
68
62
case 'erc721-ownership' :
69
- precondition = new Erc721OwnershipPrecondition (
70
- Address . from ( data . address ) ,
71
- Address . from ( data . token ) ,
72
- BigInt ( data . tokenId ) ,
73
- data . owned ,
74
- )
63
+ precondition = new Erc721OwnershipPrecondition ( data . address , data . token , BigInt ( data . tokenId ) , data . owned )
75
64
break
76
65
77
66
case 'erc721-approval' :
78
- precondition = new Erc721ApprovalPrecondition (
79
- Address . from ( data . address ) ,
80
- Address . from ( data . token ) ,
81
- BigInt ( data . tokenId ) ,
82
- Address . from ( data . operator ) ,
83
- )
67
+ precondition = new Erc721ApprovalPrecondition ( data . address , data . token , BigInt ( data . tokenId ) , data . operator )
84
68
break
85
69
86
70
case 'erc1155-balance' :
87
71
precondition = new Erc1155BalancePrecondition (
88
- Address . from ( data . address ) ,
89
- Address . from ( data . token ) ,
72
+ data . address ,
73
+ data . token ,
90
74
BigInt ( data . tokenId ) ,
91
75
data . min ? BigInt ( data . min ) : undefined ,
92
76
data . max ? BigInt ( data . max ) : undefined ,
@@ -95,10 +79,10 @@ export function decodePrecondition(p: IntentPrecondition): Precondition | undefi
95
79
96
80
case 'erc1155-approval' :
97
81
precondition = new Erc1155ApprovalPrecondition (
98
- Address . from ( data . address ) ,
99
- Address . from ( data . token ) ,
82
+ data . address ,
83
+ data . token ,
100
84
BigInt ( data . tokenId ) ,
101
- Address . from ( data . operator ) ,
85
+ data . operator ,
102
86
BigInt ( data . min ) ,
103
87
)
104
88
break
0 commit comments