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
Copy file name to clipboardExpand all lines: docs/network/flare-tx-sdk/1-getting-started.mdx
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,8 @@ Add the SDK to your project:
64
64
The SDK separates network logic from account management.
65
65
This ensures the same wallet can be used across multiple networks without code changes.
66
66
67
-
-**`Network`**: Represents the blockchain network you want to connect to. Available networks include:
67
+
-**`Network`**: Represents the blockchain network you want to connect to.
68
+
Available networks include:
68
69
-`Network.FLARE`
69
70
-`Network.COSTON2`
70
71
-`Network.SONGBIRD`
@@ -73,7 +74,9 @@ This ensures the same wallet can be used across multiple networks without code c
73
74
The `Network` object provides methods to query balances, transfer tokens, claim rewards, and interact with contracts.
74
75
It uses Flare's [public RPCs](/network/overview#configuration) by default.
75
76
76
-
-**`Wallet`**: Represents a user account. The SDK does not store private keys. Instead, it defines a [`Wallet`](https://github.com/flare-foundation/flare-tx-sdk/blob/HEAD/src/wallet/index.ts) interface which can be implemented by:
77
+
-**`Wallet`**: Represents a user account.
78
+
The SDK does not store private keys.
79
+
Instead, it defines a [`Wallet`](https://github.com/flare-foundation/flare-tx-sdk/blob/HEAD/src/wallet/index.ts) interface which can be implemented by:
77
80
- MetaMask and other browser wallets - `EIP1193WalletController`
78
81
- Ledger - `LedgerWalletController`
79
82
- Trezor - `TrezorWalletController`
@@ -191,7 +194,7 @@ async function connectEip1193() {
191
194
### Ledger
192
195
193
196
Use the [`LedgerWalletController`](https://github.com/flare-foundation/flare-tx-sdk/blob/HEAD/src/wallet/ledger/controller.ts).
194
-
It supports either Zondax Flare App ([`@zondax/ledger-flare`](https://www.npmjs.com/package/@zondax/ledger-flare)) or Ledger ETH App ([`@ledgerHQ/hw-app-eth`](https://www.npmjs.com/package/@ledgerhq/hw-app-eth)).
197
+
It supports either Zondax Flare App ([`@zondax/ledger-flare`](https://www.npmjs.com/package/@zondax/ledger-flare)) or Ledger ETH App ([`@ledgerhq/hw-app-eth`](https://www.npmjs.com/package/@ledgerhq/hw-app-eth)).
195
198
196
199
:::tip[Security]
197
200
@@ -253,7 +256,7 @@ The SDK only communicates with the device for signing.
Fetch `reward-distribution-data-tuples.json` from [timivesel/ftsov2-testnet-rewards](https://gitlab.com/timivesel/ftsov2-testnet-rewards) on GitLab.
182
+
Fetch `reward-distribution-data-tuples.json` from the community-maintained mirror [timivesel/ftsov2-testnet-rewards](https://gitlab.com/timivesel/ftsov2-testnet-rewards) on GitLab.
183
+
(This mirror is not an official Flare Foundation resource; treat the data with appropriate care and verify each tuple against on-chain values before claiming on production systems.)
183
184
184
185
```bash
185
186
EPOCH_ID=123
@@ -215,7 +216,8 @@ If the JSON cannot be fetched or validated, you cannot build a valid Merkle proo
Fetch `reward-distribution-data-tuples.json` from [timivesel/ftsov2-testnet-rewards](https://gitlab.com/timivesel/ftsov2-testnet-rewards) on GitLab.
219
+
Fetch `reward-distribution-data-tuples.json` from the community-maintained mirror [timivesel/ftsov2-testnet-rewards](https://gitlab.com/timivesel/ftsov2-testnet-rewards) on GitLab.
220
+
(This mirror is not an official Flare Foundation resource; treat the data with appropriate care and verify each tuple against on-chain values before claiming on production systems.)
<summary>T0. Authorization failure: executor not allowed or recipient not allowlisted</summary>
397
+
T0.
398
+
Authorization failure: executor not allowed or recipient not allowlisted
396
399
397
400
- If the signer sending `RewardManager.claim(...)` is not the beneficiary, ensure it is configured as a **claim executor** via `setClaimExecutors(...)`.
398
401
- If the transaction reverts when using a `recipient` address, ensure the recipient is allowlisted via `setAllowedClaimRecipients(...)`.
This guide is for developers who want to interact with Flare using Go. In this guide, using Go, you will learn how to:
23
+
This guide is for developers who want to interact with Flare using Go.
24
+
In this guide, using Go, you will learn how to:
24
25
25
26
- Query a contract on Flare using the Go API for [Geth](https://github.com/ethereum/go-ethereum), a client that implements the full Ethereum JSON-RPC API.
26
27
- Compile a Solidity contract using the CLI interface of [solc](https://github.com/argotorg/solidity), the Solidity compiler.
@@ -34,7 +35,9 @@ All examples in this guide are available at [developer-hub/examples](https://git
34
35
35
36
## Getting started
36
37
37
-
Install Geth by following the instructions in the [Geth documentation](https://geth.ethereum.org/docs/getting-started/installing-geth). Also install the Solidity compiler by following the instructions in the [Solidity documentation](https://docs.soliditylang.org/en/latest/installing-solidity.html#linux-packages). The main commands are provided here:
38
+
Install Geth by following the instructions in the [Geth documentation](https://geth.ethereum.org/docs/getting-started/installing-geth).
39
+
Also install the Solidity compiler by following the instructions in the [Solidity documentation](https://docs.soliditylang.org/en/latest/installing-solidity.html#linux-packages).
40
+
The main commands are provided here:
38
41
39
42
<Tabs>
40
43
<TabItemvalue="macos"label="MacOS via Homebrew"default>
@@ -78,7 +81,8 @@ developer-hub-go/
78
81
79
82
### Usage
80
83
81
-
You need to connect to testnet or mainnet via an RPC, any RPC listed on the [Network Configuration](/network/overview#configuration) page will work. For this guide, you can use the Public RPC.
84
+
You need to connect to testnet or mainnet via an RPC, any RPC listed on the [Network Configuration](/network/overview#configuration) page will work.
@@ -108,7 +112,11 @@ For this example, you can use the `FlareContractRegistry` contract which has the
108
112
109
113
### Fetch ABI
110
114
111
-
To fetch a contract's ABI, copy the [FlareContractRegistry ABI](https://api.routescan.io/v2/network/testnet/evm/114/etherscan/api?module=contract&action=getabi&address=0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019&format=raw), and paste it into a file named `FlareContractRegistry.abi`, located in the root of your project, i.e. same level as `go.mod`.
115
+
To fetch a contract's ABI, copy the FlareContractRegistry ABI from the appropriate Routescan endpoint and paste it into `FlareContractRegistry.abi` next to your `go.mod`.
116
+
The `FlareContractRegistry` itself is deployed at the same `0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019` on every Flare-family network — pick the URL that matches the chain you'll deploy to:
117
+
118
+
-**Flare Testnet Coston2 (chain id 114):**[routescan URL](https://api.routescan.io/v2/network/testnet/evm/114/etherscan/api?module=contract&action=getabi&address=0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019&format=raw)
119
+
-**Flare Mainnet (chain id 14):**[routescan URL](https://api.routescan.io/v2/network/mainnet/evm/14/etherscan/api?module=contract&action=getabi&address=0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019&format=raw)
112
120
113
121
To generate the ABI bindings, which will be saved to `FlareContractRegistry.go`:
114
122
@@ -154,7 +162,8 @@ For example, querying it for the address of the `WNat` contract:
154
162
155
163
## Compiling with solc
156
164
157
-
For this example, you can use the `FtsoV2FeedConsumer` contract to query the FTSOv2 feeds. Copy the `FtsoV2FeedConsumer` sample contract code given below, and save the `.sol` file in the same folder as your `go.mod`.
165
+
For this example, you can use the `FtsoV2FeedConsumer` contract to query the FTSOv2 feeds.
166
+
Copy the `FtsoV2FeedConsumer` sample contract code given below, and save the `.sol` file in the same folder as your `go.mod`.
This guide is for developers who want to interact with Flare using Rust. In this guide, using Rust, you will learn how to:
24
+
This guide is for developers who want to interact with Flare using Rust.
25
+
In this guide, using Rust, you will learn how to:
25
26
26
27
- Query a contract on Flare using [alloy-rs](https://github.com/alloy-rs), an async library for interacting with Ethereum-like chains.
27
28
- Compile a Solidity contract using the CLI interface of [solc](https://github.com/argotorg/solidity), the Solidity compiler.
@@ -35,7 +36,8 @@ All examples in this guide are available at [developer-hub/examples](https://git
35
36
36
37
## Getting started
37
38
38
-
Install the Solidity compiler by following the instructions in the [Solidity documentation](https://docs.soliditylang.org/en/latest/installing-solidity.html#linux-packages). The main commands are provided here:
39
+
Install the Solidity compiler by following the instructions in the [Solidity documentation](https://docs.soliditylang.org/en/latest/installing-solidity.html#linux-packages).
40
+
The main commands are provided here:
39
41
40
42
<Tabs>
41
43
<TabItemvalue="macos"label="MacOS via Homebrew"default>
You need to connect to testnet or mainnet via an RPC, any RPC listed on the [Network Configuration](/network/overview#configuration) page will work. For this guide, you can use the Public RPC.
70
+
You need to connect to testnet or mainnet via an RPC, any RPC listed on the [Network Configuration](/network/overview#configuration) page will work.
@@ -99,7 +102,11 @@ For this example, you can use the `FlareContractRegistry` contract which has the
99
102
100
103
### Fetch ABI
101
104
102
-
To fetch a contract's ABI, copy the [FlareContractRegistry ABI](https://api.routescan.io/v2/network/testnet/evm/114/etherscan/api?module=contract&action=getabi&address=0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019&format=raw), and paste it into a file named `FlareContractRegistry.json`, located in the root of your project, i.e. same level as `Cargo.toml`.
105
+
To fetch a contract's ABI, copy the FlareContractRegistry ABI from the appropriate Routescan endpoint and paste it into `FlareContractRegistry.json` next to your `Cargo.toml`.
106
+
Pick the URL that matches the chain you'll deploy to:
107
+
108
+
-**Flare Testnet Coston2 (chain id 114):**[routescan URL](https://api.routescan.io/v2/network/testnet/evm/114/etherscan/api?module=contract&action=getabi&address=0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019&format=raw)
109
+
-**Flare Mainnet (chain id 14):**[routescan URL](https://api.routescan.io/v2/network/mainnet/evm/14/etherscan/api?module=contract&action=getabi&address=0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019&format=raw)
103
110
104
111
### Make query
105
112
@@ -130,7 +137,8 @@ cargo run --bin make_query
130
137
131
138
## Compiling a contract
132
139
133
-
For this example, you can use the `FtsoV2FeedConsumer` contract to query the FTSOv2 feeds. Copy the `FtsoV2FeedConsumer` sample contract code given below, and save the `.sol` file in the same folder as your `Cargo.toml`.
140
+
For this example, you can use the `FtsoV2FeedConsumer` contract to query the FTSOv2 feeds.
141
+
Copy the `FtsoV2FeedConsumer` sample contract code given below, and save the `.sol` file in the same folder as your `Cargo.toml`.
@@ -159,7 +167,8 @@ This will generate a `FtsoV2FeedConsumer.json` file with the contract's ABI and
159
167
160
168
### Modify format
161
169
162
-
Things get a bit annoying here, as the alloy-rs `solc!()` macro expects a specific format for the JSON, which is not the same as the output from the Solidity compiler. To fix this, in the generated `FtsoV2FeedConsumer.json`, remove the top-level JSON fields, after you are done, the JSON should look like:
170
+
Things get a bit annoying here, as the alloy-rs `solc!()` macro expects a specific format for the JSON, which is not the same as the output from the Solidity compiler.
171
+
To fix this, in the generated `FtsoV2FeedConsumer.json`, remove the top-level JSON fields, after you are done, the JSON should look like:
163
172
164
173
```json title="FtsoV2FeedConsumer.json"
165
174
{
@@ -175,7 +184,8 @@ Things get a bit annoying here, as the alloy-rs `solc!()` macro expects a specif
175
184
176
185
## Create account
177
186
178
-
Before deploying a contract, you need to have an account with some testnet or mainnet gas tokens. You can create a new Flare account using `create_account.rs`:
187
+
Before deploying a contract, you need to have an account with some testnet or mainnet gas tokens.
188
+
You can create a new Flare account using `create_account.rs`:
@@ -227,13 +238,16 @@ With the account ready, you can now deploy the contract. In a `deploy_contract.r
227
238
</TabItem>
228
239
</Tabs>
229
240
230
-
You can now run the `deploy_contract.rs` script to deploy the contract. The contract address will be printed once the deployment is successful. You can check the contract address on a Flare Blockchain explorer, linked on the [Network Configuration](/network/overview#configuration) page.
241
+
You can now run the `deploy_contract.rs` script to deploy the contract.
242
+
The contract address will be printed once the deployment is successful.
243
+
You can check the contract address on a Flare Blockchain explorer, linked on the [Network Configuration](/network/overview#configuration) page.
231
244
232
245
```bash
233
246
cargo run --bin deploy_contract
234
247
```
235
248
236
-
Congratulations! You have now successfully deployed a contract on Flare using 🦀.
249
+
Congratulations!
250
+
You have now successfully deployed a contract on Flare using 🦀.
0 commit comments