Skip to content

Commit 37ee3b4

Browse files
feat: add solana send usd example app (#1471)
* feat: add send usd app * fix: cargo tomls * fix: pre-commit * fix: improve code quality * fix: fix names and texts * fix: pre-commit * feat: add send usd example to monorepo * fix: connection endpoint for send usd example * fix: priceUpdateData * fix: packages * fix: remove unused variables * fix: packages * fix: test * fix: tests * fix: test * remove file * fix * go * Try removing test script * Remove npm run test from the text --------- Co-authored-by: Guillermo Bescos <[email protected]>
1 parent b47ee05 commit 37ee3b4

28 files changed

+64573
-51053
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"target_chains/sui/cli",
2525
"target_chains/solana/sdk/js/solana_utils",
2626
"target_chains/solana/sdk/js/pyth_solana_receiver",
27+
"target_chains/solana/examples/send_usd/app",
2728
"contract_manager"
2829
],
2930
"dependencies": {

target_chains/solana/Anchor.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = [
33
"programs/pyth-push-oracle",
44
"programs/pyth-solana-receiver",
5-
"examples/send_usd",
5+
"examples/send_usd/program",
66
]
77

88
[features]

target_chains/solana/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ members = [
55
"program_simulator/",
66
"pyth_solana_receiver_sdk/",
77
"common_test_utils",
8-
"examples/send_usd"
8+
"examples/send_usd/program"
99
]
1010

1111
[profile.release]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm run build`
18+
19+
Builds the app for production to the `build` folder.\
20+
It correctly bundles React in production mode and optimizes the build for the best performance.
21+
22+
The build is minified and the filenames include the hashes.\
23+
Your app is ready to be deployed!
24+
25+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
26+
27+
### `npm run eject`
28+
29+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
30+
31+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
32+
33+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
34+
35+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
36+
37+
## Learn More
38+
39+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
40+
41+
To learn React, check out the [React documentation](https://reactjs.org/).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
webpack: {
3+
configure: (config) => {
4+
// ...
5+
const fileLoaderRule = getFileLoaderRule(config.module.rules);
6+
if (!fileLoaderRule) {
7+
throw new Error("File loader not found");
8+
}
9+
fileLoaderRule.exclude.push(/\.cjs$/);
10+
// ...
11+
return config;
12+
},
13+
},
14+
};
15+
16+
function getFileLoaderRule(rules) {
17+
for (const rule of rules) {
18+
if ("oneOf" in rule) {
19+
const found = getFileLoaderRule(rule.oneOf);
20+
if (found) {
21+
return found;
22+
}
23+
} else if (rule.test === undefined && rule.type === "asset/resource") {
24+
return rule;
25+
}
26+
}
27+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "send_usd",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@pythnetwork/price-service-client": "^1.8.2",
7+
"@pythnetwork/pyth-solana-receiver": "^0.7.0",
8+
"@solana/wallet-adapter-base": "^0.9.23",
9+
"@solana/wallet-adapter-react": "^0.15.35",
10+
"@solana/wallet-adapter-react-ui": "^0.9.35",
11+
"@solana/wallet-adapter-wallets": "^0.19.10",
12+
"@solana/web3.js": "^1.90.0",
13+
"@testing-library/jest-dom": "^5.17.0",
14+
"@testing-library/react": "^13.4.0",
15+
"@testing-library/user-event": "^13.5.0",
16+
"@types/jest": "^27.5.2",
17+
"@types/node": "^16.18.82",
18+
"@types/react": "^18.2.0",
19+
"@types/react-dom": "^18.2.19",
20+
"buffer": "^6.0.3",
21+
"craco": "^0.0.3",
22+
"react": "^18.2.0",
23+
"react-dom": "^18.2.0",
24+
"react-scripts": "5.0.1",
25+
"typescript": "^4.9.5",
26+
"web-vitals": "^2.1.4"
27+
},
28+
"scripts": {
29+
"start": "craco start",
30+
"build": "craco build",
31+
"eject": "craco eject"
32+
},
33+
"eslintConfig": {
34+
"extends": [
35+
"react-app",
36+
"react-app/jest"
37+
]
38+
},
39+
"browserslist": {
40+
"production": [
41+
">0.2%",
42+
"not dead",
43+
"not op_mini all"
44+
],
45+
"development": [
46+
"last 1 chrome version",
47+
"last 1 firefox version",
48+
"last 1 safari version"
49+
]
50+
}
51+
}
Binary file not shown.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>

0 commit comments

Comments
 (0)