Skip to content

Commit e5dbf54

Browse files
authored
chore: package updates (#39)
chore: package updates
1 parent 3de40ca commit e5dbf54

File tree

25 files changed

+195
-217
lines changed

25 files changed

+195
-217
lines changed

.github/workflows/check-python.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ jobs:
4141
# set git user and email as test invoke git
4242
git config --global user.email "actions@github.com" && git config --global user.name "github-actions"
4343
44+
- name: Setup Node.js 20.x
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: '20.x'
48+
4449
- name: Run tests
4550
shell: bash
4651
run: |

examples/cloud_provider/production_react_netlify/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
</head>
88
<body>
99
<div id="root"></div>
10-
<script>
11-
global = globalThis
12-
</script>
1310
<script type="module" src="/src/main.tsx"></script>
1411
</body>
1512
</html>

examples/cloud_provider/production_react_netlify/package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
"private": true,
99
"type": "module",
1010
"engines": {
11-
"node": ">=18.0",
11+
"node": ">=20.0",
1212
"npm": ">=9.0"
1313
},
1414
"devDependencies": {
15-
"@algorandfoundation/algokit-client-generator": "^3.0.3",
15+
"@algorandfoundation/algokit-client-generator": "^4.0.0",
1616
"@types/node": "^18.17.14",
1717
"@types/react": "^18.2.11",
1818
"@types/react-dom": "^18.2.4",
1919
"@vitejs/plugin-react": "^4.2.1",
2020
"autoprefixer": "^10.4.14",
21-
"eslint": "^8.42.0",
22-
"eslint-config-prettier": "^8.8.0",
23-
"eslint-plugin-prettier": "^5.0.0",
24-
"@typescript-eslint/eslint-plugin": "^6.5.0",
25-
"@typescript-eslint/parser": "^6.5.0",
21+
"eslint": "^8.56.0",
22+
"eslint-config-prettier": "^9.1.0",
23+
"eslint-plugin-prettier": "^5.1.3",
24+
"@typescript-eslint/eslint-plugin": "^7.0.2",
25+
"@typescript-eslint/parser": "^7.0.2",
2626
"postcss": "^8.4.24",
2727
"tailwindcss": "3.3.2",
2828
"ts-jest": "^29.1.1",
@@ -31,16 +31,16 @@
3131
"typescript": "^5.1.6",
3232
"@playwright/test": "^1.35.0",
3333
"playwright": "^1.35.0",
34-
"vite": "^5.0.0"
34+
"vite": "^5.0.0",
35+
"vite-plugin-node-polyfills": "^0.22.0"
3536
},
3637
"dependencies": {
37-
"@walletconnect/modal-sign-html": "^2.6.1",
38-
"@algorandfoundation/algokit-utils": "^6.0.2",
38+
"@algorandfoundation/algokit-utils": "^7.0.0",
3939
"@blockshake/defly-connect": "^1.1.6",
4040
"@daffiwallet/connect": "^1.0.3",
41-
"@perawallet/connect": "^1.3.1",
42-
"@txnlab/use-wallet": "^2.4.0",
43-
"algosdk": "^2.7.0",
41+
"@perawallet/connect": "^1.3.4",
42+
"@txnlab/use-wallet": "^2.8.2",
43+
"algosdk": ">=2.9.0 <3.0",
4444
"daisyui": "^4.0.0",
4545
"notistack": "^3.0.1",
4646
"react": "^18.2.0",
@@ -74,5 +74,8 @@
7474
"last 1 firefox version",
7575
"last 1 safari version"
7676
]
77+
},
78+
"overrides": {
79+
"ws@>7.0.0 <7.5.9": "7.5.10"
7780
}
7881
}

examples/cloud_provider/production_react_netlify/src/components/Transact.tsx

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import * as algokit from '@algorandfoundation/algokit-utils'
1+
import { algo, AlgorandClient } from '@algorandfoundation/algokit-utils'
22
import { useWallet } from '@txnlab/use-wallet'
3-
import algosdk from 'algosdk'
43
import { useSnackbar } from 'notistack'
54
import { useState } from 'react'
65
import { getAlgodConfigFromViteEnvironment } from '../utils/network/getAlgoClientConfigs'
@@ -15,15 +14,11 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
1514
const [receiverAddress, setReceiverAddress] = useState<string>('')
1615

1716
const algodConfig = getAlgodConfigFromViteEnvironment()
18-
const algodClient = algokit.getAlgoClient({
19-
server: algodConfig.server,
20-
port: algodConfig.port,
21-
token: algodConfig.token,
22-
})
17+
const algorand = AlgorandClient.fromConfig({ algodConfig })
2318

2419
const { enqueueSnackbar } = useSnackbar()
2520

26-
const { signer, activeAddress, signTransactions, sendTransactions } = useWallet()
21+
const { signer, activeAddress } = useWallet()
2722

2823
const handleSubmitAlgo = async () => {
2924
setLoading(true)
@@ -33,25 +28,15 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
3328
return
3429
}
3530

36-
const suggestedParams = await algodClient.getTransactionParams().do()
37-
38-
const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
39-
from: activeAddress,
40-
to: receiverAddress,
41-
amount: 1e6,
42-
suggestedParams,
43-
})
44-
45-
const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction)
46-
47-
const signedTransactions = await signTransactions([encodedTransaction])
48-
49-
const waitRoundsToConfirm = 4
50-
5131
try {
5232
enqueueSnackbar('Sending transaction...', { variant: 'info' })
53-
const { id } = await sendTransactions(signedTransactions, waitRoundsToConfirm)
54-
enqueueSnackbar(`Transaction sent: ${id}`, { variant: 'success' })
33+
const result = await algorand.send.payment({
34+
signer,
35+
sender: activeAddress,
36+
receiver: receiverAddress,
37+
amount: algo(1),
38+
})
39+
enqueueSnackbar(`Transaction sent: ${result.txIds[0]}`, { variant: 'success' })
5540
setReceiverAddress('')
5641
} catch (e) {
5742
enqueueSnackbar('Failed to send transaction', { variant: 'error' })

examples/cloud_provider/production_react_netlify/tests/example.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { randomAccount } from '@algorandfoundation/algokit-utils'
1+
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing'
22
import { expect, test } from '@playwright/test'
33

4+
const localnet = algorandFixture()
5+
46
test.beforeEach(async ({ page }) => {
7+
await localnet.beforeEach()
58
await page.goto('http://localhost:5173/')
69
})
710

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

30-
const dummyAccount = randomAccount()
31-
await page.getByTestId('receiver-address').fill(dummyAccount.addr)
33+
await page.getByTestId('receiver-address').fill(localnet.context.testAccount.addr)
3234
await page.getByTestId('send-algo').click()
3335

3436
// 3. Must be able to see a notification that the transaction was sent
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import react from '@vitejs/plugin-react'
22
import { defineConfig } from 'vite'
3+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
34

45
// https://vitejs.dev/config/
56
export default defineConfig({
6-
plugins: [react()],
7+
plugins: [
8+
react(),
9+
nodePolyfills({
10+
globals: {
11+
Buffer: true,
12+
},
13+
}),
14+
],
715
})

examples/cloud_provider/production_react_vercel/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
</head>
88
<body>
99
<div id="root"></div>
10-
<script>
11-
global = globalThis
12-
</script>
1310
<script type="module" src="/src/main.tsx"></script>
1411
</body>
1512
</html>

examples/cloud_provider/production_react_vercel/package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
"private": true,
99
"type": "module",
1010
"engines": {
11-
"node": ">=18.0",
11+
"node": ">=20.0",
1212
"npm": ">=9.0"
1313
},
1414
"devDependencies": {
15-
"@algorandfoundation/algokit-client-generator": "^3.0.3",
15+
"@algorandfoundation/algokit-client-generator": "^4.0.0",
1616
"@types/node": "^18.17.14",
1717
"@types/react": "^18.2.11",
1818
"@types/react-dom": "^18.2.4",
1919
"@vitejs/plugin-react": "^4.2.1",
2020
"autoprefixer": "^10.4.14",
21-
"eslint": "^8.42.0",
22-
"eslint-config-prettier": "^8.8.0",
23-
"eslint-plugin-prettier": "^5.0.0",
24-
"@typescript-eslint/eslint-plugin": "^6.5.0",
25-
"@typescript-eslint/parser": "^6.5.0",
21+
"eslint": "^8.56.0",
22+
"eslint-config-prettier": "^9.1.0",
23+
"eslint-plugin-prettier": "^5.1.3",
24+
"@typescript-eslint/eslint-plugin": "^7.0.2",
25+
"@typescript-eslint/parser": "^7.0.2",
2626
"postcss": "^8.4.24",
2727
"tailwindcss": "3.3.2",
2828
"ts-jest": "^29.1.1",
@@ -31,16 +31,16 @@
3131
"typescript": "^5.1.6",
3232
"@playwright/test": "^1.35.0",
3333
"playwright": "^1.35.0",
34-
"vite": "^5.0.0"
34+
"vite": "^5.0.0",
35+
"vite-plugin-node-polyfills": "^0.22.0"
3536
},
3637
"dependencies": {
37-
"@walletconnect/modal-sign-html": "^2.6.1",
38-
"@algorandfoundation/algokit-utils": "^6.0.2",
38+
"@algorandfoundation/algokit-utils": "^7.0.0",
3939
"@blockshake/defly-connect": "^1.1.6",
4040
"@daffiwallet/connect": "^1.0.3",
41-
"@perawallet/connect": "^1.3.1",
42-
"@txnlab/use-wallet": "^2.4.0",
43-
"algosdk": "^2.7.0",
41+
"@perawallet/connect": "^1.3.4",
42+
"@txnlab/use-wallet": "^2.8.2",
43+
"algosdk": ">=2.9.0 <3.0",
4444
"daisyui": "^4.0.0",
4545
"notistack": "^3.0.1",
4646
"react": "^18.2.0",
@@ -77,5 +77,8 @@
7777
"last 1 firefox version",
7878
"last 1 safari version"
7979
]
80+
},
81+
"overrides": {
82+
"ws@>7.0.0 <7.5.9": "7.5.10"
8083
}
8184
}

examples/cloud_provider/production_react_vercel/src/components/Transact.tsx

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import * as algokit from '@algorandfoundation/algokit-utils'
1+
import { algo, AlgorandClient } from '@algorandfoundation/algokit-utils'
22
import { useWallet } from '@txnlab/use-wallet'
3-
import algosdk from 'algosdk'
43
import { useSnackbar } from 'notistack'
54
import { useState } from 'react'
65
import { getAlgodConfigFromViteEnvironment } from '../utils/network/getAlgoClientConfigs'
@@ -15,15 +14,11 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
1514
const [receiverAddress, setReceiverAddress] = useState<string>('')
1615

1716
const algodConfig = getAlgodConfigFromViteEnvironment()
18-
const algodClient = algokit.getAlgoClient({
19-
server: algodConfig.server,
20-
port: algodConfig.port,
21-
token: algodConfig.token,
22-
})
17+
const algorand = AlgorandClient.fromConfig({ algodConfig })
2318

2419
const { enqueueSnackbar } = useSnackbar()
2520

26-
const { signer, activeAddress, signTransactions, sendTransactions } = useWallet()
21+
const { signer, activeAddress } = useWallet()
2722

2823
const handleSubmitAlgo = async () => {
2924
setLoading(true)
@@ -33,25 +28,15 @@ const Transact = ({ openModal, setModalState }: TransactInterface) => {
3328
return
3429
}
3530

36-
const suggestedParams = await algodClient.getTransactionParams().do()
37-
38-
const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
39-
from: activeAddress,
40-
to: receiverAddress,
41-
amount: 1e6,
42-
suggestedParams,
43-
})
44-
45-
const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction)
46-
47-
const signedTransactions = await signTransactions([encodedTransaction])
48-
49-
const waitRoundsToConfirm = 4
50-
5131
try {
5232
enqueueSnackbar('Sending transaction...', { variant: 'info' })
53-
const { id } = await sendTransactions(signedTransactions, waitRoundsToConfirm)
54-
enqueueSnackbar(`Transaction sent: ${id}`, { variant: 'success' })
33+
const result = await algorand.send.payment({
34+
signer,
35+
sender: activeAddress,
36+
receiver: receiverAddress,
37+
amount: algo(1),
38+
})
39+
enqueueSnackbar(`Transaction sent: ${result.txIds[0]}`, { variant: 'success' })
5540
setReceiverAddress('')
5641
} catch (e) {
5742
enqueueSnackbar('Failed to send transaction', { variant: 'error' })

examples/cloud_provider/production_react_vercel/tests/example.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { randomAccount } from '@algorandfoundation/algokit-utils'
1+
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing'
22
import { expect, test } from '@playwright/test'
33

4+
const localnet = algorandFixture()
5+
46
test.beforeEach(async ({ page }) => {
7+
await localnet.beforeEach()
58
await page.goto('http://localhost:5173/')
69
})
710

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

30-
const dummyAccount = randomAccount()
31-
await page.getByTestId('receiver-address').fill(dummyAccount.addr)
33+
await page.getByTestId('receiver-address').fill(localnet.context.testAccount.addr)
3234
await page.getByTestId('send-algo').click()
3335

3436
// 3. Must be able to see a notification that the transaction was sent

0 commit comments

Comments
 (0)