Skip to content

Commit

Permalink
refactor: fix duplicate type exports for contract data
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinWoetzel committed Nov 29, 2023
1 parent 3b6c5bf commit 9b5d199
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-tables-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shadeprotocol/shadejs": patch
---

fix duplicate type exports for contract data
5 changes: 5 additions & 0 deletions src/types/contracts/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ type Contract = {
codeHash: string,
};

type ContractData = {
address: string,
code_hash:string,
}
export type {
Contract,
ContractData,
};
32 changes: 15 additions & 17 deletions src/types/contracts/swap/response.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ContractData } from '~/types/contracts/shared';

type CustomToken = {
custom_token:{
contract_addr: string,
Expand All @@ -17,10 +19,6 @@ type ContractInstantiationInfo = {
code_hash: string,
id: number,
}
type Contract = {
address: string,
code_hash:string,
}

type Fee = {
nom: number,
Expand All @@ -32,16 +30,16 @@ type AMMSettings = {
shade_dao_fee: Fee,
stable_lp_fee: Fee,
stable_shade_dao_fee: Fee,
shade_dao_address: Contract,
shade_dao_address: ContractData,
}

type FactoryConfigResponse = {
get_config: {
pair_contract: ContractInstantiationInfo,
amm_settings: AMMSettings,
lp_token_contract: ContractInstantiationInfo,
authenticator: Contract | null,
admin_auth: Contract,
authenticator: ContractData | null,
admin_auth: ContractData,
}
}

Expand All @@ -58,9 +56,9 @@ type CustomFee = {

type PairConfigResponse = {
get_config:{
factory_contract: Contract | null,
lp_token: Contract | null,
staking_contract: Contract | null
factory_contract: ContractData | null,
lp_token: ContractData | null,
staking_contract: ContractData | null
pair: TokenPair,
custom_fee: CustomFee | null
}
Expand All @@ -82,7 +80,7 @@ type StableInfo = {
a: string,
gamma1: string,
gamma2: string,
oracle: Contract,
oracle: ContractData,
min_trade_size_x_for_y: string,
min_trade_size_y_for_x: string,
max_price_impact_allowed: string
Expand All @@ -95,8 +93,8 @@ type StableInfo = {

type PairInfoResponse = {
get_pair_info:{
liquidity_token: Contract,
factory: Contract | null,
liquidity_token: ContractData,
factory: ContractData | null,
pair: TokenPair,
amount_0: string,
amount_1: string,
Expand All @@ -114,7 +112,7 @@ type PairInfoResponse = {
}

type RewardTokenInfoResponse = {
token: Contract,
token: ContractData,
decimals: number,
reward_per_second: string,
reward_per_staked_token: string,
Expand All @@ -123,10 +121,10 @@ type RewardTokenInfoResponse = {
}

type StakingConfigResponse = {
lp_token: Contract,
lp_token: ContractData,
amm_pair: string,
admin_auth: Contract,
query_auth: Contract | null,
admin_auth: ContractData,
query_auth: ContractData | null,
total_amount_staked: string,
reward_tokens: RewardTokenInfoResponse[],
}
Expand Down

0 comments on commit 9b5d199

Please sign in to comment.