File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
pages/entropy/generate-random-numbers Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,14 @@ import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyCons
46
46
import { IEntropy } from "@pythnetwork/entropy-sdk-solidity/IEntropy.sol";
47
47
48
48
// @param entropyAddress The address of the entropy contract.
49
- contract YourContract(address entropyAddress) is IEntropyConsumer {
50
- IEntropy entropy = IEntropy(entropyAddress);
49
+ contract YourContract is IEntropyConsumer {
50
+ IEntropy public entropy;
51
+
52
+ constructor(address entropyAddress) {
53
+ entropy = IEntropy(entropyAddress);
54
+ }
51
55
}
56
+
52
57
```
53
58
54
59
<Callout type = " info" >
@@ -76,14 +81,18 @@ To generate a random number, follow these steps.
76
81
77
82
Generate a 32-byte random number on the client side.
78
83
79
- <Tabs items = { [" web3.js" , " ethers.js" ]} >
80
- <Tabs.Tab >
81
- ``` typescript copy const userRandomNumber = web3.utils.randomHex(32); ```
82
- </Tabs.Tab >
83
- <Tabs.Tab >
84
- ``` typescript copy const userRandomNumber = ethers.utils.randomBytes(32);
84
+ <Tabs >
85
+ <TabItem value = " web3.js" label = " web3.js" >
86
+ ``` javascript
87
+ const userRandomNumber = web3 .utils .randomHex (32 );
88
+ ```
89
+ </TabItem >
90
+
91
+ <TabItem value = " ethers.js" label = " ethers.js" >
92
+ ``` javascript
93
+ const userRandomNumber = ethers .utils .randomBytes (32 );
85
94
```
86
- </Tabs.Tab >
95
+ </TabItem >
87
96
</Tabs >
88
97
89
98
### 2. Request a number from Entropy
You can’t perform that action at this time.
0 commit comments