Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed Aug 25, 2022
1 parent f0b80d6 commit 596100f
Show file tree
Hide file tree
Showing 70 changed files with 5,523 additions and 701 deletions.
3 changes: 3 additions & 0 deletions examples/telescope-with-contracts/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions examples/telescope-with-contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
34 changes: 34 additions & 0 deletions examples/telescope-with-contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
294 changes: 294 additions & 0 deletions examples/telescope-with-contracts/codegen/JunoSwap.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
/**
* This file was automatically generated by @cosmwasm/[email protected].
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
import { Coin, StdFee } from "@cosmjs/amino";
import { Uint128, BalanceResponse, ExecuteMsg, Expiration, Timestamp, Uint64, TokenSelect, Addr, InfoResponse, InstantiateMsg, QueryMsg, Token, Token1ForToken2PriceResponse, Token2ForToken1PriceResponse } from "./JunoSwap.types";
export interface JunoSwapReadOnlyInterface {
contractAddress: string;
balance: ({
address
}: {
address: string;
}) => Promise<BalanceResponse>;
info: () => Promise<InfoResponse>;
token1ForToken2Price: ({
token1Amount
}: {
token1Amount: Uint128;
}) => Promise<Token1ForToken2PriceResponse>;
token2ForToken1Price: ({
token2Amount
}: {
token2Amount: Uint128;
}) => Promise<Token2ForToken1PriceResponse>;
}
export class JunoSwapQueryClient implements JunoSwapReadOnlyInterface {
client: CosmWasmClient;
contractAddress: string;

constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client;
this.contractAddress = contractAddress;
this.balance = this.balance.bind(this);
this.info = this.info.bind(this);
this.token1ForToken2Price = this.token1ForToken2Price.bind(this);
this.token2ForToken1Price = this.token2ForToken1Price.bind(this);
}

balance = async ({
address
}: {
address: string;
}): Promise<BalanceResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
balance: {
address
}
});
};
info = async (): Promise<InfoResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
info: {}
});
};
token1ForToken2Price = async ({
token1Amount
}: {
token1Amount: Uint128;
}): Promise<Token1ForToken2PriceResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
token1_for_token2_price: {
token1_amount: token1Amount
}
});
};
token2ForToken1Price = async ({
token2Amount
}: {
token2Amount: Uint128;
}): Promise<Token2ForToken1PriceResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
token2_for_token1_price: {
token2_amount: token2Amount
}
});
};
}
export interface JunoSwapInterface extends JunoSwapReadOnlyInterface {
contractAddress: string;
sender: string;
addLiquidity: ({
expiration,
maxToken2,
minLiquidity,
token1Amount
}: {
expiration?: Expiration;
maxToken2: Uint128;
minLiquidity: Uint128;
token1Amount: Uint128;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
removeLiquidity: ({
amount,
expiration,
minToken1,
minToken2
}: {
amount: Uint128;
expiration?: Expiration;
minToken1: Uint128;
minToken2: Uint128;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
swapToken1ForToken2: ({
expiration,
minToken2,
token1Amount
}: {
expiration?: Expiration;
minToken2: Uint128;
token1Amount: Uint128;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
swapToken2ForToken1: ({
expiration,
minToken1,
token2Amount
}: {
expiration?: Expiration;
minToken1: Uint128;
token2Amount: Uint128;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
multiContractSwap: ({
expiration,
inputToken,
inputTokenAmount,
outputAmmAddress,
outputMinToken,
outputToken
}: {
expiration?: Expiration;
inputToken: TokenSelect;
inputTokenAmount: Uint128;
outputAmmAddress: Addr;
outputMinToken: Uint128;
outputToken: TokenSelect;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
swapTo: ({
expiration,
inputAmount,
inputToken,
minToken,
recipient
}: {
expiration?: Expiration;
inputAmount: Uint128;
inputToken: TokenSelect;
minToken: Uint128;
recipient: Addr;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
}
export class JunoSwapClient extends JunoSwapQueryClient implements JunoSwapInterface {
client: SigningCosmWasmClient;
sender: string;
contractAddress: string;

constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress);
this.client = client;
this.sender = sender;
this.contractAddress = contractAddress;
this.addLiquidity = this.addLiquidity.bind(this);
this.removeLiquidity = this.removeLiquidity.bind(this);
this.swapToken1ForToken2 = this.swapToken1ForToken2.bind(this);
this.swapToken2ForToken1 = this.swapToken2ForToken1.bind(this);
this.multiContractSwap = this.multiContractSwap.bind(this);
this.swapTo = this.swapTo.bind(this);
}

addLiquidity = async ({
expiration,
maxToken2,
minLiquidity,
token1Amount
}: {
expiration?: Expiration;
maxToken2: Uint128;
minLiquidity: Uint128;
token1Amount: Uint128;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
add_liquidity: {
expiration,
max_token2: maxToken2,
min_liquidity: minLiquidity,
token1_amount: token1Amount
}
}, fee, memo, funds);
};
removeLiquidity = async ({
amount,
expiration,
minToken1,
minToken2
}: {
amount: Uint128;
expiration?: Expiration;
minToken1: Uint128;
minToken2: Uint128;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
remove_liquidity: {
amount,
expiration,
min_token1: minToken1,
min_token2: minToken2
}
}, fee, memo, funds);
};
swapToken1ForToken2 = async ({
expiration,
minToken2,
token1Amount
}: {
expiration?: Expiration;
minToken2: Uint128;
token1Amount: Uint128;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
swap_token1_for_token2: {
expiration,
min_token2: minToken2,
token1_amount: token1Amount
}
}, fee, memo, funds);
};
swapToken2ForToken1 = async ({
expiration,
minToken1,
token2Amount
}: {
expiration?: Expiration;
minToken1: Uint128;
token2Amount: Uint128;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
swap_token2_for_token1: {
expiration,
min_token1: minToken1,
token2_amount: token2Amount
}
}, fee, memo, funds);
};
multiContractSwap = async ({
expiration,
inputToken,
inputTokenAmount,
outputAmmAddress,
outputMinToken,
outputToken
}: {
expiration?: Expiration;
inputToken: TokenSelect;
inputTokenAmount: Uint128;
outputAmmAddress: Addr;
outputMinToken: Uint128;
outputToken: TokenSelect;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
multi_contract_swap: {
expiration,
input_token: inputToken,
input_token_amount: inputTokenAmount,
output_amm_address: outputAmmAddress,
output_min_token: outputMinToken,
output_token: outputToken
}
}, fee, memo, funds);
};
swapTo = async ({
expiration,
inputAmount,
inputToken,
minToken,
recipient
}: {
expiration?: Expiration;
inputAmount: Uint128;
inputToken: TokenSelect;
minToken: Uint128;
recipient: Addr;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
swap_to: {
expiration,
input_amount: inputAmount,
input_token: inputToken,
min_token: minToken,
recipient
}
}, fee, memo, funds);
};
}
Loading

0 comments on commit 596100f

Please sign in to comment.