Working on monorepo typescript setup

This commit is contained in:
Dummy Tester 123 2021-02-05 21:21:35 -06:00
parent 04cf8a8c8d
commit 27c62ce9d3
14 changed files with 34913 additions and 29147 deletions

2
.gitignore vendored
View File

@ -2,6 +2,7 @@
# dependencies
*/node_modules
.yarn/
/.pnp
.pnp.js
@ -23,3 +24,4 @@ yarn-debug.log*
yarn-error.log*
.idea
node_modules

0
.prettierrc Normal file
View File

5
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"recommendations": [
"arcanis.vscode-zipfs"
]
}

View File

@ -1,3 +1,9 @@
{
"editor.tabSize": 2
"editor.tabSize": 2,
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}

5
.yarnrc.yml Normal file
View File

@ -0,0 +1,5 @@
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: .yarn/releases/yarn-berry.cjs

53
common/package.json Normal file
View File

@ -0,0 +1,53 @@
{
"name": "common",
"version": "0.1.0",
"dependencies": {
"@ant-design/pro-layout": "^6.7.0",
"@craco/craco": "^5.7.0",
"@project-serum/serum": "^0.13.11",
"@project-serum/sol-wallet-adapter": "^0.1.4",
"@solana/spl-token": "0.0.11",
"@solana/spl-token-swap": "0.0.2",
"@solana/web3.js": "^0.86.2",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@types/chart.js": "^2.9.29",
"@types/echarts": "^4.9.0",
"@types/react-router-dom": "^5.1.6",
"@welldone-software/why-did-you-render": "^6.0.5",
"antd": "^4.6.6",
"bn.js": "^5.1.3",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.0",
"chart.js": "^2.9.4",
"craco-less": "^1.17.0",
"echarts": "^4.9.0",
"eventemitter3": "^4.0.7",
"identicon.js": "^2.3.3",
"jazzicon": "^1.5.0",
"lodash": "^4.17.20",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-github-btn": "^1.2.0",
"react-intl": "^5.10.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"typescript": "^4.0.0"
},
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"@types/bn.js": "^4.11.6",
"@types/bs58": "^4.0.1",
"@types/identicon.js": "^2.3.0",
"@types/jest": "^24.9.1",
"@types/node": "^12.12.62",
"@types/react": "^16.9.50",
"@types/react-dom": "^16.9.8",
"arweave-deploy": "^1.9.1",
"gh-pages": "^3.1.0",
"prettier": "^2.1.2"
}
}

View File

16399
lending/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
{
"name": "token-lending-ui",
"name": "lending",
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/pro-layout": "^6.7.0",
"@craco/craco": "^5.7.0",
@ -33,8 +32,7 @@
"react-github-btn": "^1.2.0",
"react-intl": "^5.10.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"typescript": "^4.0.0"
"react-scripts": "3.4.3"
},
"scripts": {
"start": "craco start",

View File

@ -1,17 +1,8 @@
import { AccountLayout, MintLayout, Token } from "@solana/spl-token";
import {
Account,
PublicKey,
SystemProgram,
TransactionInstruction,
} from "@solana/web3.js";
import {
LENDING_PROGRAM_ID,
TOKEN_PROGRAM_ID,
WRAPPED_SOL_MINT,
} from "../utils/ids";
import { LendingObligationLayout, TokenAccount } from "../models";
import { cache, TokenAccountParser } from "./../contexts/accounts";
import { AccountLayout, MintLayout, Token } from '@solana/spl-token';
import { Account, PublicKey, SystemProgram, TransactionInstruction } from '@solana/web3.js';
import { LENDING_PROGRAM_ID, TOKEN_PROGRAM_ID, WRAPPED_SOL_MINT } from '../utils/ids';
import { LendingObligationLayout, TokenAccount } from '../models';
import { cache, TokenAccountParser } from './../contexts/accounts';
export function ensureSplAccount(
instructions: TransactionInstruction[],
@ -25,31 +16,11 @@ export function ensureSplAccount(
return toCheck.pubkey;
}
const account = createUninitializedAccount(
instructions,
payer,
amount,
signers
);
const account = createUninitializedAccount(instructions, payer, amount, signers);
instructions.push(
Token.createInitAccountInstruction(
TOKEN_PROGRAM_ID,
WRAPPED_SOL_MINT,
account,
payer
)
);
instructions.push(Token.createInitAccountInstruction(TOKEN_PROGRAM_ID, WRAPPED_SOL_MINT, account, payer));
cleanupInstructions.push(
Token.createCloseAccountInstruction(
TOKEN_PROGRAM_ID,
account,
payer,
payer,
[]
)
);
cleanupInstructions.push(Token.createCloseAccountInstruction(TOKEN_PROGRAM_ID, account, payer, payer, []));
return account;
}
@ -154,16 +125,9 @@ export function createTokenAccount(
owner: PublicKey,
signers: Account[]
) {
const account = createUninitializedAccount(
instructions,
payer,
accountRentExempt,
signers
);
const account = createUninitializedAccount(instructions, payer, accountRentExempt, signers);
instructions.push(
Token.createInitAccountInstruction(TOKEN_PROGRAM_ID, mint, account, owner)
);
instructions.push(Token.createInitAccountInstruction(TOKEN_PROGRAM_ID, mint, account, owner));
return account;
}
@ -197,25 +161,10 @@ export function findOrCreateAccountByMint(
toAccount = account.pubkey;
} else {
// creating depositor pool account
toAccount = createTokenAccount(
instructions,
payer,
accountRentExempt,
mint,
owner,
signers
);
toAccount = createTokenAccount(instructions, payer, accountRentExempt, mint, owner, signers);
if (isWrappedSol) {
cleanupInstructions.push(
Token.createCloseAccountInstruction(
TOKEN_PROGRAM_ID,
toAccount,
payer,
payer,
[]
)
);
cleanupInstructions.push(Token.createCloseAccountInstruction(TOKEN_PROGRAM_ID, toAccount, payer, payer, []));
}
}

File diff suppressed because it is too large Load Diff

30
package.json Normal file
View File

@ -0,0 +1,30 @@
{
"private": true,
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"repository": {
"type": "git",
"url": "https://github.com/solana-labs/oyster"
},
"homepage": ".",
"workspaces": [
"lending"
],
"dependencies": {
"@yarnpkg/pnpify": "^2.4.0",
"typescript": "^4.1.3"
}
}

17807
yarn.lock Normal file

File diff suppressed because it is too large Load Diff