Skip to content

Commit 45c27d7

Browse files
committed
Patch all |> to ->
1 parent 7104855 commit 45c27d7

File tree

127 files changed

+4062
-4235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+4062
-4235
lines changed

__tests__/Coin_test.res

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ describe("Expect Coin to work correctly", () => {
99
Js.Dict.set(dict, "amount", Js.Json.string("1000000"))
1010
let coin = Js.Json.object_(dict)
1111

12-
expect(coin->decodeCoin)->toEqual({denom: "uband", amount: 1000000.})
12+
expect(coin->JsonUtils.Decode.mustDecode(decodeCoin))->toEqual({
13+
denom: "uband",
14+
amount: 1000000.,
15+
})
1316
})
1417

1518
test("should be able to create Coin by uband amount", () =>

__tests__/HistoryOracleParser_test.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ open Expect
44

55
let getDayAgo = days =>
66
MomentRe.momentNow()
7-
|> MomentRe.Moment.defaultUtc
8-
|> MomentRe.Moment.startOf(#day)
9-
|> MomentRe.Moment.subtract(~duration=MomentRe.duration(days->float_of_int, #days))
10-
|> MomentRe.Moment.toUnix
7+
->MomentRe.Moment.defaultUtc
8+
->MomentRe.Moment.startOf(#day, _)
9+
->MomentRe.Moment.subtract(~duration=MomentRe.duration(days->float_of_int, #days))
10+
->MomentRe.Moment.toUnix
1111

1212
describe("Expect HistoryOracleParser works correctly", () => {
1313
let dates = Belt.Array.makeBy(5, i => getDayAgo(i))->Belt.Array.reverse

bsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
"ppx-flags": [
1919
"@reasonml-community/graphql-ppx/ppx"
2020
],
21+
"bsc-flags": [
22+
"-open JsonCombinators"
23+
],
2124
"reason": {
2225
"react-jsx": 3
2326
},
@@ -43,7 +46,7 @@
4346
"bs-css",
4447
"bs-moment",
4548
"rescript-webapi",
46-
"@glennsl/bs-json"
49+
"@glennsl/rescript-json-combinators"
4750
],
4851
"bs-dev-dependencies": [
4952
"@glennsl/rescript-jest"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@apollo/client": "^3.6.9",
3131
"@bandprotocol/bandchain.js": "^1.2.1",
3232
"@cosmostation/cosmosjs": "0.5.5",
33-
"@glennsl/bs-json": "^5.0.4",
33+
"@glennsl/rescript-json-combinators": "^1.0.0",
3434
"@ledgerhq/hw-transport-webhid": "^6.4.1",
3535
"@ledgerhq/hw-transport-webusb": "^6.3.0",
3636
"@material-ui/core": "^4.12.3",

src/bindings/BandChainJS.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ type reference_data_t = {
88
@module("@bandprotocol/bandchain.js") @new external createClient: string => client_t = "Client"
99

1010
@send
11-
external getReferenceData: (client_t, array<string>) => Js.Promise.t<array<reference_data_t>> =
11+
external getReferenceData: (client_t, array<string>) => Promise.t<array<reference_data_t>> =
1212
"getReferenceData"

src/components/Avatar.res

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ module Styles = {
55
let avatarSm = width_ => style(. [Media.mobile([width(px(width_))])])
66
}
77

8-
let decodeThem = json =>
9-
json |> JsonUtils.Decode.at(list{"pictures", "primary", "url"}, JsonUtils.Decode.string)
8+
let decodeThem = JsonUtils.Decode.at(list{"pictures", "primary", "url"}, JsonUtils.Decode.string)
109

1110
let decode = json =>
12-
json |> JsonUtils.Decode.field("them", JsonUtils.Decode.array(decodeThem)) |> Belt.Array.get(_, 0)
11+
json
12+
->JsonUtils.Decode.mustDecode(JsonUtils.Decode.field("them", JsonUtils.Decode.array(decodeThem)))
13+
->Belt.Array.get(0)
1314

1415
module Placeholder = {
1516
@react.component
@@ -28,7 +29,7 @@ module Keybase = {
2829
)
2930
switch resOpt {
3031
| Some(res) =>
31-
switch res |> decode {
32+
switch res->decode {
3233
| Some(url) =>
3334
Some(
3435
<img

src/components/CopyButton.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let make = (~data, ~title, ~width=105, ~py=5, ~px=10, ~pySm=py, ~pxSm=px) => {
2121
<div className={CssHelper.flexBox(~align=#center, ~justify=#center, ())}>
2222
{copied ? <Icon name="fal fa-check" size=12 /> : <Icon name="far fa-clone" size=12 />}
2323
<HSpacing size=Spacing.sm />
24-
{title |> React.string}
24+
{title->React.string}
2525
</div>
2626
</Button>
2727
}

src/components/Footer.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let make = () => {
3232
})}>
3333
{mapImages
3434
->Belt.Array.mapWithIndex((i, e) =>
35-
<AbsoluteLink key={string_of_int(i)} href={e[0]}>
35+
<AbsoluteLink key={Belt.Int.toString(i)} href={e[0]}>
3636
<img src={e[1]} className=Styles.socialImg />
3737
</AbsoluteLink>
3838
)

src/components/KVTable.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let renderField = (field, maxWidth) => {
4141
<div className={CssHelper.flexBox(~direction=#column, ())}>
4242
{vals
4343
->Belt.Array.mapWithIndex((i, v) =>
44-
<div key={i->string_of_int ++ v} className={Styles.valueContainer(maxWidth)}>
44+
<div key={i->Belt.Int.toString ++ v} className={Styles.valueContainer(maxWidth)}>
4545
<Text value=v nowrap=true ellipsis=true block=true align=Text.Right />
4646
</div>
4747
)
@@ -78,7 +78,7 @@ let renderField = (field, maxWidth) => {
7878

7979
@react.component
8080
let make = (~headers=["Key", "Value"], ~rows) => {
81-
let columnSize = headers |> Belt.Array.length > 2 ? Col.Four : Col.Six
81+
let columnSize = headers->Belt.Array.length > 2 ? Col.Four : Col.Six
8282
let valueWidth = Media.isMobile() ? 70 : 480
8383

8484
let ({ThemeContext.theme: theme}, _) = React.useContext(ThemeContext.context)
@@ -88,7 +88,7 @@ let make = (~headers=["Key", "Value"], ~rows) => {
8888
<Row>
8989
{headers
9090
->Belt.Array.mapWithIndex((i, header) => {
91-
<Col key={header ++ (i |> string_of_int)} col=columnSize colSm=columnSize>
91+
<Col key={header ++ i->Belt.Int.toString} col=columnSize colSm=columnSize>
9292
<Text value=header weight=Text.Semibold height={Text.Px(18)} transform=Text.Uppercase />
9393
</Col>
9494
})
@@ -99,11 +99,11 @@ let make = (~headers=["Key", "Value"], ~rows) => {
9999
{rows
100100
->Belt.Array.mapWithIndex((i, row) => {
101101
<div
102-
key={"outerRow" ++ (i |> string_of_int)} className={CssJs.merge(. [Styles.tableSpacing])}>
102+
key={"outerRow" ++ i->Belt.Int.toString} className={CssJs.merge(. [Styles.tableSpacing])}>
103103
<Row>
104104
{row
105105
->Belt.Array.mapWithIndex((j, value) => {
106-
<Col key={"innerRow" ++ (j |> string_of_int)} col=columnSize colSm=columnSize>
106+
<Col key={"innerRow" ++ j->Belt.Int.toString} col=columnSize colSm=columnSize>
107107
{renderField(value, valueWidth)}
108108
</Col>
109109
})

src/components/NavBar.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module RenderDesktop = {
1717

1818
@react.component
1919
let make = (~routes) => {
20-
let currentRoute = RescriptReactRouter.useUrl() |> Route.fromUrl
20+
let currentRoute = RescriptReactRouter.useUrl()->Route.fromUrl
2121

2222
let ({ThemeContext.theme: theme}, _) = React.useContext(ThemeContext.context)
2323

@@ -26,7 +26,7 @@ module RenderDesktop = {
2626
->Belt.List.map(((v, route)) =>
2727
<div key=v className={CssHelper.flexBox(~justify=#spaceBetween, ())}>
2828
<Link className={Styles.nav(currentRoute == route, theme)} route>
29-
{v |> React.string}
29+
{v->React.string}
3030
</Link>
3131
</div>
3232
)

src/components/NumberCountUp.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let make = (~value, ~size, ~weight, ~spacing=?, ~color=?, ~code=true, ~smallNumb
1717
CountUp.updateGet(countUp, value)
1818
None
1919
}, [value])
20-
let newVal = CountUp.countUpGet(countUp) |> Js.Float.toString
20+
let newVal = CountUp.countUpGet(countUp)->Js.Float.toString
2121
let color_ = color->Belt.Option.getWithDefault(theme.textPrimary)
2222

2323
smallNumber

src/components/Pagination.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ let make = (~currentPage, ~pageCount, ~onPageChange: int => unit) => {
7878
Styles.paginationBox,
7979
})}>
8080
<Text
81-
value={currentPage |> Format.iPretty}
81+
value={currentPage->Format.iPretty}
8282
size=Text.Lg
8383
weight=Text.Semibold
8484
color=theme.textPrimary
8585
/>
8686
<Text value="of" size=Text.Lg />
8787
<Text
88-
value={pageCount |> Format.iPretty}
88+
value={pageCount->Format.iPretty}
8989
weight=Text.Semibold
9090
size=Text.Lg
9191
color=theme.textPrimary

src/components/SearchBar.res

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,37 @@ module SearchResults = {
8484

8585
@react.component
8686
let make = (~searchTerm, ~focusIndex, ~onHover) => {
87-
let results =
88-
[
89-
searchTerm->isValidAddress
90-
? <>
91-
<VSpacing size=#px(-2) />
92-
<Text value="ADDRESS" size=Text.Xs weight=Text.Semibold />
93-
<VSpacing size=Spacing.xs />
94-
<Text value={searchTerm ++ "1f2bce"} weight=Text.Bold size=Text.Lg block=true />
95-
<VSpacing size=Spacing.sm />
96-
</>
97-
: React.null,
98-
searchTerm->isValidTx
99-
? <>
100-
<VSpacing size=#px(-2) />
101-
<Text value="TRANSACTION" size=Text.Xs weight=Text.Semibold />
102-
<VSpacing size=Spacing.xs />
103-
<Text value={searchTerm ++ "dd92b"} weight=Text.Bold size=Text.Lg block=true />
104-
<VSpacing size=Spacing.sm />
105-
</>
106-
: React.null,
107-
<> <Text value="Show all results for " /> <Text value=searchTerm weight=Text.Bold /> </>,
108-
]->Belt.Array.keep(r => r != React.null)
87+
let results = [
88+
searchTerm->isValidAddress
89+
? <>
90+
<VSpacing size=#px(-2) />
91+
<Text value="ADDRESS" size=Text.Xs weight=Text.Semibold />
92+
<VSpacing size=Spacing.xs />
93+
<Text value={searchTerm ++ "1f2bce"} weight=Text.Bold size=Text.Lg block=true />
94+
<VSpacing size=Spacing.sm />
95+
</>
96+
: React.null,
97+
searchTerm->isValidTx
98+
? <>
99+
<VSpacing size=#px(-2) />
100+
<Text value="TRANSACTION" size=Text.Xs weight=Text.Semibold />
101+
<VSpacing size=Spacing.xs />
102+
<Text value={searchTerm ++ "dd92b"} weight=Text.Bold size=Text.Lg block=true />
103+
<VSpacing size=Spacing.sm />
104+
</>
105+
: React.null,
106+
<>
107+
<Text value="Show all results for " />
108+
<Text value=searchTerm weight=Text.Bold />
109+
</>,
110+
]->Belt.Array.keep(r => r != React.null)
109111

110112
<div className=Styles.container>
111113
{results
112114
->Belt.Array.mapWithIndex((i, result) =>
113115
<div
114116
onMouseOver={_evt => onHover(i)}
115-
key={i |> string_of_int}
117+
key={i->Belt.Int.toString}
116118
className={CssJs.merge(. [
117119
Styles.result,
118120
i == results->Array.length - 1 ? Styles.lastResult : "",
@@ -192,7 +194,7 @@ let make = () => {
192194
| "Enter" =>
193195
dispatch(ChangeSearchTerm(""))
194196
ReactEvent.Keyboard.preventDefault(event)
195-
Route.redirect(searchTerm |> Route.search)
197+
Route.redirect(searchTerm->Route.search)
196198
| _ => ()
197199
}}
198200
value=searchTerm
@@ -206,7 +208,7 @@ let make = () => {
206208
<button
207209
className=Styles.button
208210
onClick={_ => {
209-
Route.redirect(searchTerm |> Route.search)
211+
Route.redirect(searchTerm->Route.search)
210212
dispatch(ChangeSearchTerm(""))
211213
}}>
212214
<Icon name="far fa-search" color=theme.textPrimary size=16 />

src/components/Timestamp.res

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ let make = (
1313
~weight=Text.Regular,
1414
~spacing=Text.Unset,
1515
~code=false,
16-
~upper=false,
1716
~textAlign=Text.Left,
1817
~color=?,
1918
) => {
@@ -34,7 +33,7 @@ let make = (
3433
</>
3534
: React.null}
3635
<Text
37-
value={time |> MomentRe.Moment.format("YYYY-MM-DD HH:mm:ss")}
36+
value={time->MomentRe.Moment.format("YYYY-MM-DD HH:mm:ss", _)}
3837
size
3938
weight
4039
spacing
@@ -70,7 +69,6 @@ module Grid = {
7069
~spacing=Text.Unset,
7170
~color=?,
7271
~code=false,
73-
~upper=false,
7472
~textAlign=Text.Left,
7573
) => {
7674
let ({ThemeContext.theme: theme}, _) = React.useContext(ThemeContext.context)
@@ -91,7 +89,7 @@ module Grid = {
9189
: React.null}
9290
<div>
9391
<Text
94-
value={time |> MomentRe.Moment.format("YYYY-MM-DD")}
92+
value={time->MomentRe.Moment.format("YYYY-MM-DD", _)}
9593
size
9694
weight
9795
spacing
@@ -104,7 +102,7 @@ module Grid = {
104102
</div>
105103
<div>
106104
<Text
107-
value={time |> MomentRe.Moment.format("HH:mm:ss")}
105+
value={time->MomentRe.Moment.format("HH:mm:ss", _)}
108106
size
109107
weight
110108
spacing

src/components/UserAccount.res

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module ConnectBtn = {
4848
let make = (~connect) =>
4949
<div id="connectButton">
5050
<Button variant=Button.Outline px=24 py=8 onClick={_ => connect()}>
51-
{"Connect Wallet" |> React.string}
51+
{"Connect Wallet"->React.string}
5252
</Button>
5353
</div>
5454
}
@@ -81,7 +81,7 @@ module FaucetBtn = {
8181
onClick={_ => {
8282
setIsRequest(_ => true)
8383
AxiosFaucet.request({
84-
address: address |> Address.toBech32,
84+
address: address->Address.toBech32,
8585
amount: 10_000_000,
8686
})
8787
->Promise.then(_ => {
@@ -90,7 +90,7 @@ module FaucetBtn = {
9090
})
9191
->ignore
9292
}}>
93-
{"Get 10 Testnet BAND" |> React.string}
93+
{"Get 10 Testnet BAND"->React.string}
9494
</Button>
9595
</div>
9696
}
@@ -100,13 +100,14 @@ module SendBtn = {
100100
@react.component
101101
let make = (~send) =>
102102
<div id="sendToken">
103-
<Button px=20 py=5 onClick={_ => send()}> {"Send" |> React.string} </Button>
103+
<Button px=20 py=5 onClick={_ => send()}> {"Send"->React.string} </Button>
104104
</div>
105105
}
106106

107107
module Balance = {
108108
@react.component
109109
let make = (~address) => {
110+
Js.log(address)
110111
// Todo will patch later
111112
// let accountSub = AccountSub.get(address)
112113

@@ -119,7 +120,7 @@ module Balance = {
119120
value="account"
120121
// value={switch accountSub {
121122
// | Data(account) =>
122-
// account.balance |> Coin.getBandAmountFromCoins |> Format.fPretty(~digits=6)
123+
// account.balance -> Coin.getBandAmountFromCoins -> Format.fPretty(~digits=6)
123124
// | _ => "0"
124125
// }}
125126
code=true
@@ -142,7 +143,7 @@ let make = () => {
142143

143144
let clickOutside = ClickOutside.useClickOutside(_ => setShow(_ => false))
144145

145-
let connect = chainID => dispatchModal(OpenModal(Connect(chainID)))
146+
// let connect = chainID => dispatchModal(OpenModal(Connect(chainID)))
146147
let disconnect = () => {
147148
dispatchAccount(Disconnect)
148149
setShow(_ => false)
@@ -162,7 +163,9 @@ let make = () => {
162163
id="userInfoButton"
163164
className={Css.merge(list{CssHelper.flexBox(), CssHelper.clickable})}
164165
onClick={_ => setShow(prev => !prev)}>
165-
<div className={Styles.oval(theme)}> <Icon name="fal fa-user" color=Theme.white /> </div>
166+
<div className={Styles.oval(theme)}>
167+
<Icon name="fal fa-user" color=Theme.white />
168+
</div>
166169
<HSpacing size=Spacing.sm />
167170
<Icon name="fas fa-caret-down" color=theme.baseBlue />
168171
</div>
@@ -175,7 +178,8 @@ let make = () => {
175178
<Balance address />
176179
<VSpacing size=#px(16) />
177180
<div className={CssHelper.flexBox(~direction=#row, ~justify=#spaceBetween, ())}>
178-
<FaucetBtn address /> <SendBtn send />
181+
<FaucetBtn address />
182+
<SendBtn send />
179183
</div>
180184
</div>
181185
<DisconnectBtn disconnect />

0 commit comments

Comments
 (0)