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
4646import { IEntropy } from "@pythnetwork/entropy-sdk-solidity/IEntropy.sol";
4747
4848// @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+ }
5155}
56+
5257```
5358
5459<Callout type = " info" >
@@ -76,14 +81,18 @@ To generate a random number, follow these steps.
7681
7782Generate a 32-byte random number on the client side.
7883
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 );
8594 ```
86- </Tabs.Tab >
95+ </TabItem >
8796</Tabs >
8897
8998### 2. Request a number from Entropy
You can’t perform that action at this time.
0 commit comments