Skip to content

Commit

Permalink
Merge pull request #4 from UXDProtocol/fix/anchor-publickey
Browse files Browse the repository at this point in the history
fix @project-serum/anchor publickey issue
  • Loading branch information
sjillen authored Dec 13, 2021
2 parents 7c3a9bc + 4dd98fe commit 6367487
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 83 deletions.
7 changes: 7 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ const withTM = require('next-transpile-modules')(['react-markdown'])
module.exports = withTM({
target: 'serverless',
webpack: (config, { isServer }) => {
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
'@project-serum/anchor$': '@project-serum/anchor/dist/esm',
},
}
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"lint": "eslint . --ext ts --ext tsx --ext js --ext jsx",
"test": "jest",
"test-all": "yarn lint && yarn type-check && yarn test",
"notifier": "TS_NODE_PROJECT=./tsconfig.commonjs.json ts-node scripts/governance-notifier.ts"
"notifier": "TS_NODE_PROJECT=./tsconfig.commonjs.json ts-node scripts/governance-notifier.ts",
"postinstall": "patch-package"
},
"lint-staged": {
"*.@(ts|tsx|js|jsx)": [
Expand All @@ -23,16 +24,16 @@
},
"dependencies": {
"@blockworks-foundation/mango-client": "^3.2.15",
"@project-serum/anchor": "^0.19.0",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "1.31.0",
"@emotion/react": "^11.1.5",
"@emotion/styled": "^11.3.0",
"@headlessui/react": "^1.0.0",
"@heroicons/react": "^1.0.1",
"@project-serum/anchor": "^0.19.0",
"@project-serum/borsh": "^0.2.2",
"@project-serum/common": "^0.0.1-beta.3",
"@project-serum/sol-wallet-adapter": "^0.2.0",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "1.31.0",
"@tippyjs/react": "^4.2.5",
"@uxdprotocol/uxd-client": "^2.56.0",
"axios": "^0.21.1",
Expand Down Expand Up @@ -71,8 +72,10 @@
"jest": "^26.6.3",
"jest-watch-typeahead": "^0.6.1",
"lint-staged": "^10.0.10",
"patch-package": "^6.4.7",
"postcss": "^8.2.12",
"postcss-preset-env": "^6.7.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.0.2",
"tailwindcss": "^2.1.2",
"twin.macro": "^2.4.0",
Expand Down
22 changes: 22 additions & 0 deletions patches/@project-serum+anchor+0.19.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/@project-serum/anchor/dist/esm/program/common.js b/node_modules/@project-serum/anchor/dist/esm/program/common.js
index 164d8ff..bab8614 100644
--- a/node_modules/@project-serum/anchor/dist/esm/program/common.js
+++ b/node_modules/@project-serum/anchor/dist/esm/program/common.js
@@ -38,15 +38,6 @@ export function validateAccounts(ixAccounts, accounts = {}) {
}
// Translates an address to a Pubkey.
export function translateAddress(address) {
- if (typeof address === "string") {
- const pk = new PublicKey(address);
- return pk;
- }
- else if (address.constructor.prototype.constructor.name === "PublicKey") {
- return address;
- }
- else {
- throw new Error("Given address is not a PublicKey nor a string.");
- }
+ return new PublicKey(address);
}
//# sourceMappingURL=common.js.map
\ No newline at end of file
Loading

2 comments on commit 6367487

@vercel
Copy link

@vercel vercel bot commented on 6367487 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

The most recent charge for your active payment method has failed. Please update it here: https://vercel.com/teams/uxdprotocol-governance/settings/billing.

@vercel
Copy link

@vercel vercel bot commented on 6367487 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.