Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WAITING] chore: package updates #39

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions examples/cloud_provider/production_react_netlify/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
</head>
<body>
<div id="root"></div>
<script>
global = globalThis
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
27 changes: 15 additions & 12 deletions examples/cloud_provider/production_react_netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"npm": ">=9.0"
},
"devDependencies": {
"@algorandfoundation/algokit-client-generator": "^3.0.3",
"@algorandfoundation/algokit-client-generator": "v4.0.0-beta.8",
"@types/node": "^18.17.14",
"@types/react": "^18.2.11",
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.14",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"postcss": "^8.4.24",
"tailwindcss": "3.3.2",
"ts-jest": "^29.1.1",
Expand All @@ -31,16 +31,16 @@
"typescript": "^5.1.6",
"@playwright/test": "^1.35.0",
"playwright": "^1.35.0",
"vite": "^5.0.0"
"vite": "^5.0.0",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
"@walletconnect/modal-sign-html": "^2.6.1",
"@algorandfoundation/algokit-utils": "^6.0.2",
"@algorandfoundation/algokit-utils": "7.0.0-beta.22",
"@blockshake/defly-connect": "^1.1.6",
"@daffiwallet/connect": "^1.0.3",
"@perawallet/connect": "^1.3.1",
"@txnlab/use-wallet": "^2.4.0",
"algosdk": "^2.7.0",
"@perawallet/connect": "^1.3.4",
"@txnlab/use-wallet": "^2.8.2",
"algosdk": ">=2.9.0 <3.0",
"daisyui": "^4.0.0",
"notistack": "^3.0.1",
"react": "^18.2.0",
Expand Down Expand Up @@ -74,5 +74,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"overrides": {
"ws@>7.0.0 <7.5.9": "7.5.10"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as algokit from '@algorandfoundation/algokit-utils'
import { algo, AlgorandClient } from '@algorandfoundation/algokit-utils'
import { useWallet } from '@txnlab/use-wallet'
import algosdk from 'algosdk'
import { useSnackbar } from 'notistack'
import { useState } from 'react'
import { getAlgodConfigFromViteEnvironment } from '../utils/network/getAlgoClientConfigs'
Expand All @@ -15,15 +14,11 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
const [receiverAddress, setReceiverAddress] = useState<string>('')

const algodConfig = getAlgodConfigFromViteEnvironment()
const algodClient = algokit.getAlgoClient({
server: algodConfig.server,
port: algodConfig.port,
token: algodConfig.token,
})
const algorand = AlgorandClient.fromConfig({ algodConfig })

const { enqueueSnackbar } = useSnackbar()

const { signer, activeAddress, signTransactions, sendTransactions } = useWallet()
const { signer, activeAddress } = useWallet()

const handleSubmitAlgo = async () => {
setLoading(true)
Expand All @@ -33,25 +28,15 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
return
}

const suggestedParams = await algodClient.getTransactionParams().do()

const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: activeAddress,
to: receiverAddress,
amount: 1e6,
suggestedParams,
})

const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction)

const signedTransactions = await signTransactions([encodedTransaction])

const waitRoundsToConfirm = 4

try {
enqueueSnackbar('Sending transaction...', { variant: 'info' })
const { id } = await sendTransactions(signedTransactions, waitRoundsToConfirm)
enqueueSnackbar(`Transaction sent: ${id}`, { variant: 'success' })
const result = await algorand.send.payment({
signer,
sender: activeAddress,
receiver: receiverAddress,
amount: algo(1),
})
enqueueSnackbar(`Transaction sent: ${result.txIds[0]}`, { variant: 'success' })
setReceiverAddress('')
} catch (e) {
enqueueSnackbar('Failed to send transaction', { variant: 'error' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { randomAccount } from '@algorandfoundation/algokit-utils'
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing'
import { expect, test } from '@playwright/test'

const localnet = algorandFixture()

test.beforeEach(async ({ page }) => {
await localnet.beforeEach()
await page.goto('http://localhost:5173/')
})

Expand All @@ -27,8 +30,7 @@ test('authentication and dummy payment transaction', async ({ page }) => {
// 2. Must be able to send a dummy payment transaction
await page.getByTestId('transactions-demo').click()

const dummyAccount = randomAccount()
await page.getByTestId('receiver-address').fill(dummyAccount.addr)
await page.getByTestId('receiver-address').fill(localnet.context.testAccount.addr)
await page.getByTestId('send-algo').click()

// 3. Must be able to see a notification that the transaction was sent
Expand Down
10 changes: 9 additions & 1 deletion examples/cloud_provider/production_react_netlify/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [
react(),
nodePolyfills({
globals: {
Buffer: true,
},
}),
],
})
3 changes: 0 additions & 3 deletions examples/cloud_provider/production_react_vercel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
</head>
<body>
<div id="root"></div>
<script>
global = globalThis
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
27 changes: 15 additions & 12 deletions examples/cloud_provider/production_react_vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"npm": ">=9.0"
},
"devDependencies": {
"@algorandfoundation/algokit-client-generator": "^3.0.3",
"@algorandfoundation/algokit-client-generator": "v4.0.0-beta.8",
"@types/node": "^18.17.14",
"@types/react": "^18.2.11",
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.14",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"postcss": "^8.4.24",
"tailwindcss": "3.3.2",
"ts-jest": "^29.1.1",
Expand All @@ -31,16 +31,16 @@
"typescript": "^5.1.6",
"@playwright/test": "^1.35.0",
"playwright": "^1.35.0",
"vite": "^5.0.0"
"vite": "^5.0.0",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
"@walletconnect/modal-sign-html": "^2.6.1",
"@algorandfoundation/algokit-utils": "^6.0.2",
"@algorandfoundation/algokit-utils": "7.0.0-beta.22",
"@blockshake/defly-connect": "^1.1.6",
"@daffiwallet/connect": "^1.0.3",
"@perawallet/connect": "^1.3.1",
"@txnlab/use-wallet": "^2.4.0",
"algosdk": "^2.7.0",
"@perawallet/connect": "^1.3.4",
"@txnlab/use-wallet": "^2.8.2",
"algosdk": ">=2.9.0 <3.0",
"daisyui": "^4.0.0",
"notistack": "^3.0.1",
"react": "^18.2.0",
Expand Down Expand Up @@ -77,5 +77,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"overrides": {
"ws@>7.0.0 <7.5.9": "7.5.10"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as algokit from '@algorandfoundation/algokit-utils'
import { algo, AlgorandClient } from '@algorandfoundation/algokit-utils'
import { useWallet } from '@txnlab/use-wallet'
import algosdk from 'algosdk'
import { useSnackbar } from 'notistack'
import { useState } from 'react'
import { getAlgodConfigFromViteEnvironment } from '../utils/network/getAlgoClientConfigs'
Expand All @@ -15,15 +14,11 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
const [receiverAddress, setReceiverAddress] = useState<string>('')

const algodConfig = getAlgodConfigFromViteEnvironment()
const algodClient = algokit.getAlgoClient({
server: algodConfig.server,
port: algodConfig.port,
token: algodConfig.token,
})
const algorand = AlgorandClient.fromConfig({ algodConfig })

const { enqueueSnackbar } = useSnackbar()

const { signer, activeAddress, signTransactions, sendTransactions } = useWallet()
const { signer, activeAddress } = useWallet()

const handleSubmitAlgo = async () => {
setLoading(true)
Expand All @@ -33,25 +28,15 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
return
}

const suggestedParams = await algodClient.getTransactionParams().do()

const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: activeAddress,
to: receiverAddress,
amount: 1e6,
suggestedParams,
})

const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction)

const signedTransactions = await signTransactions([encodedTransaction])

const waitRoundsToConfirm = 4

try {
enqueueSnackbar('Sending transaction...', { variant: 'info' })
const { id } = await sendTransactions(signedTransactions, waitRoundsToConfirm)
enqueueSnackbar(`Transaction sent: ${id}`, { variant: 'success' })
const result = await algorand.send.payment({
signer,
sender: activeAddress,
receiver: receiverAddress,
amount: algo(1),
})
enqueueSnackbar(`Transaction sent: ${result.txIds[0]}`, { variant: 'success' })
setReceiverAddress('')
} catch (e) {
enqueueSnackbar('Failed to send transaction', { variant: 'error' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { randomAccount } from '@algorandfoundation/algokit-utils'
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing'
import { expect, test } from '@playwright/test'

const localnet = algorandFixture()

test.beforeEach(async ({ page }) => {
await localnet.beforeEach()
await page.goto('http://localhost:5173/')
})

Expand All @@ -27,8 +30,7 @@ test('authentication and dummy payment transaction', async ({ page }) => {
// 2. Must be able to send a dummy payment transaction
await page.getByTestId('transactions-demo').click()

const dummyAccount = randomAccount()
await page.getByTestId('receiver-address').fill(dummyAccount.addr)
await page.getByTestId('receiver-address').fill(localnet.context.testAccount.addr)
await page.getByTestId('send-algo').click()

// 3. Must be able to see a notification that the transaction was sent
Expand Down
10 changes: 9 additions & 1 deletion examples/cloud_provider/production_react_vercel/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [
react(),
nodePolyfills({
globals: {
Buffer: true,
},
}),
],
})
3 changes: 0 additions & 3 deletions examples/production_react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
</head>
<body>
<div id="root"></div>
<script>
global = globalThis
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
27 changes: 15 additions & 12 deletions examples/production_react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"npm": ">=9.0"
},
"devDependencies": {
"@algorandfoundation/algokit-client-generator": "^3.0.3",
"@algorandfoundation/algokit-client-generator": "v4.0.0-beta.8",
"@types/node": "^18.17.14",
"@types/react": "^18.2.11",
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.14",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"postcss": "^8.4.24",
"tailwindcss": "3.3.2",
"ts-jest": "^29.1.1",
Expand All @@ -31,16 +31,16 @@
"typescript": "^5.1.6",
"@playwright/test": "^1.35.0",
"playwright": "^1.35.0",
"vite": "^5.0.0"
"vite": "^5.0.0",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
"@walletconnect/modal-sign-html": "^2.6.1",
"@algorandfoundation/algokit-utils": "^6.0.2",
"@algorandfoundation/algokit-utils": "7.0.0-beta.22",
"@blockshake/defly-connect": "^1.1.6",
"@daffiwallet/connect": "^1.0.3",
"@perawallet/connect": "^1.3.1",
"@txnlab/use-wallet": "^2.4.0",
"algosdk": "^2.7.0",
"@perawallet/connect": "^1.3.4",
"@txnlab/use-wallet": "^2.8.2",
"algosdk": ">=2.9.0 <3.0",
"daisyui": "^4.0.0",
"notistack": "^3.0.1",
"react": "^18.2.0",
Expand Down Expand Up @@ -74,5 +74,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"overrides": {
"ws@>7.0.0 <7.5.9": "7.5.10"
}
}
Loading