@alephium/web3 0.2.0-rc.2 → 0.2.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "license": "GPL",
5
5
  "config": {
6
- "alephium_version": "1.5.0-rc2"
6
+ "alephium_version": "1.5.0-rc4"
7
7
  },
8
8
  "scripts": {
9
9
  "build": "rm -rf dist && npx tsc --build .",
@@ -12,7 +12,7 @@
12
12
  "stop-devnet": "node scripts/stop-devnet.js"
13
13
  },
14
14
  "dependencies": {
15
- "@alephium/web3": "0.2.0-rc.2"
15
+ "@alephium/web3": "0.2.0-rc.3"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/elliptic": "^6.4.13",
@@ -2,7 +2,7 @@
2
2
  "name": "my-dapp",
3
3
  "version": "0.1.0",
4
4
  "config": {
5
- "alephium_version": "1.5.0-rc0"
5
+ "alephium_version": "1.5.0-rc4"
6
6
  },
7
7
  "dependencies": {
8
8
  "@testing-library/jest-dom": "^5.16.4",
@@ -12,7 +12,7 @@
12
12
  "@types/node": "^16.11.26",
13
13
  "@types/react": "^18.0.3",
14
14
  "@types/react-dom": "^18.0.0",
15
- "@alephium/web3": "0.2.0-rc.2",
15
+ "@alephium/web3": "0.2.0-rc.3",
16
16
  "react": "^18.0.0",
17
17
  "react-dom": "^18.0.0",
18
18
  "react-scripts": "5.0.1",
@@ -175,4 +175,23 @@ describe('contract', function () {
175
175
  loadContract('./artifacts/greeter/greeter.ral.json')
176
176
  loadScript('./artifacts/greeter_main.ral.json')
177
177
  })
178
+
179
+ it('should extract metadata of contracts', async () => {
180
+ const provider = new NodeProvider('http://127.0.0.1:22973')
181
+ const contract = await Contract.fromSource(provider, 'test/metadata.ral')
182
+ expect(contract.functions.map((func) => func.name)).toEqual(['foo', 'bar', 'baz'])
183
+ expect(contract.publicFunctions()).toEqual(['foo'])
184
+ expect(contract.usingPreapprovedAssetsFunctions()).toEqual(['foo'])
185
+ expect(contract.usingAssetsInContractFunctions()).toEqual(['bar'])
186
+ })
187
+
188
+ it('should handle compiler warnings', async () => {
189
+ const provider = new NodeProvider('http://127.0.0.1:22973')
190
+ const contract = await Contract.fromSource(provider, 'test/warnings.ral', false)
191
+ expect(contract.publicFunctions()).toEqual(['foo'])
192
+
193
+ await expect(Contract.fromSource(provider, 'test/warnings.ral')).rejects.toThrowError(
194
+ 'Compilation warnings:\n - Found unused variables in function foo: foo.y\n - Found unused fields: b'
195
+ )
196
+ })
178
197
  })
@@ -56,7 +56,7 @@ describe('transactions', function () {
56
56
  await timeout(1500)
57
57
  expect(txStatus).toMatchObject({ type: 'TxNotFound' })
58
58
 
59
- const subSubmitResult = await signer.submitTransaction(subDeployTx.unsignedTx, subDeployTx.txId)
59
+ await signer.submitTransaction(subDeployTx.unsignedTx, subDeployTx.txId)
60
60
  await timeout(1500)
61
61
  expect(txStatus).toMatchObject({ type: 'Confirmed' })
62
62