Skip to content

Commit

Permalink
fix(cjs): provide path alias for warp in cjs export
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed May 2, 2024
1 parent 9c48205 commit 7f9bf9a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1,063 deletions.
4 changes: 0 additions & 4 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
"warp-contracts": "^1.4.41"
},
"devDependencies": {
"@babel/core": "^7.24.5",
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -22,7 +19,6 @@
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.2.1",
"babel-loader": "^9.1.3",
"typescript": "^4.9.5",
"vite": "^5.2.10",
"vite-plugin-html": "^3.2.2",
Expand Down
7 changes: 3 additions & 4 deletions examples/vite/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { WarpFactory } from 'warp-contracts';
import { WarpFactory, Contract } from 'warp-contracts';

import './App.css';

Expand All @@ -12,19 +12,18 @@ const antContract = warp.contract(contractTxId);
function App() {
const [contract, setContract] = useState<string>('Loading...');

// NOTE: there is a bug in warp-contracts causing this to fail on `AbortError` import missing
useEffect(() => {
antContract
.syncState(`https://api.arns.app/v1/contract/${contractTxId}`, {
validity: true,
})
.then(async (syncContract) => {
.then(async (syncContract: Contract) => {
const { cachedValue } = await syncContract.readState();
setContract(
`\`\`\`json\n${JSON.stringify(cachedValue.state, null, 2)}`,
);
})
.catch((error) => {
.catch((error: unknown) => {
console.error(error);
setContract('Error loading contract state');
});
Expand Down

0 comments on commit 7f9bf9a

Please sign in to comment.