Skip to content

Commit 9c7efd5

Browse files
authored
Merge pull request #132 from compolabs/feat/1471-update-contracts
[1471] Next version of smart contracts
2 parents ca2c127 + 07d5679 commit 9c7efd5

Some content is hidden

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

42 files changed

+1419
-1241
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"pnpm": ">=9.7.0"
1616
},
1717
"dependencies": {
18-
"@compolabs/spark-orderbook-ts-sdk": "^1.6.6",
18+
"@compolabs/spark-orderbook-ts-sdk": "^1.8.6",
1919
"@emotion/react": "^11.11.3",
2020
"@emotion/styled": "^11.11.0",
2121
"@fuels/connectors": "^0.9.1",

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/getConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function getConfig() {
44
return {
55
name: "download-config",
66
async buildStart() {
7-
const url = "https://raw.githubusercontent.com/compolabs/spark-frontend-config/main/config.json";
7+
const url = "https://raw.githubusercontent.com/compolabs/spark-frontend-config/main/config-dev.json";
88
const res = await fetch(url);
99
const json = await res.json();
1010

src/assets/icons/arrowDown.svg

Lines changed: 2 additions & 2 deletions
Loading

src/assets/icons/lightning.svg

Lines changed: 3 additions & 0 deletions
Loading

src/blockchain/FuelNetwork.ts

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import SparkOrderBookSdk, {
22
GetActiveOrdersParams,
33
Order,
44
OrderType,
5-
UserMarketBalance,
65
WriteTransactionResponse,
76
} from "@compolabs/spark-orderbook-ts-sdk";
8-
import { Account, B256Address, Bech32Address } from "fuels";
7+
import { Account, B256Address } from "fuels";
98
import { makeObservable } from "mobx";
109
import { Nullable } from "tsdef";
1110

@@ -102,12 +101,24 @@ export class FuelNetwork {
102101
return this.orderbookSdk.createOrder(...params);
103102
};
104103

104+
createSpotOrderWithDeposit = async (
105+
...params: Parameters<typeof this.orderbookSdk.createOrderWithDeposit>
106+
): Promise<WriteTransactionResponse> => {
107+
return this.orderbookSdk.createOrderWithDeposit(...params);
108+
};
109+
105110
swapTokens = async (
106111
...params: Parameters<typeof this.orderbookSdk.fulfillOrderMany>
107112
): Promise<WriteTransactionResponse> => {
108113
return this.orderbookSdk.fulfillOrderMany(...params);
109114
};
110115

116+
fulfillOrderManyWithDeposit = async (
117+
...params: Parameters<typeof this.orderbookSdk.fulfillOrderManyWithDeposit>
118+
): Promise<WriteTransactionResponse> => {
119+
return this.orderbookSdk.fulfillOrderManyWithDeposit(...params);
120+
};
121+
111122
cancelSpotOrder = async (
112123
...params: Parameters<typeof this.orderbookSdk.cancelOrder>
113124
): Promise<WriteTransactionResponse> => {
@@ -119,13 +130,14 @@ export class FuelNetwork {
119130
};
120131

121132
withdrawSpotBalance = async (
122-
...params: Parameters<typeof this.orderbookSdk.withdraw>
133+
...params: Parameters<typeof this.orderbookSdk.withdrawAssets>
123134
): Promise<WriteTransactionResponse> => {
124-
return this.orderbookSdk.withdraw(...params);
135+
return this.orderbookSdk.withdrawAssets(...params);
125136
};
126137

127-
withdrawSpotBalanceAll = async (...params: Parameters<typeof this.orderbookSdk.withdrawAll>): Promise<void> => {
128-
await this.orderbookSdk.withdrawAll(...params);
138+
withdrawSpotBalanceAll = async (...params: Parameters<typeof this.orderbookSdk.withdrawAllAssets>): Promise<void> => {
139+
console.log("params", params);
140+
await this.orderbookSdk.withdrawAllAssets(...params);
129141
};
130142

131143
depositSpotBalance = async (
@@ -178,11 +190,31 @@ export class FuelNetwork {
178190
};
179191
};
180192

181-
fetchSpotMatcherFee = async (): Promise<number> => {
193+
fetchSpotMatcherFee = async () => {
182194
return this.orderbookSdk.fetchMatcherFee();
183195
};
184196

185-
fetchSpotUserMarketBalance = async (accountAddress: Bech32Address): Promise<UserMarketBalance> => {
186-
return this.orderbookSdk.fetchUserMarketBalance(accountAddress);
197+
fetchSpotProtocolFee = async () => {
198+
return this.orderbookSdk.fetchProtocolFee();
199+
};
200+
201+
fetchSpotProtocolFeeForUser = async (...params: Parameters<typeof this.orderbookSdk.fetchProtocolFeeForUser>) => {
202+
return this.orderbookSdk.fetchProtocolFeeForUser(...params);
203+
};
204+
205+
fetchSpotProtocolFeeAmountForUser = async (
206+
...params: Parameters<typeof this.orderbookSdk.fetchProtocolFeeAmountForUser>
207+
) => {
208+
return this.orderbookSdk.fetchProtocolFeeAmountForUser(...params);
209+
};
210+
211+
fetchSpotUserMarketBalance = async (...params: Parameters<typeof this.orderbookSdk.fetchUserMarketBalance>) => {
212+
return this.orderbookSdk.fetchUserMarketBalance(...params);
213+
};
214+
215+
fetchUserMarketBalanceByContracts = async (
216+
...params: Parameters<typeof this.orderbookSdk.fetchUserMarketBalanceByContracts>
217+
) => {
218+
return this.orderbookSdk.fetchUserMarketBalanceByContracts(...params);
187219
};
188220
}

src/components/Header/Header.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ const Header: React.FC = observer(() => {
6868
</SmartFlex>
6969
<SmartFlex center="y" gap="8px">
7070
{renderWallet()}
71+
<ButtonStyled
72+
data-onboarding="assets-mobile"
73+
fitContent
74+
onClick={() => quickAssetsStore.setQuickAssets(true)}
75+
>
76+
<SmartFlex>
77+
<DataBase />
78+
</SmartFlex>
79+
</ButtonStyled>
7180
<MenuContainer data-onboarding="menu-mobile" onClick={toggleMenu}>
7281
<Menu />
7382
</MenuContainer>
@@ -104,7 +113,6 @@ const Header: React.FC = observer(() => {
104113
return (
105114
<Root>
106115
{media.mobile ? renderMobile() : renderDesktop()}
107-
108116
<MobileMenu
109117
isOpen={isMobileMenuOpen}
110118
onAccountClick={openAccountInfo}
@@ -133,6 +141,12 @@ const Root = styled(SmartFlex)`
133141
}
134142
`;
135143

144+
const ButtonStyled = styled(Button)`
145+
padding: 5px;
146+
width: 34px;
147+
height: 34px;
148+
`;
149+
136150
const Divider = styled.div`
137151
margin: 0 16px;
138152
width: 1px;

src/components/Header/MobileMenu.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ const MobileMenu: React.FC<IProps> = observer(({ isOpen, onAccountClick, onWalle
5050
</Container>
5151
<SizedBox height={8} />
5252
<FooterContainer gap="8px" column>
53-
<Button data-onboarding="assets-mobile" onClick={() => quickAssetsStore.setQuickAssets(true)}>
54-
ASSETS
55-
</Button>
5653
{renderWalletAddressButton()}
5754
</FooterContainer>
5855
</Body>

src/components/RadioButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const RadioButton: React.FC<Props> = ({ label, value, isSelected, onChang
2121
<Root key={value}>
2222
<StyledInput checked={isSelected} type="radio" value={value} onChange={handleClick} />
2323
<StyledRadio checked={isSelected} />
24-
<Text color={theme.colors.textPrimary} type={TEXT_TYPES.BUTTON_SECONDARY}>
24+
<Text color={theme.colors.textPrimary} type={TEXT_TYPES.BODY_NEW}>
2525
{label}
2626
</Text>
2727
</Root>

src/components/SelectAssets/AssetBlock.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,16 @@ export interface IAssetBlock {
2424
assetId: string;
2525
};
2626
styleToken?: CSSProperties;
27+
type?: "rounded" | "square";
2728
}
2829

2930
const AssetBlock: React.FC<IAssetBlock> = observer(
30-
({ styleToken, options: { showBalance = "balance", showNullBalance = true, isShowBalance = true }, token }) => {
31+
({
32+
styleToken,
33+
options: { showBalance = "balance", showNullBalance = true, isShowBalance = true },
34+
token,
35+
type = "square",
36+
}) => {
3137
if (!token?.asset?.priceFeed) return <></>;
3238
const { oracleStore } = useStores();
3339
const price = BN.formatUnits(oracleStore.getTokenIndexPrice(token.asset.priceFeed), DEFAULT_DECIMALS);
@@ -38,7 +44,7 @@ const AssetBlock: React.FC<IAssetBlock> = observer(
3844
<SmartFlex alignItems="center" gap="10px">
3945
<TokenIcon src={token.asset.logo} />
4046
<div>
41-
<Text type={TEXT_TYPES.BUTTON} primary>
47+
<Text type={type === "rounded" ? TEXT_TYPES.H_NEW : TEXT_TYPES.BUTTON} primary>
4248
{token.asset.symbol}
4349
</Text>
4450
{isShowBalance && <Text type={TEXT_TYPES.BODY}>{token.asset.name}</Text>}

0 commit comments

Comments
 (0)