Skip to content

Commit

Permalink
fix warp deploy plugin by tweaking webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Envoy-VC committed Dec 17, 2023
1 parent 4852d79 commit e44f083
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 115 deletions.
48 changes: 24 additions & 24 deletions apps/demo/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
},
plugins: ['@typescript-eslint'],
extends: [
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',

"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
},
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
},
};

module.exports = config;
7 changes: 7 additions & 0 deletions apps/demo/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ const config = {
locales: ['en'],
defaultLocale: 'en',
},
webpack: (config, { isServer }) => {
if (!isServer) {
config.optimization.innerGraph = false;
}

return config;
},
};

export default config;
3 changes: 1 addition & 2 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"start": "next start"
},
"dependencies": {
"avcs": "git+https://github.com/Irys-xyz/avsc.git",
"@ant-design/cssinjs": "^1.18.1",
"@irys/sdk": "^0.1.1",
"@t3-oss/env-nextjs": "^0.7.1",
Expand All @@ -27,7 +26,7 @@
"react-icons": "^4.12.0",
"usehooks-ts": "^2.9.1",
"warp-contracts": "^1.4.26",
"warp-contracts-plugin-deploy": "1.0.9",
"warp-contracts-plugin-deploy": "^1.0.12",
"zod": "^3.22.4",
"zustand": "^4.4.7"
},
Expand Down
23 changes: 8 additions & 15 deletions apps/demo/src/components/common/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,28 @@ import { useConnection } from 'arweave-wallet-kit';

// Icons
import AtomicToolkitLogo from '~/assets/light.svg';
import { WarpFactory, defaultCacheOptions } from 'warp-contracts';
import { WarpFactory } from 'warp-contracts';
import { DeployPlugin } from 'warp-contracts-plugin-deploy';

const Navbar = () => {
const { setAtomicToolkit } = useAtomicToolkit();
const { connected } = useConnection();

React.useEffect(() => {
const get = async () => {
const warp = WarpFactory.forMainnet({
...defaultCacheOptions,
inMemory: true,
}).use(new DeployPlugin());
const get = () => {
const warp = WarpFactory.forMainnet();

console.log(warp);
warp.use(new DeployPlugin());
const toolkit = new AtomicToolkitWeb({
warp,
useIrys: false,
});
return toolkit;
setAtomicToolkit(toolkit);
};

if (connected) {
get()
.then((toolkit) => {
console.log('Toolkit: ', toolkit);
setAtomicToolkit(toolkit);
})
.catch((err) => {
console.log(err);
});
get();
}
}, [connected]);

Expand Down
4 changes: 4 additions & 0 deletions packages/atomic-toolkit/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as Types from './types';
import { CreateTradableAssetOpts, CollectionOpts } from './types/asset';
import { UploadResponse } from '@irys/sdk/build/cjs/common/types';
import Transaction from 'arweave/node/lib/transaction';
import { DeployPlugin } from 'warp-contracts-plugin-deploy';

class AtomicToolkitWeb {
public warp: Warp;
Expand All @@ -26,6 +27,9 @@ class AtomicToolkitWeb {
useIrys = false,
...props
}: Types.AtomicToolkitWebOpts) {
const DeployPluginClass: typeof DeployPlugin =
(DeployPlugin as any)?.default ?? DeployPlugin;

if (!warp.hasPlugin('deploy')) {
throw new Error('Warp instance must have DeployPlugin');
}
Expand Down
76 changes: 2 additions & 74 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e44f083

Please sign in to comment.