You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `build` script will compile the TypeScript code.
95
95
96
-
Using the Coston network artifacts, the `typechain` generates TypeScript types from the Flare Periphery contracts, which are provided through a [package](https://www.npmjs.com/package/@flarenetwork/flare-periphery-contract-artifacts) containing the necessary contract artifacts.
96
+
Using the Coston2 network artifacts, the `typechain` generates TypeScript types from the Flare Periphery contracts, which are provided through a [package](https://www.npmjs.com/package/@flarenetwork/flare-periphery-contract-artifacts) containing the necessary contract artifacts.
97
97
98
98
Change the `package.json` file to use the `module` type to use ES modules and avoid issues with the `import` statement:
99
99
@@ -109,7 +109,7 @@ To generate the TypeScript types, run the following command:
109
109
npm run generate-types
110
110
```
111
111
112
-
It will generate the types TypeScript types in the `typechain` directory.
112
+
It will generate the TypeScript types in the `typechain` directory.
113
113
114
114
## Implementation
115
115
@@ -132,49 +132,58 @@ Import the ethers library to interact with the blockchain:
132
132
import { ethers } from"ethers";
133
133
```
134
134
135
-
You need to import the FAssets asset manager contract factory type:
135
+
You need to import the [Flare Contracts Registry](/network/guides/flare-contracts-registry) and the [FAssets asset manager](/fassets/reference/IAssetManager) contract factory types:
After that, you must fetch the FAssets configuration settings using the [`getSettings`](/fassets/reference/IAssetManager#getsettings) function of the FAssets asset manager contract.
Next, you must fetch the FAssets configuration settings using the [`getSettings`](/fassets/reference/IAssetManager#getsettings) function of the FAssets asset manager contract.
176
179
177
-
getSettings();
180
+
The last step is to get the lot size of FXRP in XRP and print it to the console.
Define the constants for the [registry address](/network/guides/flare-for-javascript-developers#querying-a-contract) and the [XRP/USD feed ID](/ftso/scaling/anchor-feeds).
207
+
Define the constants for the [XRP/USD feed ID](/ftso/scaling/anchor-feeds).
// Constants for RPC endpoint and contract addresses
246
-
constCOSTON_RPC="https://coston-api.flare.network/ext/C/rpc"; // RPC URL for the Coston network
247
-
constASSET_MANAGER_ADDRESS ="0xeEd82b8390880af0b6Cb6Dd398a7E361cc30E8e2"; // Address of the Asset Manager contract
248
-
const REGISTRY_ADDRESS ="0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019"; // Address of the Flare Contract Registry
253
+
constCOSTON2_RPC="https://coston2-api.flare.network/ext/C/rpc"; // RPC URL for the Coston2 network
254
+
constFLARE_CONTRACT_REGISTRY_ADDRESS =
255
+
"0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019"; // Address of the Flare Contract Registry
249
256
const XRP_USD_FEED_ID ="0x015852502f55534400000000000000000000000000"; // Feed ID for XRP/USD price https://dev.flare.network/ftso/scaling/anchor-feeds
250
257
251
258
asyncfunction getSettings() {
252
259
// Create a provider for interacting with the blockchain
Congratulations! You have built a TypeScript script that connects to the Coston network and retrieves the FAsset configuration settings and the price of XRP in USD.
326
+
Congratulations! You have built a TypeScript script that connects to the Coston2 network and retrieves the FAsset configuration settings and the price of XRP in USD.
315
327
316
328
<ExploringAdditionalParameters />
329
+
330
+
## Next Steps
331
+
332
+
To continue your FAssets development journey, you can:
333
+
334
+
- Learn how to [mint FXRP](/fassets/developer-guides/fassets-mint).
335
+
- Understand how to [redeem FXRP](/fassets/developer-guides/fassets-redeem).
0 commit comments