@alephium/web3 0.2.0-rc.2 → 0.2.0-rc.5
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.
- package/contracts/add/add.ral +5 -6
- package/contracts/greeter/greeter.ral +2 -2
- package/contracts/greeter/greeter_interface.ral +1 -0
- package/contracts/greeter_main.ral +0 -2
- package/contracts/main.ral +0 -2
- package/contracts/sub/sub.ral +1 -0
- package/contracts/test/metadata.ral +18 -0
- package/contracts/test/warnings.ral +8 -0
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +25 -5
- package/dist/src/api/api-alephium.js +16 -0
- package/dist/src/contract/contract.d.ts +77 -50
- package/dist/src/contract/contract.js +306 -219
- package/dist/src/utils/utils.d.ts +2 -2
- package/dist/src/utils/utils.js +1 -1
- package/gitignore +0 -1
- package/package.json +2 -4
- package/src/api/api-alephium.ts +39 -5
- package/src/contract/contract.ts +405 -314
- package/src/contract/events.ts +2 -2
- package/src/contract/ralph.test.ts +4 -4
- package/src/transaction/status.ts +1 -1
- package/src/utils/subscription.ts +1 -1
- package/src/utils/utils.ts +3 -3
- package/templates/base/package.json +2 -2
- package/templates/react/package.json +2 -2
- package/test/contract.test.ts +48 -13
- package/test/events.test.ts +13 -8
- package/test/transaction.test.ts +6 -4
package/contracts/add/add.ral
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import "../sub/sub.ral"
|
|
2
|
-
|
|
3
1
|
Contract Add(subContractId: ByteVec, mut result : U256) {
|
|
4
2
|
event Add(x: U256, y: U256)
|
|
5
3
|
|
|
4
|
+
@using(permissionCheck = false)
|
|
6
5
|
pub fn add(array: [U256; 2]) -> ([U256; 2]) {
|
|
6
|
+
return addPrivate(array)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
fn addPrivate(array: [U256; 2]) -> ([U256; 2]) {
|
|
7
10
|
emit Add(array[0], array[1])
|
|
8
11
|
let sub = Sub(subContractId)
|
|
9
12
|
result = result + array[0] + array[1]
|
|
10
13
|
return [result, sub.sub(array)]
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
fn addPrivate(array: [U256; 2]) -> ([U256; 2]) {
|
|
14
|
-
return add(array)
|
|
15
|
-
}
|
|
16
15
|
}
|
package/contracts/main.ral
CHANGED
package/contracts/sub/sub.ral
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Contract MetaData() {
|
|
2
|
+
@using(preapprovedAssets = true, assetsInContract = false)
|
|
3
|
+
pub fn foo() -> () {
|
|
4
|
+
transferAlph!(callerAddress!(), callerAddress!(), 1 alph)
|
|
5
|
+
return
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@using(preapprovedAssets = false, assetsInContract = true)
|
|
9
|
+
fn bar() -> () {
|
|
10
|
+
transferAlphToSelf!(selfAddress!(), 1 alph)
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@using(readonly = true)
|
|
15
|
+
fn baz() -> () {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
}
|